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
3
// return the msg.data of this call.if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytesof the msg.data - so this method will strip those 20 bytes off.otherwise (if the call was made directly and not through the forwarder), return `msg.data`should be used in the contrac...
function _msgData() internal virtual view returns (bytes memory); function versionRecipient() external virtual view returns (string memory);
function _msgData() internal virtual view returns (bytes memory); function versionRecipient() external virtual view returns (string memory);
8,789
179
// gasUsed is in gas units, gasPrice is in ETH-gwei/gas units; convert to ETH-wei
uint256 fullGasCostEthWei = gasUsed * gasPrice * (1 gwei); assert(fullGasCostEthWei < maxUint128); // the entire ETH supply fits in a uint128... return uint128(fullGasCostEthWei);
uint256 fullGasCostEthWei = gasUsed * gasPrice * (1 gwei); assert(fullGasCostEthWei < maxUint128); // the entire ETH supply fits in a uint128... return uint128(fullGasCostEthWei);
25,989
162
// Can only mark an account as inactive if 1. it's not fee exempt 2. it has a balance 3. it's been over INACTIVE_THRESHOLD_DAYS since last activity 4. it's not already marked inactive 5. the storage fees owed already consume entire balance
if (account != address(0) && _balances[account] > 0 && daysSinceActivity(account) >= INACTIVE_THRESHOLD_DAYS && !isInactive(account) && !isAllFeeExempt(account) && _balances[account].sub(calcStorageFee(account)) > 0) { return true; }
if (account != address(0) && _balances[account] > 0 && daysSinceActivity(account) >= INACTIVE_THRESHOLD_DAYS && !isInactive(account) && !isAllFeeExempt(account) && _balances[account].sub(calcStorageFee(account)) > 0) { return true; }
25,637
23
// 初始化
function BlockChainPay() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; }
function BlockChainPay() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; }
55,791
8
// 初始化代币参数
constructor() public payable {} //使用SafeMath using SafeMath for uint256; /// //uniswaop <-> ctoken // rinkeby: address public zhuAddr1 = 0x5f5E30Ea82952E6de5A318B7A5c8E7cEe78Cbd49; address public ctokenAddr = 0xdA631Adfe5C598705045129Ca4a528389F7c831C; address public weth ...
constructor() public payable {} //使用SafeMath using SafeMath for uint256; /// //uniswaop <-> ctoken // rinkeby: address public zhuAddr1 = 0x5f5E30Ea82952E6de5A318B7A5c8E7cEe78Cbd49; address public ctokenAddr = 0xdA631Adfe5C598705045129Ca4a528389F7c831C; address public weth ...
6,262
7
// Initialize the governor to the contract caller. /
function _initialize(address _initGovernor) internal { governor = _initGovernor; }
function _initialize(address _initGovernor) internal { governor = _initGovernor; }
20,381
9
// called when user wants to withdraw single token back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain id id to withdraw amount amount to withdraw /
function withdrawSingle(uint256 id, uint256 amount) external { _burn(_msgSender(), id, amount); }
function withdrawSingle(uint256 id, uint256 amount) external { _burn(_msgSender(), id, amount); }
40,281
354
// Convenience method to calculate amount returned from redeeming options after settlement Settlement fee is 0, but still return it in case it's set in the future /
function calcRedeemAmountAndFee(bool isLongToken, uint256 strikeIndex) external view returns (uint256 cost, uint256)
function calcRedeemAmountAndFee(bool isLongToken, uint256 strikeIndex) external view returns (uint256 cost, uint256)
7,533
161
// Overloaded version of the transferFrom function _from sender of transfer _to receiver of transfer _value value of transferreturn bool success /
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { adjustInvestorCount(_from, _to, _value); require(verifyTransfer(_from, _to, _value), "Transfer is not valid"); adjustBalanceCheckpoints(_from); adjustBalanceCheckpoints(_to); req...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { adjustInvestorCount(_from, _to, _value); require(verifyTransfer(_from, _to, _value), "Transfer is not valid"); adjustBalanceCheckpoints(_from); adjustBalanceCheckpoints(_to); req...
3,724
22
// Claims any tokens or eth for `_contributor` from active or expired bountiesmsg.sender does not necessarily match `_contributor`O(N) where N = number of contributions by `_contributor`_contributor The address of the contributor to claim tokens for
function claim(address _contributor) external nonReentrant { BountyStatus _status = status(); require( _status != BountyStatus.ACTIVE, "Bounty::claim: bounty still active" ); require( totalContributedByAddress[_contributor] != 0, "Bount...
function claim(address _contributor) external nonReentrant { BountyStatus _status = status(); require( _status != BountyStatus.ACTIVE, "Bounty::claim: bounty still active" ); require( totalContributedByAddress[_contributor] != 0, "Bount...
54,392
16
// Header hash of the tip block.
bytes32 public _tipHash;
bytes32 public _tipHash;
18,150
4
// 1.bids consists of all the bids and is made private to ensure no bias./getlist of all bids with descriptionmadebuttons and functions/initial owner of contract/
constructor() { manager = payable (msg.sender); }
constructor() { manager = payable (msg.sender); }
6,057
25
// Token refund /
function refund() external virtual whenNotPaused { address buyer = _msgSender(); Bought memory temp = invoice[buyer]; require(block.timestamp <= lastRefundAt, 'over'); require(temp.purchased > 0 && token != address(0) && tokenPrice > 0, 'bad'); require(temp.stableRefunded == 0, 'refunded'); ...
function refund() external virtual whenNotPaused { address buyer = _msgSender(); Bought memory temp = invoice[buyer]; require(block.timestamp <= lastRefundAt, 'over'); require(temp.purchased > 0 && token != address(0) && tokenPrice > 0, 'bad'); require(temp.stableRefunded == 0, 'refunded'); ...
14,560
29
// initialize the following exempts:These accounts are exempted from taxation
exempts[exchanges] = true; exempts[investors] = true; exempts[marketing] = true; exempts[0xf164fC0Ec4E93095b804a4795bBe1e041497b92a] = true; // UniswapV1Router01 exempts[0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = true; // UniswapV2Router02 exempts[0xE592427A0AEce92De3E...
exempts[exchanges] = true; exempts[investors] = true; exempts[marketing] = true; exempts[0xf164fC0Ec4E93095b804a4795bBe1e041497b92a] = true; // UniswapV1Router01 exempts[0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = true; // UniswapV2Router02 exempts[0xE592427A0AEce92De3E...
40,943
2
// The fee discount tiers /
Tier[] public tiers;
Tier[] public tiers;
14,768
52
// return true;
} //get tokens sent by error to contract
} //get tokens sent by error to contract
10,315
75
// Get funding info of user/address.It will return how much funding the user has made in terms of wei /
function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){ return vault.deposited(_user); }
function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){ return vault.deposited(_user); }
9,616
157
// Get the number of "zero" bytes (0x00) in an address (20 bytes long).Each zero byte reduces the cost of including address in calldata by 64 gas.Each leading zero byte enables the address to be packed that much tighter. account address The address in question.return The leading number and total number of zero bytes in...
function getZeroBytes(address account) external pure returns ( uint256 leadingZeroBytes, uint256 totalZeroBytes
function getZeroBytes(address account) external pure returns ( uint256 leadingZeroBytes, uint256 totalZeroBytes
11,590
56
// Convert signed 64.64 fixed point number into signed 128.128 fixed pointnumber.x signed 64.64-bit fixed point numberreturn signed 128.128 fixed point number /
function to128x128 (int128 x) internal pure returns (int256) { return int256 (x) << 64; }
function to128x128 (int128 x) internal pure returns (int256) { return int256 (x) << 64; }
8,021
976
// flag to indicate the presence of this staker in the array of stakers of each contract
mapping(address => bool) isInContractStakers;
mapping(address => bool) isInContractStakers;
13,509
12
// 0x29 == )
if (char == 0x29) {
if (char == 0x29) {
7,762
34
// determine what index the present sender is:
uint index = ownerIndex[msg.sender];
uint index = ownerIndex[msg.sender];
9,263
35
// Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner
33,634
42
// XXX Currently there is no better way to check if there is a contract in an address than tocheck the size of the code at that address.TODO: Check this again before the Serenity release, because all addresses will becontracts then. /
assembly { size := extcodesize(_addr) } // solium-disable-line security/no-inline-assembly
assembly { size := extcodesize(_addr) } // solium-disable-line security/no-inline-assembly
22,016
30
// Guillaume Gonnaud/Auction House Logic Code/Laws proposition instanced by the senate.
contract LawProposition { address public senate; //The address of the senate mapping (address => bool) public tokenWhoVoted; //A mapping storing every token that has voted on this law address public law; //The address of a smart contract logic code to be potentially used in the VC uint256 public enacti...
contract LawProposition { address public senate; //The address of the senate mapping (address => bool) public tokenWhoVoted; //A mapping storing every token that has voted on this law address public law; //The address of a smart contract logic code to be potentially used in the VC uint256 public enacti...
26,148
28
// Lottery Chainlink VRF powered lottery for ERC-20 tokens /
contract Lottery is SmolGame, VRFConsumerBaseV2 { uint256 private constant PERCENT_DENOMENATOR = 1000; address private constant DEAD = address(0xdead); IERC20 lottoToken = IERC20(0xAAb679E21a9c73a02C9Ed33bbB6bb9E59f11afa9); uint256 public currentMinWinAmount; uint256 public percentageFeeWin = (PERCENT_DENOME...
contract Lottery is SmolGame, VRFConsumerBaseV2 { uint256 private constant PERCENT_DENOMENATOR = 1000; address private constant DEAD = address(0xdead); IERC20 lottoToken = IERC20(0xAAb679E21a9c73a02C9Ed33bbB6bb9E59f11afa9); uint256 public currentMinWinAmount; uint256 public percentageFeeWin = (PERCENT_DENOME...
5,124
113
// Sender addresses excluded from Tax
mapping(address => bool) public excludedAddresses; event TaxOfficeTransferred(address oldAddress, address newAddress);
mapping(address => bool) public excludedAddresses; event TaxOfficeTransferred(address oldAddress, address newAddress);
11,581
164
// Used if an aggregator contract has been proposed.return 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 return meaningful values)return updatedAt is the tim...
function proposedLatestRoundData() public view virtual hasProposal() returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function proposedLatestRoundData() public view virtual hasProposal() returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
27,152
375
// Add the approval vote to the tally
proposalDetails[_fund].approverVotes.push(msg.sender); emit ApprovalVoteCast(_fund, proposalDetails[_fund].proposalTimestamp, msg.sender);
proposalDetails[_fund].approverVotes.push(msg.sender); emit ApprovalVoteCast(_fund, proposalDetails[_fund].proposalTimestamp, msg.sender);
58,573
17
// Because the iteration is bounded by `tokens.length`, which matches the EnumerableMap's length, we can use `unchecked_at` as we know `i` is a valid token index, saving storage reads.
(tokens[i], balances[i]) = poolBalances.unchecked_at(i);
(tokens[i], balances[i]) = poolBalances.unchecked_at(i);
33,811
63
// Hash (keccak256) of the payload used by deposit _contractAddress the target ERC20 address _amount the original minter /
function entranceHash(bytes32 txnHash, address _contractAddress, uint256 _amount) public view returns (bytes32) { // "0x8177cf3c": entranceHash(bytes32, address,uint256) return keccak256(abi.encode( bytes4(0x8177cf3c), msg.sender, txnHash, _contractAddress, _amount)); }
function entranceHash(bytes32 txnHash, address _contractAddress, uint256 _amount) public view returns (bytes32) { // "0x8177cf3c": entranceHash(bytes32, address,uint256) return keccak256(abi.encode( bytes4(0x8177cf3c), msg.sender, txnHash, _contractAddress, _amount)); }
83,924
2
// Increment quantity owned of a token for a given address. Canonly be called by authorized core contracts. _token The address of the ERC20 token_owner The address of the token owner_quantityThe number of tokens to attribute to owner /
function incrementTokenOwner( address _token, address _owner,
function incrementTokenOwner( address _token, address _owner,
23,173
166
// Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address /
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; }
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; }
2,291
15
// Returs true if `msg.sender` can successfully execute a spin. /
function canSpin() override external view returns (bool) { return _hasFreeSpin(msg.sender) || _hasExtraSpin(msg.sender); }
function canSpin() override external view returns (bool) { return _hasFreeSpin(msg.sender) || _hasExtraSpin(msg.sender); }
15,083
1
// Creates the NFT contract./
constructor( CommonNFTAttributes memory _commonNFTAttributes, PermissionValidationComponents memory _permissionValidationComponents, IMintFeeOracle _feeOracle
constructor( CommonNFTAttributes memory _commonNFTAttributes, PermissionValidationComponents memory _permissionValidationComponents, IMintFeeOracle _feeOracle
23,055
39
// (Mainnet) May 22, 2019 GMT (epoch time 1558483200) (Kovan) from now
timestampStartVote = 1558483200;
timestampStartVote = 1558483200;
9,544
19
// Get valid cERC20 address from previous succesful deposit
address _cErc20Contract = marketPairs[_erc20Contract];
address _cErc20Contract = marketPairs[_erc20Contract];
34,837
39
// Returns the `fee` to be charged for a flash loan./amount The sum of tokens lent./ return fee The `fee` amount of 'token' to be charged for the loan, on top of the returned principal - uniform in Baal.
function flashFee(address, uint amount) public view returns (uint fee) { fee = amount * flashFeeNumerator / 10000; /*Calculate `fee` - precision factor '10000' derived from ERC-3156 'Flash Loan Reference'*/ }
function flashFee(address, uint amount) public view returns (uint fee) { fee = amount * flashFeeNumerator / 10000; /*Calculate `fee` - precision factor '10000' derived from ERC-3156 'Flash Loan Reference'*/ }
21,002
274
// check trading fee is less than 100% note trading fee can be 0
require(_tradingFee < SCALE, "Trading fee must be < 1"); baseToken = IERC20(_baseToken); oracle = IOracle(_oracle); strikePrices = _strikePrices; expiryTime = _expiryTime; isPut = _isPut; tradingFee = _tradingFee; for (uint256 i = 0; i < _strikePrices.le...
require(_tradingFee < SCALE, "Trading fee must be < 1"); baseToken = IERC20(_baseToken); oracle = IOracle(_oracle); strikePrices = _strikePrices; expiryTime = _expiryTime; isPut = _isPut; tradingFee = _tradingFee; for (uint256 i = 0; i < _strikePrices.le...
29,876
190
// View function to see pending HOTCs on frontend.
function pendingHotc(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accHotcPerShare = pool.accHotcPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
function pendingHotc(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accHotcPerShare = pool.accHotcPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
62,658
67
// Check that proposal has at least _executeMinPct% of staked votes.
uint256 minVotes = (_governingToken.stakedSupply() / (10000 / _executeMinPct)).mul(100); currentCanExecute = minVotes <= proposal.votesFor.add(proposal.votesAgainst).mul(voteWeight());
uint256 minVotes = (_governingToken.stakedSupply() / (10000 / _executeMinPct)).mul(100); currentCanExecute = minVotes <= proposal.votesFor.add(proposal.votesAgainst).mul(voteWeight());
10,795
685
// Encodes a 22 bits signed integer shifted by an offset. The return value can be logically ORed with other encoded values to form a 256 bit word. /
function encodeInt22(int256 value, uint256 offset) internal pure returns (bytes32) { // Integer values need masking to remove the upper bits of negative values. return bytes32((uint256(value) & _MASK_22) << offset); }
function encodeInt22(int256 value, uint256 offset) internal pure returns (bytes32) { // Integer values need masking to remove the upper bits of negative values. return bytes32((uint256(value) & _MASK_22) << offset); }
52,529
36
// An extension to the default ERC721 behaviour, derived from ERC-875. Allowing for batch transfers from the provided address, will fail if from does not own all the tokens _from the address to transfer tokens from _to the address to transfer tokens to _tokenIds list of token IDs to transfer /
function batchTransferFrom( address _from, address _to, uint256[] calldata _tokenIds
function batchTransferFrom( address _from, address _to, uint256[] calldata _tokenIds
40,097
7
// ========== VIEW FUNCTIONS ========== // pull index from sNecc token /
function index() public view returns (uint256) { LibnNeccStorage.Layout storage n = LibnNeccStorage.layout(); return IsNecc(n.sNecc).index(); }
function index() public view returns (uint256) { LibnNeccStorage.Layout storage n = LibnNeccStorage.layout(); return IsNecc(n.sNecc).index(); }
15,381
37
// Update User Balance
_userBalanceList[userAddress] = updatedAmount;
_userBalanceList[userAddress] = updatedAmount;
67,643
17
// SwapKind.GIVEN_OUT
(amountIn, amountOut) = (amountCalculated, amountGiven);
(amountIn, amountOut) = (amountCalculated, amountGiven);
2,236
82
// sessionID {uint256} - id of the stakeamount {uint256} - amount of AXNstart {uint256} - start date of the stakeend {uint256} - end date of the stakestakingDays {uint256} - number of staking daysfirstPayout {uint256} - id of the first payout for the stakelastPayout {uint256} - if of the last payout for the stakestaker...
function stakeInternalCommon( uint256 sessionId, uint256 amount, uint256 start, uint256 end, uint256 stakingDays, uint256 firstPayout, address staker ) internal { uint256 shares = _getStakersSharesAmount(amount, start, end);
function stakeInternalCommon( uint256 sessionId, uint256 amount, uint256 start, uint256 end, uint256 stakingDays, uint256 firstPayout, address staker ) internal { uint256 shares = _getStakersSharesAmount(amount, start, end);
5,369
87
// distribute deposit fee among users above on the branch & update users&39; statuses
distribute(data.parentOf(client), 0, depositsCount, amount);
distribute(data.parentOf(client), 0, depositsCount, amount);
39,040
10
// Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must be owned by `from`.- If the caller is not `from`, it must be approved to mo...
function transferFrom(address from, address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
281
209
// Unpause mint/swap/redeem actions. /
function unpause() external { require(msg.sender == governance, "not governance"); require(paused, "not paused"); paused = false; }
function unpause() external { require(msg.sender == governance, "not governance"); require(paused, "not paused"); paused = false; }
20,435
1
// Swaps tokens through a specified path on the best exchange./swaps The exchanges to choose from./path The path for the swap./amount The amount of tokens to sell./slippage The max slippage in basis points./ return The amount of tokens received.
function swap( UniswapV2[] memory swaps, address[] memory path, uint256 amount, uint256 slippage
function swap( UniswapV2[] memory swaps, address[] memory path, uint256 amount, uint256 slippage
779
140
// The number of hero classes ever defined.
uint32 public numberOfHeroClasses;
uint32 public numberOfHeroClasses;
22,147
10
// Check the 4 bytes interfaceId and handle the case where the metadata was not intended for this contract Skip 32 bytes reserved for generic extension parameters.
if (_data.metadata.length < 36 || bytes4(_data.metadata[32:36]) != type(IJB721Delegate).interfaceId) { revert INVALID_REDEMPTION_METADATA(); }
if (_data.metadata.length < 36 || bytes4(_data.metadata[32:36]) != type(IJB721Delegate).interfaceId) { revert INVALID_REDEMPTION_METADATA(); }
30,631
14
// IMAGE URI STORAGE
mapping(uint256 => bool) relicStatus; mapping(uint256 => string) ogRelics; mapping(uint256 => string) userRelics;
mapping(uint256 => bool) relicStatus; mapping(uint256 => string) ogRelics; mapping(uint256 => string) userRelics;
17,852
38
// Allows the contract to receive ETH
receive() external payable {} }
receive() external payable {} }
9,161
46
// Day of week.
weekday = getWeekday(timestamp);
weekday = getWeekday(timestamp);
30,266
29
// address public constant NFTaddress = 0xf8e81D47203A594245E36C48e151709F0C19fBe8; local
IERC721 nft = IERC721(NFTaddress); address public stakePadTokenAddress = 0xb0fC7b9e27cF805ba8F8e3D013b5F5A6D2ED8Ef2; //testnet
IERC721 nft = IERC721(NFTaddress); address public stakePadTokenAddress = 0xb0fC7b9e27cF805ba8F8e3D013b5F5A6D2ED8Ef2; //testnet
36,021
82
// Used to change `strategist`.This may only be called by governance or the existing strategist. _strategist The new address to assign as `strategist`. /
function setStrategist(address _strategist) external onlyAuthorized { require(_strategist != address(0)); strategist = _strategist; emit UpdatedStrategist(_strategist); }
function setStrategist(address _strategist) external onlyAuthorized { require(_strategist != address(0)); strategist = _strategist; emit UpdatedStrategist(_strategist); }
1,170
3
// swapping if pulltoken - remaintoken is different than uniswap's 0 - 1 order.
if (!pullTokenIs0) { (reserveAPull, reserveARemain) = (reserveARemain, reserveAPull); (reserveBpull, reserveBremain) = (reserveBremain, reserveBpull); }
if (!pullTokenIs0) { (reserveAPull, reserveARemain) = (reserveARemain, reserveAPull); (reserveBpull, reserveBremain) = (reserveBremain, reserveBpull); }
7,099
18
// needs to be voted upon
laurelsPerConceptUnit[conceptid] = amount;
laurelsPerConceptUnit[conceptid] = amount;
11,965
221
// Compute the exact number of days vested.
uint256 daysVested = onDay - startDay();
uint256 daysVested = onDay - startDay();
25,189
120
// To change the starting tokenId, please override this function./
function _startTokenId() internal view virtual returns (uint256) { return 1; }
function _startTokenId() internal view virtual returns (uint256) { return 1; }
833
257
// Total DVD that have been burned./These DVD are still in circulation therefore they/ are still considered on the bonding curve formula./ return Total burned DVD in wei.
function dvdBurnedAmount() public view returns (uint256) { return IERC20(dvd).balanceOf(BURN_ADDRESS); }
function dvdBurnedAmount() public view returns (uint256) { return IERC20(dvd).balanceOf(BURN_ADDRESS); }
49,213
32
// revert if the deposit is not found
require(_token != address(0), "CollateralizationOracle: deposit not found");
require(_token != address(0), "CollateralizationOracle: deposit not found");
86,985
20
// Returns whether a record has been imported to the registry. node The specified node.return Bool if record exists /
function recordExists(bytes32 node) public view returns (bool) { return records[node].owner != address(0x0); }
function recordExists(bytes32 node) public view returns (bool) { return records[node].owner != address(0x0); }
77,633
2
// The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint256) { return 10; } // 10 actions
function proposalMaxOperations() public pure returns (uint256) { return 10; } // 10 actions
11,733
65
// ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account. The `spender` contract function `receiveApproval(...)` is then executed ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes memory data) public returns(bool success) { assert(!approveAndCallLock && !blacklist[msg.sender]); //Must be unlocked, cannot be a blacklisted allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAnd...
function approveAndCall(address spender, uint tokens, bytes memory data) public returns(bool success) { assert(!approveAndCallLock && !blacklist[msg.sender]); //Must be unlocked, cannot be a blacklisted allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAnd...
760
216
// Create a new instance of an app linked to this kernel and set its baseimplementation if it was not already setCreate a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`_appId Identifier for app_appBase Address...
function newAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
function newAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
17,606
41
// Redeems rewards for a given staker, and reinvests them in the stake//_owner owner of the stake to process/_talent talent token of the stake to process/ return true if operation succeeds
function claimRewardsOnBehalf(address _owner, address _talent) public updatesAdjustedShares(_owner, _talent) returns (bool)
function claimRewardsOnBehalf(address _owner, address _talent) public updatesAdjustedShares(_owner, _talent) returns (bool)
28,540
60
// Whether or not the contract is shutdown in case of an emergency. /
bool public isShutdown;
bool public isShutdown;
3,818
31
// Emitted when a Witnet Data Request is posted to the WRB.
event PostedRequest(uint256 queryId, address from);
event PostedRequest(uint256 queryId, address from);
54,080
69
// Allows the current governor to relinquish control of the contract. Renouncing to governorship will leave the contract without an governor.It will not be possible to call the functions with the `governance`modifier anymore. /
function renounceGovernorship() public governance { emit GovernorshipTransferred(governor, address(0)); governor = address(0); }
function renounceGovernorship() public governance { emit GovernorshipTransferred(governor, address(0)); governor = address(0); }
16,616
77
// tokenRefund calculates the token amount to be refunded back It will be pro-rated if oversubscribed, else 0
function tokenRefund(address _account) public view returns (uint256) { require(presaleStart == false, "Presale has not ended yet"); require(whitelist[_account], "Account not whitelisted"); return _tokenRefund(_account, _tokenShare(_account)); }
function tokenRefund(address _account) public view returns (uint256) { require(presaleStart == false, "Presale has not ended yet"); require(whitelist[_account], "Account not whitelisted"); return _tokenRefund(_account, _tokenShare(_account)); }
1,771
31
// charge exit fee on the pool token side pAiAfterExitFee = pAi(1-exitFee)
uint poolAmountInAfterExitFee = bmul(poolAmountIn, bsub(BASE, EXIT_FEE)); uint newPoolSupply = bsub(poolSupply, poolAmountInAfterExitFee); uint poolRatio = bdiv(newPoolSupply, poolSupply);
uint poolAmountInAfterExitFee = bmul(poolAmountIn, bsub(BASE, EXIT_FEE)); uint newPoolSupply = bsub(poolSupply, poolAmountInAfterExitFee); uint poolRatio = bdiv(newPoolSupply, poolSupply);
15,010
432
// Constructs the ExpandedERC20. _tokenName The name which describes the new token. _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars. _tokenDecimals The number of decimals to define token precision. /
constructor( string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals
constructor( string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals
12,120
192
// _amount = 10000000000000000000000000 (mints 10M tokens) _vestingBeneficiary = 0x4Ce92027f8eE71bF3582a2799f2a9CF3fC6dcE5f
uint256 CreatorAmount = 9800000000000000000000000; uint256 OwnershipAmount = 200000000000000000000000; constructor( address _vestingBeneficiary, address _Ownership
uint256 CreatorAmount = 9800000000000000000000000; uint256 OwnershipAmount = 200000000000000000000000; constructor( address _vestingBeneficiary, address _Ownership
44,465
99
// Counter underflow is impossible as _burnCounter cannot be incremented more than _currentIndex times
unchecked { return _currentIndex - _burnCounter; }
unchecked { return _currentIndex - _burnCounter; }
1,472
3
// function mintWithCategory( address _to, uint256 _mintNumber, uint256 _category
// ) public { // require(enabledMinter[msg.sender], "!minter"); // uint256 supply = totalSupply(); // require(!paused, "paused"); // require(supply + 1 <= maxSupply, "OverMaxSupply"); // _safeMint(address(0), _to, _mintNumber, ""); // monsterCategory[_mintNumber] = _c...
// ) public { // require(enabledMinter[msg.sender], "!minter"); // uint256 supply = totalSupply(); // require(!paused, "paused"); // require(supply + 1 <= maxSupply, "OverMaxSupply"); // _safeMint(address(0), _to, _mintNumber, ""); // monsterCategory[_mintNumber] = _c...
16,261
25
//
* function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * }
* function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * }
4,277
220
// we just keep all money in want if we dont have any lenders
if(lenders.length == 0){ return; }
if(lenders.length == 0){ return; }
61,481
76
// 找零
if(_balance > 0 && _isRebuy == false){ uint temp = _balance; _balance = 0; playerBook.buyOrderRefund(_buyer, temp); }
if(_balance > 0 && _isRebuy == false){ uint temp = _balance; _balance = 0; playerBook.buyOrderRefund(_buyer, temp); }
54,222
7
// Remove tokens from staked balance. The money can/ be released after timeToRelease seconds, if the/ function withdraw is called./_amount The amount of tokens that are gonna be unstaked.
function unstake(uint256 _amount) external;
function unstake(uint256 _amount) external;
9,929
3,316
// 1659
entry "untrivialized" : ENG_ADJECTIVE
entry "untrivialized" : ENG_ADJECTIVE
18,271
11
// Store the length of the first bytes array at the beginning of the memory for tempBytes.
let length := mload(_preBytes) mstore(tempBytes, length)
let length := mload(_preBytes) mstore(tempBytes, length)
6,403
41
// this is in case a dead pet addons is stuck in contract, we can use for diff cases.
function withdraw(uint256 _id, address _to) external onlyOwner { addons.safeTransferFrom(address(this), _to, _id, 1, ""); }
function withdraw(uint256 _id, address _to) external onlyOwner { addons.safeTransferFrom(address(this), _to, _id, 1, ""); }
29,055
128
// Fill resulting variable
nonZeroAdapterBalances[nonZeroAdaptersCounter] = AdapterBalance({ protocolAdapterName: adapterBalances[i].protocolAdapterName, absoluteTokenAmounts: nonZeroAbsoluteTokenAmounts });
nonZeroAdapterBalances[nonZeroAdaptersCounter] = AdapterBalance({ protocolAdapterName: adapterBalances[i].protocolAdapterName, absoluteTokenAmounts: nonZeroAbsoluteTokenAmounts });
32,411
232
// add TUSD to curve
_flush(currencyAmount, minMintAmount);
_flush(currencyAmount, minMintAmount);
19,529
13
// make sure owner owns this token
if (ownerOfToken == msg.sender) { _nightmareMap[_tokenId-1] = true; }
if (ownerOfToken == msg.sender) { _nightmareMap[_tokenId-1] = true; }
19,822
247
// Pay the toll. Mint and Redeem fees here since its a swap. We burn all from sender and mint to fee receiver to reduce costs.
uint256 redeemFee = (targetRedeemFee * specificIds.length) + ( randomRedeemFee * (count - specificIds.length) ); uint256 totalFee = (mintFee * count) + redeemFee; _chargeAndDistributeFees(msg.sender, totalFee);
uint256 redeemFee = (targetRedeemFee * specificIds.length) + ( randomRedeemFee * (count - specificIds.length) ); uint256 totalFee = (mintFee * count) + redeemFee; _chargeAndDistributeFees(msg.sender, totalFee);
29,996
15
// Checks if a user has been borrowing from any reserve self The configuration objectreturn True if the user has been borrowing any reserve, false otherwise /
function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) { return self.data & BORROWING_MASK != 0; }
function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) { return self.data & BORROWING_MASK != 0; }
35,488
221
// Address of the contract that handles swaps between collateral token and R.
function amm() external view returns (IAMM);
function amm() external view returns (IAMM);
35,894
29
// ----------------Variable Getters---------------------
function uintStorage(bytes32 _key) external view returns (uint); function stringStorage(bytes32 _key) external view returns (string);
function uintStorage(bytes32 _key) external view returns (uint); function stringStorage(bytes32 _key) external view returns (string);
45,930
5
// The Command for turning off the light - ConcreteCommand 2 /
function Off() { Execute("off"); }
function Off() { Execute("off"); }
25,913
931
// Validate token type
require(tokenStorage.tokenType != TokenType.Ether); // dev: ether can only be set once if (underlying) {
require(tokenStorage.tokenType != TokenType.Ether); // dev: ether can only be set once if (underlying) {
6,372
21
// earnings withdrawal
function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); }
function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); }
8,194
344
// Reference @openzeppelin/contracts/token/ERC20/IERC20.sol
interface ILendFlareVotingEscrow { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); }
interface ILendFlareVotingEscrow { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); }
72,635
2
// Gets Layer /
function getLayer(string memory content, string memory style, string memory class ) public pure returns (string memory svg){ return string.concat('<g class="',class,'" style="',style,'" >',content,'</g>'); }
function getLayer(string memory content, string memory style, string memory class ) public pure returns (string memory svg){ return string.concat('<g class="',class,'" style="',style,'" >',content,'</g>'); }
30,409
66
// Provides information about the current execution context, including thesender of the transaction and its data. While these are generally availablevia msg.sender and msg.data, they should not be accessed in such a directmanner. /
abstract contract ManagedIdentity { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { return msg.data; } }
abstract contract ManagedIdentity { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { return msg.data; } }
4,948
30
// Compute the payouts for the rewards = (staking rewards + vested auction fee rewards) the protocol rewards must be paid off already in 'processNodeExit'
( payouts[0], payouts[1], payouts[2], payouts[3] ) = getRewardsPayouts( true, false, true, _splits,
( payouts[0], payouts[1], payouts[2], payouts[3] ) = getRewardsPayouts( true, false, true, _splits,
10,936
179
// add new url to mapping_url New url/
function addNewUrl(string _url) public onlyOwner { urlRank[maxRankIndex] = _url; maxRankIndex += 1; }
function addNewUrl(string _url) public onlyOwner { urlRank[maxRankIndex] = _url; maxRankIndex += 1; }
82,864