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
26
// Burn `_role` in `_app`, so no modification can be made to it (grant, revoke, permission manager)_app Address of the app in which the permission is being burned_role Identifier for the group of actions being burned/
function burnPermissionManager(address _app, bytes32 _role) external onlyPermissionManager(_app, _role)
function burnPermissionManager(address _app, bytes32 _role) external onlyPermissionManager(_app, _role)
16,330
84
// Returns true if the reentrancy guard is currently set to "entered", which indicates there is a`nonReentrant` function in the call stack. /
function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; }
function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; }
2,779
16
// Executes a given list of functions/_marketplaceCallData List of marketplace calldata
function executeFunctions( FunctionCallData[] memory _marketplaceCallData
function executeFunctions( FunctionCallData[] memory _marketplaceCallData
39,526
150
// Ok, if we're here and 'remainingToFulfill' isn't zero, then we need to refund the remainder of their ETH back to them.
if (remainingToFulfill > 0) { msg.sender.transfer( remainingToFulfill.divideDecimal( exchangeRates().rateForCurrency(ETH) ) ); }
if (remainingToFulfill > 0) { msg.sender.transfer( remainingToFulfill.divideDecimal( exchangeRates().rateForCurrency(ETH) ) ); }
15,381
217
// percentage > 0, data.tAmount > 0
assert (distributingAmount > 0); require( distributingAmount <= saleToken.balanceOf(address(this)), "Distribute: not enough token to distribute" );
assert (distributingAmount > 0); require( distributingAmount <= saleToken.balanceOf(address(this)), "Distribute: not enough token to distribute" );
12,303
64
// Fire the event
MintToken(msg.sender, _to, _amount);
MintToken(msg.sender, _to, _amount);
51,193
46
// burnable
event Burn(address indexed burner, uint256 value);
event Burn(address indexed burner, uint256 value);
21,952
342
// ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solhint-disable-next-line no-inline-assembly
assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) }
assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) }
12,988
33
// Get user's token, it'll revert if user doesn't hold the asset We're importing ERC721Holder, we don't need safeTransferFrom Convert token URI of token to uint256 array
string memory _tokenURI = _onlyTokenIdUri(tokenId); uint256 lucky = getLucky(tokenId); uint256 earn_tm = getLastEarnTm(tokenId); _burn(tokenId);
string memory _tokenURI = _onlyTokenIdUri(tokenId); uint256 lucky = getLucky(tokenId); uint256 earn_tm = getLastEarnTm(tokenId); _burn(tokenId);
9,282
3
// Array of addresses of price-feed contracts for fiat/fiat pairs: [0] - USD / USD priceFeed = '0x0000000000000000000000000000000000000000' !!! [1] - EUR / USD
address[2] fiatPriceFeedList = [ 0x0000000000000000000000000000000000000000, 0x0bf79F617988C472DcA68ff41eFe1338955b9A80 // EUR / USD (BSC Mainnet) ];
address[2] fiatPriceFeedList = [ 0x0000000000000000000000000000000000000000, 0x0bf79F617988C472DcA68ff41eFe1338955b9A80 // EUR / USD (BSC Mainnet) ];
3,807
144
// EVENTS
event StakeDeposited(address indexed account, uint256 amount); event WithdrawInitiated(address indexed account, uint256 amount, uint256 initiateDate); event WithdrawExecuted(address indexed account, uint256 amount, uint256 reward); event RewardsWithdrawn(address indexed account, uint256 reward); eve...
event StakeDeposited(address indexed account, uint256 amount); event WithdrawInitiated(address indexed account, uint256 amount, uint256 initiateDate); event WithdrawExecuted(address indexed account, uint256 amount, uint256 reward); event RewardsWithdrawn(address indexed account, uint256 reward); eve...
40,740
122
// when there are a lots of loans to be collected then/
uint totalLoanAmountCollected; uint totalCollateralToCollect; uint totalDefaultingFee; for (uint i = 0; i < loanIds.length; i++) { require(i < loans.length, "invalid loanId"); // next line would revert but require to emit reason LoanData storage loan = loans[loanI...
uint totalLoanAmountCollected; uint totalCollateralToCollect; uint totalDefaultingFee; for (uint i = 0; i < loanIds.length; i++) { require(i < loans.length, "invalid loanId"); // next line would revert but require to emit reason LoanData storage loan = loans[loanI...
4,557
85
// transfer tnxAmount (tokens) that had been approved by user (msg.sender) to the merchant(address(this))
erc20.transferFrom(msg.sender, merchantWalletAddress, tnxAmount); if (totalTnxFee > 0) {
erc20.transferFrom(msg.sender, merchantWalletAddress, tnxAmount); if (totalTnxFee > 0) {
23,123
38
// Note we do not check whether the keyHash is valid to save gas. The consequence for users is that they can send requests for invalid keyHashes which will simply not be fulfilled.
uint64 nonce = currentNonce + 1; (uint256 requestId, uint256 preSeed) = computeRequestId(keyHash, msg.sender, subId, nonce); s_requestCommitments[requestId] = keccak256( abi.encode(requestId, block.number, subId, callbackGasLimit, numWords, msg.sender) ); emit RandomWordsRequested( keyH...
uint64 nonce = currentNonce + 1; (uint256 requestId, uint256 preSeed) = computeRequestId(keyHash, msg.sender, subId, nonce); s_requestCommitments[requestId] = keccak256( abi.encode(requestId, block.number, subId, callbackGasLimit, numWords, msg.sender) ); emit RandomWordsRequested( keyH...
1,847
17
// update reveal strategy before starting index is set - only callable by owner/_revealStrategy new state of revealStrategy - possible values: (1: auto reveal) - (2: restricted manual reveal) - (3: unrestricted manual reveal)
function setRevealStrategy(uint256 _revealStrategy) external onlyOwner { if(startingIndex != 0) revert StartingIndexSet(); if(_revealStrategy < AUTO_REVEAL_STRATEGY || _revealStrategy > UNRESTRICTED_MANUAL_REVEAL_STRATEGY) revert InvalidParameter(); revealStrategy = _revealStrategy; ...
function setRevealStrategy(uint256 _revealStrategy) external onlyOwner { if(startingIndex != 0) revert StartingIndexSet(); if(_revealStrategy < AUTO_REVEAL_STRATEGY || _revealStrategy > UNRESTRICTED_MANUAL_REVEAL_STRATEGY) revert InvalidParameter(); revealStrategy = _revealStrategy; ...
9,415
90
// Remove investor from the whitelist /
function blacklistInvestor(address investor) public onlyKycProvider { require(investorWhitelist[investor] == true, "Investor not on whitelist"); investorWhitelist[investor] = false; uint256 arrayLen = investorWhitelistLUT.length; for (uint256 i = 0; i < arrayLen; i++) { if (investorWhitelistLUT[i] == invest...
function blacklistInvestor(address investor) public onlyKycProvider { require(investorWhitelist[investor] == true, "Investor not on whitelist"); investorWhitelist[investor] = false; uint256 arrayLen = investorWhitelistLUT.length; for (uint256 i = 0; i < arrayLen; i++) { if (investorWhitelistLUT[i] == invest...
34,355
47
// Allow user to sell CDRT tokens and destroy them. Can not be executed until 1539561600_qty amount to sell and destroy/
function execBuyBack(uint256 _qty) public{ require(now > 1539561600); uint256 toPay = _qty*buyBackPrice; require(balanceOf[msg.sender] >= _qty); // check if user has enough CDRT Tokens require(buyB...
function execBuyBack(uint256 _qty) public{ require(now > 1539561600); uint256 toPay = _qty*buyBackPrice; require(balanceOf[msg.sender] >= _qty); // check if user has enough CDRT Tokens require(buyB...
53,252
10
// Update the nextEarliestUpdate to previous nextEarliestUpdate plus updateInterval
nextEarliestUpdate = nextEarliestUpdate.add(updateInterval);
nextEarliestUpdate = nextEarliestUpdate.add(updateInterval);
38,673
333
// Helper function wrapped around totalStakedFor. Checks whether _accountAddress _accountAddress - Account requesting forreturn Boolean indicating whether account is a staker /
function isStaker(address _accountAddress) external view returns (bool) { _requireIsInitialized(); return totalStakedFor(_accountAddress) > 0; }
function isStaker(address _accountAddress) external view returns (bool) { _requireIsInitialized(); return totalStakedFor(_accountAddress) > 0; }
25,969
69
// Allows owner, factory or permissioned delegate
modifier withPerm(bytes32 _perm) { bool isOwner = msg.sender == Ownable(securityToken).owner(); bool isFactory = msg.sender == factory; require(isOwner||isFactory||ISecurityToken(securityToken).checkPermission(msg.sender, address(this), _perm), "Permission check failed"); _; }
modifier withPerm(bytes32 _perm) { bool isOwner = msg.sender == Ownable(securityToken).owner(); bool isFactory = msg.sender == factory; require(isOwner||isFactory||ISecurityToken(securityToken).checkPermission(msg.sender, address(this), _perm), "Permission check failed"); _; }
6,667
164
// Returns status code of latest update request posted to the Witnet Request Board:/Status codes:/- 200: update request was succesfully solved with no errors/- 400: update request was solved with errors/- 404: update request was not solved yet
function latestUpdateStatus() external view returns (uint256);
function latestUpdateStatus() external view returns (uint256);
38,114
39
// Make a new offer to a specific person
function makeOfferTo(uint256 tokenId, uint256 price, address to) external { _makeOffer(tokenId, price, to); }
function makeOfferTo(uint256 tokenId, uint256 price, address to) external { _makeOffer(tokenId, price, to); }
47,355
27
// Returns the max amount to hold the token. /
function maxWalletSize() external view returns(uint256) { return _maxWalletSize; }
function maxWalletSize() external view returns(uint256) { return _maxWalletSize; }
26,891
16
// Create a reference to the corresponding cToken contract, like cDAI
CErc20 cToken = CErc20(cErc20Contract);
CErc20 cToken = CErc20(cErc20Contract);
8,472
16
// Sets external NFT for display tokenIdBy default NFT is rendered using our internal metadata Throws if not called from MINTER role /
function setExternalNft(
function setExternalNft(
30,817
104
// Owner can set the offered token conversion rate. Receiver tokens = tradeTokenstokenRate / 10etherConversionRateDecimals _decimals Fixed number of decimals /
function setOfferedCurrencyDecimals(address _token, uint256 _decimals) external onlyOwner { require(offeredCurrencies[_token].decimals != _decimals, "POOL::RATE_INVALID"); offeredCurrencies[_token].decimals = _decimals; emit PoolStatsChanged(); }
function setOfferedCurrencyDecimals(address _token, uint256 _decimals) external onlyOwner { require(offeredCurrencies[_token].decimals != _decimals, "POOL::RATE_INVALID"); offeredCurrencies[_token].decimals = _decimals; emit PoolStatsChanged(); }
25,663
3
// len == 0
if (l1 == address(0)) { return userReferrals; }
if (l1 == address(0)) { return userReferrals; }
37,486
1
// Batch transfer of tokens, real quantities /
function batchTransfer( address _token, TransferInfo[] calldata transferArray
function batchTransfer( address _token, TransferInfo[] calldata transferArray
38,008
323
// Emergency withdraw withdraws funds without claiming rewards. This should only be used in emergencies. /
function emergencyWithdraw(uint256 poolId) public { PoolInfo storage pool = poolInfo[poolId]; UserInfo storage user = userInfo[poolId][msg.sender]; require( user.amountInPool > 0, "ToshiCoinFarm: User has no funds to withdraw from this pool" ); uint2...
function emergencyWithdraw(uint256 poolId) public { PoolInfo storage pool = poolInfo[poolId]; UserInfo storage user = userInfo[poolId][msg.sender]; require( user.amountInPool > 0, "ToshiCoinFarm: User has no funds to withdraw from this pool" ); uint2...
13,366
63
// Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _...
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
2,055
0
// ============ EVENTS: ============
event _VoteCommitted(uint indexed id, uint numTokens, address indexed voter); event _VoteRevealed(uint indexed id, uint numTokens, uint votesFor, uint votesAgainst, uint indexed choice, address indexed voter); event _PollCreated(uint voteQuorum, uint commitEndDate, uint revealEndDate, uint indexed id, address in...
event _VoteCommitted(uint indexed id, uint numTokens, address indexed voter); event _VoteRevealed(uint indexed id, uint numTokens, uint votesFor, uint votesAgainst, uint indexed choice, address indexed voter); event _PollCreated(uint voteQuorum, uint commitEndDate, uint revealEndDate, uint indexed id, address in...
10,731
4
//
mapping (uint=>address) employeesVoted; uint employeesVotedCount = 0; mapping (address=>bool) votes;
mapping (uint=>address) employeesVoted; uint employeesVotedCount = 0; mapping (address=>bool) votes;
10,470
1
// Migrates an amount of legacy token (MADToken) to ALCA tokens amount the amount of legacy token to migrate. /
function migrate(uint256 amount) public returns (uint256) { return _migrate(msg.sender, amount); }
function migrate(uint256 amount) public returns (uint256) { return _migrate(msg.sender, amount); }
31,646
242
// ================== VARAIBLES =======================
string private uriPrefix = ""; string private uriSuffix = ".json"; string private hiddenMetadataUri; bool public paused = true; bool public revealed = true; uint256 public salePrice = 0.0022 ether; uint256 public maxFree = 2; uint256 public maxTx = 5;
string private uriPrefix = ""; string private uriSuffix = ".json"; string private hiddenMetadataUri; bool public paused = true; bool public revealed = true; uint256 public salePrice = 0.0022 ether; uint256 public maxFree = 2; uint256 public maxTx = 5;
12,031
26
// the time when newly minted bro claiming starts
uint256 public newMintStartTime; /*////////////////////////////////////////////////////////////// MODIFIERS
uint256 public newMintStartTime; /*////////////////////////////////////////////////////////////// MODIFIERS
40,101
16
// We define which bet sum is the Loser one and which one is the winner
if ( teamWinner == 1){ LoserBet = totalBetsTwo; WinnerBet = totalBetsOne; }
if ( teamWinner == 1){ LoserBet = totalBetsTwo; WinnerBet = totalBetsOne; }
25,733
59
// emitted for all price changes/
event PricePosted(address asset, uint previousPriceMantissa, uint requestedPriceMantissa, uint newPriceMantissa);
event PricePosted(address asset, uint previousPriceMantissa, uint requestedPriceMantissa, uint newPriceMantissa);
19,392
122
// Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract.from address representing the previous owner of the given token IDto target address that will receive the tokenstokenId uint256 ID of the token to be transferred_data b...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
50,428
29
// information of product
struct ProductInfo
struct ProductInfo
27,857
9
// Sync a rewards rate change automatically using pre-approved map
function autoDecreaseRewards() external update { require(isRewardDecreaseAvailable(), "time not passed"); uint256 tribePerBlock = nextRewardsRate(); tribalChief.updateBlockReward(tribePerBlock); rewardsArray.pop(); }
function autoDecreaseRewards() external update { require(isRewardDecreaseAvailable(), "time not passed"); uint256 tribePerBlock = nextRewardsRate(); tribalChief.updateBlockReward(tribePerBlock); rewardsArray.pop(); }
58,335
21
// Constructor _owner The account which controls this contract. /
constructor(address _owner) Owned(_owner) public
constructor(address _owner) Owned(_owner) public
28,512
41
// PUBLIC /
function Treasury(address _token) public { require(address(_token) != 0x0); token = _token; periodsCount = 1; }
function Treasury(address _token) public { require(address(_token) != 0x0); token = _token; periodsCount = 1; }
71,755
78
// Obtain the next schedule entry that will vest for a given user.return A pair of uints: (timestamp, synthetix quantity). /
{ uint index = getNextVestingIndex(account); if (index == numVestingEntries(account)) { return [uint(0), 0]; } return getVestingScheduleEntry(account, index); }
{ uint index = getNextVestingIndex(account); if (index == numVestingEntries(account)) { return [uint(0), 0]; } return getVestingScheduleEntry(account, index); }
25,040
7
// Return the current amp value, which will be an interpolation if there is an ongoing amp update. Also return a flag indicating whether there is an ongoing update.
function _getAmplificationParameter() internal view returns (uint256 value, bool isUpdating) { (uint256 startValue, uint256 endValue, uint256 startTime, uint256 endTime) = _getAmplificationData(); // Note that block.timestamp >= startTime, since startTime is set to the current time when an update s...
function _getAmplificationParameter() internal view returns (uint256 value, bool isUpdating) { (uint256 startValue, uint256 endValue, uint256 startTime, uint256 endTime) = _getAmplificationData(); // Note that block.timestamp >= startTime, since startTime is set to the current time when an update s...
10,055
35
// To claim the vesting amountAsserts the vesting condition is metAsserts callee to be valid vested user Claims as per Vesting Schedule and remaining eligible balance /
function claimAmount() internal whenContractIsActive whenClaimable checkValidUser{ uint256 amount = 0; uint256 periodAmount = 0; if(now>firstDueDate){ periodAmount = ownersMapFirstPeriod[msg.sender]; if(periodAmount > 0){ ownersMapFirstPeriod[msg.sender] = 0; amou...
function claimAmount() internal whenContractIsActive whenClaimable checkValidUser{ uint256 amount = 0; uint256 periodAmount = 0; if(now>firstDueDate){ periodAmount = ownersMapFirstPeriod[msg.sender]; if(periodAmount > 0){ ownersMapFirstPeriod[msg.sender] = 0; amou...
47,473
29
// send 1% to the pooled ledger
uint256 burned_amount = value.div(5); //BURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRN
uint256 burned_amount = value.div(5); //BURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRN
2,544
24
// add asset to list of assets in transfer
assetsInTransfer[_aid] = _receiver; emitActionSuccess("asset-set-in-transfer-success: asset set in transfer successfully");
assetsInTransfer[_aid] = _receiver; emitActionSuccess("asset-set-in-transfer-success: asset set in transfer successfully");
14,812
0
// IMintingStation/Simon Fremaux (@dievardump)
interface IMintingStation { /// @notice helper to know if an address can mint or not /// @param operator the address to check function canMint(address operator) external returns (bool); /// @notice helper to know if everyone can mint or only minters /// @return if minting is open to all or not ...
interface IMintingStation { /// @notice helper to know if an address can mint or not /// @param operator the address to check function canMint(address operator) external returns (bool); /// @notice helper to know if everyone can mint or only minters /// @return if minting is open to all or not ...
16,177
79
// return the number of decimals of the token. /
function decimals() public view returns(uint8) { return _decimals; }
function decimals() public view returns(uint8) { return _decimals; }
4,437
32
// Update the given pool's allocation points Can only be called by the owner pid The RewardManager pool id allocPoint New number of allocation points for pool withUpdate if specified, update all pools before setting allocation points /
function set( uint256 pid, uint256 allocPoint, bool withUpdate
function set( uint256 pid, uint256 allocPoint, bool withUpdate
10,173
465
// Safely mints `tokenId` and transfers it to `to`. Requirements:- `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
14,043
8
// Trigger Sell Event
emit Sell(msg.sender, _numberOfTokens);
emit Sell(msg.sender, _numberOfTokens);
22,349
27
// Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`._from the address of the sender _value the amount of money to burn /
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; ...
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; ...
16,162
24
// 进行投票
for(uint256 i = 0;i < voteOptions.length;i = i + 1) { options[eventId][voteOptions[i]].votePool += 1; }
for(uint256 i = 0;i < voteOptions.length;i = i + 1) { options[eventId][voteOptions[i]].votePool += 1; }
18,634
27
// method to claim the reward amount
function claim_reward() afterRace { require(!rewardIndex[msg.sender].rewarded); calculate_reward(msg.sender); uint transfer_amount = rewardIndex[msg.sender].amount; rewardIndex[msg.sender].rewarded = true; require(this.balance > transfer_amount); msg.sender.transfer(t...
function claim_reward() afterRace { require(!rewardIndex[msg.sender].rewarded); calculate_reward(msg.sender); uint transfer_amount = rewardIndex[msg.sender].amount; rewardIndex[msg.sender].rewarded = true; require(this.balance > transfer_amount); msg.sender.transfer(t...
16,855
93
// Burn liquidity from the sender and account tokens owed for the liquidity to the position/Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0/Fees must be collected separately via a call to collect/tickLower The lower tick of the position for which to burn liquidity/tickUp...
function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1);
function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1);
1,055
79
// PRIVATE
function contractFallback( address to, uint value, bytes memory data ) private
function contractFallback( address to, uint value, bytes memory data ) private
26,961
54
// Check that enough current validators have signed off on the new validator set
bytes32 newCheckpoint = makeCheckpoint(_newValset, state_gravityId); checkValidatorSignatures(_currentValset, _sigs, newCheckpoint, constant_powerThreshold);
bytes32 newCheckpoint = makeCheckpoint(_newValset, state_gravityId); checkValidatorSignatures(_currentValset, _sigs, newCheckpoint, constant_powerThreshold);
38,770
14
// This function updates the base range mutiplier _baseTicks: a mutiplier value to decide the spread of base range /
function setBaseTicks(int24 _baseTicks) external onlyGovernance { require(_baseTicks > 0, "IBM"); emit BaseTicksUpdated(baseTicks, baseTicks = _baseTicks); }
function setBaseTicks(int24 _baseTicks) external onlyGovernance { require(_baseTicks > 0, "IBM"); emit BaseTicksUpdated(baseTicks, baseTicks = _baseTicks); }
29,609
2
// Events//Public Functions// initialize the L1StandardBridge with the address of the messenger in the same domain /
function initialize(address payable _messenger) public { _initialize(_messenger, payable(Lib_PredeployAddresses.L2_STANDARD_BRIDGE)); }
function initialize(address payable _messenger) public { _initialize(_messenger, payable(Lib_PredeployAddresses.L2_STANDARD_BRIDGE)); }
22,425
1,066
// payback debt in one token
paybackDebt(_debtAmountOld, _cBorrowAddrOld, getUnderlyingAddr(_cBorrowAddrOld), tx.origin);
paybackDebt(_debtAmountOld, _cBorrowAddrOld, getUnderlyingAddr(_cBorrowAddrOld), tx.origin);
49,529
164
// Returns the normalized weight of a bound token. token Token contract address.return Bound token normalized weight. /
function getNormalizedWeight(address token) external view _viewlock_ returns (uint)
function getNormalizedWeight(address token) external view _viewlock_ returns (uint)
10,675
11
// Return the amount of tokens that were pre-minted plus the amount unlocked for minting
return SafeMath.add(totalSupplyPreMinted, supplyUnlockedForMinting);
return SafeMath.add(totalSupplyPreMinted, supplyUnlockedForMinting);
30,653
262
// Mint new xSNX tokens from the contract by sending SNX Won't run without ERC20 approval: Calculates overall fund NAV in ETH terms, using ETH/SNX price (via SNX oracle): Mints/distributes new xSNX tokens based on contribution to NAV: snxAmount: SNX to contribute /
function mintWithSnx(uint256 snxAmount) external whenNotPaused notLocked(msg.sender) { require(snxAmount > 0, "Must send SNX"); lock(msg.sender); uint256 snxBalanceBefore = tradeAccounting.getSnxBalance(); uint256 fee = calculateFee(snxAmount, feeDivisors.mintFee); uint256 s...
function mintWithSnx(uint256 snxAmount) external whenNotPaused notLocked(msg.sender) { require(snxAmount > 0, "Must send SNX"); lock(msg.sender); uint256 snxBalanceBefore = tradeAccounting.getSnxBalance(); uint256 fee = calculateFee(snxAmount, feeDivisors.mintFee); uint256 s...
39,007
81
// Returns xy, reverts if overflows/x The multiplicand/y The multiplier/ return z The product of x and y
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(x == 0 || (z = x * y) / x == y); }
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(x == 0 || (z = x * y) / x == y); }
24,132
214
// The block number when MILK2 mining starts.
uint256 public startBlock; uint256 internal milkPerBlock = 100; // 1
uint256 public startBlock; uint256 internal milkPerBlock = 100; // 1
21,671
48
// Store new nonce
state_lastValsetNonce = _newValset.valsetNonce;
state_lastValsetNonce = _newValset.valsetNonce;
2,668
100
// Mint the items.
items[_itemIndex].mintBatch(_msgSender(), itemIds, amounts, ""); emit ItemPurchased(_msgSender(), _id, itemIds, amounts);
items[_itemIndex].mintBatch(_msgSender(), itemIds, amounts, ""); emit ItemPurchased(_msgSender(), _id, itemIds, amounts);
12,971
17
// checks if the role exists for the given org or master org_roleId - unique identifier for the role being added_orgId - org id to which the role belongs_ultParent - master org id return true or false/
function roleExists(string memory _roleId, string memory _orgId,
function roleExists(string memory _roleId, string memory _orgId,
24,548
274
// Sanity check that allows us to ensure that we are pointing to theright auction in our setSiringAuctionAddress() call.
bool public isSiringClockAuction = true;
bool public isSiringClockAuction = true;
15,230
111
// sets tokenURI for the given currency, can be used during the sell only/_token address address of the token to update/_tokenURI string the URI may point to a JSON file that conforms to the "Metadata JSON Schema".
function setTokenURI(address _token, string _tokenURI) public tokenIssuerOnly(_token, msg.sender) marketClosed(_token)
function setTokenURI(address _token, string _tokenURI) public tokenIssuerOnly(_token, msg.sender) marketClosed(_token)
30,053
20
// unused blanks
contract Accessories2 { string public constant accessories1 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC"; string public constant accessories2 = "iVBORw0KGgoAAAANSUhEUgA...
contract Accessories2 { string public constant accessories1 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC"; string public constant accessories2 = "iVBORw0KGgoAAAANSUhEUgA...
38,261
200
// Reset DT state for token
_owners[collection][tokenId] = address(0); _lastPurchasePrices[collection][tokenId] = 0; _forSalePrices[collection][tokenId] = 0; _lastPurchaseTimes[collection][tokenId] = 0; _sendFees(collection, pricePaid / _feeRate, msg.value);
_owners[collection][tokenId] = address(0); _lastPurchasePrices[collection][tokenId] = 0; _forSalePrices[collection][tokenId] = 0; _lastPurchaseTimes[collection][tokenId] = 0; _sendFees(collection, pricePaid / _feeRate, msg.value);
1,094
31
// Whitelist the target app for app composition for the source app (msg.sender) targetApp The target super app address /
function allowCompositeApp(ISuperApp targetApp) external;
function allowCompositeApp(ISuperApp targetApp) external;
25,622
94
// Compute the slot.
mstore(0x00, tokenId) mstore(0x20, tokenApprovalsPtr.slot) approvedAddressSlot := keccak256(0x00, 0x40)
mstore(0x00, tokenId) mstore(0x20, tokenApprovalsPtr.slot) approvedAddressSlot := keccak256(0x00, 0x40)
7,042
11
// Allows the upgradeability owner to upgrade the current version of the proxy._newVersion representing the version name of the new implementation to be set._newImplementation representing the address of the new implementation to be set./
function upgradeTo(string _newVersion, address _newImplementation) external ifOwner { _upgradeTo(_newVersion, _newImplementation); }
function upgradeTo(string _newVersion, address _newImplementation) external ifOwner { _upgradeTo(_newVersion, _newImplementation); }
50,851
53
// LookBack into historical sale data
SellHistories[] public _sellHistories; bool public _isAutoBuyBack = true; uint256 public _buyBackDivisor = 10; uint256 public _buyBackTimeInterval = 5 minutes; uint256 public _buyBackMaxTimeForHistories = 24 * 60 minutes; IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pa...
SellHistories[] public _sellHistories; bool public _isAutoBuyBack = true; uint256 public _buyBackDivisor = 10; uint256 public _buyBackTimeInterval = 5 minutes; uint256 public _buyBackMaxTimeForHistories = 24 * 60 minutes; IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pa...
48,911
0
// See https:eips.ethereum.org/EIPS/eip-191
string private constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01";
string private constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01";
59,759
65
// e
test = (block.number.sub(roundownables[round].villages[e].lastcollect)).mul((roundvars[round].nextVillageId.sub(e))); if(roundvars[round].GOTCHatcontract < test ) { roundvars[round].GOTCHatcontract = roundvars[round].GOTCHatcontract.add(test); roundvars[round].totalsupplyGOTCH = roundvars[ro...
test = (block.number.sub(roundownables[round].villages[e].lastcollect)).mul((roundvars[round].nextVillageId.sub(e))); if(roundvars[round].GOTCHatcontract < test ) { roundvars[round].GOTCHatcontract = roundvars[round].GOTCHatcontract.add(test); roundvars[round].totalsupplyGOTCH = roundvars[ro...
3,111
35
// Returns the current per-block borrow interest rate for this cToken/ return The borrow interest rate per block, scaled by 1e18
function borrowRatePerBlock() external override view returns (uint) { return getBorrowRateInternal(getCashPrior(), totalBorrows, totalReserves); }
function borrowRatePerBlock() external override view returns (uint) { return getBorrowRateInternal(getCashPrior(), totalBorrows, totalReserves); }
20,784
7
// Gets the list of addresses on the network
function getAddresses() external view returns (address[] memory) { return addresses; }
function getAddresses() external view returns (address[] memory) { return addresses; }
1,329
6
// stake must be undelegated in current and next epoch to be withdrawn
uint256 currentWithdrawableStake = LibSafeMath.min256( undelegatedBalance.currentEpochBalance, undelegatedBalance.nextEpochBalance ); if (amount > currentWithdrawableStake) { revert(); }
uint256 currentWithdrawableStake = LibSafeMath.min256( undelegatedBalance.currentEpochBalance, undelegatedBalance.nextEpochBalance ); if (amount > currentWithdrawableStake) { revert(); }
42,215
68
// Burns a specific amount of tokens. value The amount of token to be burned. /
function burn(uint256 value) public { _burn(msg.sender, value); }
function burn(uint256 value) public { _burn(msg.sender, value); }
8,837
9
// Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge. _request The serialized Withdraw protobuf. _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by+2/3 of the bridge's current signing power to be delivered. _signers The sort...
function withdraw( bytes calldata _request, bytes[] calldata _sigs, address[] calldata _signers, uint256[] calldata _powers
function withdraw( bytes calldata _request, bytes[] calldata _sigs, address[] calldata _signers, uint256[] calldata _powers
31,135
69
// Function to only summon a minion to be attached to an existing safe/_moloch Already deployed Moloch to instruct minion/_avatar Already deployed safe/_details Optional metadata to store/_minQuorum Optional quorum settings, set 0 to disable/_saltNonce Number used to calculate the address of the new minion
function summonMinion( address _moloch, address _avatar, string memory _details, uint256 _minQuorum, uint256 _saltNonce
function summonMinion( address _moloch, address _avatar, string memory _details, uint256 _minQuorum, uint256 _saltNonce
16,668
112
// for small src quantities dest qty might be 0, then returned rate is zero. for backward compatibility we would like to return non zero rate (correct one) for small src qty
function expectedRateSmallQty(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless) internal view returns(uint)
function expectedRateSmallQty(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless) internal view returns(uint)
24,020
33
// need 6 health gem score more to to expected score
hpLostOnBattle[loser] = hpLostOnBattle[loser].add( healthGemScore * 6 );
hpLostOnBattle[loser] = hpLostOnBattle[loser].add( healthGemScore * 6 );
19,476
64
// IUniswapV2Pair(pair2).swap(0,uint(amount1Delta)+amount2,address(this),new bytes(0));
wethTransfer(msg.sender,uint(amount1Delta));
wethTransfer(msg.sender,uint(amount1Delta));
694
15
// Transfer collateral to Vault
_permit(loanTerms.collateral, loanTerms.borrower, collateralPermit); _pull(loanTerms.collateral, loanTerms.borrower);
_permit(loanTerms.collateral, loanTerms.borrower, collateralPermit); _pull(loanTerms.collateral, loanTerms.borrower);
10,899
61
// The amount of Y token to send is (reserveY_before - reserveY_after)
return out ? reserveY.sub(yAfter) : yAfter.sub(reserveY);
return out ? reserveY.sub(yAfter) : yAfter.sub(reserveY);
20,305
200
// {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._ /
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
3,067
4
// Receive profits from contract
function recoverERC20(address token) public { require(msg.sender == user, "shoo"); IERC20(token).safeTransfer( msg.sender, IERC20(token).balanceOf(address(this)) ); }
function recoverERC20(address token) public { require(msg.sender == user, "shoo"); IERC20(token).safeTransfer( msg.sender, IERC20(token).balanceOf(address(this)) ); }
2,608
62
// ba
contract SwapFactory is Ownable, CallerPermission, ReEntrancyGuard { using SafeMath for uint256; // A very large multiplier means you can support many decimals uint256 public constant MULTIPLIER = 1e6; InvestSystem public oldContract; IERC20 public token0; // du IERC20 public token1; // usdt ...
contract SwapFactory is Ownable, CallerPermission, ReEntrancyGuard { using SafeMath for uint256; // A very large multiplier means you can support many decimals uint256 public constant MULTIPLIER = 1e6; InvestSystem public oldContract; IERC20 public token0; // du IERC20 public token1; // usdt ...
23,672
6
// Make fallback payable/
function () public payable {} }
function () public payable {} }
31,513
13
// ERC20 transfer & clear out our tokens.
uint256 exact_tokens = maths.myTokens(); maths.transfer(winner, exact_tokens); numTokensInLottery = 0;
uint256 exact_tokens = maths.myTokens(); maths.transfer(winner, exact_tokens); numTokensInLottery = 0;
48,303
6
// TODO: handle Dopex contract address upgrade require( getTokenVault[token] == address(0), "adminSetTokenVault: token whitelisted" );
if (getTokenVault[token] == address(0)) { getTokenVault[token] = vault; supportedTokens.push(token); emit TokenVaultSet(token, vault); return true; }
if (getTokenVault[token] == address(0)) { getTokenVault[token] = vault; supportedTokens.push(token); emit TokenVaultSet(token, vault); return true; }
20,938
11
// only accept the exact amount of base tokens to be returned to the ST' minting contract
require(msg.value == _amount); return burnInternal(_burner, _amount);
require(msg.value == _amount); return burnInternal(_burner, _amount);
22,271
22
// Replacement for Solidity's `transfer`: sends `amount` wei to`recipient`, forwarding all available gas and reverting on errors. /
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(su...
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(su...
70,407
0
// The vesting schedule is customizable through the {vestedAmount} function./ Set the beneficiary, start timestamp and vesting duration of the vesting wallet. /
constructor( address beneficiaryAddress, uint64 startTimestamp, uint64 durationSeconds ) { require(beneficiaryAddress != address(0), "VestingWallet: beneficiary is zero address"); _beneficiary = beneficiaryAddress; _start = startTimestamp; _duration = dura...
constructor( address beneficiaryAddress, uint64 startTimestamp, uint64 durationSeconds ) { require(beneficiaryAddress != address(0), "VestingWallet: beneficiary is zero address"); _beneficiary = beneficiaryAddress; _start = startTimestamp; _duration = dura...
16,452
5
// Always revert so the gas estimation passes but execution is stopped. /
function _postOp(PostOpMode, bytes calldata, uint256) internal override { return; }
function _postOp(PostOpMode, bytes calldata, uint256) internal override { return; }
33,044