Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
100
// User Accounting, should ONLY happen on new stake
UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = timeForContract .sub(now) .mul(amountForContract); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakingShareSeconds); uint256 totalUserRewards = (_totalStakingShareSeconds > 0)
UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = timeForContract .sub(now) .mul(amountForContract); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakingShareSeconds); uint256 totalUserRewards = (_totalStakingShareSeconds > 0)
40,091
218
// ------------------------------------------------
contract FraxUnifiedFarm_ERC20 is FraxUnifiedFarmTemplate {
contract FraxUnifiedFarm_ERC20 is FraxUnifiedFarmTemplate {
12,122
66
// the event is emitted when a market is created
marketPausedDefaultState = _state;
marketPausedDefaultState = _state;
32,383
15
// This contract deals with transfer of eth coins and not tokens!!!
contract digicrowd { address public baseContract; //Executes when deployed constructor() { baseContract = address(this); } //Structure of the block struct Campaign { address owner; string title; string description; uint256 target; uint256 deadline; uint256 amountCollected; string[] image; address[] donators; uint256[] donations; ERC20 token; } mapping(uint256 => Campaign) public campaigns; //takes Id of the campaign and returns the details of the campaign //When deployed, Initialized to 0 uint256 public numberOfCampaigns = 0; //To create campaign function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string[] memory _image, ERC20 _token ) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; // is everything okay? require( campaign.deadline < block.timestamp, "The deadline should be a date in the future." ); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline = _deadline; campaign.amountCollected = 0; campaign.image = _image; campaign.token = _token; numberOfCampaigns++; return numberOfCampaigns - 1; } //returns all campaigns function getCampaigns() public view returns (Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for (uint256 i = 0; i < numberOfCampaigns; i++) { Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return allCampaigns; } //returns a specific campaign function getCampaign(uint256 campaignId) public view returns (Campaign memory) { return campaigns[campaignId]; } // To check balance of an address function balanceOf(address account) public view returns (uint256) { return account.balance; } // Contract transfers the funds to fundraiser function donateToCampaign( uint256 _id ) public payable { Campaign storage campaign = campaigns[_id]; uint256 _amount = msg.value; require(baseContract.balance >= _amount, "Transaction failed 106!!!"); (bool sent, ) = payable(campaign.owner).call{value: _amount}(""); require(sent, "Transaction failed 110!!!"); if(sent){ campaign.amountCollected = campaign.amountCollected + _amount; campaign.donators.push(msg.sender); campaign.donations.push(_amount); } } // Investor transfers to contract event Received(address, uint256); event TransferSent(address from, address to, uint256 amount); function transferERC20(uint256 _id,address from, uint256 amount) public { Campaign storage campaign = campaigns[_id]; // require(msg.sender === owner, "Only owner can withdraw funds"); uint256 erc20balance = campaign.token.balanceOf(address(this)); require(amount <= erc20balance, "balance is low"); campaign.token.transfer(campaign.owner, amount); emit TransferSent(from, campaign.owner, amount); campaign.amountCollected = campaign.amountCollected + amount; campaign.donators.push(from); campaign.donations.push(amount); } }
contract digicrowd { address public baseContract; //Executes when deployed constructor() { baseContract = address(this); } //Structure of the block struct Campaign { address owner; string title; string description; uint256 target; uint256 deadline; uint256 amountCollected; string[] image; address[] donators; uint256[] donations; ERC20 token; } mapping(uint256 => Campaign) public campaigns; //takes Id of the campaign and returns the details of the campaign //When deployed, Initialized to 0 uint256 public numberOfCampaigns = 0; //To create campaign function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string[] memory _image, ERC20 _token ) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; // is everything okay? require( campaign.deadline < block.timestamp, "The deadline should be a date in the future." ); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline = _deadline; campaign.amountCollected = 0; campaign.image = _image; campaign.token = _token; numberOfCampaigns++; return numberOfCampaigns - 1; } //returns all campaigns function getCampaigns() public view returns (Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for (uint256 i = 0; i < numberOfCampaigns; i++) { Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return allCampaigns; } //returns a specific campaign function getCampaign(uint256 campaignId) public view returns (Campaign memory) { return campaigns[campaignId]; } // To check balance of an address function balanceOf(address account) public view returns (uint256) { return account.balance; } // Contract transfers the funds to fundraiser function donateToCampaign( uint256 _id ) public payable { Campaign storage campaign = campaigns[_id]; uint256 _amount = msg.value; require(baseContract.balance >= _amount, "Transaction failed 106!!!"); (bool sent, ) = payable(campaign.owner).call{value: _amount}(""); require(sent, "Transaction failed 110!!!"); if(sent){ campaign.amountCollected = campaign.amountCollected + _amount; campaign.donators.push(msg.sender); campaign.donations.push(_amount); } } // Investor transfers to contract event Received(address, uint256); event TransferSent(address from, address to, uint256 amount); function transferERC20(uint256 _id,address from, uint256 amount) public { Campaign storage campaign = campaigns[_id]; // require(msg.sender === owner, "Only owner can withdraw funds"); uint256 erc20balance = campaign.token.balanceOf(address(this)); require(amount <= erc20balance, "balance is low"); campaign.token.transfer(campaign.owner, amount); emit TransferSent(from, campaign.owner, amount); campaign.amountCollected = campaign.amountCollected + amount; campaign.donators.push(from); campaign.donations.push(amount); } }
6,579
55
// event emitted when a wager is made
event PlaceBet(uint256 indexed event_id, address bettor_address, uint256 amount, Occurences occured);
event PlaceBet(uint256 indexed event_id, address bettor_address, uint256 amount, Occurences occured);
18,466
30
// Transfers a local currency token to the Community Chest_fromUserId User identifier _roundUpValue Round up value to transfer (can be zero) /
function _roundUp(bytes32 _fromUserId, uint256 _roundUpValue) internal returns (bool) { bool success = _transfer( getWalletAddress(_fromUserId), communityChestAddress, _roundUpValue ); if (success) emit TransferToEvent(_fromUserId, communityChestAddress, _roundUpValue); return success; }
function _roundUp(bytes32 _fromUserId, uint256 _roundUpValue) internal returns (bool) { bool success = _transfer( getWalletAddress(_fromUserId), communityChestAddress, _roundUpValue ); if (success) emit TransferToEvent(_fromUserId, communityChestAddress, _roundUpValue); return success; }
21,175
107
// 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)); // * ... // * }
// * function call, use {hasRole}: // * // * ``` // * function foo() public { // * require(hasRole(MY_ROLE, msg.sender)); // * ... // * }
10,970
251
// Base External Facing Functions //An accurate estimate for the total amount of assets (principle + return)that this strategy is currently managing, denominated in terms of want tokens. /
function estimatedTotalAssets() public override view returns (uint256) { (uint256 deposits, uint256 borrows) = getCurrentPosition(); uint256 _claimableComp = predictCompAccrued(); uint256 currentComp = IERC20(comp).balanceOf(address(this)); // Use touch price. it doesnt matter if we are wrong as this is not used for decision making uint256 estimatedWant = priceCheck(comp, address(want),_claimableComp.add(currentComp)); uint256 conservativeWant = estimatedWant.mul(9).div(10); //10% pessimist return want.balanceOf(address(this)).add(deposits).add(conservativeWant).sub(borrows); }
function estimatedTotalAssets() public override view returns (uint256) { (uint256 deposits, uint256 borrows) = getCurrentPosition(); uint256 _claimableComp = predictCompAccrued(); uint256 currentComp = IERC20(comp).balanceOf(address(this)); // Use touch price. it doesnt matter if we are wrong as this is not used for decision making uint256 estimatedWant = priceCheck(comp, address(want),_claimableComp.add(currentComp)); uint256 conservativeWant = estimatedWant.mul(9).div(10); //10% pessimist return want.balanceOf(address(this)).add(deposits).add(conservativeWant).sub(borrows); }
29,539
2
// ==== status: This contract's state-machine state. See TradeStatus enum, above
TradeStatus public status;
TradeStatus public status;
11,007
10
// version; The current version of the WeiFund contract/This is the version value of this WeiFund contract
uint public version = 1;
uint public version = 1;
49,482
4
// Throws if not allowed caller /
modifier onlyAllowedCaller(address _caller) { require(isAllowedCaller(_caller), "Address not permitted to call"); _; }
modifier onlyAllowedCaller(address _caller) { require(isAllowedCaller(_caller), "Address not permitted to call"); _; }
28,111
1
// returns the sale price in ETH for the given quantity./quantity - the quantity to purchase. max 5./ return price - the sale price for the given quantity
function salePrice(uint256 quantity) external view returns (uint256 price);
function salePrice(uint256 quantity) external view returns (uint256 price);
34,927
70
// Set the transaction status of an asset, prohibit deposit, borrowing, repayment, liquidation and transfer.
function setMarketIsValid(address underlying, bool isValid) external onlyAdmin { Market storage market = markets[underlying]; market.isValid = isValid; }
function setMarketIsValid(address underlying, bool isValid) external onlyAdmin { Market storage market = markets[underlying]; market.isValid = isValid; }
17,564
25
// emit both a mint and transfer event
emit Transfer(address(0), _target, _amount); emit Mint(_target, _amount);
emit Transfer(address(0), _target, _amount); emit Mint(_target, _amount);
7,696
144
// Raise given number x into power specified as a simple fraction y/z and thenmultiply the result by the normalization factor 2^(128(1 - y/z)).Revert if z is zero, or if both x and y are zeros.x number to raise into given power y/z y numerator of the power to raise x into z denominator of the power to raise x intoreturn x raised into power y/z and then multiplied by 2^(128(1 - y/z)) /
function pow(uint128 x, uint128 y, uint128 z)
function pow(uint128 x, uint128 y, uint128 z)
52,158
109
// tokens that are allocated for treasury tax
uint256 public totalTreasuryTax;
uint256 public totalTreasuryTax;
39,264
4
// Indicate if the sale is open
bool private saleOpen = true; event AddressWhitelisted( address indexed addr, uint256 amountOfToken, uint256 fundsDeposited );
bool private saleOpen = true; event AddressWhitelisted( address indexed addr, uint256 amountOfToken, uint256 fundsDeposited );
52,423
11
// Returns the sum of withdrawable amount._localDisputeID Identifier of a dispute in scope of arbitrable contract. Arbitrator ids can be translated to local ids via externalIDtoLocalID._contributor Beneficiary of withdraw operation._ruling Ruling option that caller wants to get withdrawable amount from. return sum The total amount available to withdraw. /
function getTotalWithdrawableAmount(
function getTotalWithdrawableAmount(
12,006
460
// Public variables
function admin() external view returns (address); function future_admin() external view returns (address); function token() external view returns (address); function voting_escrow() external view returns (address); function n_gauge_types() external view returns (int128); function n_gauges() external view returns (int128); function gauge_type_names(int128) external view returns (string memory); function gauges(uint256) external view returns (address); function vote_user_slopes(address, address) external
function admin() external view returns (address); function future_admin() external view returns (address); function token() external view returns (address); function voting_escrow() external view returns (address); function n_gauge_types() external view returns (int128); function n_gauges() external view returns (int128); function gauge_type_names(int128) external view returns (string memory); function gauges(uint256) external view returns (address); function vote_user_slopes(address, address) external
37,040
25
// FlowCarbon LLC/A Carbon Credit Token Reference Implementation
contract CarbonCreditToken is AbstractToken { /// @notice Emitted when a token renounces its permission list /// @param renouncedPermissionListAddress - The address of the renounced permission list event PermissionListRenounced(address renouncedPermissionListAddress); /// @notice Emitted when the used permission list changes /// @param oldPermissionListAddress - The address of the old permission list /// @param newPermissionListAddress - The address of the new permission list event PermissionListChanged(address oldPermissionListAddress, address newPermissionListAddress); /// @notice The details of a token struct TokenDetails { /// The methodology of the token (e.g. VERRA) string methodology; /// The credit type of the token (e.g. FORESTRY) string creditType; /// The year in which the offset took place uint16 vintage; } /// @notice Token metadata TokenDetails private _details; /// @notice The permissionlist associated with this token ICarbonCreditPermissionList public permissionList; /// @notice The bundle token factory associated with this token CarbonCreditBundleTokenFactory public carbonCreditBundleTokenFactory; /// @notice Emitted when the contract owner mints new tokens /// @dev The account is already in the Transfer Event and thus omitted here /// @param amount - The amount of tokens that were minted /// @param checksum - A checksum associated with the underlying purchase event event Mint(uint256 amount, bytes32 checksum); /// @notice Checksums associated with the underlying mapped to the number of minted tokens mapping (bytes32 => uint256) private _checksums; /// @notice Checksums associated with the underlying offset event mapped to the number of finally offsetted tokens mapping (bytes32 => uint256) private _offsetChecksums; /// @notice Number of tokens removed from chain uint256 public movedOffChain; function initialize( string memory name_, string memory symbol_, TokenDetails memory details_, ICarbonCreditPermissionList permissionList_, address owner_, CarbonCreditBundleTokenFactory carbonCreditBundleTokenFactory_ ) external initializer { require(details_.vintage > 2000, 'vintage out of bounds'); require(details_.vintage < 2100, 'vintage out of bounds'); require(bytes(details_.methodology).length > 0, 'methodology is required'); require(bytes(details_.creditType).length > 0, 'credit type is required'); require(address(carbonCreditBundleTokenFactory_) != address(0), 'bundle token factory is required'); __AbstractToken_init(name_, symbol_, owner_); _details = details_; permissionList = permissionList_; carbonCreditBundleTokenFactory = carbonCreditBundleTokenFactory_; } /// @notice Mints new tokens, a checksum representing purchase of the underlying with the minting event /// @param account_ - The account that will receive the new tokens /// @param amount_ - The amount of new tokens to be minted /// @param checksum_ - A checksum associated with the underlying purchase event function mint(address account_, uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) { require(checksum_ > 0, 'checksum is required'); require(_checksums[checksum_] == 0, 'checksum was already used'); _mint(account_, amount_); _checksums[checksum_] = amount_; emit Mint(amount_, checksum_); return true; } /// @notice Get the amount of tokens minted with the given checksum /// @param checksum_ - The checksum associated with a minting event /// @return The amount minted with the associated checksum function amountMintedWithChecksum(bytes32 checksum_) external view returns (uint256) { return _checksums[checksum_]; } /// @notice The contract owner can finalize the offsetting process once the underlying tokens have been offset /// @param amount_ - The number of token to finalize offsetting /// @param checksum_ - The checksum associated with the underlying offset event function finalizeOffset(uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) { require(checksum_ > 0, 'checksum is required'); require(_offsetChecksums[checksum_] == 0, 'checksum was already used'); require(amount_ <= pendingBalance, 'offset exceeds pending balance'); _offsetChecksums[checksum_] = amount_; pendingBalance -= amount_; offsetBalance += amount_; emit FinalizeOffset(amount_, checksum_); return true; } /// @dev Allow only privileged users to burn the given amount of tokens /// @param amount_ - The amount of tokens to burn function burn(uint256 amount_) public virtual { require( _msgSender() == owner() || carbonCreditBundleTokenFactory.hasContractDeployedAt(_msgSender()), 'sender does not have permission to burn' ); _burn(_msgSender(), amount_); if (owner() == _msgSender()) { movedOffChain += amount_; } } /// @notice Return the balance of tokens offsetted by an address that match the given checksum /// @param checksum_ - The checksum of the associated offset event of the underlying token /// @return The number of tokens that have been offsetted with this checksum function amountOffsettedWithChecksum(bytes32 checksum_) external view returns (uint256) { return _offsetChecksums[checksum_]; } /// @notice The methodology of this token (e.g. VERRA or GOLDSTANDARD) function methodology() external view returns (string memory) { return _details.methodology; } /// @notice The creditType of this token (e.g. 'WETLAND_RESTORATION', or 'REFORESTATION') function creditType() external view returns (string memory) { return _details.creditType; } /// @notice The guaranteed vintage of this year - newer is possible because new is always better :-) function vintage() external view returns (uint16) { return _details.vintage; } /// @notice Renounce the permission list, making this token accessible to everyone /// NOTE: This operation is *irreversible* and will leave the token permanently non-permissioned! function renouncePermissionList() onlyOwner external { permissionList = ICarbonCreditPermissionList(address(0)); emit PermissionListRenounced(address(this)); } /// @notice Set the permission list /// @param permissionList_ - The permission list to use function setPermissionList(ICarbonCreditPermissionList permissionList_) onlyOwner external { require(address(permissionList) != address(0), 'this operation is not allowed for non-permissioned tokens'); require(address(permissionList_) != address(0), 'invalid attempt at renouncing the permission list - use renouncePermissionList() instead'); address oldPermissionListAddress = address(permissionList); permissionList = permissionList_; emit PermissionListChanged(oldPermissionListAddress, address(permissionList_)); } /// @notice Override ERC20.transfer to respect permission lists /// @param from_ - The senders address /// @param to_ - The recipients address /// @param amount_ - The amount of tokens to send function _transfer(address from_, address to_, uint256 amount_) internal virtual override { if (address(permissionList) != address(0)) { require(permissionList.hasPermission(from_), 'the sender is not permitted to transfer this token'); require(permissionList.hasPermission(to_), 'the recipient is not permitted to receive this token'); } return super._transfer(from_, to_, amount_); } }
contract CarbonCreditToken is AbstractToken { /// @notice Emitted when a token renounces its permission list /// @param renouncedPermissionListAddress - The address of the renounced permission list event PermissionListRenounced(address renouncedPermissionListAddress); /// @notice Emitted when the used permission list changes /// @param oldPermissionListAddress - The address of the old permission list /// @param newPermissionListAddress - The address of the new permission list event PermissionListChanged(address oldPermissionListAddress, address newPermissionListAddress); /// @notice The details of a token struct TokenDetails { /// The methodology of the token (e.g. VERRA) string methodology; /// The credit type of the token (e.g. FORESTRY) string creditType; /// The year in which the offset took place uint16 vintage; } /// @notice Token metadata TokenDetails private _details; /// @notice The permissionlist associated with this token ICarbonCreditPermissionList public permissionList; /// @notice The bundle token factory associated with this token CarbonCreditBundleTokenFactory public carbonCreditBundleTokenFactory; /// @notice Emitted when the contract owner mints new tokens /// @dev The account is already in the Transfer Event and thus omitted here /// @param amount - The amount of tokens that were minted /// @param checksum - A checksum associated with the underlying purchase event event Mint(uint256 amount, bytes32 checksum); /// @notice Checksums associated with the underlying mapped to the number of minted tokens mapping (bytes32 => uint256) private _checksums; /// @notice Checksums associated with the underlying offset event mapped to the number of finally offsetted tokens mapping (bytes32 => uint256) private _offsetChecksums; /// @notice Number of tokens removed from chain uint256 public movedOffChain; function initialize( string memory name_, string memory symbol_, TokenDetails memory details_, ICarbonCreditPermissionList permissionList_, address owner_, CarbonCreditBundleTokenFactory carbonCreditBundleTokenFactory_ ) external initializer { require(details_.vintage > 2000, 'vintage out of bounds'); require(details_.vintage < 2100, 'vintage out of bounds'); require(bytes(details_.methodology).length > 0, 'methodology is required'); require(bytes(details_.creditType).length > 0, 'credit type is required'); require(address(carbonCreditBundleTokenFactory_) != address(0), 'bundle token factory is required'); __AbstractToken_init(name_, symbol_, owner_); _details = details_; permissionList = permissionList_; carbonCreditBundleTokenFactory = carbonCreditBundleTokenFactory_; } /// @notice Mints new tokens, a checksum representing purchase of the underlying with the minting event /// @param account_ - The account that will receive the new tokens /// @param amount_ - The amount of new tokens to be minted /// @param checksum_ - A checksum associated with the underlying purchase event function mint(address account_, uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) { require(checksum_ > 0, 'checksum is required'); require(_checksums[checksum_] == 0, 'checksum was already used'); _mint(account_, amount_); _checksums[checksum_] = amount_; emit Mint(amount_, checksum_); return true; } /// @notice Get the amount of tokens minted with the given checksum /// @param checksum_ - The checksum associated with a minting event /// @return The amount minted with the associated checksum function amountMintedWithChecksum(bytes32 checksum_) external view returns (uint256) { return _checksums[checksum_]; } /// @notice The contract owner can finalize the offsetting process once the underlying tokens have been offset /// @param amount_ - The number of token to finalize offsetting /// @param checksum_ - The checksum associated with the underlying offset event function finalizeOffset(uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) { require(checksum_ > 0, 'checksum is required'); require(_offsetChecksums[checksum_] == 0, 'checksum was already used'); require(amount_ <= pendingBalance, 'offset exceeds pending balance'); _offsetChecksums[checksum_] = amount_; pendingBalance -= amount_; offsetBalance += amount_; emit FinalizeOffset(amount_, checksum_); return true; } /// @dev Allow only privileged users to burn the given amount of tokens /// @param amount_ - The amount of tokens to burn function burn(uint256 amount_) public virtual { require( _msgSender() == owner() || carbonCreditBundleTokenFactory.hasContractDeployedAt(_msgSender()), 'sender does not have permission to burn' ); _burn(_msgSender(), amount_); if (owner() == _msgSender()) { movedOffChain += amount_; } } /// @notice Return the balance of tokens offsetted by an address that match the given checksum /// @param checksum_ - The checksum of the associated offset event of the underlying token /// @return The number of tokens that have been offsetted with this checksum function amountOffsettedWithChecksum(bytes32 checksum_) external view returns (uint256) { return _offsetChecksums[checksum_]; } /// @notice The methodology of this token (e.g. VERRA or GOLDSTANDARD) function methodology() external view returns (string memory) { return _details.methodology; } /// @notice The creditType of this token (e.g. 'WETLAND_RESTORATION', or 'REFORESTATION') function creditType() external view returns (string memory) { return _details.creditType; } /// @notice The guaranteed vintage of this year - newer is possible because new is always better :-) function vintage() external view returns (uint16) { return _details.vintage; } /// @notice Renounce the permission list, making this token accessible to everyone /// NOTE: This operation is *irreversible* and will leave the token permanently non-permissioned! function renouncePermissionList() onlyOwner external { permissionList = ICarbonCreditPermissionList(address(0)); emit PermissionListRenounced(address(this)); } /// @notice Set the permission list /// @param permissionList_ - The permission list to use function setPermissionList(ICarbonCreditPermissionList permissionList_) onlyOwner external { require(address(permissionList) != address(0), 'this operation is not allowed for non-permissioned tokens'); require(address(permissionList_) != address(0), 'invalid attempt at renouncing the permission list - use renouncePermissionList() instead'); address oldPermissionListAddress = address(permissionList); permissionList = permissionList_; emit PermissionListChanged(oldPermissionListAddress, address(permissionList_)); } /// @notice Override ERC20.transfer to respect permission lists /// @param from_ - The senders address /// @param to_ - The recipients address /// @param amount_ - The amount of tokens to send function _transfer(address from_, address to_, uint256 amount_) internal virtual override { if (address(permissionList) != address(0)) { require(permissionList.hasPermission(from_), 'the sender is not permitted to transfer this token'); require(permissionList.hasPermission(to_), 'the recipient is not permitted to receive this token'); } return super._transfer(from_, to_, amount_); } }
17,271
10
// Method to pre-scan a set of asteroids to be offered during pre-sale. This method may only be runbefore any sale purchases have been made. _asteroidIds An array of asteroid ERC721 token IDs _bonuses An array of bit-packed bonuses corresponding to _asteroidIds /
function setInitialBonuses(uint[] calldata _asteroidIds, uint[] calldata _bonuses) external onlyOwner { require(scanOrderCount == 0); require(_asteroidIds.length == _bonuses.length); for (uint i = 0; i < _asteroidIds.length; i++) { scanInfo[_asteroidIds[i]] |= _bonuses[i] << 64; emit AsteroidScanned(_asteroidIds[i], _bonuses[i]); } }
function setInitialBonuses(uint[] calldata _asteroidIds, uint[] calldata _bonuses) external onlyOwner { require(scanOrderCount == 0); require(_asteroidIds.length == _bonuses.length); for (uint i = 0; i < _asteroidIds.length; i++) { scanInfo[_asteroidIds[i]] |= _bonuses[i] << 64; emit AsteroidScanned(_asteroidIds[i], _bonuses[i]); } }
41,545
64
// add transaction and returns its id
function addTransaction(address _investor, uint256 _amount) internal returns (uint256) { uint256 transactionId = transactionCount; // save transaction transactions[transactionId] = Deposit({ amount: _amount, beneficiary: _investor, time: uint64(now), cleared : false }); // save transactionId for investor address addressTransactions[_investor].push(transactionId); transactionCount = transactionCount.add(1); pendingCount = pendingCount.add(1); LogDeposited(_investor, _amount, transactionId); return transactionId; }
function addTransaction(address _investor, uint256 _amount) internal returns (uint256) { uint256 transactionId = transactionCount; // save transaction transactions[transactionId] = Deposit({ amount: _amount, beneficiary: _investor, time: uint64(now), cleared : false }); // save transactionId for investor address addressTransactions[_investor].push(transactionId); transactionCount = transactionCount.add(1); pendingCount = pendingCount.add(1); LogDeposited(_investor, _amount, transactionId); return transactionId; }
44,026
410
// Refactored function to calc and rewards accounts supplier rewards jToken The market to verify the mint against borrower Borrower to be rewarded /
function updateAndDistributeBorrowerRewardsForToken( address jToken, address borrower, Exp calldata marketBorrowIndex
function updateAndDistributeBorrowerRewardsForToken( address jToken, address borrower, Exp calldata marketBorrowIndex
33,260
0
// UtilityTokenInterface contract Provides the interface to utility token contract. /
contract UtilityTokenInterface { /** Events */ /** Minted raised when new utility tokens are minted for a beneficiary */ event Minted( address indexed _beneficiary, uint256 _amount, uint256 _totalSupply, address _utilityToken ); /** Burnt raised when new utility tokens are burnt for an address */ event Burnt( address indexed _account, uint256 _amount, uint256 _totalSupply, address _utilityToken ); /** Public Functions */ /** * @notice Mints the utility token * * @dev Adds _amount tokens to beneficiary balance and increases the * totalTokenSupply. Can be called only by CoGateway. * * @param _beneficiary Address of tokens beneficiary. * @param _amount Amount of tokens to mint. * * @return bool `true` if mint is successful, false otherwise. */ function mint( address _beneficiary, uint256 _amount ) external returns (bool success); /** * @notice Burns the balance for the burner's address * * @dev only burns the amount from CoGateway address, So to burn * transfer the amount to CoGateway. * * @param _burner Burner address. * @param _amount Amount of tokens to burn. * * @return bool `true` if burn is successful, false otherwise. */ function burn( address _burner, uint256 _amount ) external returns (bool success); }
contract UtilityTokenInterface { /** Events */ /** Minted raised when new utility tokens are minted for a beneficiary */ event Minted( address indexed _beneficiary, uint256 _amount, uint256 _totalSupply, address _utilityToken ); /** Burnt raised when new utility tokens are burnt for an address */ event Burnt( address indexed _account, uint256 _amount, uint256 _totalSupply, address _utilityToken ); /** Public Functions */ /** * @notice Mints the utility token * * @dev Adds _amount tokens to beneficiary balance and increases the * totalTokenSupply. Can be called only by CoGateway. * * @param _beneficiary Address of tokens beneficiary. * @param _amount Amount of tokens to mint. * * @return bool `true` if mint is successful, false otherwise. */ function mint( address _beneficiary, uint256 _amount ) external returns (bool success); /** * @notice Burns the balance for the burner's address * * @dev only burns the amount from CoGateway address, So to burn * transfer the amount to CoGateway. * * @param _burner Burner address. * @param _amount Amount of tokens to burn. * * @return bool `true` if burn is successful, false otherwise. */ function burn( address _burner, uint256 _amount ) external returns (bool success); }
38,376
1
// Mapping from holder address to their (enumerable) set of owned tokens
mapping(address => EnumerableSetUpgradeable.UintSet) private _holderTokens;
mapping(address => EnumerableSetUpgradeable.UintSet) private _holderTokens;
24,982
344
// Get reward token amounts rewardTokens Reward token address arrayreturn Reward token amounts /
function _getRewardTokenAmounts(address[] memory rewardTokens) private view returns(uint256[] memory) { uint256[] memory rewardTokenAmounts = new uint[](rewardTokens.length); for (uint256 i = 0; i < rewardTokenAmounts.length; i++) { rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanceOf(address(this)); } return rewardTokenAmounts; }
function _getRewardTokenAmounts(address[] memory rewardTokens) private view returns(uint256[] memory) { uint256[] memory rewardTokenAmounts = new uint[](rewardTokens.length); for (uint256 i = 0; i < rewardTokenAmounts.length; i++) { rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanceOf(address(this)); } return rewardTokenAmounts; }
61,162
169
// Mints `quantity` tokens and transfers them to `to`. This function is intended for efficient minting only during contract creation.
* It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); }
* It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); }
6,299
87
// year The year month The month day The dayreturn _days Returns the number of days /
function _daysFromDate (uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) { require(year >= 1970, "Error"); int _year = int(year); int _month = int(month); int _day = int(day); int __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - OFFSET19700101; _days = uint256(__days); }
function _daysFromDate (uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) { require(year >= 1970, "Error"); int _year = int(year); int _month = int(month); int _day = int(day); int __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - OFFSET19700101; _days = uint256(__days); }
26,047
178
// These timestamps and durations have values clamped within reasonable values and cannot overflow.
bool totalPeriodElapsed = liquidationTimestamp + liquidationPeriod < now;
bool totalPeriodElapsed = liquidationTimestamp + liquidationPeriod < now;
25,633
11
// Deploys a derivative and option to links it with an already existing pool derivativeVersion Version of the derivative contract derivativeParamsData Input params of derivative constructor pool Existing pool contract to link with the new derivativereturn derivative Derivative contract deployed /
function deployOnlyDerivative(
function deployOnlyDerivative(
21,181
88
// One approve at the end
_approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( totalSpend, "Multisend: Not enough allowance." ) );
_approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( totalSpend, "Multisend: Not enough allowance." ) );
3,667
269
// Reserve 1 alpha for team - Giveaways/Prizes etc
uint public alphaReserve = 1; event alphaNameChange(address _by, uint _tokenId, string _name); event licenseisLocked(string _licenseText);
uint public alphaReserve = 1; event alphaNameChange(address _by, uint _tokenId, string _name); event licenseisLocked(string _licenseText);
47,879
29
// solium-disable-next-line security/no-block-members
return block.timestamp;
return block.timestamp;
4,442
120
// View function to see pending CREWs on frontend.
function pendingCrew(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCrewPerShare = pool.accCrewPerShare; uint256 PoolEndBlock = block.number; if(block.number>bonusEndBlock){ PoolEndBlock = bonusEndBlock; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (PoolEndBlock > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, PoolEndBlock); uint256 crewReward = multiplier.mul(crewPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accCrewPerShare = accCrewPerShare.add(crewReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accCrewPerShare).div(1e12).sub(user.rewardDebt); }
function pendingCrew(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCrewPerShare = pool.accCrewPerShare; uint256 PoolEndBlock = block.number; if(block.number>bonusEndBlock){ PoolEndBlock = bonusEndBlock; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (PoolEndBlock > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, PoolEndBlock); uint256 crewReward = multiplier.mul(crewPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accCrewPerShare = accCrewPerShare.add(crewReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accCrewPerShare).div(1e12).sub(user.rewardDebt); }
14,442
44
// Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected return value, Requirements: - `target` must be a contract.- calling `target` with `data` must not revert. _Available since v3.1._ /
function functionCall( address target, bytes memory data
function functionCall( address target, bytes memory data
10,648
82
// Throws if called by any account has no access /
modifier canMint() { address sender = _msgSender(); require(owner() == sender || _participants[sender], "Collection: caller has no access"); _; }
modifier canMint() { address sender = _msgSender(); require(owner() == sender || _participants[sender], "Collection: caller has no access"); _; }
1,029
109
// Check caller = anchorAdmin.
if (msg.sender != anchorAdmin) { return failOracle( address(0), OracleError.UNAUTHORIZED, OracleFailureInfo.SET_PENDING_ANCHOR_ADMIN_OWNER_CHECK ); }
if (msg.sender != anchorAdmin) { return failOracle( address(0), OracleError.UNAUTHORIZED, OracleFailureInfo.SET_PENDING_ANCHOR_ADMIN_OWNER_CHECK ); }
17,810
102
// emitted when a new proposal is created id Id of the proposal creator address of the creator executor The ExecutorWithTimelock contract that will execute the proposal targets list of contracts called by proposal's associated transactions values list of value in wei for each propoposal's associated transaction signatures list of function signatures (can be empty) to be used when created the callData calldatas list of calldatas: if associated signature empty, calldata ready, else calldata is arguments withDelegatecalls boolean, true = transaction delegatecalls the taget, else calls the target startBlock block number when vote starts endBlock block number when vote ends strategy
* Note: Vote is a struct: ({bool support, uint248 votingPower}) * @param proposalId id of the proposal * @param voter address of the voter * @return The associated Vote memory object **/ function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory); /** * @dev Get the current state of a proposal * @param proposalId id of the proposal * @return The current state if the proposal **/ function getProposalState(uint256 proposalId) external view returns (ProposalState); }
* Note: Vote is a struct: ({bool support, uint248 votingPower}) * @param proposalId id of the proposal * @param voter address of the voter * @return The associated Vote memory object **/ function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory); /** * @dev Get the current state of a proposal * @param proposalId id of the proposal * @return The current state if the proposal **/ function getProposalState(uint256 proposalId) external view returns (ProposalState); }
77,456
20
// Router
IDEXRouter public router; address public pair; address public Liq = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8; //USDC address public dist; bool public swapEnabled = true; uint256 public swapThreshold = _totalSupply / 10000 * 3; // 0.3% bool public isTradingEnabled = false;
IDEXRouter public router; address public pair; address public Liq = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8; //USDC address public dist; bool public swapEnabled = true; uint256 public swapThreshold = _totalSupply / 10000 * 3; // 0.3% bool public isTradingEnabled = false;
20,219
8
// Initialize the contract./_spokePool The contract address of the spoke pool on the source chain./_weth The address of the WETH token on the source chain.
constructor(IAcrossSpokePool _spokePool, address _weth) { spokePool = _spokePool; weth = _weth; }
constructor(IAcrossSpokePool _spokePool, address _weth) { spokePool = _spokePool; weth = _weth; }
26,333
10
// Allows an admin to approve a spender of the molecule vault collateral. _spender: The address that will be approved as a spender. _amount: The amount the spender will be approved to spend./
function approve( address _spender, uint256 _amount ) public onlyWhitelistAdmin()
function approve( address _spender, uint256 _amount ) public onlyWhitelistAdmin()
48,485
6
// Deletes the cron job matching the provided id. Reverts ifthe id is not found. id the id of the cron job to delete /
function deleteCronJob(uint256 id) external onlyOwner { if (s_targets[id] == address(0)) { revert CronJobIDNotFound(id); } uint256 existingID; uint256 oldLength = s_activeCronJobIDs.length; uint256 newLength = oldLength - 1; uint256 idx; for (idx = 0; idx < newLength; idx++) { existingID = s_activeCronJobIDs[idx]; if (existingID == id) { s_activeCronJobIDs[idx] = s_activeCronJobIDs[newLength]; break; } } delete s_lastRuns[id]; delete s_specs[id]; delete s_targets[id]; delete s_handlers[id]; delete s_handlerSignatures[id]; s_activeCronJobIDs.pop(); emit CronJobDeleted(id); }
function deleteCronJob(uint256 id) external onlyOwner { if (s_targets[id] == address(0)) { revert CronJobIDNotFound(id); } uint256 existingID; uint256 oldLength = s_activeCronJobIDs.length; uint256 newLength = oldLength - 1; uint256 idx; for (idx = 0; idx < newLength; idx++) { existingID = s_activeCronJobIDs[idx]; if (existingID == id) { s_activeCronJobIDs[idx] = s_activeCronJobIDs[newLength]; break; } } delete s_lastRuns[id]; delete s_specs[id]; delete s_targets[id]; delete s_handlers[id]; delete s_handlerSignatures[id]; s_activeCronJobIDs.pop(); emit CronJobDeleted(id); }
41,795
38
// Constructor
constructor () public { ceoAddress = msg.sender; }
constructor () public { ceoAddress = msg.sender; }
11,800
15
// 8 - state change message/reason
bytes32 stateMessage;
bytes32 stateMessage;
45,402
85
// Check sent eth against _value and also make sure is not 0
require(msg.value == _value && msg.value > 0);
require(msg.value == _value && msg.value > 0);
28,072
126
// Implements simple signed fixed point math add, sub, mul and div operations.
library SignedDecimalMath { using SignedSafeMathUpgradeable for int256; /// @dev Returns 1 in the fixed point representation, with `decimals` decimals. function unit(uint8 decimals) internal pure returns (int256) { return int256(10**uint256(decimals)); } /// @dev Adds x and y, assuming they are both fixed point with 18 decimals. function addd(int256 x, int256 y) internal pure returns (int256) { return x.add(y); } /// @dev Subtracts y from x, assuming they are both fixed point with 18 decimals. function subd(int256 x, int256 y) internal pure returns (int256) { return x.sub(y); } /// @dev Multiplies x and y, assuming they are both fixed point with 18 digits. function muld(int256 x, int256 y) internal pure returns (int256) { return muld(x, y, 18); } /// @dev Multiplies x and y, assuming they are both fixed point with `decimals` digits. function muld( int256 x, int256 y, uint8 decimals ) internal pure returns (int256) { return x.mul(y).div(unit(decimals)); } /// @dev Divides x between y, assuming they are both fixed point with 18 digits. function divd(int256 x, int256 y) internal pure returns (int256) { return divd(x, y, 18); } /// @dev Divides x between y, assuming they are both fixed point with `decimals` digits. function divd( int256 x, int256 y, uint8 decimals ) internal pure returns (int256) { return x.mul(unit(decimals)).div(y); } }
library SignedDecimalMath { using SignedSafeMathUpgradeable for int256; /// @dev Returns 1 in the fixed point representation, with `decimals` decimals. function unit(uint8 decimals) internal pure returns (int256) { return int256(10**uint256(decimals)); } /// @dev Adds x and y, assuming they are both fixed point with 18 decimals. function addd(int256 x, int256 y) internal pure returns (int256) { return x.add(y); } /// @dev Subtracts y from x, assuming they are both fixed point with 18 decimals. function subd(int256 x, int256 y) internal pure returns (int256) { return x.sub(y); } /// @dev Multiplies x and y, assuming they are both fixed point with 18 digits. function muld(int256 x, int256 y) internal pure returns (int256) { return muld(x, y, 18); } /// @dev Multiplies x and y, assuming they are both fixed point with `decimals` digits. function muld( int256 x, int256 y, uint8 decimals ) internal pure returns (int256) { return x.mul(y).div(unit(decimals)); } /// @dev Divides x between y, assuming they are both fixed point with 18 digits. function divd(int256 x, int256 y) internal pure returns (int256) { return divd(x, y, 18); } /// @dev Divides x between y, assuming they are both fixed point with `decimals` digits. function divd( int256 x, int256 y, uint8 decimals ) internal pure returns (int256) { return x.mul(unit(decimals)).div(y); } }
15,811
0
// emitted when a new Token is added to the group./subToken the token added, its id will be its index in the array.
event SubToken(ERC20SubToken subToken);
event SubToken(ERC20SubToken subToken);
53,196
22
// Triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory
event NewSmartToken(address _token);
event NewSmartToken(address _token);
72,715
67
// See {ICreatorCore-getFees}. /
function getFees(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) { require(_exists(tokenId), "Nonexistent token"); return _getRoyalties(tokenId); }
function getFees(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) { require(_exists(tokenId), "Nonexistent token"); return _getRoyalties(tokenId); }
36,985
155
// Captures any available interest as award balance./This function also captures the reserve fees./ return The total amount of assets to be awarded for the current prize
function captureAwardBalance() external returns (uint256);
function captureAwardBalance() external returns (uint256);
69,792
2
// Flash Close Fee Factor
Factor public flashCloseF; IFujiAdmin private _fujiAdmin; IFujiOracle private _oracle; IUniswapV2Router02 public swapper;
Factor public flashCloseF; IFujiAdmin private _fujiAdmin; IFujiOracle private _oracle; IUniswapV2Router02 public swapper;
52,496
99
// internal method for registering an interface /
function _registerInterface(bytes4 interfaceId) internal
function _registerInterface(bytes4 interfaceId) internal
30,099
6
// Event for when an address is whitelisted to authenticate
event WhitelistEvent( uint partnerId, address target, bool whitelist ); address public hydroContract = 0x0; mapping (uint => mapping (address => bool)) public whitelist; mapping (uint => mapping (address => partnerValues)) public partnerMap;
event WhitelistEvent( uint partnerId, address target, bool whitelist ); address public hydroContract = 0x0; mapping (uint => mapping (address => bool)) public whitelist; mapping (uint => mapping (address => partnerValues)) public partnerMap;
2,179
177
// Mapping of addresses allowed to call rebalance()
mapping(address => bool) public tradeAllowList;
mapping(address => bool) public tradeAllowList;
13,113
55
// transfer the remaning ether
_safeTransfer(weth, address(pair), IERC20(weth).balanceOf(address(this))); _safeTransfer(token, address(this), IERC20(token).balanceOf(address(this))); pair.mint(to);
_safeTransfer(weth, address(pair), IERC20(weth).balanceOf(address(this))); _safeTransfer(token, address(this), IERC20(token).balanceOf(address(this))); pair.mint(to);
2,793
15
// Mints specified amount of tokens to list of recipients _amount Number of tokens to be minted for each recipient _recipients List of addresses to send tokens to Requirements: - `owner` must be function caller- `numReserveClaimed` must not exceed the total max reserve /
function discoverReservedTrolls(uint256 _amount, address[] memory _recipients) public onlyOwner { numReserveClaimed += _recipients.length * _amount; require(numReserveClaimed <= maxReserve, "No more reserved tokens available to claim"); for (uint256 i = 0; i < _recipients.length; i++) { _discover(_amount, _recipients[i]); } }
function discoverReservedTrolls(uint256 _amount, address[] memory _recipients) public onlyOwner { numReserveClaimed += _recipients.length * _amount; require(numReserveClaimed <= maxReserve, "No more reserved tokens available to claim"); for (uint256 i = 0; i < _recipients.length; i++) { _discover(_amount, _recipients[i]); } }
8,248
194
// Close the existing short otoken position. Currently this implementation is simple.It closes the most recent vault opened by the contract. This assumes that the contract willonly have a single vault open at any given time. Since calling `closeShort` deletes vaults,this assumption should hold. /
function closeShort() external override returns (uint256) { IController controller = IController(gammaController); // gets the currently active vault ID uint256 vaultID = controller.getAccountVaultCounter(address(this)); GammaTypes.Vault memory vault = controller.getVault(address(this), vaultID); require(vault.shortOtokens.length > 0, "No active short"); IERC20 collateralToken = IERC20(vault.collateralAssets[0]); OtokenInterface otoken = OtokenInterface(vault.shortOtokens[0]); bool settlementAllowed = isSettlementAllowed( otoken.underlyingAsset(), otoken.expiryTimestamp() ); uint256 startCollateralBalance = collateralToken.balanceOf(address(this)); IController.ActionArgs[] memory actions; // If it is after expiry, we need to settle the short position using the normal way // Delete the vault and withdraw all remaining collateral from the vault // // If it is before expiry, we need to burn otokens in order to withdraw collateral from the vault if (settlementAllowed) { actions = new IController.ActionArgs[](1); actions[0] = IController.ActionArgs( IController.ActionType.SettleVault, address(this), // owner address(this), // address to transfer to address(0), // not used vaultID, // vaultId 0, // not used 0, // not used "" // not used ); controller.operate(actions); } else { // Burning otokens given by vault.shortAmounts[0] (closing the entire short position), // then withdrawing all the collateral from the vault actions = new IController.ActionArgs[](2); actions[0] = IController.ActionArgs( IController.ActionType.BurnShortOption, address(this), // owner address(this), // address to transfer to address(otoken), // otoken address vaultID, // vaultId vault.shortAmounts[0], // amount 0, //index "" //data ); actions[1] = IController.ActionArgs( IController.ActionType.WithdrawCollateral, address(this), // owner address(this), // address to transfer to address(collateralToken), // withdrawn asset vaultID, // vaultId vault.collateralAmounts[0], // amount 0, //index "" //data ); controller.operate(actions); } uint256 endCollateralBalance = collateralToken.balanceOf(address(this)); return endCollateralBalance.sub(startCollateralBalance); }
function closeShort() external override returns (uint256) { IController controller = IController(gammaController); // gets the currently active vault ID uint256 vaultID = controller.getAccountVaultCounter(address(this)); GammaTypes.Vault memory vault = controller.getVault(address(this), vaultID); require(vault.shortOtokens.length > 0, "No active short"); IERC20 collateralToken = IERC20(vault.collateralAssets[0]); OtokenInterface otoken = OtokenInterface(vault.shortOtokens[0]); bool settlementAllowed = isSettlementAllowed( otoken.underlyingAsset(), otoken.expiryTimestamp() ); uint256 startCollateralBalance = collateralToken.balanceOf(address(this)); IController.ActionArgs[] memory actions; // If it is after expiry, we need to settle the short position using the normal way // Delete the vault and withdraw all remaining collateral from the vault // // If it is before expiry, we need to burn otokens in order to withdraw collateral from the vault if (settlementAllowed) { actions = new IController.ActionArgs[](1); actions[0] = IController.ActionArgs( IController.ActionType.SettleVault, address(this), // owner address(this), // address to transfer to address(0), // not used vaultID, // vaultId 0, // not used 0, // not used "" // not used ); controller.operate(actions); } else { // Burning otokens given by vault.shortAmounts[0] (closing the entire short position), // then withdrawing all the collateral from the vault actions = new IController.ActionArgs[](2); actions[0] = IController.ActionArgs( IController.ActionType.BurnShortOption, address(this), // owner address(this), // address to transfer to address(otoken), // otoken address vaultID, // vaultId vault.shortAmounts[0], // amount 0, //index "" //data ); actions[1] = IController.ActionArgs( IController.ActionType.WithdrawCollateral, address(this), // owner address(this), // address to transfer to address(collateralToken), // withdrawn asset vaultID, // vaultId vault.collateralAmounts[0], // amount 0, //index "" //data ); controller.operate(actions); } uint256 endCollateralBalance = collateralToken.balanceOf(address(this)); return endCollateralBalance.sub(startCollateralBalance); }
28,687
76
// Returns a descriptive name for a collection of NFTokens. return _name Representing name./
function name() external view returns (string memory _name) { _name = nftName; }
function name() external view returns (string memory _name) { _name = nftName; }
53,745
103
// Struct if the information of each controller
struct ControllerInfo { // Address of the Controller address controllerAddress; // The lastId of the previous Controller uint256 lastId; }
struct ControllerInfo { // Address of the Controller address controllerAddress; // The lastId of the previous Controller uint256 lastId; }
6,733
46
// Internal function that mints an amount of the token and assigns it to an account. account The account that will receive the created tokens. value The amount that will be created. /
function _mint(address account, uint256 value) internal { require(_totalSupply.add(value) <= _cap); require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Mint(account, value); emit Transfer(address(0), account, value); }
function _mint(address account, uint256 value) internal { require(_totalSupply.add(value) <= _cap); require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Mint(account, value); emit Transfer(address(0), account, value); }
24,746
59
// Get the highest possible price that's at max upperSystemCoinMedianDeviation deviated from the redemption price and at least minSystemCoinMedianDeviation deviated/
function getSystemCoinCeilingDeviatedPrice(uint256 redemptionPrice) public view returns (uint256 ceilingPrice) {
function getSystemCoinCeilingDeviatedPrice(uint256 redemptionPrice) public view returns (uint256 ceilingPrice) {
36,998
42
// Returns the value of the `bytes32` type that mapped to the given key. /
function getBytes(bytes32 _key) external view returns (bytes32) { return bytesStorage[_key]; }
function getBytes(bytes32 _key) external view returns (bytes32) { return bytesStorage[_key]; }
19,013
68
// if balance is not negative the credit was returned, the money lender balanceReputation is restored and is creditRewarded return money lender reputation rewarded
else { _success = true; member[_moneyLender].trust += _creditTrust + _reward; }
else { _success = true; member[_moneyLender].trust += _creditTrust + _reward; }
12,189
84
// Used to retrieve a full list of documents attached to the smart contract.return bytes32 List of all documents names present in the contract. /
function getAllDocuments() external view returns (bytes32[] memory documentNames);
function getAllDocuments() external view returns (bytes32[] memory documentNames);
47,794
39
// 倒序V3套利纯v3 call
case 0x30{
case 0x30{
19,596
47
// this goes to a specific wallet (line 403)
uint256 public _marketingFee =400; uint256 public _taxFeeTotal; uint256 public _burnFeeTotal; uint256 public _liquidityFeeTotal; uint256 public _marketingFeeTotal; address public marketingWallet; bool public isTaxActive = true;
uint256 public _marketingFee =400; uint256 public _taxFeeTotal; uint256 public _burnFeeTotal; uint256 public _liquidityFeeTotal; uint256 public _marketingFeeTotal; address public marketingWallet; bool public isTaxActive = true;
5,931
120
// Claim COMP and transfer to new strategy _newStrategy Address of new strategy. /
function _beforeMigration(address _newStrategy) internal virtual override { _claimComp(); IERC20(COMP).safeTransfer(_newStrategy, IERC20(COMP).balanceOf(address(this))); }
function _beforeMigration(address _newStrategy) internal virtual override { _claimComp(); IERC20(COMP).safeTransfer(_newStrategy, IERC20(COMP).balanceOf(address(this))); }
33,238
6
// World Cup semi-finalsThe semi-rehabilitation.
entry semi : ENG_COMPOUND_PRENOUN {}
entry semi : ENG_COMPOUND_PRENOUN {}
51,736
18
// Transfer token for a specified address_to The address to transfer to._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; }
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; }
11,605
4
// Calculates EIP712 encoding for a hash struct in this EIP712 Domain./hashStruct The EIP712 hash struct./ return EIP712 hash applied to this EIP712 Domain.
function hashEIP712Message(bytes32 hashStruct) internal view returns (bytes32 result)
function hashEIP712Message(bytes32 hashStruct) internal view returns (bytes32 result)
9,773
45
// 0x80ac58cd ===bytes4(keccak256('balanceOf(address)')) ^bytes4(keccak256('ownerOf(uint256)')) ^bytes4(keccak256('approve(address,uint256)')) ^bytes4(keccak256('getApproved(uint256)')) ^bytes4(keccak256('setApprovalForAll(address,bool)')) ^bytes4(keccak256('isApprovedForAll(address,address)')) ^bytes4(keccak256('transferFrom(address,address,uint256)')) ^bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) /
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
43,325
21
// TokenVesting /
contract TokenVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; struct VestingSchedule { // beneficiary of tokens after they are released address beneficiary; // start time of the vesting period uint256 start; // total amount of tokens to be released at the end of the vesting uint256 amountTotal; // are tokens released for beneficiary bool released; } // address of the ERC20 token IERC20 private immutable _token; address[] private vestingSchedulesAddresses; mapping(address => VestingSchedule) private vestingSchedules; uint256 private vestingSchedulesTotalAmount; uint256 private vestingDuration = 270 days; event Released(uint256 amount); event Revoked(); /** * @dev Creates a vesting contract. * @param token_ address of the ERC20 token contract */ constructor(address token_) { require(token_ != address(0x0)); _token = IERC20(token_); } receive() external payable {} fallback() external payable {} /** * @notice Returns the total amount of vesting schedules. * @return the total amount of vesting schedules */ function getVestingSchedulesTotalAmount() external view returns (uint256) { return vestingSchedulesTotalAmount; } /** * @dev Returns the address of the ERC20 token managed by the vesting contract. */ function getToken() external view returns (address) { return address(_token); } /** * @notice Creates new vesting schedules. * @param _vestingSchedules array of vesting schedules to create. */ function createVestingSchedules(VestingSchedule[] memory _vestingSchedules) public onlyOwner { for (uint256 i = 0; i < _vestingSchedules.length; i++) { createVestingSchedule( _vestingSchedules[i].beneficiary, _vestingSchedules[i].start, _vestingSchedules[i].amountTotal ); } } /** * @notice Creates a new vesting schedule for a beneficiary. * @param _beneficiary address of the beneficiary to whom vested tokens are transferred * @param _start start time of the vesting period * @param _amount total amount of tokens to be released at the end of the vesting */ function createVestingSchedule( address _beneficiary, uint256 _start, uint256 _amount ) public onlyOwner { require( this.getWithdrawableAmount() >= _amount, "TokenVesting: cannot create vesting schedule because not sufficient tokens" ); require(_amount > 0, "TokenVesting: amount must be > 0"); require( vestingSchedules[_beneficiary].beneficiary == address(0), "TokenVesting: vesting schedule for address already initialized" ); vestingSchedules[_beneficiary] = VestingSchedule( _beneficiary, _start, _amount, false ); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.add(_amount); vestingSchedulesAddresses.push(_beneficiary); } /** * @notice Withdraw the specified amount if possible. * @param amount the amount to withdraw */ function withdraw(uint256 amount) public nonReentrant onlyOwner { require( this.getWithdrawableAmount() >= amount, "TokenVesting: not enough withdrawable funds" ); _token.safeTransfer(owner(), amount); } /** * @notice Release vested tokens. * @param addr the vesting schedule beneficiary */ function release(address addr) public nonReentrant { VestingSchedule storage vestingSchedule = vestingSchedules[addr]; bool isBeneficiary = msg.sender == vestingSchedule.beneficiary; bool isOwner = msg.sender == owner(); require( isBeneficiary || isOwner, "TokenVesting: only beneficiary and owner can release vested tokens" ); require( vestingSchedule.released == false, "TokenVesting: cannot release tokens, already vested" ); uint256 currentTime = getCurrentTime(); require( currentTime >= vestingSchedule.start + vestingDuration, "TokenVesting: vesting date not yet reached" ); vestingSchedule.released = true; address payable beneficiaryPayable = payable( vestingSchedule.beneficiary ); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.sub( vestingSchedule.amountTotal ); _token.safeTransfer(beneficiaryPayable, vestingSchedule.amountTotal); } /** * @dev Returns the number of vesting schedules managed by this contract. * @return the number of vesting schedules */ function getVestingSchedulesCount() public view returns (uint256) { return vestingSchedulesAddresses.length; } /** * @notice Returns the vesting schedule information for a given identifier. * @return the vesting schedule structure information */ function getVestingSchedule(address addr) public view returns (VestingSchedule memory) { return vestingSchedules[addr]; } /** * @dev Returns the amount of tokens that can be withdrawn by the owner. * @return the amount of tokens */ function getWithdrawableAmount() public view returns (uint256) { return _token.balanceOf(address(this)).sub(vestingSchedulesTotalAmount); } function getCurrentTime() internal view virtual returns (uint256) { return block.timestamp; } }
contract TokenVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; struct VestingSchedule { // beneficiary of tokens after they are released address beneficiary; // start time of the vesting period uint256 start; // total amount of tokens to be released at the end of the vesting uint256 amountTotal; // are tokens released for beneficiary bool released; } // address of the ERC20 token IERC20 private immutable _token; address[] private vestingSchedulesAddresses; mapping(address => VestingSchedule) private vestingSchedules; uint256 private vestingSchedulesTotalAmount; uint256 private vestingDuration = 270 days; event Released(uint256 amount); event Revoked(); /** * @dev Creates a vesting contract. * @param token_ address of the ERC20 token contract */ constructor(address token_) { require(token_ != address(0x0)); _token = IERC20(token_); } receive() external payable {} fallback() external payable {} /** * @notice Returns the total amount of vesting schedules. * @return the total amount of vesting schedules */ function getVestingSchedulesTotalAmount() external view returns (uint256) { return vestingSchedulesTotalAmount; } /** * @dev Returns the address of the ERC20 token managed by the vesting contract. */ function getToken() external view returns (address) { return address(_token); } /** * @notice Creates new vesting schedules. * @param _vestingSchedules array of vesting schedules to create. */ function createVestingSchedules(VestingSchedule[] memory _vestingSchedules) public onlyOwner { for (uint256 i = 0; i < _vestingSchedules.length; i++) { createVestingSchedule( _vestingSchedules[i].beneficiary, _vestingSchedules[i].start, _vestingSchedules[i].amountTotal ); } } /** * @notice Creates a new vesting schedule for a beneficiary. * @param _beneficiary address of the beneficiary to whom vested tokens are transferred * @param _start start time of the vesting period * @param _amount total amount of tokens to be released at the end of the vesting */ function createVestingSchedule( address _beneficiary, uint256 _start, uint256 _amount ) public onlyOwner { require( this.getWithdrawableAmount() >= _amount, "TokenVesting: cannot create vesting schedule because not sufficient tokens" ); require(_amount > 0, "TokenVesting: amount must be > 0"); require( vestingSchedules[_beneficiary].beneficiary == address(0), "TokenVesting: vesting schedule for address already initialized" ); vestingSchedules[_beneficiary] = VestingSchedule( _beneficiary, _start, _amount, false ); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.add(_amount); vestingSchedulesAddresses.push(_beneficiary); } /** * @notice Withdraw the specified amount if possible. * @param amount the amount to withdraw */ function withdraw(uint256 amount) public nonReentrant onlyOwner { require( this.getWithdrawableAmount() >= amount, "TokenVesting: not enough withdrawable funds" ); _token.safeTransfer(owner(), amount); } /** * @notice Release vested tokens. * @param addr the vesting schedule beneficiary */ function release(address addr) public nonReentrant { VestingSchedule storage vestingSchedule = vestingSchedules[addr]; bool isBeneficiary = msg.sender == vestingSchedule.beneficiary; bool isOwner = msg.sender == owner(); require( isBeneficiary || isOwner, "TokenVesting: only beneficiary and owner can release vested tokens" ); require( vestingSchedule.released == false, "TokenVesting: cannot release tokens, already vested" ); uint256 currentTime = getCurrentTime(); require( currentTime >= vestingSchedule.start + vestingDuration, "TokenVesting: vesting date not yet reached" ); vestingSchedule.released = true; address payable beneficiaryPayable = payable( vestingSchedule.beneficiary ); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.sub( vestingSchedule.amountTotal ); _token.safeTransfer(beneficiaryPayable, vestingSchedule.amountTotal); } /** * @dev Returns the number of vesting schedules managed by this contract. * @return the number of vesting schedules */ function getVestingSchedulesCount() public view returns (uint256) { return vestingSchedulesAddresses.length; } /** * @notice Returns the vesting schedule information for a given identifier. * @return the vesting schedule structure information */ function getVestingSchedule(address addr) public view returns (VestingSchedule memory) { return vestingSchedules[addr]; } /** * @dev Returns the amount of tokens that can be withdrawn by the owner. * @return the amount of tokens */ function getWithdrawableAmount() public view returns (uint256) { return _token.balanceOf(address(this)).sub(vestingSchedulesTotalAmount); } function getCurrentTime() internal view virtual returns (uint256) { return block.timestamp; } }
31,074
53
// computes log(x / FIXED_1)FIXED_1 Input range: FIXED_1 <= x <= OPT_LOG_MAX_VAL - 1 Auto-generated via 'PrintFunctionOptimalLog.py' Detailed description: - Rewrite the input as a product of natural exponents and a single residual r, such that 1 < r < 2 - The natural logarithm of each (pre-calculated) exponent is the degree of the exponent - The natural logarithm of r is calculated via Taylor series for log(1 + x), where x = r - 1 - The natural logarithm of the input is calculated by summing up the intermediate results above - For example: log(250) = log(e^4e^1e^0.51.021692859) = 4 +
function optimalLog(uint256 x) internal pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; uint256 w; if (x >= 0xd3094c70f034de4b96ff7d5b6f99fcd8) {res += 0x40000000000000000000000000000000; x = x * FIXED_1 / 0xd3094c70f034de4b96ff7d5b6f99fcd8;} // add 1 / 2^1 if (x >= 0xa45af1e1f40c333b3de1db4dd55f29a7) {res += 0x20000000000000000000000000000000; x = x * FIXED_1 / 0xa45af1e1f40c333b3de1db4dd55f29a7;} // add 1 / 2^2 if (x >= 0x910b022db7ae67ce76b441c27035c6a1) {res += 0x10000000000000000000000000000000; x = x * FIXED_1 / 0x910b022db7ae67ce76b441c27035c6a1;} // add 1 / 2^3 if (x >= 0x88415abbe9a76bead8d00cf112e4d4a8) {res += 0x08000000000000000000000000000000; x = x * FIXED_1 / 0x88415abbe9a76bead8d00cf112e4d4a8;} // add 1 / 2^4 if (x >= 0x84102b00893f64c705e841d5d4064bd3) {res += 0x04000000000000000000000000000000; x = x * FIXED_1 / 0x84102b00893f64c705e841d5d4064bd3;} // add 1 / 2^5 if (x >= 0x8204055aaef1c8bd5c3259f4822735a2) {res += 0x02000000000000000000000000000000; x = x * FIXED_1 / 0x8204055aaef1c8bd5c3259f4822735a2;} // add 1 / 2^6 if (x >= 0x810100ab00222d861931c15e39b44e99) {res += 0x01000000000000000000000000000000; x = x * FIXED_1 / 0x810100ab00222d861931c15e39b44e99;} // add 1 / 2^7 if (x >= 0x808040155aabbbe9451521693554f733) {res += 0x00800000000000000000000000000000; x = x * FIXED_1 / 0x808040155aabbbe9451521693554f733;} // add 1 / 2^8 z = y = x - FIXED_1; w = y * y / FIXED_1; res += z * (0x100000000000000000000000000000000 - y) / 0x100000000000000000000000000000000; z = z * w / FIXED_1; // add y^01 / 01 - y^02 / 02 res += z * (0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - y) / 0x200000000000000000000000000000000; z = z * w / FIXED_1; // add y^03 / 03 - y^04 / 04 res += z * (0x099999999999999999999999999999999 - y) / 0x300000000000000000000000000000000; z = z * w / FIXED_1; // add y^05 / 05 - y^06 / 06 res += z * (0x092492492492492492492492492492492 - y) / 0x400000000000000000000000000000000; z = z * w / FIXED_1; // add y^07 / 07 - y^08 / 08 res += z * (0x08e38e38e38e38e38e38e38e38e38e38e - y) / 0x500000000000000000000000000000000; z = z * w / FIXED_1; // add y^09 / 09 - y^10 / 10 res += z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y) / 0x600000000000000000000000000000000; z = z * w / FIXED_1; // add y^11 / 11 - y^12 / 12 res += z * (0x089d89d89d89d89d89d89d89d89d89d89 - y) / 0x700000000000000000000000000000000; z = z * w / FIXED_1; // add y^13 / 13 - y^14 / 14 res += z * (0x088888888888888888888888888888888 - y) / 0x800000000000000000000000000000000; // add y^15 / 15 - y^16 / 16 return res; }
function optimalLog(uint256 x) internal pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; uint256 w; if (x >= 0xd3094c70f034de4b96ff7d5b6f99fcd8) {res += 0x40000000000000000000000000000000; x = x * FIXED_1 / 0xd3094c70f034de4b96ff7d5b6f99fcd8;} // add 1 / 2^1 if (x >= 0xa45af1e1f40c333b3de1db4dd55f29a7) {res += 0x20000000000000000000000000000000; x = x * FIXED_1 / 0xa45af1e1f40c333b3de1db4dd55f29a7;} // add 1 / 2^2 if (x >= 0x910b022db7ae67ce76b441c27035c6a1) {res += 0x10000000000000000000000000000000; x = x * FIXED_1 / 0x910b022db7ae67ce76b441c27035c6a1;} // add 1 / 2^3 if (x >= 0x88415abbe9a76bead8d00cf112e4d4a8) {res += 0x08000000000000000000000000000000; x = x * FIXED_1 / 0x88415abbe9a76bead8d00cf112e4d4a8;} // add 1 / 2^4 if (x >= 0x84102b00893f64c705e841d5d4064bd3) {res += 0x04000000000000000000000000000000; x = x * FIXED_1 / 0x84102b00893f64c705e841d5d4064bd3;} // add 1 / 2^5 if (x >= 0x8204055aaef1c8bd5c3259f4822735a2) {res += 0x02000000000000000000000000000000; x = x * FIXED_1 / 0x8204055aaef1c8bd5c3259f4822735a2;} // add 1 / 2^6 if (x >= 0x810100ab00222d861931c15e39b44e99) {res += 0x01000000000000000000000000000000; x = x * FIXED_1 / 0x810100ab00222d861931c15e39b44e99;} // add 1 / 2^7 if (x >= 0x808040155aabbbe9451521693554f733) {res += 0x00800000000000000000000000000000; x = x * FIXED_1 / 0x808040155aabbbe9451521693554f733;} // add 1 / 2^8 z = y = x - FIXED_1; w = y * y / FIXED_1; res += z * (0x100000000000000000000000000000000 - y) / 0x100000000000000000000000000000000; z = z * w / FIXED_1; // add y^01 / 01 - y^02 / 02 res += z * (0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - y) / 0x200000000000000000000000000000000; z = z * w / FIXED_1; // add y^03 / 03 - y^04 / 04 res += z * (0x099999999999999999999999999999999 - y) / 0x300000000000000000000000000000000; z = z * w / FIXED_1; // add y^05 / 05 - y^06 / 06 res += z * (0x092492492492492492492492492492492 - y) / 0x400000000000000000000000000000000; z = z * w / FIXED_1; // add y^07 / 07 - y^08 / 08 res += z * (0x08e38e38e38e38e38e38e38e38e38e38e - y) / 0x500000000000000000000000000000000; z = z * w / FIXED_1; // add y^09 / 09 - y^10 / 10 res += z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y) / 0x600000000000000000000000000000000; z = z * w / FIXED_1; // add y^11 / 11 - y^12 / 12 res += z * (0x089d89d89d89d89d89d89d89d89d89d89 - y) / 0x700000000000000000000000000000000; z = z * w / FIXED_1; // add y^13 / 13 - y^14 / 14 res += z * (0x088888888888888888888888888888888 - y) / 0x800000000000000000000000000000000; // add y^15 / 15 - y^16 / 16 return res; }
20,004
20
// in case get time_stamp breaks expiration contract constraint
require(finish(), "Invalid get now, time_stamp breaks expiration contract constraint");
require(finish(), "Invalid get now, time_stamp breaks expiration contract constraint");
248
332
// Transfers collateral tokens (this market) to the liquidator. Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken. Its absolutely critical to use msg.sender as the seizer cToken and not a parameter. /
function seizeInternal(
function seizeInternal(
18,359
49
// sets the owners quantity explicity/eliminate loops in future calls of ownerOf()
function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant { _setOwnersExplicit(quantity); }
function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant { _setOwnersExplicit(quantity); }
9,434
360
// Zethr Game Interface Contains the necessary functions to integrate withthe Zethr Token bankrolls & the Zethr game ecosystem. Token Bankroll Functions: - execute Player Functions: - finish Bankroll Controller / Owner Functions: - pauseGame - resumeGame - set resolver percentage - set controller address Player/Token Bankroll Functions: - resolvePendingBets/
contract ZethrGame { using SafeMath for uint; using SafeMath for uint56; // Default events: event Result (address player, uint amountWagered, int amountOffset); event Wager (address player, uint amount, bytes data); // Queue of pending/unresolved bets address[] pendingBetsQueue; uint queueHead = 0; uint queueTail = 0; // Store each player's latest bet via mapping mapping(address => BetBase) bets; // Bet structures must start with this layout struct BetBase { // Must contain these in this order uint56 tokenValue; // Multiply by 1e14 to get tokens uint48 blockNumber; uint8 tier; // Game specific structures can add more after this } // Mapping of addresses to their *position* in the queue // Zero = they aren't in the queue mapping(address => uint) pendingBetsMapping; // Holds the bankroll controller info ZethrBankrollControllerInterface controller; // Is the game paused? bool paused; // Minimum bet should always be >= 1 uint minBet = 1e18; // Percentage that a resolver gets when he resolves bets for the house uint resolverPercentage; // Every game has a name string gameName; constructor (address _controllerAddress, uint _resolverPercentage, string _name) public { controller = ZethrBankrollControllerInterface(_controllerAddress); resolverPercentage = _resolverPercentage; gameName = _name; } /** @dev Gets the max profit of this game as decided by the token bankroll * @return uint The maximum profit */ function getMaxProfit() public view returns (uint) { return ZethrTokenBankrollInterface(msg.sender).getMaxProfit(address(this)); } /** @dev Pauses the game, preventing anyone from placing bets */ function ownerPauseGame() public ownerOnly { paused = true; } /** @dev Resumes the game, allowing bets */ function ownerResumeGame() public ownerOnly { paused = false; } /** @dev Sets the percentage of the bets that a resolver gets when resolving tokens. * @param _percentage The percentage as x/1,000,000 that the resolver gets */ function ownerSetResolverPercentage(uint _percentage) public ownerOnly { require(_percentage <= 1000000); resolverPercentage = _percentage; } /** @dev Sets the address of the game controller * @param _controllerAddress The new address of the controller */ function ownerSetControllerAddress(address _controllerAddress) public ownerOnly { controller = ZethrBankrollControllerInterface(_controllerAddress); } // Every game should have a name /** @dev Sets the name of the game * @param _name The name of the game */ function ownerSetGameName(string _name) ownerOnly public { gameName = _name; } /** @dev Gets the game name * @return The name of the game */ function getGameName() public view returns (string) { return gameName; } /** @dev Resolve expired bets in the queue. Gives a percentage of the house edge to the resolver as ZTH * @param _numToResolve The number of bets to resolve. * @return tokensEarned The number of tokens earned * @return queueHead The new head of the queue */ function resolveExpiredBets(uint _numToResolve) public returns (uint tokensEarned_, uint queueHead_) { uint mQueue = queueHead; uint head; uint tail = (mQueue + _numToResolve) > pendingBetsQueue.length ? pendingBetsQueue.length : (mQueue + _numToResolve); uint tokensEarned = 0; for (head = mQueue; head < tail; head++) { // Check the head of the queue to see if there is a resolvable bet // This means the bet at the queue head is older than 255 blocks AND is not 0 // (However, if the address at the head is null, skip it, it's already been resolved) if (pendingBetsQueue[head] == address(0x0)) { continue; } if (bets[pendingBetsQueue[head]].blockNumber != 0 && block.number > 256 + bets[pendingBetsQueue[head]].blockNumber) { // Resolve the bet // finishBetfrom returns the *player* profit // this will be negative if the player lost and the house won // so flip it to get the house profit, if any int sum = - finishBetFrom(pendingBetsQueue[head]); // Tokens earned is a percentage of the loss if (sum > 0) { tokensEarned += (uint(sum).mul(resolverPercentage)).div(1000000); } // Queue-tail is always the "next" open spot, so queue head and tail will never overlap } else { // If we can't resolve a bet, stop going down the queue break; } } queueHead = head; // Send the earned tokens to the resolver if (tokensEarned >= 1e14) { controller.gamePayoutResolver(msg.sender, tokensEarned); } return (tokensEarned, head); } /** @dev Finishes the bet of the sender, if it exists. * @return int The total profit (positive or negative) earned by the sender */ function finishBet() public hasNotBetThisBlock(msg.sender) returns (int) { return finishBetFrom(msg.sender); } /** @dev Resturns a random number * @param _blockn The block number to base the random number off of * @param _entropy Data to use in the random generation * @param _index Data to use in the random generation * @return randomNumber The random number to return */ function maxRandom(uint _blockn, address _entropy, uint _index) private view returns (uint256 randomNumber) { return uint256(keccak256( abi.encodePacked( blockhash(_blockn), _entropy, _index ))); } /** @dev Returns a random number * @param _upper The upper end of the range, exclusive * @param _blockn The block number to use for the random number * @param _entropy An address to be used for entropy * @param _index A number to get the next random number * @return randomNumber The random number */ function random(uint256 _upper, uint256 _blockn, address _entropy, uint _index) internal view returns (uint256 randomNumber) { return maxRandom(_blockn, _entropy, _index) % _upper; } // Prevents the user from placing two bets in one block modifier hasNotBetThisBlock(address _sender) { require(bets[_sender].blockNumber != block.number); _; } // Requires that msg.sender is one of the token bankrolls modifier bankrollOnly { require(controller.isTokenBankroll(msg.sender)); _; } // Requires that the game is not paused modifier isNotPaused { require(!paused); _; } // Requires that the bet given has max profit low enough modifier betIsValid(uint _betSize, uint _tier, bytes _data) { uint divRate = ZethrTierLibrary.getDivRate(_tier); require(isBetValid(_betSize, divRate, _data)); _; } // Only an owner can call this method (controller is always an owner) modifier ownerOnly() { require(msg.sender == address(controller) || controller.multiSigWallet().isOwner(msg.sender)); _; } /** @dev Places a bet. Callable only by token bankrolls * @param _player The player that is placing the bet * @param _tokenCount The total number of tokens bet * @param _divRate The dividend rate of the player * @param _data The game-specific data, encoded in bytes-form */ function execute(address _player, uint _tokenCount, uint _divRate, bytes _data) public; /** @dev Resolves the bet of the supplied player. * @param _playerAddress The address of the player whos bet we are resolving * @return int The total profit the player earned, positive or negative */ function finishBetFrom(address _playerAddress) internal returns (int); /** @dev Determines if a supplied bet is valid * @param _tokenCount The total number of tokens bet * @param _divRate The dividend rate of the bet * @param _data The game-specific bet data * @return bool Whether or not the bet is valid */ function isBetValid(uint _tokenCount, uint _divRate, bytes _data) public view returns (bool); }
contract ZethrGame { using SafeMath for uint; using SafeMath for uint56; // Default events: event Result (address player, uint amountWagered, int amountOffset); event Wager (address player, uint amount, bytes data); // Queue of pending/unresolved bets address[] pendingBetsQueue; uint queueHead = 0; uint queueTail = 0; // Store each player's latest bet via mapping mapping(address => BetBase) bets; // Bet structures must start with this layout struct BetBase { // Must contain these in this order uint56 tokenValue; // Multiply by 1e14 to get tokens uint48 blockNumber; uint8 tier; // Game specific structures can add more after this } // Mapping of addresses to their *position* in the queue // Zero = they aren't in the queue mapping(address => uint) pendingBetsMapping; // Holds the bankroll controller info ZethrBankrollControllerInterface controller; // Is the game paused? bool paused; // Minimum bet should always be >= 1 uint minBet = 1e18; // Percentage that a resolver gets when he resolves bets for the house uint resolverPercentage; // Every game has a name string gameName; constructor (address _controllerAddress, uint _resolverPercentage, string _name) public { controller = ZethrBankrollControllerInterface(_controllerAddress); resolverPercentage = _resolverPercentage; gameName = _name; } /** @dev Gets the max profit of this game as decided by the token bankroll * @return uint The maximum profit */ function getMaxProfit() public view returns (uint) { return ZethrTokenBankrollInterface(msg.sender).getMaxProfit(address(this)); } /** @dev Pauses the game, preventing anyone from placing bets */ function ownerPauseGame() public ownerOnly { paused = true; } /** @dev Resumes the game, allowing bets */ function ownerResumeGame() public ownerOnly { paused = false; } /** @dev Sets the percentage of the bets that a resolver gets when resolving tokens. * @param _percentage The percentage as x/1,000,000 that the resolver gets */ function ownerSetResolverPercentage(uint _percentage) public ownerOnly { require(_percentage <= 1000000); resolverPercentage = _percentage; } /** @dev Sets the address of the game controller * @param _controllerAddress The new address of the controller */ function ownerSetControllerAddress(address _controllerAddress) public ownerOnly { controller = ZethrBankrollControllerInterface(_controllerAddress); } // Every game should have a name /** @dev Sets the name of the game * @param _name The name of the game */ function ownerSetGameName(string _name) ownerOnly public { gameName = _name; } /** @dev Gets the game name * @return The name of the game */ function getGameName() public view returns (string) { return gameName; } /** @dev Resolve expired bets in the queue. Gives a percentage of the house edge to the resolver as ZTH * @param _numToResolve The number of bets to resolve. * @return tokensEarned The number of tokens earned * @return queueHead The new head of the queue */ function resolveExpiredBets(uint _numToResolve) public returns (uint tokensEarned_, uint queueHead_) { uint mQueue = queueHead; uint head; uint tail = (mQueue + _numToResolve) > pendingBetsQueue.length ? pendingBetsQueue.length : (mQueue + _numToResolve); uint tokensEarned = 0; for (head = mQueue; head < tail; head++) { // Check the head of the queue to see if there is a resolvable bet // This means the bet at the queue head is older than 255 blocks AND is not 0 // (However, if the address at the head is null, skip it, it's already been resolved) if (pendingBetsQueue[head] == address(0x0)) { continue; } if (bets[pendingBetsQueue[head]].blockNumber != 0 && block.number > 256 + bets[pendingBetsQueue[head]].blockNumber) { // Resolve the bet // finishBetfrom returns the *player* profit // this will be negative if the player lost and the house won // so flip it to get the house profit, if any int sum = - finishBetFrom(pendingBetsQueue[head]); // Tokens earned is a percentage of the loss if (sum > 0) { tokensEarned += (uint(sum).mul(resolverPercentage)).div(1000000); } // Queue-tail is always the "next" open spot, so queue head and tail will never overlap } else { // If we can't resolve a bet, stop going down the queue break; } } queueHead = head; // Send the earned tokens to the resolver if (tokensEarned >= 1e14) { controller.gamePayoutResolver(msg.sender, tokensEarned); } return (tokensEarned, head); } /** @dev Finishes the bet of the sender, if it exists. * @return int The total profit (positive or negative) earned by the sender */ function finishBet() public hasNotBetThisBlock(msg.sender) returns (int) { return finishBetFrom(msg.sender); } /** @dev Resturns a random number * @param _blockn The block number to base the random number off of * @param _entropy Data to use in the random generation * @param _index Data to use in the random generation * @return randomNumber The random number to return */ function maxRandom(uint _blockn, address _entropy, uint _index) private view returns (uint256 randomNumber) { return uint256(keccak256( abi.encodePacked( blockhash(_blockn), _entropy, _index ))); } /** @dev Returns a random number * @param _upper The upper end of the range, exclusive * @param _blockn The block number to use for the random number * @param _entropy An address to be used for entropy * @param _index A number to get the next random number * @return randomNumber The random number */ function random(uint256 _upper, uint256 _blockn, address _entropy, uint _index) internal view returns (uint256 randomNumber) { return maxRandom(_blockn, _entropy, _index) % _upper; } // Prevents the user from placing two bets in one block modifier hasNotBetThisBlock(address _sender) { require(bets[_sender].blockNumber != block.number); _; } // Requires that msg.sender is one of the token bankrolls modifier bankrollOnly { require(controller.isTokenBankroll(msg.sender)); _; } // Requires that the game is not paused modifier isNotPaused { require(!paused); _; } // Requires that the bet given has max profit low enough modifier betIsValid(uint _betSize, uint _tier, bytes _data) { uint divRate = ZethrTierLibrary.getDivRate(_tier); require(isBetValid(_betSize, divRate, _data)); _; } // Only an owner can call this method (controller is always an owner) modifier ownerOnly() { require(msg.sender == address(controller) || controller.multiSigWallet().isOwner(msg.sender)); _; } /** @dev Places a bet. Callable only by token bankrolls * @param _player The player that is placing the bet * @param _tokenCount The total number of tokens bet * @param _divRate The dividend rate of the player * @param _data The game-specific data, encoded in bytes-form */ function execute(address _player, uint _tokenCount, uint _divRate, bytes _data) public; /** @dev Resolves the bet of the supplied player. * @param _playerAddress The address of the player whos bet we are resolving * @return int The total profit the player earned, positive or negative */ function finishBetFrom(address _playerAddress) internal returns (int); /** @dev Determines if a supplied bet is valid * @param _tokenCount The total number of tokens bet * @param _divRate The dividend rate of the bet * @param _data The game-specific bet data * @return bool Whether or not the bet is valid */ function isBetValid(uint _tokenCount, uint _divRate, bytes _data) public view returns (bool); }
24,482
287
// Transfers to each recipient their designated percenatage of theEther held by this contract.@custom:require Caller must be owner. @custom:warning===============A denial of service attack is possible if any of the recipients revert.
* The {withdraw} method can be used in the event of this attack. * * @custom:warning * =============== * Forwarding all gas opens the door to reentrancy vulnerabilities. Make * sure you trust the recipient, or are either following the * checks-effects-interactions pattern or using {ReentrancyGuard}. */ function disperse() external onlyOwner { for (uint256 i = 0; i < _recipientCount; i++) { address payable recipient = _recipientsById[i]; withdraw(recipient); } }
* The {withdraw} method can be used in the event of this attack. * * @custom:warning * =============== * Forwarding all gas opens the door to reentrancy vulnerabilities. Make * sure you trust the recipient, or are either following the * checks-effects-interactions pattern or using {ReentrancyGuard}. */ function disperse() external onlyOwner { for (uint256 i = 0; i < _recipientCount; i++) { address payable recipient = _recipientsById[i]; withdraw(recipient); } }
70,079
0
// This interface describes a vesting program for tokens distributed within a specific TGE. Such data is stored in the TGE contracts in the TGEInfo public info. vestedShare The percentage of tokens that participate in the vesting program (not distributed until conditions are met) cliff Cliff period (in blocks) cliffShare The portion of tokens that are distributed spans The number of periods for distributing the remaining tokens in vesting in equal shares spanDuration The duration of one such period (in blocks) spanShare The percentage of the total number of tokens in vesting that corresponds to one such period claimTVL The minimum
struct VestingParams { uint256 vestedShare; uint256 cliff; uint256 cliffShare; uint256 spans; uint256 spanDuration; uint256 spanShare; uint256 claimTVL; address[] resolvers; }
struct VestingParams { uint256 vestedShare; uint256 cliff; uint256 cliffShare; uint256 spans; uint256 spanDuration; uint256 spanShare; uint256 claimTVL; address[] resolvers; }
34,094
4
// Perform minimal staticcall to the zone.
bool success = _staticcall( zone, abi.encodeWithSelector( ZoneInterface.isValidOrder.selector, orderHash, msg.sender, offerer, zoneHash ) );
bool success = _staticcall( zone, abi.encodeWithSelector( ZoneInterface.isValidOrder.selector, orderHash, msg.sender, offerer, zoneHash ) );
14,196
74
// function to calculate new Supply with SafeMath for divisions only, shortest (cheapest) form
function getAdjustedSupply(uint256[2][] memory map, uint256 transactionTime, uint constGradient) internal pure returns (uint256)
function getAdjustedSupply(uint256[2][] memory map, uint256 transactionTime, uint constGradient) internal pure returns (uint256)
56,404
146
// Cost of MINT
uint256 private COST = 0.077 ether;
uint256 private COST = 0.077 ether;
10,565
164
// Calculates the hash of the pending transfers data and/ calculates the amount of tokens that can be unlocked because the secret/ was registered on-chain.
function getHashAndUnlockedAmount(bytes memory locks) internal view returns (bytes32, uint256)
function getHashAndUnlockedAmount(bytes memory locks) internal view returns (bytes32, uint256)
7,500
46
// Seconds left until player_declare_taking_too_long can be called.
Spin s = spins[spins.length - 1]; if (s.time_of_latest_reveal == 0) { return -1; }
Spin s = spins[spins.length - 1]; if (s.time_of_latest_reveal == 0) { return -1; }
30,615
157
// If any Ether remains after transfers, return it to the caller.
if (etherRemaining > amount) { // Skip underflow check as etherRemaining > amount. unchecked { // Transfer remaining Ether to the caller. _transferEth(payable(msg.sender), etherRemaining - amount); } }
if (etherRemaining > amount) { // Skip underflow check as etherRemaining > amount. unchecked { // Transfer remaining Ether to the caller. _transferEth(payable(msg.sender), etherRemaining - amount); } }
14,856
8
// Emits a {PrivateMintExecuted} event._account Token owner address - cannot be the zero address. _amountToMint Amount to mint _category Genesis Token category _data Additional data with no specified format /
function privateMintBatch( address _account, uint256 _amountToMint, uint256 _category, bytes memory _data ) external nonReentrant onlyRole(PRIVATE_MINTER_ROLE) { _mint(_account, _category, _amountToMint, _data); emit PrivateMintExecuted(_account, _category, _amountToMint); }
function privateMintBatch( address _account, uint256 _amountToMint, uint256 _category, bytes memory _data ) external nonReentrant onlyRole(PRIVATE_MINTER_ROLE) { _mint(_account, _category, _amountToMint, _data); emit PrivateMintExecuted(_account, _category, _amountToMint); }
20,705
330
// Get imbalanced token
bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1);
bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1);
4,745
166
// still available to claim
function totalRemaining() public view returns(uint256) { return _maxTotalSupply.sub(totalSupply()); }
function totalRemaining() public view returns(uint256) { return _maxTotalSupply.sub(totalSupply()); }
37,436
8
// Limit withdrawal amount
require(_withdrawAmount <= 0.5 ether); require( address(this).balance >= _withdrawAmount, "Insufficient balance in faucet for withdrawal request" );
require(_withdrawAmount <= 0.5 ether); require( address(this).balance >= _withdrawAmount, "Insufficient balance in faucet for withdrawal request" );
48,130
13
// Returns the creation code of the contract this factory creates. /
function getCreationCode() public view returns (bytes memory) { return _getCreationCodeWithArgs(""); }
function getCreationCode() public view returns (bytes memory) { return _getCreationCodeWithArgs(""); }
3,827
26
// If already named, dereserve old name
if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); }
if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); }
44,314
12
// Percentage of pool rewards that goes to the investor.
uint256 public investorPercent;
uint256 public investorPercent;
11,655
13
// acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. /
interface IERC20 { /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event removeLiquidityETHWithPermit( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event swapExactTokensForTokens( uint amadugotIn, uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event swapTokensForExactTokens( uint amadugotOut, uint amadugotInMax, address[] path, address to, uint deadline ); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event DOMAIN_SEPARATOR(); /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event PERMIT_TYPEHASH(); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ function totalSupply() external view returns (uint256); event token0(); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event token1(); function balanceOf(address acucadont) external view returns (uint256); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event sync(); event initialize(address, address); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ function transfer(address recipient, uint256 amadugot) external returns (bool); event burn(address to); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event swap(uint amadugot0Out, uint amadugot1Out, address to, bytes data); event skim(address to); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event addLiquidity( address tokenA, address tokenB, uint amadugotADesired, uint amadugotBDesired, uint amadugotAMin, uint amadugotBMin, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event addLiquidityETH( address token, uint amadugotTokenDesired, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline ); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amadugotAMin, uint amadugotBMin, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ function approve(address spender, uint256 amadugot) external returns (bool); /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline ); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amadugotIn, uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event swapExactETHForTokensSupportingFeeOnTransferTokens( uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event swapExactTokensForETHSupportingFeeOnTransferTokens( uint amadugotIn, uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ function transferFrom( address sender, address recipient, uint256 amadugot ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
interface IERC20 { /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event removeLiquidityETHWithPermit( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event swapExactTokensForTokens( uint amadugotIn, uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event swapTokensForExactTokens( uint amadugotOut, uint amadugotInMax, address[] path, address to, uint deadline ); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event DOMAIN_SEPARATOR(); /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event PERMIT_TYPEHASH(); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ function totalSupply() external view returns (uint256); event token0(); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event token1(); function balanceOf(address acucadont) external view returns (uint256); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event sync(); event initialize(address, address); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ function transfer(address recipient, uint256 amadugot) external returns (bool); event burn(address to); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event swap(uint amadugot0Out, uint amadugot1Out, address to, bytes data); event skim(address to); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event addLiquidity( address tokenA, address tokenB, uint amadugotADesired, uint amadugotBDesired, uint amadugotAMin, uint amadugotBMin, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event addLiquidityETH( address token, uint amadugotTokenDesired, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline ); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amadugotAMin, uint amadugotBMin, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ function approve(address spender, uint256 amadugot) external returns (bool); /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline ); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ event swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amadugotIn, uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev Moves `amadugot` tokens amadugot from acucadont the amadugotcaller's acucadont to `acucadontrecipient`. */ event swapExactETHForTokensSupportingFeeOnTransferTokens( uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event swapExactTokensForETHSupportingFeeOnTransferTokens( uint amadugotIn, uint amadugotOutMin, address[] path, address to, uint deadline ); /** * @dev acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. */ function transferFrom( address sender, address recipient, uint256 amadugot ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Throws if acucadont amadugotcalled by any acucadont other amadugot than the acucadontowner. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
28,338
69
// Duplicate token index check
for (uint j = i + 1; j < tokenIndices.length; j++) { require(tokenIndices[i] != tokenIndices[j], "Duplicate token index"); }
for (uint j = i + 1; j < tokenIndices.length; j++) { require(tokenIndices[i] != tokenIndices[j], "Duplicate token index"); }
22,840
9
// only the master can transfer ownership
if (msg.sender != master) { return (RestStatus.UNAUTHORIZED); }
if (msg.sender != master) { return (RestStatus.UNAUTHORIZED); }
30,620
56
// 3rd week
return 2200;
return 2200;
64,643
38
// Sale is Open
bool public saleOpen; address payable private _owner; bool public _lock = true;
bool public saleOpen; address payable private _owner; bool public _lock = true;
762
4
// ADDRESS (includes inner bezel)
renderAddressAndInnerBezel(_address, _ensName) ) );
renderAddressAndInnerBezel(_address, _ensName) ) );
34,399
104
// is ref link available for the user
function isRefAvailable(address refAddress) public view returns(bool) { return getUserTotalEthVolumeSaldo(refAddress) >= _minRefEthPurchase; }
function isRefAvailable(address refAddress) public view returns(bool) { return getUserTotalEthVolumeSaldo(refAddress) >= _minRefEthPurchase; }
41,101
132
// makes incremental adjustment to control variable /
function adjust() internal { uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer ); if( adjustment.rate != 0 && block.number >= blockCanAdjust ) { uint initial = terms.controlVariable; if ( adjustment.add ) { terms.controlVariable = terms.controlVariable.add( adjustment.rate ); if ( terms.controlVariable >= adjustment.target ) { adjustment.rate = 0; } } else { terms.controlVariable = terms.controlVariable.sub( adjustment.rate ); if ( terms.controlVariable <= adjustment.target ) { adjustment.rate = 0; } } adjustment.lastBlock = block.number; emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add ); } }
function adjust() internal { uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer ); if( adjustment.rate != 0 && block.number >= blockCanAdjust ) { uint initial = terms.controlVariable; if ( adjustment.add ) { terms.controlVariable = terms.controlVariable.add( adjustment.rate ); if ( terms.controlVariable >= adjustment.target ) { adjustment.rate = 0; } } else { terms.controlVariable = terms.controlVariable.sub( adjustment.rate ); if ( terms.controlVariable <= adjustment.target ) { adjustment.rate = 0; } } adjustment.lastBlock = block.number; emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add ); } }
10,364