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
12
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
42,068
20
// These requires are not strictly necessary, our calling code should make sure that these conditions are never broken. However! _createKitty() is already an expensive call (for storage), and it doesn't hurt to be especially careful to ensure our data structures are always valid.
require(_matronId == uint256(uint32(_matronId))); require(_sireId == uint256(uint32(_sireId))); require(_generation == uint256(uint16(_generation))); Kitty memory _kitty = Kitty({ genes: _genes, birthTime: uint64(_birthTime), cooldownEndBlock: uint64(...
require(_matronId == uint256(uint32(_matronId))); require(_sireId == uint256(uint32(_sireId))); require(_generation == uint256(uint16(_generation))); Kitty memory _kitty = Kitty({ genes: _genes, birthTime: uint64(_birthTime), cooldownEndBlock: uint64(...
3,979
7
// TODO: Add comment /
function burn(uint256 burnQuantity) external returns (bool);
function burn(uint256 burnQuantity) external returns (bool);
6,925
250
// allocate tokens to early investor or team member in a batch beneficiary - users who gets tokens allocated amount - amounts of tokens being allocated notStaked - flags if user is eligible for vesting rewards/
function allocateUserMultiple(address[] memory beneficiary, uint256[] memory amount, bool[] memory notStaked) public isAdmin() { uint256 length = beneficiary.length; require(length <= 346, "Vesting-allocateUserMultiple: List too long"); for (uint256 i = 0; i < length; i++) { a...
function allocateUserMultiple(address[] memory beneficiary, uint256[] memory amount, bool[] memory notStaked) public isAdmin() { uint256 length = beneficiary.length; require(length <= 346, "Vesting-allocateUserMultiple: List too long"); for (uint256 i = 0; i < length; i++) { a...
28,756
72
// Unique Merchant identifier hash
bytes32 public merchantIdHash;
bytes32 public merchantIdHash;
24,949
285
// BoredBaldmanYachtClub contract Extends ERC721 Non-Fungible Token Standard basic implementation /
contract Baldmanoilclub is ERC721, Ownable { using SafeMath for uint256; string public BMOC_PROVENANCE = ""; uint256 public startingIndexBlock; uint256 public startingIndex; uint256 public BaldmanPrice = 80000000000000000; //0.08 ETH uint public constant maxPurchase = 20; uint256 publi...
contract Baldmanoilclub is ERC721, Ownable { using SafeMath for uint256; string public BMOC_PROVENANCE = ""; uint256 public startingIndexBlock; uint256 public startingIndex; uint256 public BaldmanPrice = 80000000000000000; //0.08 ETH uint public constant maxPurchase = 20; uint256 publi...
7,380
166
// Updates the withdrawal penalty/_penalty - the amount of the new penalty (in BIPS)
function setWithdrawalPenalty(uint256 _penalty) external onlyOwner { require(_penalty <= MAX_WITHDRAWAL_PENALTY); withdrawalPenalty = _penalty; emit WithdrawalPenaltyUpdated(_penalty); }
function setWithdrawalPenalty(uint256 _penalty) external onlyOwner { require(_penalty <= MAX_WITHDRAWAL_PENALTY); withdrawalPenalty = _penalty; emit WithdrawalPenaltyUpdated(_penalty); }
10,384
305
// Use to add the new default restriction for all token holder _allowedTokens Amount of tokens allowed to be traded for all token holder. _startTime Unix timestamp at which restriction get into effect _rollingPeriodInDays Rolling period in days (Minimum value should be 1 day) _endTime Unix timestamp at which restrictio...
function addDefaultRestriction( uint256 _allowedTokens, uint256 _startTime, uint256 _rollingPeriodInDays, uint256 _endTime, RestrictionType _restrictionType ) external withPerm(ADMIN)
function addDefaultRestriction( uint256 _allowedTokens, uint256 _startTime, uint256 _rollingPeriodInDays, uint256 _endTime, RestrictionType _restrictionType ) external withPerm(ADMIN)
33,404
0
// Authorities
address public authority;
address public authority;
42,564
6
// (pID => data) player data
mapping (uint256 => Player) public plyr_;
mapping (uint256 => Player) public plyr_;
59,313
83
// Internal function to update funds for jackpot and dividends weiAmount eth amount in wei /
function _addWeiAmount(uint256 weiAmount) internal
function _addWeiAmount(uint256 weiAmount) internal
72,748
6
// produces new instance with defined name and symbol _info The new instance's inforeturn The new instance's address /
function produce( InstanceInfo memory _info
function produce( InstanceInfo memory _info
30,157
128
// disallow previous dex
if (dex[_i] != address(0)) { reward.safeApprove(dex[_i], 0); }
if (dex[_i] != address(0)) { reward.safeApprove(dex[_i], 0); }
4,753
43
// /
function setListing(uint256 ticketId, uint256 sellingPrice_) public checkSellingPrice(ticketId, sellingPrice_) checkTicketIsOwner(ticketId, _msgSender()) checkTicketNotOnSale(ticketId)
function setListing(uint256 ticketId, uint256 sellingPrice_) public checkSellingPrice(ticketId, sellingPrice_) checkTicketIsOwner(ticketId, _msgSender()) checkTicketNotOnSale(ticketId)
6,036
2
// concatenate six-digit number
function createNum() public { for(uint256 x = 0; x < 9; x++) { digits(x); } }
function createNum() public { for(uint256 x = 0; x < 9; x++) { digits(x); } }
44,703
96
// Emit VotingRightsDelegation
emit VotingRightsDelegation(msg.sender, delegate, amount);
emit VotingRightsDelegation(msg.sender, delegate, amount);
51,451
168
// info stored for each user's position
struct Info { // the amount of liquidity owned by this position uint128 liquidity; // fee growth per unit of liquidity as of the last update to liquidity or fees owed uint256 feeGrowthInside0LastX128; uint256 feeGrowthInside1LastX128; // the fees owed to the position ...
struct Info { // the amount of liquidity owned by this position uint128 liquidity; // fee growth per unit of liquidity as of the last update to liquidity or fees owed uint256 feeGrowthInside0LastX128; uint256 feeGrowthInside1LastX128; // the fees owed to the position ...
76,265
278
// we're done - return the value from the last element
return _h[_h.length - 1].v;
return _h[_h.length - 1].v;
50,174
42
// ---------------------------------------------------------------------------- DreamFrames Crowdsale Contract - Purchase FrameRush Tokens with ETH
// Deployed to : {TBA} // // Enjoy. // // (c) BokkyPooBah / Bok Consulting Pty Ltd for GazeCoin 2018. The MIT Licence. // (c) Adrian Guerrera / Deepyr Pty Ltd for Dreamframes 2019. The MIT Licence. // ---------------------------------------------------------------------------- import "../Shared/Operated.sol"; import "...
// Deployed to : {TBA} // // Enjoy. // // (c) BokkyPooBah / Bok Consulting Pty Ltd for GazeCoin 2018. The MIT Licence. // (c) Adrian Guerrera / Deepyr Pty Ltd for Dreamframes 2019. The MIT Licence. // ---------------------------------------------------------------------------- import "../Shared/Operated.sol"; import "...
32,842
102
// Operator mints basis bonds to a recipient recipient_ The address of recipient amount_ The amount of basis bonds to mint toreturn whether the process has been done /
function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) { uint256 balanceBefore = balanceOf(recipient_); _mint(recipient_, amount_); uint256 balanceAfter = balanceOf(recipient_); return balanceAfter > balanceBefore;
function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) { uint256 balanceBefore = balanceOf(recipient_); _mint(recipient_, amount_); uint256 balanceAfter = balanceOf(recipient_); return balanceAfter > balanceBefore;
11,731
18
// Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
4,564
127
// Migration timestamp of this pool, zero means not set Migration timestamp can only be set with a grace period at least 3 days, and the `migrationDestination` pool address must be also set when setting migration timestamp, users can use this grace period to verify the `migrationDestination` pool code
uint256 _migrationTimestamp;
uint256 _migrationTimestamp;
59,738
132
// Add to liquidity pool
if (_autoSwapAndLiquifyEnabled) {
if (_autoSwapAndLiquifyEnabled) {
20,775
18
// send borrow rate in 4 decimals from UI. In the smart contract it'll convert to 27 decimals which where is 100%
uint128 maxBorrowRate; // maximum borrow rate above this leveraging should not happen
uint128 maxBorrowRate; // maximum borrow rate above this leveraging should not happen
57,388
3
// error about that the set time is less than the delay
error MinDelay();
error MinDelay();
36,034
315
// The encoded chain's ID of Band.
bytes public encodedChainID;
bytes public encodedChainID;
28,402
16
// Storage slot with the address of the current implementation.This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and isvalidated in the constructor. /
bytes32 internal constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
bytes32 internal constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
17,184
3
// Move tokens to controller where money will be protected with time lock/_token Token address/amount Token amount
function withdrawToController(address _token, uint256 amount) external override onlyController { uint256 tokenBalance = IERC20(_token).balanceOf(address(this)); require(tokenBalance >= amount, "not enough balance"); IERC20(_token).safeTransfer(_controller(), amount); emit TokenWithdrawn(_token, amount...
function withdrawToController(address _token, uint256 amount) external override onlyController { uint256 tokenBalance = IERC20(_token).balanceOf(address(this)); require(tokenBalance >= amount, "not enough balance"); IERC20(_token).safeTransfer(_controller(), amount); emit TokenWithdrawn(_token, amount...
8,051
13
// Function modifier to require caller to be contract deployer /
modifier onlyOwner() { require(isOwner(msg.sender), "!Owner"); _; }
modifier onlyOwner() { require(isOwner(msg.sender), "!Owner"); _; }
4,509
27
// set initial virtual allocation of token0 and token1/init0_ initial virtual allocation of token 0./init1_ initial virtual allocation of token 1./only callable by restrictedMint or by owner if restrictedMint is unset.
function setInits(uint256 init0_, uint256 init1_) external { require(init0_ > 0 || init1_ > 0, "I"); require(totalSupply() == 0, "TS"); address requiredCaller = restrictedMint == address(0) ? owner() : restrictedMint; require(msg.sender == requiredCaller, "R")...
function setInits(uint256 init0_, uint256 init1_) external { require(init0_ > 0 || init1_ > 0, "I"); require(totalSupply() == 0, "TS"); address requiredCaller = restrictedMint == address(0) ? owner() : restrictedMint; require(msg.sender == requiredCaller, "R")...
24,783
25
// Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow...
uint256 private minimumDiffSellBuyTime = 2 minutes; uint256 private _totalSupply = 5000 ether; string private _name = "LIF4.finance"; string private _symbol = "LIF4"; uint8 private _decimals = 18; address private __owner; bool public beginning = true; bool private limitBuy = true;
uint256 private minimumDiffSellBuyTime = 2 minutes; uint256 private _totalSupply = 5000 ether; string private _name = "LIF4.finance"; string private _symbol = "LIF4"; uint8 private _decimals = 18; address private __owner; bool public beginning = true; bool private limitBuy = true;
17,421
117
// Initially set token address and admin wallet address
constructor(address _token, address _admin, address _rewardToken) { token = IERC20(_token); admin = IRBAC(_admin); rewardToken = IERC20(_rewardToken); }
constructor(address _token, address _admin, address _rewardToken) { token = IERC20(_token); admin = IRBAC(_admin); rewardToken = IERC20(_rewardToken); }
35,688
157
// Note:: Solidity is kind of terrible in that there is a limit to localvariables that can be put into the stack. The real pain is thatone can put structs, arrays, or mappings into memory but not basicdata types. Hence our payments array that stores these values.
uint256[4] memory payments;
uint256[4] memory payments;
57,508
35
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; }
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; }
26,425
14
// Update Constants
totalSold = totalSold.add(amount); collectedETH = collectedETH.add(msg.value);
totalSold = totalSold.add(amount); collectedETH = collectedETH.add(msg.value);
36,138
50
// Claims all unclaimed RGT allocated privately to `msg.sender`. /
function claimAllPrivateRgt() external { uint256 unclaimedRgt = getUnclaimedPrivateRgt(msg.sender); require(unclaimedRgt > 0, "Unclaimed RGT allocated privately not greater than 0."); _claimPrivateRgt(msg.sender, unclaimedRgt); }
function claimAllPrivateRgt() external { uint256 unclaimedRgt = getUnclaimedPrivateRgt(msg.sender); require(unclaimedRgt > 0, "Unclaimed RGT allocated privately not greater than 0."); _claimPrivateRgt(msg.sender, unclaimedRgt); }
42,105
49
// Calculate and send tokens to taker and relayer _orderIssuanceOrder object containing order params_fillQuantity Quantity of Set to be filled_requiredMakerTokenAmount Max amount of maker token available to fill orders_makerTokenUsed Amount of maker token used to fill order /
function settleAccounts( OrderLibrary.IssuanceOrder _order, uint _fillQuantity, uint _requiredMakerTokenAmount, uint _makerTokenUsed ) private
function settleAccounts( OrderLibrary.IssuanceOrder _order, uint _fillQuantity, uint _requiredMakerTokenAmount, uint _makerTokenUsed ) private
28,595
231
// Can not tranche bonds for 3 days from last execution of this function /
function trancheBonds() external override isActive endCoolTime { uint256 currentPriceE8 = ORACLE.latestPrice(); uint256 bondGroupId = _getSuitableBondGroup(currentPriceE8); if (bondGroupId == 0) { bondGroupId = _addSuitableBondGroup(currentPriceE8); } (uint256 am...
function trancheBonds() external override isActive endCoolTime { uint256 currentPriceE8 = ORACLE.latestPrice(); uint256 bondGroupId = _getSuitableBondGroup(currentPriceE8); if (bondGroupId == 0) { bondGroupId = _addSuitableBondGroup(currentPriceE8); } (uint256 am...
3,545
63
// Round bonuses
uint256 bonus1 = 10; uint256 bonus2 = 15; uint256 bonus3 = 20; uint256 bonus4 = 30;
uint256 bonus1 = 10; uint256 bonus2 = 15; uint256 bonus3 = 20; uint256 bonus4 = 30;
10,449
1
// compute the amount that must be sent to move the price to the profit-maximizing price
amountIn = leftSide.sub(rightSide);
amountIn = leftSide.sub(rightSide);
12,623
235
// Returns the keccak hash of the ABI-encoded StoredBlockInfo
function hashStoredBlockInfo(StoredBlockInfo memory _storedBlockInfo) internal pure returns (bytes32) { return keccak256(abi.encode(_storedBlockInfo)); }
function hashStoredBlockInfo(StoredBlockInfo memory _storedBlockInfo) internal pure returns (bytes32) { return keccak256(abi.encode(_storedBlockInfo)); }
78,431
45
// Address of manager
address public icoOwner;
address public icoOwner;
27,678
40
// Direct payout
if(users[msg.sender].payouts < max_payout && users[msg.sender].direct_bonus > 0) { uint256 direct_bonus = users[msg.sender].direct_bonus; if(users[msg.sender].payouts + direct_bonus > max_payout) { direct_bonus = max_payout - users[msg.sender].payouts; }
if(users[msg.sender].payouts < max_payout && users[msg.sender].direct_bonus > 0) { uint256 direct_bonus = users[msg.sender].direct_bonus; if(users[msg.sender].payouts + direct_bonus > max_payout) { direct_bonus = max_payout - users[msg.sender].payouts; }
46,170
9
// Returns the base URI for an image for a given member registry. registry_ The address of the member registry to get the base URI for.return A string representing the base URI for the registry. /
function getImageBaseURI( address registry_
function getImageBaseURI( address registry_
39,242
56
// Adds up to 30 referred investors. To be called one or more timesfor initial referred list loading. _referralCodes keccak-256 hashes of referral codes. _investors corresponding referred investors. /
function loadReferredInvestors(bytes32[] _referralCodes, address[] _investors) public onlyOwner
function loadReferredInvestors(bytes32[] _referralCodes, address[] _investors) public onlyOwner
25,755
30
// Emision del evento para la nueva atraccion
emit nueva_atraccion(_nombreAtraccion, _precio);
emit nueva_atraccion(_nombreAtraccion, _precio);
41,733
71
// automatically generates getters
uint public constant minInvesment = 10 finney; uint public constant maxBalance = 333e5 ether; address public advertisingAddress; address public adminsAddress; uint public investmentsNumber; uint public waveStartup;
uint public constant minInvesment = 10 finney; uint public constant maxBalance = 333e5 ether; address public advertisingAddress; address public adminsAddress; uint public investmentsNumber; uint public waveStartup;
40,433
280
// Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled/A fee amount can never be removed, so this value should be hard coded or cached in the calling context/fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee/ return The tick spacing
function feeAmountTickSpacing(uint24 fee) external view returns (int24);
function feeAmountTickSpacing(uint24 fee) external view returns (int24);
28,469
159
// Update a profiterole address//_profiterole profiterole address// return result code of an operation
function updateProfiterole(address _profiterole, uint _block) public returns (uint _code) { _code = _multisig(keccak256(_profiterole), _block); if (OK != _code) { return _code; } profiterole = _profiterole; return OK; }
function updateProfiterole(address _profiterole, uint _block) public returns (uint _code) { _code = _multisig(keccak256(_profiterole), _block); if (OK != _code) { return _code; } profiterole = _profiterole; return OK; }
2,751
19
// Swap half WETH for token0
uint256 _weth = IERC20(weth).balanceOf(address(this)); if (_weth > 0 && token0 != weth) { _swapSushiswap(weth, token0, _weth.div(2)); }
uint256 _weth = IERC20(weth).balanceOf(address(this)); if (_weth > 0 && token0 != weth) { _swapSushiswap(weth, token0, _weth.div(2)); }
41,398
59
// Returns if a blockchain is in the list of allowed blockchains to cross tokens using the bridge. Parameters: string name of blockchain Returns: boolean true if it is in the list/
function existsBlockchain(string memory name) public view override returns (bool)
function existsBlockchain(string memory name) public view override returns (bool)
50,107
61
// Two sides are fully funded.
shadowWinner = NO_SHADOW_WINNER; arbitrator.appeal.value(appealCost)(session.disputeID, arbitratorExtraData); session.rounds.length++; round.feeRewards = round.feeRewards.subCap(appealCost); reservedETH = reservedETH.subCap(appealCost);
shadowWinner = NO_SHADOW_WINNER; arbitrator.appeal.value(appealCost)(session.disputeID, arbitratorExtraData); session.rounds.length++; round.feeRewards = round.feeRewards.subCap(appealCost); reservedETH = reservedETH.subCap(appealCost);
10,398
21
// Get voters count
function getTotalVoter() public view returns (uint256) { // Returns total number of voters return voterCount; }
function getTotalVoter() public view returns (uint256) { // Returns total number of voters return voterCount; }
1,188
16
// Require that the Plebness attribute selector has not been locked. /
modifier whenPlebnessNotLocked() { require(!isPlebnessLocked, 'Plebness is locked'); _; }
modifier whenPlebnessNotLocked() { require(!isPlebnessLocked, 'Plebness is locked'); _; }
25,332
335
// Get exact ticks depending on Sorbetto's new balances
(tickLower, tickUpper) = pool.getPositionTicks(cache.amount0Desired, cache.amount1Desired, baseThreshold, tickSpacing); cache.liquidity = pool.liquidityForAmounts(cache.amount0Desired, cache.amount1Desired, tickLower, tickUpper);
(tickLower, tickUpper) = pool.getPositionTicks(cache.amount0Desired, cache.amount1Desired, baseThreshold, tickSpacing); cache.liquidity = pool.liquidityForAmounts(cache.amount0Desired, cache.amount1Desired, tickLower, tickUpper);
18,757
2
// Returns the pool for the given token pair and fee. The pool contract may or may not exist.
function getPool( address tokenA, address tokenB, uint24 fee ) private view returns (IYumyumSwapPool) { return IYumyumSwapPool(PoolAddress.computeAddress(factory, PoolAddress.getPoolKey(tokenA, tokenB, fee))); }
function getPool( address tokenA, address tokenB, uint24 fee ) private view returns (IYumyumSwapPool) { return IYumyumSwapPool(PoolAddress.computeAddress(factory, PoolAddress.getPoolKey(tokenA, tokenB, fee))); }
13,470
9
// The players' balances, so that at some point they can withdraw (and pay the gas for it)
mapping(address => uint) public balances; event LogGameCreated(string gameName, address playerAddress); event LogPlayerDeclares(string gameName, address playerAddress); event LogPlayerReveals(string gameName, address playerAddress, string move);
mapping(address => uint) public balances; event LogGameCreated(string gameName, address playerAddress); event LogPlayerDeclares(string gameName, address playerAddress); event LogPlayerReveals(string gameName, address playerAddress, string move);
13,337
144
// IMigratableVault Interface/Enzyme Council <[email protected]>/DO NOT EDIT CONTRACT
interface IMigratableVault { function canMigrate(address _who) external view returns (bool canMigrate_); function init( address _owner, address _accessor, string calldata _fundName ) external; function setAccessor(address _nextAccessor) external; function setVaultLib(addre...
interface IMigratableVault { function canMigrate(address _who) external view returns (bool canMigrate_); function init( address _owner, address _accessor, string calldata _fundName ) external; function setAccessor(address _nextAccessor) external; function setVaultLib(addre...
68,427
21
// Terminate the crowd proposal, send back staked UNI tokens
function terminate() external { require(msg.sender == author, 'CrowdProposal::terminate: only author can terminate'); require(!terminated, 'CrowdProposal::terminate: proposal has been already terminated'); terminated = true; ...
function terminate() external { require(msg.sender == author, 'CrowdProposal::terminate: only author can terminate'); require(!terminated, 'CrowdProposal::terminate: proposal has been already terminated'); terminated = true; ...
4,889
2
// To be raised inside withdrawFeesAndRewards function.localDisputeID The dispute id as in arbitrable contract.round Round code of the appeal. Starts from 0.ruling Indicates the ruling option which got the contribution.contributor Caller of fundAppeal function.reward Total amount of deposits reimbursed plus rewards. Th...
event Withdrawal(uint indexed localDisputeID, uint indexed round, uint ruling, address indexed contributor, uint reward);
event Withdrawal(uint indexed localDisputeID, uint indexed round, uint ruling, address indexed contributor, uint reward);
27,082
28
// vm.expectRevert(abi.encodeWithSignature("NotStorage(bytes4)", bytes4(keccak256("const()"))));
stdstore.target(address(test)).sig("const()").find();
stdstore.target(address(test)).sig("const()").find();
10,846
32
// Accept USDT
ERC20_USDT(USDTContract).transferFrom(_tokenOwner, address(this), allowanceUsdt);
ERC20_USDT(USDTContract).transferFrom(_tokenOwner, address(this), allowanceUsdt);
7,708
60
// Adjust lateness of Project before stage ✅
function adjustLatenessBeforeStage(uint256 _projectID) internal { ProjectManager.Project storage project = projects[_projectID]; uint256 lateness = 0; // If we are late to start stage by more than 15 minutes, add lateness to all tasks and nextmilestone if ( block.timesta...
function adjustLatenessBeforeStage(uint256 _projectID) internal { ProjectManager.Project storage project = projects[_projectID]; uint256 lateness = 0; // If we are late to start stage by more than 15 minutes, add lateness to all tasks and nextmilestone if ( block.timesta...
1,469
444
// function to initialize the contract
function __ERC721WithPermit_init(string memory name_) internal { DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( 'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)' ), keccak256(bytes(name_)...
function __ERC721WithPermit_init(string memory name_) internal { DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( 'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)' ), keccak256(bytes(name_)...
44,449
221
// Token contract checks are in the corresponding TokenNetwork contract
token_network = new TokenNetwork( _token_address, secret_registry_address, settlement_timeout_min, settlement_timeout_max, controller, _channel_participant_deposit_limit, _token_network_deposit_limit );
token_network = new TokenNetwork( _token_address, secret_registry_address, settlement_timeout_min, settlement_timeout_max, controller, _channel_participant_deposit_limit, _token_network_deposit_limit );
27,845
48
// check if lending entry has fees
uint256 _feesPercent = lentERC721List[tokenAddress][tokenId].platformFeesPercent; if (feesContractAddress != address(0) && _feesPercent > 0) {
uint256 _feesPercent = lentERC721List[tokenAddress][tokenId].platformFeesPercent; if (feesContractAddress != address(0) && _feesPercent > 0) {
19,617
6
// Emitted when the warmup period is changed/oldVal The old warmup period/newVal The new warmup period
event WarmupPeriodSet(uint48 oldVal, uint48 newVal);
event WarmupPeriodSet(uint48 oldVal, uint48 newVal);
31,200
4
// Buyer releases balance deposit to seller
function releaseBalanceToSeller() internal
function releaseBalanceToSeller() internal
40,728
9
// To save cashout date/amount so we can filter by date
struct SubPayment { // The amount of tokens the user cashed out uint256 amount; // The date the user performed this cash out uint256 date; }
struct SubPayment { // The amount of tokens the user cashed out uint256 amount; // The date the user performed this cash out uint256 date; }
17,082
62
// ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)and `uint256` (`UintSet`) are supported. [WARNING]====Trying to delete such a structure from storage will likely result in data corruption, rendering the structureunusable. In order to clean an EnumerableSet, you can either remove all e...
library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just...
library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just...
21,034
202
// If voter had previously voted, decrease count
if (state == VoterState.Yea) { vote_.yea = vote_.yea.sub(voterStake); } else if (state == VoterState.Nay) {
if (state == VoterState.Yea) { vote_.yea = vote_.yea.sub(voterStake); } else if (state == VoterState.Nay) {
46,383
163
// royaltyPayment
if (payments[1] > 0) { SendValueOrEscrow.sendValueOrEscrow(_royaltyPayee, payments[1]); }
if (payments[1] > 0) { SendValueOrEscrow.sendValueOrEscrow(_royaltyPayee, payments[1]); }
55,212
8
// Modifiers /
modifier isValidListingIndex(uint _index) { require (_index < listings.length); _; }
modifier isValidListingIndex(uint _index) { require (_index < listings.length); _; }
34,309
17
// 设置锁
function setLock() public returns (bool success) { require(msg.sender == owner, "not owner"); unLock = !unLock; success = true; }
function setLock() public returns (bool success) { require(msg.sender == owner, "not owner"); unLock = !unLock; success = true; }
31,202
23
// pragma solidity >0.4.13; /
contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint x, uint y) intern...
contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint x, uint y) intern...
49,701
42
// allow the trove to transfer from the liquidation pool
_troves[_token].liquidationPool.approveTrove(troveAddress);
_troves[_token].liquidationPool.approveTrove(troveAddress);
23,368
15
// ========== RESTRICTED FUNCTIONS ========== //Not for use in UI. Call once after reward tokens have been received by this contract correctly. This will start the reward duration. It is possible to stake LP tokens ahead of time./reward Quantity of reward to be added the amount that needs to be distributed. Should not ...
function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward / rewardsDuration; } else { uint256 remaining = periodFinish - block.timestamp; uint256 left...
function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward / rewardsDuration; } else { uint256 remaining = periodFinish - block.timestamp; uint256 left...
26,181
0
// slotAttestations[keccak256(blockNumber || addr || slot || slotValue)] = true if and only if it has been checked that:at block number `blockNumber`, the account storage of `addr` has value `slotValue` at slot `slot`
mapping(bytes32 => bool) public slotAttestations; event UpdateAxiomAddress(address newAddress); event UpdateSnarkVerifierAddress(address newAddress); constructor(address _axiomAddress, address _verifierAddress) { axiomAddress = _axiomAddress; verifierAddress = _verifierAddress; }
mapping(bytes32 => bool) public slotAttestations; event UpdateAxiomAddress(address newAddress); event UpdateSnarkVerifierAddress(address newAddress); constructor(address _axiomAddress, address _verifierAddress) { axiomAddress = _axiomAddress; verifierAddress = _verifierAddress; }
20,107
9
// increase exchange ether amount
function donate() public payable{ accumulated = accumulated.add(msg.value); }
function donate() public payable{ accumulated = accumulated.add(msg.value); }
9,703
161
// Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. startTokenId - the first token id to be transferredquantity - the amount to be transferred Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will betransferred to `to`.-...
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity
45,421
68
// Returns the tokens and amounts underlying `_user` SHERX balance/_user Account whose underlying SHERX tokens should be queried/ return tokens Array of ERC-20 tokens representing the underlying/ return amounts Corresponding amounts of the underlying tokens
function calcUnderlying(address _user) external view returns (IERC20[] memory tokens, uint256[] memory amounts);
function calcUnderlying(address _user) external view returns (IERC20[] memory tokens, uint256[] memory amounts);
47,911
15
// Opens short position (for example, swap USDC to ETH, open credit account in ETH, then swap all ETH to USDC)/curvePool Curve pool address/i Index value for the coin to send/j Index value of the coin to receive/amountIn Amount in, if you send ETH as value- it would be taken from msg.value/amountOutMin Minimal amount a...
function openShortCurve( address curvePool, int128 i, int128 j, uint256 amountIn, uint256 amountOutMin, LongParameters calldata longParams, uint256 referralCode
function openShortCurve( address curvePool, int128 i, int128 j, uint256 amountIn, uint256 amountOutMin, LongParameters calldata longParams, uint256 referralCode
28,626
254
// The fee is expressed as a percentage. E.g. a value of 40 stands for a 40% fee, so the recipient will be charged for 1.4 times the spent amount.
return (gas * gasPrice * (100 + fee)) / 100;
return (gas * gasPrice * (100 + fee)) / 100;
37,594
20
// Don't push/pop this all the time, we have just enough space on stack.
let mask := 0
let mask := 0
16,317
68
// Token contract instance
AMOCoin public token;
AMOCoin public token;
29,231
34
// slither-disable-next-line incorrect-equality
if (sToken.stakePool == 1) {
if (sToken.stakePool == 1) {
24,667
31
// Used if an aggregator contract has been proposed. _roundId the round ID to retrieve the round data forreturn roundId is the round ID for which data was retrievedreturn answer is the answer for the given roundreturn startedAt is the timestamp when the round was started.(Only some AggregatorV3Interface implementations...
function proposedGetRoundData(uint80 _roundId) public view virtual hasProposal() returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function proposedGetRoundData(uint80 _roundId) public view virtual hasProposal() returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
8,927
16
// get faces, verts and colors
vars = makeFacesVertsCols( tokenHash, tris, geomVars, colScheme, objPosition );
vars = makeFacesVertsCols( tokenHash, tris, geomVars, colScheme, objPosition );
31,081
40
// Allows users to wrap any amount of any ERC-20 token with a 1:1 ratioof corresponding ERC-1155 tokens with native metaTransaction methods. EachERC-20 is assigned an ERC-1155 id for more efficient CALLDATA usage whendoing transfers. /
contract MetaERC20Wrapper is ERC1155Meta, ERC1155MintBurn { // Variables uint256 internal nTokens = 1; // Number of ERC-20 tokens registered uint256 constant internal ETH_ID = 0x1; // ID fo tokens representing Ether is 1 address constant internal ETH_ADDRESS = address(0x1)...
contract MetaERC20Wrapper is ERC1155Meta, ERC1155MintBurn { // Variables uint256 internal nTokens = 1; // Number of ERC-20 tokens registered uint256 constant internal ETH_ID = 0x1; // ID fo tokens representing Ether is 1 address constant internal ETH_ADDRESS = address(0x1)...
4,995
97
// The cap of this presale contract in wei // Server holds the private key to this address to decide if the AML payload is valid or not. // A new server-side signer key was set to be effective // An user made a prepurchase through KYC'ed interface. The money has been moved to the token sale multisig wallet. The buyer w...
function KYCPresale(address _multisigWallet, uint _start, uint _end, uint _saleWeiCap) CrowdsaleBase(FractionalERC20(address(1)), PricingStrategy(address(0)), _multisigWallet, _start, _end, 0) { saleWeiCap = _saleWeiCap; }
function KYCPresale(address _multisigWallet, uint _start, uint _end, uint _saleWeiCap) CrowdsaleBase(FractionalERC20(address(1)), PricingStrategy(address(0)), _multisigWallet, _start, _end, 0) { saleWeiCap = _saleWeiCap; }
35,821
8
// check if a pool with this gauge already exists
bool gaugeExists = IPools(pools).gaugeMap(_gauge); require(!gaugeExists, "already registered gauge");
bool gaugeExists = IPools(pools).gaugeMap(_gauge); require(!gaugeExists, "already registered gauge");
15,900
9
// Info: current game
bool public gameActive; Coordinates public devCoordinates; uint256 private currentGameNumber = 0; mapping(uint256 => mapping(address => address[])) public rewardsUsage; uint256 public accumulatedTokens;
bool public gameActive; Coordinates public devCoordinates; uint256 private currentGameNumber = 0; mapping(uint256 => mapping(address => address[])) public rewardsUsage; uint256 public accumulatedTokens;
26,522
50
// Constructor; must supply bankroll address
constructor(address BankrollAddress) public
constructor(address BankrollAddress) public
69,956
315
// solhint-disable not-rely-on-time
_reportResult(_queryId, block.timestamp, _drTxHash, _cborBytes);
_reportResult(_queryId, block.timestamp, _drTxHash, _cborBytes);
22,495
49
// Updates reward variables `lastRewardedTimestampHour`, `accumulatedRewardsPerShare` and `lastRewardsRangeIndex`for a given pool. _poolId Available pool values 0-3 /
function updatePool(uint256 _poolId) public { Pool storage pool = pools[_poolId]; if (block.timestamp < pool.timeRanges[0].startTimestampHour) return; if (block.timestamp <= pool.lastRewardedTimestampHour + SECONDS_PER_HOUR) return; uint48 lastTimestampHour = pool.timeRanges[pool.t...
function updatePool(uint256 _poolId) public { Pool storage pool = pools[_poolId]; if (block.timestamp < pool.timeRanges[0].startTimestampHour) return; if (block.timestamp <= pool.lastRewardedTimestampHour + SECONDS_PER_HOUR) return; uint48 lastTimestampHour = pool.timeRanges[pool.t...
18,472
152
// `updateValueAtNow` used to update the `balances` map and the/`totalSupplyHistory`/checkpoints The history of data being updated/_value The new number of tokens
function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value
function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value
45,874
24
// swap calls are restricted only to HolyHand transfer proxy, which is set using this method
function setTransferProxy(address _transferProxyAddress) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Admin only"); transferProxyAddress = _transferProxyAddress; }
function setTransferProxy(address _transferProxyAddress) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Admin only"); transferProxyAddress = _transferProxyAddress; }
29,557
5
// Sets `reward rate`. Returns a boolean value indicating whether the operation succeeded. /
function setRewardRate(uint256 rewardRate) external returns (bool success);
function setRewardRate(uint256 rewardRate) external returns (bool success);
31,899
39
// pragma solidity 0.6.7; / computes square roots using the babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method
contract BabylonianMath { function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; }
contract BabylonianMath { function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; }
32,142
44
// Create an new Identity for the transaction sender./Sets the msg.sender as the only associatedAddress./recoveryAddress A recovery address to set for the new Identity./providers A list of providers to set for the new Identity./resolvers A list of resolvers to set for the new Identity./ return The EIN of the new Identi...
function createIdentity(address recoveryAddress, address[] memory providers, address[] memory resolvers) public returns (uint ein)
function createIdentity(address recoveryAddress, address[] memory providers, address[] memory resolvers) public returns (uint ein)
51,072