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
958
// GLOBAL STATE FUNCTIONS // Locks contract state in expired and requests oracle price. this function can only be called once the contract is expired and can't be re-called. /
function expire() external onlyPostExpiration() onlyOpenState() fees() nonReentrant() { contractState = ContractState.ExpiredPriceRequested; // Final fees do not need to be paid when sending a request to the optimistic oracle. _requestOraclePriceExpiration(expirationTimestamp); emi...
function expire() external onlyPostExpiration() onlyOpenState() fees() nonReentrant() { contractState = ContractState.ExpiredPriceRequested; // Final fees do not need to be paid when sending a request to the optimistic oracle. _requestOraclePriceExpiration(expirationTimestamp); emi...
21,680
94
// add token buy amount to sender's balance
balances[msg.sender] = balances[msg.sender].add(_buyAmount);
balances[msg.sender] = balances[msg.sender].add(_buyAmount);
8,812
61
// Sets the parameter which control the timing and frequency ofrebase operations the minimum time period that must elapse between rebase cycles. minRebaseTimeIntervalSec_ More than this much time must pass between rebase operations, in seconds. /
function setRebaseTimingParameter(uint256 minRebaseTimeIntervalSec_) external onlyOwner
function setRebaseTimingParameter(uint256 minRebaseTimeIntervalSec_) external onlyOwner
52,978
114
// fromToken Address of the source token toToken Address of the destination token fromAmount Amount of source tokens to be swapped toAmount Minimum destination token amount expected out of this swap expectedAmount Expected amount of destination tokens without slippage beneficiary Beneficiary address0 then 100% will be ...
struct SellData { IERC20 fromToken; IERC20 toToken; uint256 fromAmount; uint256 toAmount; uint256 expectedAmount; address payable beneficiary; string referrer; Utils.Path[] path; }
struct SellData { IERC20 fromToken; IERC20 toToken; uint256 fromAmount; uint256 toAmount; uint256 expectedAmount; address payable beneficiary; string referrer; Utils.Path[] path; }
3,393
96
// Add the owner public key to the list of used public keys
ownerPublicKeys[ownerPublicKey_x][ownerPublicKey_y] = true;
ownerPublicKeys[ownerPublicKey_x][ownerPublicKey_y] = true;
43,413
54
// store eth inside a boxboxId id of the box amount amount of eth to store /
function _storeEth(uint256 boxId, uint256 amount) private { // update the box _indexedEth[boxId] += amount; }
function _storeEth(uint256 boxId, uint256 amount) private { // update the box _indexedEth[boxId] += amount; }
49,531
19
// External function to start the battle. This function can be called only by owner. /
function startBattle() external onlyOwner { require( bytes(prizeTokenURI).length > 0 && inPlay.length > 1, "BattleRoyale: Tokens in game are not enough to play" ); battleState = BATTLE_STATE.RUNNING; emit BattleStarted(address(this), inPlay); }
function startBattle() external onlyOwner { require( bytes(prizeTokenURI).length > 0 && inPlay.length > 1, "BattleRoyale: Tokens in game are not enough to play" ); battleState = BATTLE_STATE.RUNNING; emit BattleStarted(address(this), inPlay); }
19,592
39
// Save the latest location
saveProductLocation(t, productId, timestamp, latitude, longitude);
saveProductLocation(t, productId, timestamp, latitude, longitude);
49,422
124
// make sure we can actually claim it and that we are paying the correct amount
require(canClaim); require(amount == lowestClaimPrice);
require(canClaim); require(amount == lowestClaimPrice);
48,521
140
// Precalculated
cutoffs = [ 500000 ether, 100000 ether, 50000 ether, 25000 ether, 1 ether ];
cutoffs = [ 500000 ether, 100000 ether, 50000 ether, 25000 ether, 1 ether ];
48,573
225
// See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); }
function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); }
28,977
133
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
bytes32 lastvalue = set._values[lastIndex];
541
165
// Units up for cooldown
uint88 cooldownUnits;
uint88 cooldownUnits;
87,807
146
// Returns the element stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); }
* - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); }
5,093
223
// ealry miting one day time
uint256 public EARLY_MINT_TIME_ONE_DAY = 1 days;
uint256 public EARLY_MINT_TIME_ONE_DAY = 1 days;
46,705
25
// Indicator that this is a CToken contract (for inspection) /
bool public constant isCToken = true;
bool public constant isCToken = true;
22,582
86
// Gets the total number of tokens cast as a member for/against a given claim /
function getMemberClaimVotesToken( uint _claimId ) external view returns(uint claimId, uint cnt)
function getMemberClaimVotesToken( uint _claimId ) external view returns(uint claimId, uint cnt)
22,151
51
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) { if (tokenId >= ERC721AStorage.layout()._currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
if (packed == 0) { if (tokenId >= ERC721AStorage.layout()._currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
38,906
9
// Redeem the vault tokens to receive main tokens
vaultToken.redeem(vaultToken.balanceOf(address(this)), address(this), address(this), true);
vaultToken.redeem(vaultToken.balanceOf(address(this)), address(this), address(this), true);
31,900
35
// If the amount being transfered is more than the balance of theaccount the transfer throws
var previousBalanceFrom = balanceOfAt(_from, block.number); require(previousBalanceFrom >= _amount);
var previousBalanceFrom = balanceOfAt(_from, block.number); require(previousBalanceFrom >= _amount);
38,271
7
// return one container by trackingID/
function getSingleContainer(string memory _trackingID) public view returns (Container memory) { require(bytes(containerSupplyChain[_trackingID].trackingID).length > 0, "HTTP 400 product does not exist"); return containerSupplyChain[_trackingID]; }
function getSingleContainer(string memory _trackingID) public view returns (Container memory) { require(bytes(containerSupplyChain[_trackingID].trackingID).length > 0, "HTTP 400 product does not exist"); return containerSupplyChain[_trackingID]; }
18,675
157
// Owner may change the percent of insurance fees referrers receive. _referPercent The percent of fees referrers receive. 50 == 5%./
{ require(_referPercent <= 500, "Cannot give referrer more than 50% of rewards."); referPercent = _referPercent; }
{ require(_referPercent <= 500, "Cannot give referrer more than 50% of rewards."); referPercent = _referPercent; }
36,130
58
// OMGToken Omise Go Token contract /
contract OMGToken is PausableToken, MintableToken { using SafeMath for uint256; string public name = "OMGToken"; string public symbol = "OMG"; uint public decimals = 18; /** * @dev mint timelocked tokens */ function mintTimelocked(address _to, uint256 _amount, uint256 _releaseTime) onlyOwner can...
contract OMGToken is PausableToken, MintableToken { using SafeMath for uint256; string public name = "OMGToken"; string public symbol = "OMG"; uint public decimals = 18; /** * @dev mint timelocked tokens */ function mintTimelocked(address _to, uint256 _amount, uint256 _releaseTime) onlyOwner can...
52,154
1
// the current progression towards that cap
uint256 public current;
uint256 public current;
34,488
61
// update the developers fund based on this calculated amount
DEVELOPERSFUND = SafeMath.add(DEVELOPERSFUND, developersCut);
DEVELOPERSFUND = SafeMath.add(DEVELOPERSFUND, developersCut);
46,174
64
// Data structure declaring a loyalty tier_rate apr for reward tier_price to select reward tier_enabled availability for reward tier/
struct Tier {
struct Tier {
48,987
84
// Used to prevent re-entrancy
uint256 internal status;
uint256 internal status;
14,880
14
// remove withdrawn bonds from the total now that we have the bond value
pool.poolBondsTotal = pool.poolBondsTotal.sub(pool.bondsWithdrawPool);
pool.poolBondsTotal = pool.poolBondsTotal.sub(pool.bondsWithdrawPool);
150
4
// Retrieve a list of authorized sendersreturn array of addresses /
function getAuthorizedSenders() external view override returns (address[] memory) { return s_authorizedSenderList; }
function getAuthorizedSenders() external view override returns (address[] memory) { return s_authorizedSenderList; }
33,351
20
// Returns rewardPerTokenSum of `asset`
function getRewardPerTokenSum(address asset) external view returns (uint256) { return rewardPerTokenSum[asset]; }
function getRewardPerTokenSum(address asset) external view returns (uint256) { return rewardPerTokenSum[asset]; }
6,933
15
// ====================================== INTERNAL ======================================
function _setInfo(string memory _collectionName, string memory _containerName) internal { _name = _collectionName; _symbol = _containerName; }
function _setInfo(string memory _collectionName, string memory _containerName) internal { _name = _collectionName; _symbol = _containerName; }
8,106
14
// mapping for storing amount supplied by the user across different token addresses
mapping(address => mapping(address => uint256)) public lentAmount;
mapping(address => mapping(address => uint256)) public lentAmount;
18,792
70
// coefficient 2 in the reward calculator
uint256 public Y;
uint256 public Y;
44,665
20
// Pooltype to set pool display type on frontend.
function setPoolType(uint256 _pid, uint256 _pooltype) external onlyOwner { poolInfo[_pid].pooltype = _pooltype; }
function setPoolType(uint256 _pid, uint256 _pooltype) external onlyOwner { poolInfo[_pid].pooltype = _pooltype; }
51,798
201
// Update dev address by the previous inv.
function inv(address _invaddr) public { require(msg.sender == invaddr, "dev: wut?"); invaddr = _invaddr; }
function inv(address _invaddr) public { require(msg.sender == invaddr, "dev: wut?"); invaddr = _invaddr; }
11,889
5
// --- LQTYToken specific data ---
uint public constant ONE_YEAR_IN_SECONDS = 31536000; // 60 * 60 * 24 * 365
uint public constant ONE_YEAR_IN_SECONDS = 31536000; // 60 * 60 * 24 * 365
11,423
13
// sell defi token at balancer to get weth
balancer.swapExactAmountIn(_pi, piAmount, weth, _minAmountOut, maxPrice); wethContract.withdraw(wethContract.balanceOf(address(this))); require(address(this).balance >= ethIn, "ethOut must > ethIn"); msg.sender.transfer(msg.value);
balancer.swapExactAmountIn(_pi, piAmount, weth, _minAmountOut, maxPrice); wethContract.withdraw(wethContract.balanceOf(address(this))); require(address(this).balance >= ethIn, "ethOut must > ethIn"); msg.sender.transfer(msg.value);
7,092
48
// ADVANCED TOKEN STARTS HERE /
contract SHToken is owned, TokenERC20 { using SafeMath for uint256; mapping (address => uint8) whileList ; //event mylog(uint code); function() external payable{ transEth(); } /* Initializes contract with initial supply tokens to the creator of the contract */ constructor(...
contract SHToken is owned, TokenERC20 { using SafeMath for uint256; mapping (address => uint8) whileList ; //event mylog(uint code); function() external payable{ transEth(); } /* Initializes contract with initial supply tokens to the creator of the contract */ constructor(...
5,738
91
// The items-based escrow ticketer getter /
function getItemsTicketer() external view returns (address);
function getItemsTicketer() external view returns (address);
12,982
20
// CHECK IF THE LAND DOES NOT BELONG TO SOMEONE ELSE && CHECK IF THE OWNER ID AND THE LAND ID BOTH EXIST IN THE SYSTEM
if ( (lands[_landId].ownerAddress == address(0)) && (_landId <= landCounter) && (_ownerId <= ownerCounter) ){
if ( (lands[_landId].ownerAddress == address(0)) && (_landId <= landCounter) && (_ownerId <= ownerCounter) ){
36,204
12
// apply incentives on transfer/sender the sender address of the FEI/receiver the receiver address of the FEI/operator the operator (msg.sender) of the transfer/amount the amount of FEI transferred
function incentivize( address sender, address receiver, address operator, uint256 amount ) external;
function incentivize( address sender, address receiver, address operator, uint256 amount ) external;
42,576
7
// 100 DID
value: 100 * 1 ether
value: 100 * 1 ether
46,588
20
// Creates `amount` tokens and assigns them to `account`, increasing the total supply./_to The address of the account that will receive the freshly minted tokens
function _mint(address _to, uint256 _amount) internal virtual { require(_to != address(0), "ERC20_INVALID_MINT_ADDRESS"); _totalSupply += _amount; unchecked { balances[_to] += _amount; } emit Transfer(address(0), _to, _amount); }
function _mint(address _to, uint256 _amount) internal virtual { require(_to != address(0), "ERC20_INVALID_MINT_ADDRESS"); _totalSupply += _amount; unchecked { balances[_to] += _amount; } emit Transfer(address(0), _to, _amount); }
33,248
173
// Initialize the deployed contract after creation This is a one time call which sets _deployer to msg.sender.Subsequent calls reverts. /
function initialize() external;
function initialize() external;
66,419
3
// returns the details of a specific pool
function poolAddressById(uint8) external view returns (address poolAddress); function poolIdArray(uint256) external view returns (uint8); function getPoolIdArray() external view returns (uint8[] memory);
function poolAddressById(uint8) external view returns (address poolAddress); function poolIdArray(uint256) external view returns (uint8); function getPoolIdArray() external view returns (uint8[] memory);
28,520
64
// If the heap is empty join the _addr
if (_size == 0) { emit JoinHeap(_addr, _new, 0); heap.insert(_addr, _new); return; }
if (_size == 0) { emit JoinHeap(_addr, _new, 0); heap.insert(_addr, _new); return; }
35,854
1
// deposit into convex, receive a tokenized deposit.parameter to stake immediately
function deposit( uint256 _pid, uint256 _amount, bool _stake ) external returns (bool);
function deposit( uint256 _pid, uint256 _amount, bool _stake ) external returns (bool);
29,807
5
// contract [Integer / 1E10]
mapping(address => uint) public vSYMAssetCounterVaultE18; // vSYM deposited in inverse vault mapping(address => uint) public weiDebtCounterVault; // weiDebtCounterVault
mapping(address => uint) public vSYMAssetCounterVaultE18; // vSYM deposited in inverse vault mapping(address => uint) public weiDebtCounterVault; // weiDebtCounterVault
21,866
1
// Emitted on supply() reserve The address of the underlying asset of the reserve user The address initiating the supply onBehalfOf The beneficiary of the supply, receiving the xTokens amount The amount supplied referralCode The referral code used // Emitted on withdraw() reserve The address of the underlying asset bei...
function flashClaim( address receiverAddress, address nftAsset, uint256[] calldata nftTokenIds, bytes calldata params ) external;
function flashClaim( address receiverAddress, address nftAsset, uint256[] calldata nftTokenIds, bytes calldata params ) external;
11,566
57
// Mapping of edition id to descriptive data.
mapping(uint256 => Edition) public editions;
mapping(uint256 => Edition) public editions;
5,057
8
// See {ERC721-_burn}Increases value of _burnCounter /
function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); unchecked { _burnCounter++; }
function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); unchecked { _burnCounter++; }
13,511
28
// Setter for the address of the rewards recipient /
function setRewardRecipient(address _recipient) external { require(hasRole(ADMIN_ROLE, msg.sender), "ERR_CALLER"); rewardsRecipient = _recipient; emit RewardsRecipientUpdated(_recipient); }
function setRewardRecipient(address _recipient) external { require(hasRole(ADMIN_ROLE, msg.sender), "ERR_CALLER"); rewardsRecipient = _recipient; emit RewardsRecipientUpdated(_recipient); }
25,335
184
// The foundation address
address public foundation;
address public foundation;
22,250
65
// IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0xD99D1c33F9fC3444f8101754aBC46c52416550D1);BSC
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Ropsten/ETH
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Ropsten/ETH
36,615
49
// @custom:oc-access-control Owner
function transferOwnership(address newOwner) external;
function transferOwnership(address newOwner) external;
17,243
132
// dispatch price data update for the smart token/connector
emit PriceDataUpdate(_connectorToken, token.totalSupply(), getConnectorBalance(_connectorToken), connector.weight); return amount;
emit PriceDataUpdate(_connectorToken, token.totalSupply(), getConnectorBalance(_connectorToken), connector.weight); return amount;
4,718
205
// Decrement length of byte array.
let newLen := sub(mload(b), 1) mstore(b, newLen)
let newLen := sub(mload(b), 1) mstore(b, newLen)
18,017
17
// slither-disable-next-line divide-before-multiply
collateral_ = (collateral_ / Maths.WAD) * Maths.WAD; // use collateral floor return Maths.wmul(collateral_, price_) >= debt_;
collateral_ = (collateral_ / Maths.WAD) * Maths.WAD; // use collateral floor return Maths.wmul(collateral_, price_) >= debt_;
39,945
72
// See {IERC721-safeTransferFrom}. /
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
29,206
169
// Disable investment in specified assets/ofAssets Array of assets to disable investment in
function disableInvestment(address[] ofAssets) external pre_cond(isOwner())
function disableInvestment(address[] ofAssets) external pre_cond(isOwner())
73,992
195
// Calculate elapsed blocks between `_from` and `_to`. _from The starting block. _to The ending block. /
function duration( uint256 _from, uint256 _to
function duration( uint256 _from, uint256 _to
33,230
25
// Get the maximum value of a token that an operator is allowed to manage. _tokenId The token for which to query the allowance _operator The address of an operatorreturn The current approval value of `_tokenId` that `_operator` is allowed to manage /
function allowance(uint256 _tokenId, address _operator) external view returns (uint256);
function allowance(uint256 _tokenId, address _operator) external view returns (uint256);
43,162
12
// Admin errors/Royalty percentage too high
error Setup_RoyaltyPercentageTooHigh(uint16 maxRoyaltyBPS);
error Setup_RoyaltyPercentageTooHigh(uint16 maxRoyaltyBPS);
269
6
// get any return value
returndatacopy(0, 0, returndatasize())
returndatacopy(0, 0, returndatasize())
12,376
209
// Enables borrowing on a reserve asset The address of the underlying asset of the reserve stableBorrowRateEnabled True if stable borrow rate needs to be enabled by default on this reserve /
{ DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setBorrowingEnabled(true); currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled); pool.setConfiguration(asset, currentConfig.data); emit BorrowingEnabledOnReserve(asset, stableB...
{ DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setBorrowingEnabled(true); currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled); pool.setConfiguration(asset, currentConfig.data); emit BorrowingEnabledOnReserve(asset, stableB...
21,690
0
// The interface of role management/["Rivtower Technologies <contact@rivtower.com>"]
interface IRoleManagement { function newRole(bytes32 _name, address[] _permissions) external returns (address); function deleteRole(address _role) external returns (bool); function updateRoleName(address _role, bytes32 _name) external returns (bool); function addPermissions(address _role, address[] _...
interface IRoleManagement { function newRole(bytes32 _name, address[] _permissions) external returns (address); function deleteRole(address _role) external returns (bool); function updateRoleName(address _role, bytes32 _name) external returns (bool); function addPermissions(address _role, address[] _...
49,362
44
// Harvest funds in the strategy's pool /
function harvest( uint256[] calldata _estimates ) external override onlyController
function harvest( uint256[] calldata _estimates ) external override onlyController
60,174
5
// Approve transfer on the ERC20 contract
IERC20(_erc20Contract).safeIncreaseAllowance( cToken, _numTokensToSupply );
IERC20(_erc20Contract).safeIncreaseAllowance( cToken, _numTokensToSupply );
21,627
123
// Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account amount The number of tokens to transferreturn Whether or not the transfer succeeded /
function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) { return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR); }
function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) { return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR); }
3,347
174
// Private function to remove a token from this extension's token tracking data structures.This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint256 ID of the token to be removed from the tokens list /
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tok...
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tok...
3,667
27
// Creates `amount` tokens and assigns them to `account`, increasingthe total supply. Emits a `Transfer` event with `from` set to the zero address. Requirements - `to` cannot be the zero address. /
function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
9,933
22
// 3.1 Remove liquidity 2 sides
uint amtLPToRemove = IERC20(lp).balanceOf(address(this)).sub(amt.amtLPWithdraw); if (amtLPToRemove > 0) { uint[] memory minAmountsOut = new uint[](2); IBalancerPool(lp).exitPool(amtLPToRemove, minAmountsOut); }
uint amtLPToRemove = IERC20(lp).balanceOf(address(this)).sub(amt.amtLPWithdraw); if (amtLPToRemove > 0) { uint[] memory minAmountsOut = new uint[](2); IBalancerPool(lp).exitPool(amtLPToRemove, minAmountsOut); }
16,460
96
// withdraws all of your earnings.-functionhash- 0x3ccfd60b /
function withdraw() isActivated() isHuman() public
function withdraw() isActivated() isHuman() public
15,791
310
// now we see if we want to add or remove balance if the desired borrow is less than our current borrow we are in deficit. so we want to reduce position
if (desiredBorrow < borrows) { deficit = true; position = borrows - desiredBorrow; //safemath check done in if statement } else {
if (desiredBorrow < borrows) { deficit = true; position = borrows - desiredBorrow; //safemath check done in if statement } else {
38,180
113
// We are exposing these functions to be able to manual swap and send in case the token is highly valued and 5M becomes too much
function manualSwap() external onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); }
function manualSwap() external onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); }
26,921
44
// To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one in the array, and then remove the last entry (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1;
uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1;
1,712
8
// ERC-20 standard token interface, as defined /
contract Token { function totalSupply() constant returns (uint256 supply); function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, address _to, uint256 _value) returns (bool suc...
contract Token { function totalSupply() constant returns (uint256 supply); function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, address _to, uint256 _value) returns (bool suc...
18,355
125
// _nexusAddress of the Nexus _lp Address of LP _platformAddressGeneric platform address _rewardTokenReward token, if any /
constructor( address _nexus, address _lp, address _platformAddress, address _rewardToken
constructor( address _nexus, address _lp, address _platformAddress, address _rewardToken
28,150
3
// constants
uint256 private constant precision = 10**24; uint256 public constant minLockTimeMultiplier = 10**6; address private constant burnAddress = 0x000000000000000000000000000000000000dEaD; address public constant token = 0x1E8E29CA51363D923725aB9DaC73Bd7e9C440f71;
uint256 private constant precision = 10**24; uint256 public constant minLockTimeMultiplier = 10**6; address private constant burnAddress = 0x000000000000000000000000000000000000dEaD; address public constant token = 0x1E8E29CA51363D923725aB9DaC73Bd7e9C440f71;
8,037
12
// _gauge 向proxy 转账
function deposit(address _gauge, address _token) external { require(strategies[msg.sender], "!strategy"); uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(address(proxy), _balance); _balance = IERC20(_token).balanceOf(address(proxy)); p...
function deposit(address _gauge, address _token) external { require(strategies[msg.sender], "!strategy"); uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(address(proxy), _balance); _balance = IERC20(_token).balanceOf(address(proxy)); p...
11,093
2
// the new contract must have the same ABI and you must have the power to change it again
require(IControllable(address(this)).isController(msg.sender), "wrong impl");
require(IControllable(address(this)).isController(msg.sender), "wrong impl");
31,836
26
// Send coins and call receiveTransfer/
function transferAndCall(address _to, uint256 _value, bytes _extraData) public returns (bool success) { if(transfer(_to, _value)) { transferRecipient(_to).receiveTransfer(msg.sender, _value, _extraData); return true; } }
function transferAndCall(address _to, uint256 _value, bytes _extraData) public returns (bool success) { if(transfer(_to, _value)) { transferRecipient(_to).receiveTransfer(msg.sender, _value, _extraData); return true; } }
3,843
24
// !SPDX-License-Identifier: MIT License /
contract EtherChainCo is Ownable, Pausable { struct User { uint256 cycle; address upline; uint256 referrals; uint256 payouts; uint256 direct_bonus; uint256 pool_bonus; uint256 match_bonus; uint256 deposit_amount; uint256 deposit_payouts; ...
contract EtherChainCo is Ownable, Pausable { struct User { uint256 cycle; address upline; uint256 referrals; uint256 payouts; uint256 direct_bonus; uint256 pool_bonus; uint256 match_bonus; uint256 deposit_amount; uint256 deposit_payouts; ...
27,153
229
// Exclude/Include account from fees (eg. CEX)
function TeamExcludeAccountFromFees(address account) public onlyTeam { _excluded.add(account); }
function TeamExcludeAccountFromFees(address account) public onlyTeam { _excluded.add(account); }
38,406
2
// Interface for the proxy contract which allows strategies to/ make calls to the Curve DAO through the common CurveYCRVVoter./This is an interface with just a few function signatures of the proxy./For more info and function description please see:/- https:github.com/yearn/yearn-protocol/blob/develop/contracts/strategi...
interface IStrategyProxy { function balanceOf(address gauge) external view returns (uint256); function deposit(address gauge, address token) external; function withdraw( address gauge, address token, uint256 amount ) external returns (uint256); function withdrawAll(address...
interface IStrategyProxy { function balanceOf(address gauge) external view returns (uint256); function deposit(address gauge, address token) external; function withdraw( address gauge, address token, uint256 amount ) external returns (uint256); function withdrawAll(address...
16,322
600
// Calculate and validate availabilities of orders and fill them/_leftOrderHash bytes32/_leftOrder SwaprateOrder/_rightOrderHash bytes32/_rightOrder SwaprateOrder/ return fillable uint256
function _checkFillability(bytes32 _leftOrderHash, SwaprateOrder memory _leftOrder, bytes32 _rightOrderHash, SwaprateOrder memory _rightOrder) private returns (uint256 fillable) { // Calculate availabilities of orders uint256 leftAvailable = _leftOrder.quantity.sub(filled[_leftOrderHash]); u...
function _checkFillability(bytes32 _leftOrderHash, SwaprateOrder memory _leftOrder, bytes32 _rightOrderHash, SwaprateOrder memory _rightOrder) private returns (uint256 fillable) { // Calculate availabilities of orders uint256 leftAvailable = _leftOrder.quantity.sub(filled[_leftOrderHash]); u...
34,565
7
// Setup default state
questFactoryContract = IQuestFactory(payable(msg.sender));
questFactoryContract = IQuestFactory(payable(msg.sender));
34,932
55
// we don't need to checkTicks here, because invalid positions will never have non-zero tokensOwed{0,1}
Position.Info storage position = positions.get(msg.sender, tickLower, tickUpper); amount0 = amount0Requested > position.tokensOwed0 ? position.tokensOwed0 : amount0Requested; amount1 = amount1Requested > position.tokensOwed1 ? position.tokensOwed1 : amount1Requested; if (amount0 > 0) {...
Position.Info storage position = positions.get(msg.sender, tickLower, tickUpper); amount0 = amount0Requested > position.tokensOwed0 ? position.tokensOwed0 : amount0Requested; amount1 = amount1Requested > position.tokensOwed1 ? position.tokensOwed1 : amount1Requested; if (amount0 > 0) {...
27,251
118
// Check how many tokens used for given address members Current members struct account Address you want to checkreturn uint256 Member used tokens /
function usedTokensOf(Members storage members, address account) internal view returns (uint256) { Member storage member = members.list[members.addressMap[account]]; return member.usedTokens; }
function usedTokensOf(Members storage members, address account) internal view returns (uint256) { Member storage member = members.list[members.addressMap[account]]; return member.usedTokens; }
10,796
66
// Admin is able to change owner/_owner Address of new owner
function setOwnerByAdmin(address _owner) public { require(msg.sender == admin); owner = _owner; }
function setOwnerByAdmin(address _owner) public { require(msg.sender == admin); owner = _owner; }
33,476
238
// Approve 1inch v3 for swaps /
function approveOneInch(IERC20 token0, IERC20 token1) public { token0.safeApprove(oneInchExchange, type(uint256).max); token1.safeApprove(oneInchExchange, type(uint256).max); }
function approveOneInch(IERC20 token0, IERC20 token1) public { token0.safeApprove(oneInchExchange, type(uint256).max); token1.safeApprove(oneInchExchange, type(uint256).max); }
81,828
12
// Change the votes distribution
userVotesDistribution[msg.sender][candidate] += msg.value;
userVotesDistribution[msg.sender][candidate] += msg.value;
39,023
29
// Get token URI
function uri(uint256 tokenId) public view virtual override(ERC1155URIStorageUpgradeable, ERC1155Upgradeable) returns (string memory) { return super.uri(tokenId); }
function uri(uint256 tokenId) public view virtual override(ERC1155URIStorageUpgradeable, ERC1155Upgradeable) returns (string memory) { return super.uri(tokenId); }
24,188
23
// Wipe (Not Necessary)
senderBox.countErc20 = 0; prtnerBox.countErc20 = 0; senderBox.countErc721 = 0; prtnerBox.countErc721 = 0; emit BoxCountModifiedERC20(msg.sender, _tradePartner, _boxNum, 0, senderBox.nonce); emit BoxCountModifiedERC20(_tradePartner, msg.sender, _boxNum, 0, prtnerBox.nonce); emit BoxCoun...
senderBox.countErc20 = 0; prtnerBox.countErc20 = 0; senderBox.countErc721 = 0; prtnerBox.countErc721 = 0; emit BoxCountModifiedERC20(msg.sender, _tradePartner, _boxNum, 0, senderBox.nonce); emit BoxCountModifiedERC20(_tradePartner, msg.sender, _boxNum, 0, prtnerBox.nonce); emit BoxCoun...
42,652
11
// Contract module which allows children to implement an emergency stopmechanism that can be triggered by an authorized account. This is a stripped down version of Open zeppelin's Pausable contract./
contract PausableUpgradeable is Initializable{ /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev...
contract PausableUpgradeable is Initializable{ /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev...
28,770
3
// Mint the amount of provided Pets.
for (uint i = 0; i < numberOfPets; i++) { _safeMint(msg.sender, supply + i); }
for (uint i = 0; i < numberOfPets; i++) { _safeMint(msg.sender, supply + i); }
48,689
570
// check is user is whitelisted
function isWhitelisted(address _address) public view returns(bool) { return whitelist[_address]; }
function isWhitelisted(address _address) public view returns(bool) { return whitelist[_address]; }
59,009
8
// Mint and deposit `amount` $ARC tokens to message senderThrows on the following restriction errors:Caller is not Arcade Swap contractMint exceeds MAX_SUPPLY_amount The amount of tokens to be minted /
function mintArcade(uint256 _amount) public isArcadeSwapContract { require( totalSupply() + _amount <= MAX_SUPPLY, "Amount to mint will exceed total supply" ); _mint(ArcadeSwapContractAddress, _amount); ERC20(this).increaseAllowance(ArcadeSwapContractAddress,...
function mintArcade(uint256 _amount) public isArcadeSwapContract { require( totalSupply() + _amount <= MAX_SUPPLY, "Amount to mint will exceed total supply" ); _mint(ArcadeSwapContractAddress, _amount); ERC20(this).increaseAllowance(ArcadeSwapContractAddress,...
11,159
11
// ATTRIBUTES /
) public view virtual returns (bool) { return attributes[account].has(_attribute); }
) public view virtual returns (bool) { return attributes[account].has(_attribute); }
16,599
2
// insert new vars here at the end to keep the storage layout the same
/*////////////////////////////////////////////////////////////// CONSTRUCTOR
/*////////////////////////////////////////////////////////////// CONSTRUCTOR
18,001