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
45
// daily winners' award
mapping(uint => mapping(address => uint)) winnerDailyParticipantInfos;
mapping(uint => mapping(address => uint)) winnerDailyParticipantInfos;
3,338
15
// Constructor function _name Token name _symbol Token symbol _price Token price _unitsPerTransaction Purchasable token amounts per transaction _maxSupply Maximum number of mintable tokens _defaultTokenURI Deafult token uri _prizeTokenURI Prize token uri _baseURI Base token uri _startingTime Start time to purchase NFT ...
constructor( string memory _name, string memory _symbol, uint256 _price, uint256 _unitsPerTransaction, uint256 _maxSupply, string memory _defaultTokenURI, string memory _prizeTokenURI, string memory _baseURI, uint256 _startingTime
constructor( string memory _name, string memory _symbol, uint256 _price, uint256 _unitsPerTransaction, uint256 _maxSupply, string memory _defaultTokenURI, string memory _prizeTokenURI, string memory _baseURI, uint256 _startingTime
19,589
26
// Creates a lock for the provided _beneficiary with the provided amountThe creation can be peformed only if:- the sender is the address of the crowdsale;- the _beneficiary and _tokenHolder are valid addresses;- the _amount is greater than 0 and was appoved by the _tokenHolder prior to the transaction.The investors wil...
function createInvestorTokenTimeLock( address _beneficiary, uint256 _amount, uint256 _start, address _tokenHolder ) external onlyCrowdsale returns (bool)
function createInvestorTokenTimeLock( address _beneficiary, uint256 _amount, uint256 _start, address _tokenHolder ) external onlyCrowdsale returns (bool)
66,417
47
// Pocket the money
if(!wallet.send(msg.value)) throw;
if(!wallet.send(msg.value)) throw;
51,345
4
// User Begin
struct User { address _eth; uint _startTime; uint _pledgeCycle; uint _curBTC; //uint _btcVal; string _btc; bool _bReceive; //bool _Receive; bool _bExist; }
struct User { address _eth; uint _startTime; uint _pledgeCycle; uint _curBTC; //uint _btcVal; string _btc; bool _bReceive; //bool _Receive; bool _bExist; }
40,115
33
// See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. /
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
10,064
19
// _______ ______ // \ \/ / (_)| |__(_) |_ _| ___| |______ _//\ \/\/ /| || / /| | | |/ _ \ | / / / -_)| ' \ // \_/\_/_|_|_ |_\_\ _|_|_ _|_|_ \___/ |_\_\ \___||_||_|// _|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| //"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'//wiki...
contract Token is ERC721Enumerable, JuiceboxProject { /// Minted page ids in order, used for pagination and for getting all of the tokens belonging to an address. uint256[] private _mintedWikipediaPageIds; /// Base URI that WikiToken IDs will be concatenated to. string public baseURI; /// True if Juice is e...
contract Token is ERC721Enumerable, JuiceboxProject { /// Minted page ids in order, used for pagination and for getting all of the tokens belonging to an address. uint256[] private _mintedWikipediaPageIds; /// Base URI that WikiToken IDs will be concatenated to. string public baseURI; /// True if Juice is e...
43,283
42
// mapping that keeps track of if a user is staking normal nft
mapping (address => bool) isStakingNormalNFT;
mapping (address => bool) isStakingNormalNFT;
16,224
2
// Deposit LP tokens to MCV2 for SUSHI allocation./pid The index of the pool. See `poolInfo`./amount LP token amount to deposit./to The receiver of `amount` deposit benefit.
function deposit( uint256 pid, uint256 amount, address to ) external;
function deposit( uint256 pid, uint256 amount, address to ) external;
53,431
18
// Deposit staked tokens and collect reward tokens (if any) _amount: amount to deposit (in stakedToken) /
function deposit(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; _updatePool(); if (user.amount > 0) { uint256 pendingToken1 = user .amount .mul(mapOfAccTokenPerShare[TOKEN1]) .div(mapOfPreci...
function deposit(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; _updatePool(); if (user.amount > 0) { uint256 pendingToken1 = user .amount .mul(mapOfAccTokenPerShare[TOKEN1]) .div(mapOfPreci...
51,527
32
// Divide wei between 3 and 6 matrixes
uint cost3 = msg.value / 2; uint cost6 = msg.value - cost3;
uint cost3 = msg.value / 2; uint cost6 = msg.value - cost3;
21,688
32
// 20: processed, but tx still open[ FINAL STATES >= 50 ]50: processed, costing done, tx settled60: rejected or error-ed, costing done, tx settled
bool isxIPFS; // true: IPFS-augmented call (xIPFS); false: on-chain call
bool isxIPFS; // true: IPFS-augmented call (xIPFS); false: on-chain call
1,158
8
// Set the computational speed limit for the chain
function setSpeedLimit(uint64 limit) external;
function setSpeedLimit(uint64 limit) external;
16,635
11
// newStartPrice The new start price
event NewStartPrice( uint128 newStartPrice );
event NewStartPrice( uint128 newStartPrice );
21,217
372
// round 18
ark(i, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455); sbox_partial(i, q); mix(i, q);
ark(i, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455); sbox_partial(i, q); mix(i, q);
51,198
92
// Data part taken out for building of contracts that receive delegate calls
contract ERC20Data { /// @notice owner > balance mapping. mapping(address => uint256) public balanceOf; /// @notice owner > spender > allowance mapping. mapping(address => mapping(address => uint256)) public allowance; /// @notice owner > nonce mapping. Used in `permit`. mapping(address => uint2...
contract ERC20Data { /// @notice owner > balance mapping. mapping(address => uint256) public balanceOf; /// @notice owner > spender > allowance mapping. mapping(address => mapping(address => uint256)) public allowance; /// @notice owner > nonce mapping. Used in `permit`. mapping(address => uint2...
6,249
270
// if vault is partially liquidated (amount of short otoken is still greater than zero) make sure remaining collateral amount is greater than dust amount
if (vault.shortAmounts[0].sub(_args.amount) > 0) { require(vault.collateralAmounts[0].sub(collateralToSell) >= collateralDust, "C34"); }
if (vault.shortAmounts[0].sub(_args.amount) > 0) { require(vault.collateralAmounts[0].sub(collateralToSell) >= collateralDust, "C34"); }
9,593
224
// override base uri. It will be combined with token ID
function _baseURI() internal view override returns (string memory) { return _baseURL; }
function _baseURI() internal view override returns (string memory) { return _baseURL; }
11,464
51
// OperableCore The Operable contract enable the restrictions of operations to a set of operatorsCyril Lapinte - <cyril.lapinte@openfiz.com> Error messagesOC01: Sender is not a system operatorOC02: Sender is not a core operatorOC03: Sender is not a proxy operatorOC04: AllPrivileges is a reserved role /
contract OperableCore is Core, OperableStorage { constructor() public { operators[msg.sender].coreRole = ALL_PRIVILEGES; operators[msg.sender].proxyRoles[ALL_PROXIES] = ALL_PRIVILEGES; } /** * @dev onlySysOp modifier * @dev for safety reason, core owner * @dev can always define roles and assign...
contract OperableCore is Core, OperableStorage { constructor() public { operators[msg.sender].coreRole = ALL_PRIVILEGES; operators[msg.sender].proxyRoles[ALL_PROXIES] = ALL_PRIVILEGES; } /** * @dev onlySysOp modifier * @dev for safety reason, core owner * @dev can always define roles and assign...
30,463
39
// VIEW & PURE FUNCTIONS /
function _getAPrecise(Swap storage self) internal view returns (uint256) { return AmplificationUtils._getAPrecise(self); }
function _getAPrecise(Swap storage self) internal view returns (uint256) { return AmplificationUtils._getAPrecise(self); }
45,136
7
// Emitted after burn, notifies relays that transfer is happening/amount Amount of token burned/substrateRecipient Who should get tokens on substrate
event OutgoingReceipt(uint256 amount, bytes32 substrateRecipient);
event OutgoingReceipt(uint256 amount, bytes32 substrateRecipient);
13,174
14
// Check if the _pricePerToken needs to be overridden
if (_allowlistProof.pricePerToken > 0) { _pricePerToken = _allowlistProof.pricePerToken; }
if (_allowlistProof.pricePerToken > 0) { _pricePerToken = _allowlistProof.pricePerToken; }
18,254
98
// How much tokens we Swapped into
uint256 SwappedTokens = balanceOf(address(balancer)); uint256 rewardForCaller = SwappedTokens.mul(_rebalanceCallerFee).div(10**(_feeDecimal + 2)); uint256 amountToBurn = SwappedTokens.sub(rewardForCaller); uint256 rate = _getReflectionRate(); _reflectionBalance[tx.origin] = _r...
uint256 SwappedTokens = balanceOf(address(balancer)); uint256 rewardForCaller = SwappedTokens.mul(_rebalanceCallerFee).div(10**(_feeDecimal + 2)); uint256 amountToBurn = SwappedTokens.sub(rewardForCaller); uint256 rate = _getReflectionRate(); _reflectionBalance[tx.origin] = _r...
28,642
71
// usertx info
struct UserTx { BaseTx baseTx; uint tokenPairID; uint value; uint fee; address userAccount; /// HTLC transaction sender address for the security check while user's revoke }
struct UserTx { BaseTx baseTx; uint tokenPairID; uint value; uint fee; address userAccount; /// HTLC transaction sender address for the security check while user's revoke }
36,129
39
// Take DAI from the urn in case there is any in the Urn can be dealt with through migrate() after ES
function quit() public auth { urn.quit(); }
function quit() public auth { urn.quit(); }
39,041
134
// Before reward is minted, increment blockIssue in CerticolDAOVoC record
_vocRecords[msg.sender][target].blockIssue = _vocRecords[msg.sender][target].blockIssue.add(_posatRewardRequirement);
_vocRecords[msg.sender][target].blockIssue = _vocRecords[msg.sender][target].blockIssue.add(_posatRewardRequirement);
51,489
67
// Can be overridden to add finalization logic. The overriding functionshould call super.finalization() to ensure the chain of finalization isexecuted entirely. /
function finalization() internal { }
function finalization() internal { }
25,759
144
// Collects UNI tokens
IStakingRewards(rewards).getReward(); uint256 _uni = IERC20(uni).balanceOf(address(this)); if (_uni > 0) {
IStakingRewards(rewards).getReward(); uint256 _uni = IERC20(uni).balanceOf(address(this)); if (_uni > 0) {
48,674
123
// K值是固定常量,伪造amountIn没有意义
if (src == NEST_TOKEN_ADDRESS && dest == DCU_TOKEN_ADDRESS) { amountOut = _swap(NEST_TOKEN_ADDRESS, DCU_TOKEN_ADDRESS, to); } else if (src == DCU_TOKEN_ADDRESS && dest == NEST_TOKEN_ADDRESS) {
if (src == NEST_TOKEN_ADDRESS && dest == DCU_TOKEN_ADDRESS) { amountOut = _swap(NEST_TOKEN_ADDRESS, DCU_TOKEN_ADDRESS, to); } else if (src == DCU_TOKEN_ADDRESS && dest == NEST_TOKEN_ADDRESS) {
26,808
5
// Maps each token id to a mapping that can enumerate all active quests within an adventure
mapping (uint256 => mapping (address => uint32[])) public activeQuestList;
mapping (uint256 => mapping (address => uint32[])) public activeQuestList;
12,662
63
// Shezmu
if (rewardInfo.pending > 0) { IERC20(addressProvider.getShezmu()).safeTransfer( _recipient, rewardInfo.pending ); delete rewardInfoOf[_depositId]; }
if (rewardInfo.pending > 0) { IERC20(addressProvider.getShezmu()).safeTransfer( _recipient, rewardInfo.pending ); delete rewardInfoOf[_depositId]; }
7,108
1
// RLP encodes a list of RLP encoded byte byte strings._in The list of RLP encoded byte strings. return The RLP encoded list of items in bytes. /
function writeList(bytes[] memory _in) internal pure returns (bytes memory) { bytes memory list = _flatten(_in); return abi.encodePacked(_writeLength(list.length, 192), list); }
function writeList(bytes[] memory _in) internal pure returns (bytes memory) { bytes memory list = _flatten(_in); return abi.encodePacked(_writeLength(list.length, 192), list); }
19,624
4
// nftPerAddressLimit: mint amount of token per address limittokenBalanceOf: token balance minted by input address /
uint256 public nftPerAddressLimit = 100;
uint256 public nftPerAddressLimit = 100;
16,496
240
// if `returnedFund` is negative, trader can't get anything back
if (returnedFund.toInt() > 0) { settledValue = returnedFund.abs(); }
if (returnedFund.toInt() > 0) { settledValue = returnedFund.abs(); }
30,832
38
// Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte...
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
122
1
// transfer ETH from the contract to the caller
function withdraw(uint256 amount) external { msg.sender.transfer(amount); }
function withdraw(uint256 amount) external { msg.sender.transfer(amount); }
4,763
53
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
331
13
// Decreases the amount of liquidity in a position and accounts it to the position/params tokenId The ID of the token for which liquidity is being decreased,/ amount The amount by which liquidity will be decreased,/ amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,/ amount1Min T...
function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
18,965
379
// 获得赎回了多少代币
uint redeemBal = self.balance;
uint redeemBal = self.balance;
30,127
21
// randomWords looks like this uint256: 68187645017388103597074813724954069904348581739269924188458647203960383435815
console.log("Fulfilling random Words by RandomWordFunction"); string[] memory urisForTrend = currentMarketTrend == MarketTrend.BULL ? bullUrisIpfs : bearUrisIpfs; uint256 idx = randomWords[0] % urisForTrend.length; // use modulo to choose a random index. for (uint i = 0; i < _tokenIdCounter.curr...
console.log("Fulfilling random Words by RandomWordFunction"); string[] memory urisForTrend = currentMarketTrend == MarketTrend.BULL ? bullUrisIpfs : bearUrisIpfs; uint256 idx = randomWords[0] % urisForTrend.length; // use modulo to choose a random index. for (uint i = 0; i < _tokenIdCounter.curr...
12,458
57
// solium-disable-next-line arg-overflow
safeTransferFrom(_from, _to, _tokenId, "");
safeTransferFrom(_from, _to, _tokenId, "");
26,296
172
// hash_t4f6p52
struct HashInputs4
struct HashInputs4
47,526
11
// To change the approve amount you first have to reduce the addresses&39;s allowance to zero
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
30,695
59
// erc20TokenAddress the wrapped ERC20 Token address you want to know info aboutreturn objectId the id in the collection which correspondes to the given erc20TokenAddress /
function object(address erc20TokenAddress) external view returns (uint256 objectId);
function object(address erc20TokenAddress) external view returns (uint256 objectId);
6,990
36
// Set Chainlink Oracle's job id -> http get > uint256 job /
function setChainJobId(string memory _jobId) public onlyOwner{ JOBID = _jobId; }
function setChainJobId(string memory _jobId) public onlyOwner{ JOBID = _jobId; }
34,071
3
// solhint-disable-next-line var-name-mixedcase
bytes4 immutable private _MAX_SELECTOR = bytes4(uint32(IERC20.transferFrom.selector) + 10); uint256 constant private _FROM_INDEX = 0; uint256 constant private _TO_INDEX = 1; uint256 constant private _AMOUNT_INDEX = 2; mapping(bytes32 => uint256) private _remaining; mapping(address => mapping(u...
bytes4 immutable private _MAX_SELECTOR = bytes4(uint32(IERC20.transferFrom.selector) + 10); uint256 constant private _FROM_INDEX = 0; uint256 constant private _TO_INDEX = 1; uint256 constant private _AMOUNT_INDEX = 2; mapping(bytes32 => uint256) private _remaining; mapping(address => mapping(u...
12,861
176
// For refunds, the numerator is the negative of the bid case.
if (refund) { (bidsPerPrice, _deposited) = (_deposited, bidsPerPrice); }
if (refund) { (bidsPerPrice, _deposited) = (_deposited, bidsPerPrice); }
36,893
224
// assign reward for posting to creator
owner_pending_posts[memes[_id].owner].push(_id); total_pending_rewards[memes[_id].owner] += posting.amount_owner; post_rewards_status[_id] = 1;
owner_pending_posts[memes[_id].owner].push(_id); total_pending_rewards[memes[_id].owner] += posting.amount_owner; post_rewards_status[_id] = 1;
36,397
158
// See {IERC721Enumerable-totalSupply}. /
function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; }
function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; }
5,654
156
// Transfer any leftover dust back to the vault buffer.
uint256 dust = IERC20(_asset).balanceOf(address(this)); if (dust > 0) { IERC20(_asset).safeTransfer(vaultAddress, dust); }
uint256 dust = IERC20(_asset).balanceOf(address(this)); if (dust > 0) { IERC20(_asset).safeTransfer(vaultAddress, dust); }
43,336
48
// Get token info
TokenType listTokenType = getTokenType(_param.assetContract);
TokenType listTokenType = getTokenType(_param.assetContract);
30,050
722
// Now use Newton-Raphson itteration to improve the precision. We want to find the root of the equation: f(x) = x - 1 / d (where d = denominator) Newton-Rhapson itteration then is f(x)d - 1 / xx' = x -------- = x - ----------- = x(2 - dx) f'(x)1 / x^2 Thanks to Hensel's lifting lemma, this also works in modular arithme...
inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^8 inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^16 inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^32 inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^64 ...
inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^8 inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^16 inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^32 inv := mul(inv, sub(2, mul(denominator, inv))) // inverse mod 2^64 ...
71,639
4
// In addition to the current interfaceId, also support previous version of the interfaceId that did not include the castVoteWithReasonAndParams() function as standard
return interfaceId == type(IERC721ReceiverUpgradeable).interfaceId || interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);
return interfaceId == type(IERC721ReceiverUpgradeable).interfaceId || interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);
21,644
209
// Hardcode the Manager's approval so that users don't have to waste gas approving
if (_msgSender() != address(staking)) require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId);
if (_msgSender() != address(staking)) require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId);
42,920
13
// Public Sale Mint /
function publicSaleMint(uint256 numberOfTokens) external payable whenNotPaused { require(isMintingActive, "Public Sale minting is not active yet."); require(numberOfTokens <= 20, "Too many requested"); require(CLAIMED_SUPPLY + numberOfTokens < TOTAL_SUPPLY, "Purchase would exceed max tokens...
function publicSaleMint(uint256 numberOfTokens) external payable whenNotPaused { require(isMintingActive, "Public Sale minting is not active yet."); require(numberOfTokens <= 20, "Too many requested"); require(CLAIMED_SUPPLY + numberOfTokens < TOTAL_SUPPLY, "Purchase would exceed max tokens...
76,884
37
// Emitted when the buy out is triggered on an auction. auctionId : The id of the auction this bid was for. buyer : The buyer who triggered the buyOut. buyOutAmount: The amount of the bid. /
event AuctionSellingAgreementBuyOutTriggered( uint256 indexed auctionId, address indexed buyer,
event AuctionSellingAgreementBuyOutTriggered( uint256 indexed auctionId, address indexed buyer,
18,410
23
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of the m...
uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length;
uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length;
6,835
165
// Returns the number of tokens minted by `owner`. /
function _numberMinted(address owner) internal view returns (uint256) { if (owner == address(0)) revert MintedQueryForZeroAddress(); return uint256(_addressData[owner].numberMinted); }
function _numberMinted(address owner) internal view returns (uint256) { if (owner == address(0)) revert MintedQueryForZeroAddress(); return uint256(_addressData[owner].numberMinted); }
6,652
6
// Current amount of snails given to new players
uint256 public startingSnailAmount = STARTING_SNAIL;
uint256 public startingSnailAmount = STARTING_SNAIL;
38,366
102
// Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver recipient address The address which you want to transfer to amount uint256 The amount of tokens to be transferred data bytes Additional data with no specified format, sent in call to `recipient`return true unless thro...
function transferAndCall( address recipient, uint256 amount, bytes calldata data ) external returns (bool);
function transferAndCall( address recipient, uint256 amount, bytes calldata data ) external returns (bool);
11,763
159
// Check that matron and sire are both owned by caller, or that the sire has given siring permission to caller (i.e. matron's owner). Will fail for _sireId = 0
require(_isSiringPermitted(_sireId, _matronId));
require(_isSiringPermitted(_sireId, _matronId));
14,624
0
// Unofficial Turnstile interface/This interface is used as part of the csrCANTO related contracts/This minimal interface can be reused for contracts registration to the CSR
interface ICanto_Turnstile { /// @notice Mints ownership NFT that allows the owner to collect fees earned by the smart contract. /// `msg.sender` is assumed to be a smart contract that earns fees. Only smart contract itself /// can register a fee receipient. /// @param _recipient recipi...
interface ICanto_Turnstile { /// @notice Mints ownership NFT that allows the owner to collect fees earned by the smart contract. /// `msg.sender` is assumed to be a smart contract that earns fees. Only smart contract itself /// can register a fee receipient. /// @param _recipient recipi...
15,556
38
// Hardcode the Manager's approval so that users don't have to waste gas approving
if (_msgSender() != address(castle)) require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId);
if (_msgSender() != address(castle)) require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId);
22,376
9
// Max harvest interval: 14 days.
uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days;
uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days;
9,734
26
// check a vote isn't active
if (!proposal.onVote) { require( validateProposedContract(proposalType, proposalAddress) == true, "The proposed contract did not operate as expected" ); proposal.onVote = true; // put proposal on vote, no changes until vote is setteled or remov...
if (!proposal.onVote) { require( validateProposedContract(proposalType, proposalAddress) == true, "The proposed contract did not operate as expected" ); proposal.onVote = true; // put proposal on vote, no changes until vote is setteled or remov...
12,945
340
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
set._values[toDeleteIndex] = lastvalue;
28,675
43
// read 3 bytes
let input := mload(dataPtr)
let input := mload(dataPtr)
15,394
63
// Increase the GUNIV3DAIUSDC1-A Debt Ceiling - October 11, 2021https:vote.makerdao.com/polling/QmU6fTQx?network=mainnetpoll-detail
DssExecLib.setIlkAutoLineParameters("GUNIV3DAIUSDC1-A", 50 * MILLION, 10 * MILLION, 8 hours);
DssExecLib.setIlkAutoLineParameters("GUNIV3DAIUSDC1-A", 50 * MILLION, 10 * MILLION, 8 hours);
12,186
16
// Lifts the ban on transfers for given addresses/
function restrict(address [] _restricted) external onlyAuthorized returns (bool) { for (uint i = 0; i < _restricted.length; i++) { blacklist[_restricted[i]] = true; } return true; }
function restrict(address [] _restricted) external onlyAuthorized returns (bool) { for (uint i = 0; i < _restricted.length; i++) { blacklist[_restricted[i]] = true; } return true; }
44,981
180
// return The associated Initial Reporter or a Dispute Crowdsourcer contract for the current tentative winning payout /
function getWinningReportingParticipant() public view returns (IReportingParticipant) { return participants[participants.length-1]; }
function getWinningReportingParticipant() public view returns (IReportingParticipant) { return participants[participants.length-1]; }
4,355
19
// ID for the Axon (ERC721 token ID)
uint256 axonId;
uint256 axonId;
15,746
2
// AErc20Interface Aegis /
contract AErc20Interface is AErc20Common { function mint(uint _mintAmount) external returns (uint); function redeem(uint _redeemTokens) external returns (uint); function redeemUnderlying(uint _redeemAmount) external returns (uint); function borrow(uint _borrowAmount) external returns (uint); functio...
contract AErc20Interface is AErc20Common { function mint(uint _mintAmount) external returns (uint); function redeem(uint _redeemTokens) external returns (uint); function redeemUnderlying(uint _redeemAmount) external returns (uint); function borrow(uint _borrowAmount) external returns (uint); functio...
20,936
29
// Buy insurance for a flight/
function buy ( address airline, address passenger, string flight, uint256 amount, uint256 payout ) external ...
function buy ( address airline, address passenger, string flight, uint256 amount, uint256 payout ) external ...
16,756
199
// Event fired when a new digital media is created. No point in returning printIndex since its always zero when created.
event DigitalMediaCreateEvent( uint256 id, address creator, uint32 totalSupply, uint32 royalty, bool immutableMedia, string metadataPath); event DigitalMediaReleaseCreateEvent( uint256 id,
event DigitalMediaCreateEvent( uint256 id, address creator, uint32 totalSupply, uint32 royalty, bool immutableMedia, string metadataPath); event DigitalMediaReleaseCreateEvent( uint256 id,
54,146
370
// Returns the minimum price available
function _getWantTokenPrice() internal view returns (uint256) { // Use price from spotter as base uint256 minPrice = MakerDaiDelegateLib.getSpotPrice(ilk); // Peek the OSM to get current price try wantToUSDOSMProxy.read() returns ( uint256 current, bool curre...
function _getWantTokenPrice() internal view returns (uint256) { // Use price from spotter as base uint256 minPrice = MakerDaiDelegateLib.getSpotPrice(ilk); // Peek the OSM to get current price try wantToUSDOSMProxy.read() returns ( uint256 current, bool curre...
3,435
78
// Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier/ Address of lock flag variable./ Flag is placed at random memory location to not interfere with Storage contract.
uint constant private LOCK_FLAG_ADDRESS = 0x8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf4; // keccak256("ReentrancyGuard") - 1; function initializeReentrancyGuard () internal {
uint constant private LOCK_FLAG_ADDRESS = 0x8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf4; // keccak256("ReentrancyGuard") - 1; function initializeReentrancyGuard () internal {
22,406
109
// Get the current action state of an action by its `actionInfo` struct./actionInfo Data required to create an action./ return The current action state of the action.
function getActionState(ActionInfo calldata actionInfo) public view returns (ActionState) { // We don't need an explicit check on the action ID to make sure it exists, because if the // action does not exist, the expected payload hash from storage will be `bytes32(0)`, so // bypassing this check by provid...
function getActionState(ActionInfo calldata actionInfo) public view returns (ActionState) { // We don't need an explicit check on the action ID to make sure it exists, because if the // action does not exist, the expected payload hash from storage will be `bytes32(0)`, so // bypassing this check by provid...
33,760
20
// block when the match ended
uint256 endBlock;
uint256 endBlock;
32,379
112
// Add new token gauge
function addGauge(address _token) external onlyBenevolent { require(gauges[_token] == address(0x0), "exists"); gauges[_token] = address(new GaugeV2(_token, governance)); _tokens.push(_token); }
function addGauge(address _token) external onlyBenevolent { require(gauges[_token] == address(0x0), "exists"); gauges[_token] = address(new GaugeV2(_token, governance)); _tokens.push(_token); }
630
22
// The token which is already deployed to the network
ERC20Basic public token; event AirDroppedTokens(uint256 addressCount); event AirDrop(address indexed receiver, uint256 total);
ERC20Basic public token; event AirDroppedTokens(uint256 addressCount); event AirDrop(address indexed receiver, uint256 total);
43,626
31
// Hashes a commitment /
function hashCommitment(CommitmentPreimage memory _commitmentPreimage) public pure returns (bytes32)
function hashCommitment(CommitmentPreimage memory _commitmentPreimage) public pure returns (bytes32)
17,290
19
// query the available amount of LINK to withdraw by msg.sender /
function withdrawable() external view returns (uint256);
function withdrawable() external view returns (uint256);
21,060
27
// nftID ID of nft token /
function getNft(uint32 nftID) external override responsible view returns(Punk, address collector) { return {flag: 64} (tokens[nftID], nftOwner[nftID]); }
function getNft(uint32 nftID) external override responsible view returns(Punk, address collector) { return {flag: 64} (tokens[nftID], nftOwner[nftID]); }
26,166
274
// Check if `account` has operator role
require(hasRole(OPERATOR_ROLE, account), "StakePool#removeOperator: NO_OPERATOR_ROLE"); revokeRole(OPERATOR_ROLE, account);
require(hasRole(OPERATOR_ROLE, account), "StakePool#removeOperator: NO_OPERATOR_ROLE"); revokeRole(OPERATOR_ROLE, account);
26,834
7
// get user and balance
address a = dataAddress[__i(i, "tokenHolder")]; uint256 bal = dataUint256[__a(a, "tokenBalance")];
address a = dataAddress[__i(i, "tokenHolder")]; uint256 bal = dataUint256[__a(a, "tokenBalance")];
47,060
98
// Recipient is a module, governed by mStable governance /
{ rewardsDistributor = _rewardsDistributor; }
{ rewardsDistributor = _rewardsDistributor; }
5,461
3
// Store the mapping between the wearable NFT tokenId and the parent NFT tokenId
mapping(uint256 => uint256) public wearableTokenIdToParentTokenId;
mapping(uint256 => uint256) public wearableTokenIdToParentTokenId;
2,813
7
// Returns the time when the tokens are released in seconds since Unix epoch (i.e. Unix timestamp). /
function releaseTime() public view virtual returns (uint256) { return _releaseTime; }
function releaseTime() public view virtual returns (uint256) { return _releaseTime; }
25,531
6
// Addresses can set their name when composing jingles
function setAuthorName(string _name) public { authors[msg.sender] = _name; }
function setAuthorName(string _name) public { authors[msg.sender] = _name; }
3,271
76
// Withdraw available ethers into beneficiary account, serves as a safety, should never be needed /
function ownerSafeWithdrawal() external onlyOwner { beneficiary.transfer(this.balance); }
function ownerSafeWithdrawal() external onlyOwner { beneficiary.transfer(this.balance); }
17,537
344
// add unlent balance
total = total.add(_contractBalanceOf(token));
total = total.add(_contractBalanceOf(token));
22,589
215
// Starts at 0 and is set to the block at which the objection period ends when the objection period is initiated
uint64 objectionPeriodEndBlock;
uint64 objectionPeriodEndBlock;
4,956
6
// Burn address
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
241
40
// Mapping of index of component -> user address -> balance
mapping(uint => mapping(address => uint)) internal unredeemedBalances;
mapping(uint => mapping(address => uint)) internal unredeemedBalances;
32,729
1
// this runs when the contract is executed /
constructor() public { // initialize the variables }
constructor() public { // initialize the variables }
46,239
33
// Save the miner and value received
self.currentMiners[self.uintVars[keccak256("slotProgress")]].value = _value; self.currentMiners[self.uintVars[keccak256("slotProgress")]].miner = msg.sender;
self.currentMiners[self.uintVars[keccak256("slotProgress")]].value = _value; self.currentMiners[self.uintVars[keccak256("slotProgress")]].miner = msg.sender;
11,785
4
// mapping of users' address and their upline address,/ which means the value address that referred the key address./ user should be invited by unique upline address,/ and user can invite many other addresses.
mapping(address => address) public usersUpline;
mapping(address => address) public usersUpline;
35,585
19
// emit an event to announce the deal has been closed
emit DealClosed(_d);
emit DealClosed(_d);
30,698
9
// Note: this could be made external in a utility contract if addressCache was made public (used for deployment)
function isResolverCached(AddressResolver _resolver) external view returns (bool) { if (resolver != _resolver) { return false; } // otherwise, check everything for (uint i = 0; i < resolverAddressesRequired.length; i++) { bytes32 name = resolverAddressesRequi...
function isResolverCached(AddressResolver _resolver) external view returns (bool) { if (resolver != _resolver) { return false; } // otherwise, check everything for (uint i = 0; i < resolverAddressesRequired.length; i++) { bytes32 name = resolverAddressesRequi...
39,283
41
// Registers a new version with its implementation address version representing the version name of the new implementation to be registered implementation representing the address of the new implementation to be registered /
function addVersion( string contractName, string version, address implementation ) public onlyCoreDev
function addVersion( string contractName, string version, address implementation ) public onlyCoreDev
37,538