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
72
// Add the NFT to the trader's purchased list
if (nfts[_nftId[i]].owner != address(0)) { removePurchasedNFT(nfts[_nftId[i]].owner, _nftId[i]); }
if (nfts[_nftId[i]].owner != address(0)) { removePurchasedNFT(nfts[_nftId[i]].owner, _nftId[i]); }
8,889
129
// Creates a new pool & then initializes the pool/_token0 The contract address of token0 of the pool/_token1 The contract address of token1 of the pool/data Necessary data needed to create pool/ In data we will provide the `fee` amount of the v3 pool for the specified token pair,/ also `sqrtPriceX96` The initial square...
function createPair( address _token0, address _token1, bytes memory data ) external returns (address _pool);
function createPair( address _token0, address _token1, bytes memory data ) external returns (address _pool);
59,192
3
// Mint a token /
function mintOne(address, uint256) external payable override { revert("not implemented"); }
function mintOne(address, uint256) external payable override { revert("not implemented"); }
37,886
113
// Donate a skin to player. Only COO can operate
function donateSkin(uint128 specifiedAppearance, address donee) external whenNotPaused onlyCOO { Skin memory newSkin = Skin({appearance: specifiedAppearance, cooldownEndTime: uint64(now), mixingWithId: 0}); skins[nextSkinId] = newSkin; skinIdToOwner[nextSkinId] = donee; isOnSale[next...
function donateSkin(uint128 specifiedAppearance, address donee) external whenNotPaused onlyCOO { Skin memory newSkin = Skin({appearance: specifiedAppearance, cooldownEndTime: uint64(now), mixingWithId: 0}); skins[nextSkinId] = newSkin; skinIdToOwner[nextSkinId] = donee; isOnSale[next...
54,238
8
// Approve module in ZMM
alice.setApprovalForModule(address(module), true);
alice.setApprovalForModule(address(module), true);
45,660
14
// send refund back to sender
if (!msg.sender.send(amount_to_refund)) throw;
if (!msg.sender.send(amount_to_refund)) throw;
32,273
373
// Emitted when mint is paused/unpaused by admin or pause guardian
event MintPaused(address iToken, bool paused); function _setMintPaused(address iToken, bool paused) external; function _setAllMintPaused(bool paused) external;
event MintPaused(address iToken, bool paused); function _setMintPaused(address iToken, bool paused) external; function _setAllMintPaused(bool paused) external;
40,619
48
// Mints OffsetsnumberOfNFTs uint256 number of NFTs to mint /
function mintNFT(uint256 numberOfNFTs) public payable { require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended"); require(numberOfNFTs > 0, "numberOfNFTs cannot be 0"); if (totalSupply() < 10) { require( numberOfNFTs == 1, "You may not col...
function mintNFT(uint256 numberOfNFTs) public payable { require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended"); require(numberOfNFTs > 0, "numberOfNFTs cannot be 0"); if (totalSupply() < 10) { require( numberOfNFTs == 1, "You may not col...
23,161
49
// Minimum Deposit in USD cents
uint256 public constant minContributionUSDc = 1000;
uint256 public constant minContributionUSDc = 1000;
45,567
41
// ========== RESTRICTED FUNCTIONS (YPOOL_WORKER) ========== //Fulfill a swap request for a user by YPool worker/ Closing a swap MUST be performed on target chain and only by YPool worker/swapDesc is the swap info for swapping on DEX on target chain, not the info of the swap request user initiated on source chain/swapD...
function closeSwap( IAggregator.SwapDescription calldata swapDesc, bytes memory aggregatorData, uint32 fromChainId, uint256 fromSwapId
function closeSwap( IAggregator.SwapDescription calldata swapDesc, bytes memory aggregatorData, uint32 fromChainId, uint256 fromSwapId
35,477
14
// Returns all the chat messages communicated in a channel
function readMessage(address friend_key) external view returns(message[] memory) { bytes32 chatCode = _getChatCode(msg.sender, friend_key); return allMessages[chatCode]; }
function readMessage(address friend_key) external view returns(message[] memory) { bytes32 chatCode = _getChatCode(msg.sender, friend_key); return allMessages[chatCode]; }
37,949
11
// Pause redeems until unpause is called. this pauses the whole contract. /
function pause() external override onlyOwner { _pause(); }
function pause() external override onlyOwner { _pause(); }
17,342
0
// Calculate the key for a staking incentive/key The components used to compute the incentive identifier/ return incentiveId The identifier for the incentive
function compute(IUniswapV3Staker.IncentiveKey memory key) internal pure returns (bytes32 incentiveId) { return keccak256(abi.encode(key)); }
function compute(IUniswapV3Staker.IncentiveKey memory key) internal pure returns (bytes32 incentiveId) { return keccak256(abi.encode(key)); }
43,237
17
// Obtain the project goal./projectId Id of the project./ return goal amount to fund in wei.
function getProjectGoal(uint projectId) public view validProject(projectId) returns (uint){ return projects[projectId].goal; }
function getProjectGoal(uint projectId) public view validProject(projectId) returns (uint){ return projects[projectId].goal; }
4,098
81
// getter function for long term lockup wallet address /
function longTermLockUp() public view override returns(address) { return _longTermLockUp; }
function longTermLockUp() public view override returns(address) { return _longTermLockUp; }
26,074
39
// Apply order fill fraction to offer item end amount.
uint256 endAmount = _getFraction( numerator, denominator, offerItem.endAmount );
uint256 endAmount = _getFraction( numerator, denominator, offerItem.endAmount );
33,151
5
// Owners are the Masters or the Academy. Only them can add projects in portfolio, because they validate the project before add it.
require (!compareStrings(projectName, ""), "portfolio: invalid name"); require (!(projectAddress == address(0x0)), "portfolio: invalid address"); require (projectList.exists(projectName), "portfolio: project not exists"); require (projectList.isActive(projectName), "portfolio: project no...
require (!compareStrings(projectName, ""), "portfolio: invalid name"); require (!(projectAddress == address(0x0)), "portfolio: invalid address"); require (projectList.exists(projectName), "portfolio: project not exists"); require (projectList.isActive(projectName), "portfolio: project no...
10,494
6
// Testing retrieval of all guests
function testGetGuestAddressByItemIdInArray() public { // Store guests in memory rather than contract's storage address[16] memory guests = registry.getGuests(); Assert.equal(guests[expectedItemId], expectedGuest, "Guests claiming the expected item should be this contract"); }
function testGetGuestAddressByItemIdInArray() public { // Store guests in memory rather than contract's storage address[16] memory guests = registry.getGuests(); Assert.equal(guests[expectedItemId], expectedGuest, "Guests claiming the expected item should be this contract"); }
30,976
2
// function withdraw( uint _value
// ) onlyOwner payable public returns(bool) { // require(address(this).balance >= _value); // owner.transfer(_value); // return true; // }
// ) onlyOwner payable public returns(bool) { // require(address(this).balance >= _value); // owner.transfer(_value); // return true; // }
41,809
311
// Store challenge
uint256 challengeId = nextChallengeId++; Challenge storage challenge = challenges[challengeId]; challenge.actionId = _actionId; challenge.challenger = _challenger; challenge.endDate = getTimestamp64().add(_requirement.challengeDuration); challenge.context = _context; ...
uint256 challengeId = nextChallengeId++; Challenge storage challenge = challenges[challengeId]; challenge.actionId = _actionId; challenge.challenger = _challenger; challenge.endDate = getTimestamp64().add(_requirement.challengeDuration); challenge.context = _context; ...
58,264
8
// Executes a transfer operation in the context of Stoa.// asset The asset to transfer./ amountThe amount to transfer./ recipient The recipient of the transfer.
function _transfer( address asset, uint256 amount, address recipient
function _transfer( address asset, uint256 amount, address recipient
10,648
5
// Dividents for bonds security token
contract Dividents is Governance { using SafeMath for uint256; //map user->token->config mapping(address => mapping(address => Config)) public dvDetails; uint256 public INTREVAL = 1 weeks; ///config struct of dividents struct Config { address token; uint256 periods;//total period...
contract Dividents is Governance { using SafeMath for uint256; //map user->token->config mapping(address => mapping(address => Config)) public dvDetails; uint256 public INTREVAL = 1 weeks; ///config struct of dividents struct Config { address token; uint256 periods;//total period...
25,707
14
// See {IERC721Market-offerForSaleToAddress}.
function offerForSaleToAddress( uint256 index, uint256 minSalePriceInWei, address toAddress ) public onlyOwnerOf(index) onlyValidIndex(index) { _offerForSale(index, minSalePriceInWei, toAddress); }
function offerForSaleToAddress( uint256 index, uint256 minSalePriceInWei, address toAddress ) public onlyOwnerOf(index) onlyValidIndex(index) { _offerForSale(index, minSalePriceInWei, toAddress); }
40,434
0
// Expiration Mask: predicate := PredicateHelper.timestampBelow(deadline) Maker Nonce: predicate := this.nonceEquals(makerAddress, makerNonce)
event OrderFilled( address indexed maker, bytes32 orderHash, uint256 remaining ); event OrderFilledRFQ( bytes32 orderHash, uint256 makingAmount
event OrderFilled( address indexed maker, bytes32 orderHash, uint256 remaining ); event OrderFilledRFQ( bytes32 orderHash, uint256 makingAmount
12,860
46
// keccak256(MessageSent(bytes))
bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;
bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;
53,319
2,182
// 1093
entry "authentiquely" : ENG_ADVERB
entry "authentiquely" : ENG_ADVERB
21,929
25
// make sure submissions are open
require(!submissionsPaused, "Submissions are paused. Please check back later.");
require(!submissionsPaused, "Submissions are paused. Please check back later.");
35,416
3
// TODO change to interface if that ever gets added to the parser
contract RngRequester { function acceptRandom(bytes32 id, bytes result); }
contract RngRequester { function acceptRandom(bytes32 id, bytes result); }
7,724
469
// See {Governor-_quorumReached}. In this module, only forVotes count toward the quorum. /
function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) { ProposalDetails storage details = _proposalDetails[proposalId]; return quorum(proposalSnapshot(proposalId)) <= details.forVotes; }
function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) { ProposalDetails storage details = _proposalDetails[proposalId]; return quorum(proposalSnapshot(proposalId)) <= details.forVotes; }
20,275
49
// providing a counter dispute proof with higher nonce
require(!channels[ch_key].dispute_started_by_left == msg.sender < params.partner, "Only your partner can counter dispute"); require(channels[ch_key].dispute_nonce < params.dispute_nonce, "New nonce must be greater"); require(params.entries_hash == keccak256(abi.encode(params.entries)), "Invalid entr...
require(!channels[ch_key].dispute_started_by_left == msg.sender < params.partner, "Only your partner can counter dispute"); require(channels[ch_key].dispute_nonce < params.dispute_nonce, "New nonce must be greater"); require(params.entries_hash == keccak256(abi.encode(params.entries)), "Invalid entr...
40,022
9
// Returns tuple containing last valid price and timestamp, as well as status code of latest update/ request that got posted to the Witnet Request Board./ return _lastPrice Last valid price reported back from the Witnet oracle./ return _lastTimestamp EVM-timestamp of the last valid price./ return _lastDrTxHash Hash of ...
function lastValue() external view virtual override returns ( int _lastPrice, uint _lastTimestamp, bytes32 _lastDrTxHash, uint _latestUpdateStatus )
function lastValue() external view virtual override returns ( int _lastPrice, uint _lastTimestamp, bytes32 _lastDrTxHash, uint _latestUpdateStatus )
22,151
0
// emit ERC721Received(_operator, _from, _tokenId, _data, gasleft());
return ERC721_RECEIVED_DRAFT;
return ERC721_RECEIVED_DRAFT;
22,607
9
// transfer confirm when `to` receive assets successfully.
function transferInterChainConfirm(uint transId) public returns(bool) { if (transferMap[transId].id == 0) { retLog(10019); return false; } Transfer storage transfer = transferMap[transId]; UserInfo storage fromUser = userMap[transfer.from]; fromUser.unAvailAssets -= transfer.amount; transfer.status...
function transferInterChainConfirm(uint transId) public returns(bool) { if (transferMap[transId].id == 0) { retLog(10019); return false; } Transfer storage transfer = transferMap[transId]; UserInfo storage fromUser = userMap[transfer.from]; fromUser.unAvailAssets -= transfer.amount; transfer.status...
27,616
5
// Function to convert the candidateList to a string returns eg - modi, mamta, rahul /
function concatCandidates() private returns(string){ for(uint i=0; i<candidateList.length; i++){ candidates = string(abi.encodePacked(candidates, bytes32ToString(candidateList[i]),",")); } return string(candidates); }
function concatCandidates() private returns(string){ for(uint i=0; i<candidateList.length; i++){ candidates = string(abi.encodePacked(candidates, bytes32ToString(candidateList[i]),",")); } return string(candidates); }
27,013
11
// transfer the amount to the follower
payable(follower).transfer(msg.value); emit Follow(msg.sender, follower);
payable(follower).transfer(msg.value); emit Follow(msg.sender, follower);
17,754
39
// solium-disable-next-line arg-overflow
safeTransferFrom(_from, _to, _tokenId, "");
safeTransferFrom(_from, _to, _tokenId, "");
17,829
4
// The utilization point at which the jump multiplier is applied /
uint public kink;
uint public kink;
33,302
23
// The function containing the painting of a heart on the NFT. The token is the canvas.
function heart() public { require(false,"nope"); assembly{ sstore(69, 0xa00000a00000a00000ffffffffffffffffffa00000a00000a00000) sstore(69, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) sstore(69, 0xfffffffffffffffffffffffffffffffffffffffffffffff...
function heart() public { require(false,"nope"); assembly{ sstore(69, 0xa00000a00000a00000ffffffffffffffffffa00000a00000a00000) sstore(69, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) sstore(69, 0xfffffffffffffffffffffffffffffffffffffffffffffff...
20,799
16
// Cancels a swap offer for a token /
function cancelSwapOffer() public { require(offers[msg.sender].from != address(0), "No offer to cancel."); uint256 id = offers[msg.sender].id; uint256 forId = offers[msg.sender].forId; delete offers[msg.sender]; swapOfferAddresses.remove(msg.sender); emit SwapOffer...
function cancelSwapOffer() public { require(offers[msg.sender].from != address(0), "No offer to cancel."); uint256 id = offers[msg.sender].id; uint256 forId = offers[msg.sender].forId; delete offers[msg.sender]; swapOfferAddresses.remove(msg.sender); emit SwapOffer...
9,931
2
// fees in the live version the; enlistingFee will be 0.01 ether and the wageringFee will be 0.005 ether
uint256 constant enlistingFee = 0; uint256 constant wageringFee = 0;
uint256 constant enlistingFee = 0; uint256 constant wageringFee = 0;
48,446
10
// The contract has 2 stages: 1 - The initial state. The owner is able to add addresses to the whitelist, and any whitelisted addresses can deposit or withdraw eth to the contract. 2 - The eth is sent from the contract to the receiver. Unused eth can be claimed by contributors immediately. Once tokens are sent to the c...
uint8 public contractStage = 1;
uint8 public contractStage = 1;
25,755
14
// minimalWbtcPrice 为 btc / eth 价格. 当前价格下输入30即可
function distributeReward(uint256 minimalWbtcPrice) external onlyOperator { uint256 totalWbtc = 0; for (uint256 i=0; i<lpStakings.length; i++) { address lpStaking = lpStakings[i]; address rewardToken = stakingRewardToken[lpStaking]; uint256 accumulateFee = ILpStak...
function distributeReward(uint256 minimalWbtcPrice) external onlyOperator { uint256 totalWbtc = 0; for (uint256 i=0; i<lpStakings.length; i++) { address lpStaking = lpStakings[i]; address rewardToken = stakingRewardToken[lpStaking]; uint256 accumulateFee = ILpStak...
752
68
// This function is called to check that a merkle proof is a valid merkle proofParam: _merkleProof => An array of bytes32 that represent the "proof" that the address is on the merkle treereturns(bool) => The bool saying whether the proof is verified or not
function checkValidity(bytes32[] calldata _merkleProof) public view returns (bool)
function checkValidity(bytes32[] calldata _merkleProof) public view returns (bool)
37,745
13
// liquidity balance variable
uint256 private _tTotalForLiquidity; uint256 private _rTotalForLiquidity; event LiquifyEnabledUpdated(bool enabled); event Liquify(uint256 tokensAdded, uint256 ethAdded); event BurnFeeChanged(uint256 percentage); event CashBackFeeChanged(uint256 percentage); event NFTCashBackChanged(uint256...
uint256 private _tTotalForLiquidity; uint256 private _rTotalForLiquidity; event LiquifyEnabledUpdated(bool enabled); event Liquify(uint256 tokensAdded, uint256 ethAdded); event BurnFeeChanged(uint256 percentage); event CashBackFeeChanged(uint256 percentage); event NFTCashBackChanged(uint256...
40,926
4
// Mint reserve tokens. to Recipient address. numberToMint Quantity of tokens to mint. /
function devMint(address to, uint256 numberToMint) external onlyRole(SUPPORT_ROLE) { uint256 reserveSupply_ = reserveSupply; require(numberToMint <= reserveSupply_, "Exceeds reserve limit"); reserveSupply = reserveSupply_ - numberToMint; _mintTokens(to, numberToMint); }
function devMint(address to, uint256 numberToMint) external onlyRole(SUPPORT_ROLE) { uint256 reserveSupply_ = reserveSupply; require(numberToMint <= reserveSupply_, "Exceeds reserve limit"); reserveSupply = reserveSupply_ - numberToMint; _mintTokens(to, numberToMint); }
34,602
262
// Withdraw LP tokens from liquidity mining pool and harvests rewards/incentives address - Liquidity mining pool/value uint - value to withdraw
function withdrawAndHarvest(address incentives, uint value) external { GebIncentivesLike incentivesContract = GebIncentivesLike(incentives); DSTokenLike rewardToken = DSTokenLike(incentivesContract.rewardsToken()); DSTokenLike lpToken = DSTokenLike(incentivesContract.stakingToken()); ...
function withdrawAndHarvest(address incentives, uint value) external { GebIncentivesLike incentivesContract = GebIncentivesLike(incentives); DSTokenLike rewardToken = DSTokenLike(incentivesContract.rewardsToken()); DSTokenLike lpToken = DSTokenLike(incentivesContract.stakingToken()); ...
38,228
64
// Remove staker
delete _stakers[sender]; emit StakerRemoved(sender);
delete _stakers[sender]; emit StakerRemoved(sender);
35,420
360
// Make royalty fee claimable and add to total
_claimable[minter] += minterFee; _totalClaimable += minterFee;
_claimable[minter] += minterFee; _totalClaimable += minterFee;
2,603
1
// Per product collateral state
mapping(IProduct => OptimisticLedger) private _products;
mapping(IProduct => OptimisticLedger) private _products;
21,463
9
// Add a wallet address to an existing contact
function addWalletToContact(string memory _name, address _wallet) public onlyOwner { // Add the wallet to the contact contacts[_name].wallets.push(_wallet); }
function addWalletToContact(string memory _name, address _wallet) public onlyOwner { // Add the wallet to the contact contacts[_name].wallets.push(_wallet); }
17,890
4
// Returns current floor value /
function floor() public view returns (uint256) { if (currentSupply == 0) { return address(this).balance; } return address(this).balance / currentSupply; }
function floor() public view returns (uint256) { if (currentSupply == 0) { return address(this).balance; } return address(this).balance / currentSupply; }
16,294
172
// verifySignature checks the the provided signature matches the/ provided parameters. Returns a 4-byte value as defined by ERC1271.
function isValidSignature(bytes32 sigHash, bytes calldata signature) external view override returns (bytes4) { address mintAuthority_ = getMintAuthority(); require(mintAuthority_ != address(0x0), "SignatureVerifier: mintAuthority not initialized"); if (mintAuthority_ == ECDSA.recover(sigHash...
function isValidSignature(bytes32 sigHash, bytes calldata signature) external view override returns (bytes4) { address mintAuthority_ = getMintAuthority(); require(mintAuthority_ != address(0x0), "SignatureVerifier: mintAuthority not initialized"); if (mintAuthority_ == ECDSA.recover(sigHash...
70,221
3
// hash Hash to be checked. account Address of the hash will be checked for.return True if hash has already been used by this account address. /
function isHashUsed(bytes32 hash, address account) public view returns (bool) { return isHashUsed_[hash][account]; }
function isHashUsed(bytes32 hash, address account) public view returns (bool) { return isHashUsed_[hash][account]; }
9,650
54
// Returns the list of active tiers /
function getActiveTiers() public view returns (uint256[] memory) { uint256[] memory tiers = new uint256[](getNActiveTiers()); uint256 index = 0; for(uint256 tier = 0 ; tier < _nTiers ; tier++) { if(isActiveTier(tier)) { tiers[index] = tier; index+...
function getActiveTiers() public view returns (uint256[] memory) { uint256[] memory tiers = new uint256[](getNActiveTiers()); uint256 index = 0; for(uint256 tier = 0 ; tier < _nTiers ; tier++) { if(isActiveTier(tier)) { tiers[index] = tier; index+...
18,561
32
// Burn price ratio is 0.9
uint256 constant burn_ratio = 9 * fmk / 10;
uint256 constant burn_ratio = 9 * fmk / 10;
41,655
276
// We use this to save work computing terms
int256 realTerm = REAL_ONE; for (int216 n = 0; n < maxIterations; n++) {
int256 realTerm = REAL_ONE; for (int216 n = 0; n < maxIterations; n++) {
37,136
114
// Standard Burnable Token Adds burnFrom method to ERC20 implementations /
contract StandardBurnableToken is BurnableToken, StandardToken { /** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param _from address The address which you want to send tokens from * @param _value uint256 The amount of token to be burned */ fu...
contract StandardBurnableToken is BurnableToken, StandardToken { /** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param _from address The address which you want to send tokens from * @param _value uint256 The amount of token to be burned */ fu...
32,234
6
// bytes executeFuncSignature
ISygmaAdapter(address(0)).storeHashes.selector,
ISygmaAdapter(address(0)).storeHashes.selector,
24,540
39
// reference to Pytheas for checking that a colonist has mined enoughrEON to make an attempt as well as pay from this amount, either thecurrent mint cost ona successful pirate mint, or pirate tax on a failed attempt.
IPytheas public pytheas;
IPytheas public pytheas;
49,266
9
// status functions /
function getBalance(ERC20 token) public view returns(uint) { if (token == ETH_TOKEN_ADDRESS) return this.balance; else { address wallet = tokenWallet[token]; uint balanceOfWallet = token.balanceOf(wallet); uint allowanceOfWallet = token.allowance(walle...
function getBalance(ERC20 token) public view returns(uint) { if (token == ETH_TOKEN_ADDRESS) return this.balance; else { address wallet = tokenWallet[token]; uint balanceOfWallet = token.balanceOf(wallet); uint allowanceOfWallet = token.allowance(walle...
7,813
4
// 0x80ac58cd ===bytes4(keccak256('balanceOf(address)')) ^bytes4(keccak256('ownerOf(uint256)')) ^bytes4(keccak256('approve(address,uint256)')) ^bytes4(keccak256('getApproved(uint256)')) ^bytes4(keccak256('setApprovalForAll(address,bool)')) ^bytes4(keccak256('isApprovedForAll(address,address)')) ^bytes4(keccak256('trans...
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
25,735
8
// Check that the goal is a positive number
require(_goal > 0, "The goal must be a positive number");
require(_goal > 0, "The goal must be a positive number");
25,775
43
// If we check and the interest rate is no longer negative then we allow normal 1 to 1 withdraws [even if the speedbump was hit less than 48 hours ago, to prevent possible griefing]
if (holdings < localSupply) {
if (holdings < localSupply) {
5,085
50
// ------------------------------------------------------------------------------------------------ Events ------------------------------------------------------------------------------------------------
event LogIncomeReceived(address indexed _sender, uint _paymentAmount); event LogIncomeCollected(uint _block, address _address, uint _amount);
event LogIncomeReceived(address indexed _sender, uint _paymentAmount); event LogIncomeCollected(uint _block, address _address, uint _amount);
17,604
2
// Set deployer as an immutable controller that can update channel statuses.
address private immutable _controller;
address private immutable _controller;
33,409
49
// Accounting storage mapping account addresses to how much COMP they owe the protocol.
mapping(address => uint) public compReceivable;
mapping(address => uint) public compReceivable;
17,064
5
// Canonical NaN value. /
bytes16 private constant NaN = 0x7FFF8000000000000000000000000000;
bytes16 private constant NaN = 0x7FFF8000000000000000000000000000;
23,782
3
// Domain getters - you can also get all Domain data by calling the auto-generated domains(domainName) method
function getDomainHolder(string calldata _domainName) public override view returns(address) { return domains[strings.lower(_domainName)].holder; }
function getDomainHolder(string calldata _domainName) public override view returns(address) { return domains[strings.lower(_domainName)].holder; }
20,160
218
// Both arrays are ordered:/
uint[] public probabilities; uint[] public multipliers; uint public totalAmountWagered; event LOG_newSpinsContainer(bytes32 myid, address playerAddress, uint amountWagered, uint nSpins); event LOG_SpinExecuted(bytes32 myid, address playerAddress, uint spinIndex, uint numberDrawn, uint gro...
uint[] public probabilities; uint[] public multipliers; uint public totalAmountWagered; event LOG_newSpinsContainer(bytes32 myid, address playerAddress, uint amountWagered, uint nSpins); event LOG_SpinExecuted(bytes32 myid, address playerAddress, uint spinIndex, uint numberDrawn, uint gro...
32,718
79
// when buy
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); }
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); }
30,961
80
// check that contract have enough balance for exchange and protocol fee
require(getBalance(_exData.srcAddr) >= _exData.srcAmount, ERR_SRC_AMOUNT); require(getBalance(KYBER_ETH_ADDRESS) >= _exData.offchainData.protocolFee, ERR_PROTOCOL_FEE); ERC20(_exData.srcAddr).safeApprove(_exData.offchainData.allowanceTarget, _exData.srcAmount);
require(getBalance(_exData.srcAddr) >= _exData.srcAmount, ERR_SRC_AMOUNT); require(getBalance(KYBER_ETH_ADDRESS) >= _exData.offchainData.protocolFee, ERR_PROTOCOL_FEE); ERC20(_exData.srcAddr).safeApprove(_exData.offchainData.allowanceTarget, _exData.srcAmount);
15,390
13
// ------------------------------------------------------------------------ Complete token sale ------------------------------------------------------------------------
function setComplete(bool _completed) public { require(msg.sender == owner); completed = _completed; }
function setComplete(bool _completed) public { require(msg.sender == owner); completed = _completed; }
25,495
21
// participants for the daily period
mapping(uint => address[]) participantsDaily;
mapping(uint => address[]) participantsDaily;
36,848
27
// if (for some reason) token is already staked
if (since[tokenId] > 0
if (since[tokenId] > 0
50,544
46
// Tokens for early contributors, should be allocated by function
balances[0] = 62500000e18; // 62.5M
balances[0] = 62500000e18; // 62.5M
20,214
36
// Calculate the amount of tokens now based on inflation rate
uint256 newTokens = _inflationCalculate(intervalsSinceLastMint);
uint256 newTokens = _inflationCalculate(intervalsSinceLastMint);
44,725
4
// shares Number of rewards shares to redeem for VISRto Address to which redeemed pool assets are sentfrom Address from which liquidity tokens are sent return rewards Amount of visr redeemed by the submitted liquidity tokens
function withdraw( uint256 shares, address to, address from
function withdraw( uint256 shares, address to, address from
29,713
33
// Dequeue verified inbound roots and insert them into the aggregator tree. Will dequeue a fixed maximum amount of roots to prevent out of gas errors. As such, thismethod is public and separate from `propagate` so we can curtail an overloaded queue as needed. Reverts if no verified inbound roots are found. return bytes...
function dequeue() public whenNotPaused returns (bytes32, uint256) { // Get all of the verified roots from the queue. bytes32[] memory _verifiedInboundRoots = pendingInboundRoots.dequeueVerified(delayBlocks, DEQUEUE_MAX); // If there's nothing dequeued, just return the root and count. if (_verifiedIn...
function dequeue() public whenNotPaused returns (bytes32, uint256) { // Get all of the verified roots from the queue. bytes32[] memory _verifiedInboundRoots = pendingInboundRoots.dequeueVerified(delayBlocks, DEQUEUE_MAX); // If there's nothing dequeued, just return the root and count. if (_verifiedIn...
38,267
0
// Emitted when `tokenId` token is transferred from `from` to `to`./
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
15,628
32
// Make sure there aren't already (or will be) too many swap tokens
require((ERC20(swap_token_address).balanceOf(address(this)) + token_amount) <= swap_token_cap[swap_token_address], "Swap token cap reached");
require((ERC20(swap_token_address).balanceOf(address(this)) + token_amount) <= swap_token_cap[swap_token_address], "Swap token cap reached");
9,955
422
// Gets current Balance of token i, Bi, and weight of token i, Wi, from BPool.
uint256 tokenBalance = bPool.getBalance(erc20); uint256 tokenWeight = bPool.getDenormalizedWeight(erc20); bool xfer = IERC20(erc20).transferFrom(from, address(this), amount); require(xfer, "ERR_ERC20_FALSE"); bPool.rebind( erc20, BalancerSafeMath.badd(tok...
uint256 tokenBalance = bPool.getBalance(erc20); uint256 tokenWeight = bPool.getDenormalizedWeight(erc20); bool xfer = IERC20(erc20).transferFrom(from, address(this), amount); require(xfer, "ERR_ERC20_FALSE"); bPool.rebind( erc20, BalancerSafeMath.badd(tok...
16,274
31
// ClaimsProxy dYdXContract which claims DYDX rewards from multiple contracts on behalf of a user.Requires the following permissions: - Set as the CLAIMS_PROXY on the SafetyModuleV1 contract. - Has role CLAIM_OPERATOR_ROLE on the LiquidityStakingV1 contract. - Has role CLAIM_OPERATOR_ROLE on the MerkleDistributorV1 con...
contract ClaimsProxy { using SafeMath for uint256; // ============ Constants ============ ISafetyModuleV1 public immutable SAFETY_MODULE; ILiquidityStakingV1 public immutable LIQUIDITY_STAKING; IMerkleDistributorV1 public immutable MERKLE_DISTRIBUTOR; ITreasuryVester public immutable REWARDS_TREASURY_VEST...
contract ClaimsProxy { using SafeMath for uint256; // ============ Constants ============ ISafetyModuleV1 public immutable SAFETY_MODULE; ILiquidityStakingV1 public immutable LIQUIDITY_STAKING; IMerkleDistributorV1 public immutable MERKLE_DISTRIBUTOR; ITreasuryVester public immutable REWARDS_TREASURY_VEST...
12,661
20
// get lock id
bytes32 lockID = calculateLockID(msg.sender, token);
bytes32 lockID = calculateLockID(msg.sender, token);
28,555
207
// Claim one teji with whitelist proof./signature Whitelist proof signature.
function claimWhitelist(bytes memory signature) external { require(_currentIndex < 1000, "Tejiverse: max supply exceeded"); require(saleState == 1, "Tejiverse: whitelist sale is not open"); require(!_boughtPresale[msg.sender], "Tejiverse: already claimed"); bytes32 digest = keccak256(abi.encodePacked...
function claimWhitelist(bytes memory signature) external { require(_currentIndex < 1000, "Tejiverse: max supply exceeded"); require(saleState == 1, "Tejiverse: whitelist sale is not open"); require(!_boughtPresale[msg.sender], "Tejiverse: already claimed"); bytes32 digest = keccak256(abi.encodePacked...
20,852
6
// ``` TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructor...
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructor...
7,626
12
// Calculate xy rounding down, where x is signed 64.64 fixed point numberand y is unsigned 256-bit integer number.Revert on overflow.x signed 64.64 fixed point number y unsigned 256-bit integer numberreturn unsigned 256-bit integer number /
function mulu (int128 x, uint256 y) internal pure returns (uint256) { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (x) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (x) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF...
function mulu (int128 x, uint256 y) internal pure returns (uint256) { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (x) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (x) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF...
24,277
6
// error//variable//validator/
modifier validArea(uint256 _area) { require(_area == 0 || _area == 1, AREA_IS_NOT_VALID); _; }
modifier validArea(uint256 _area) { require(_area == 0 || _area == 1, AREA_IS_NOT_VALID); _; }
45,440
2
// Withdraw wrapped ether to get ether
function withdraw(uint256) external;
function withdraw(uint256) external;
19,389
2
// When a case is created then the escrow is created. If the sender confirms or the handlerconfirms then the escrow is released. escrowId id of the escrow partyA The address that will receive the money if the escrow is released partyB The address of the person who sent the money partyArbitrator The address of the perso...
struct EscrowVault { uint256 escrowId; address partyA; address partyB; uint256 nftA; uint256 nftB; address partyArbitrator; uint256 arbitratorFeeBps; string description; uint256 createTime; uint256 determineTime; bool started; ...
struct EscrowVault { uint256 escrowId; address partyA; address partyB; uint256 nftA; uint256 nftB; address partyArbitrator; uint256 arbitratorFeeBps; string description; uint256 createTime; uint256 determineTime; bool started; ...
9,016
192
// Remove the pair's channel counter
pair_hash = getParticipantsHash(participant1, participant2); delete participants_hash_to_channel_identifier[pair_hash];
pair_hash = getParticipantsHash(participant1, participant2); delete participants_hash_to_channel_identifier[pair_hash];
27,827
145
// never overflows, and + overflow is desired
TWAPObservationHistory.push( TWAPObservation( blockTimestamp, price0CumulativeLast() + uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed, price1CumulativeLast() + uint(UQ112x112.encode(_reserve0).u...
TWAPObservationHistory.push( TWAPObservation( blockTimestamp, price0CumulativeLast() + uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed, price1CumulativeLast() + uint(UQ112x112.encode(_reserve0).u...
26,551
303
// Reads an immutable arg with type uint64/argOffset The offset of the arg in the packed data/ return arg The arg value
function _getArgUint64(uint256 argOffset) internal pure returns (uint64 arg) { uint256 offset = _getImmutableArgsOffset(); // solhint-disable-next-line no-inline-assembly assembly { arg := shr(0xc0, calldataload(add(offset, argOffset))) } }
function _getArgUint64(uint256 argOffset) internal pure returns (uint64 arg) { uint256 offset = _getImmutableArgsOffset(); // solhint-disable-next-line no-inline-assembly assembly { arg := shr(0xc0, calldataload(add(offset, argOffset))) } }
60,148
13
// Executes the swap returning the amountIn needed to spend to receive the desired amountOut.
amountIn = swapRouter.exactOutputSingle(params);
amountIn = swapRouter.exactOutputSingle(params);
14,532
178
// Update reward variables for all pools. Be careful of gas spending!
function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } }
function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } }
2,588
22
// ICO starting and ending blocks, can be changed as needed
uint256 public icoStartBlock;
uint256 public icoStartBlock;
39,696
15
// function to submit a new proposal /
function propose(bytes32 key, uint value, bytes32 offchain) public { Proposal memory p; p.key = key; p.value = value; p.deadline = now + params["votingWindow"]; p.status = 1; proposals.push(p); emit...
function propose(bytes32 key, uint value, bytes32 offchain) public { Proposal memory p; p.key = key; p.value = value; p.deadline = now + params["votingWindow"]; p.status = 1; proposals.push(p); emit...
32,226
480
// Create a new DAOFactory, creating DAOs with Kernels proxied to `_baseKernel`, ACLs proxied to `_baseACL`, and new EVMScriptRegistries created from `_regFactory`._baseKernel Base Kernel_baseACL Base ACL_regFactory EVMScriptRegistry factory/
constructor(IKernel _baseKernel, IACL _baseACL, EVMScriptRegistryFactory _regFactory) public { // No need to init as it cannot be killed by devops199 if (address(_regFactory) != address(0)) { regFactory = _regFactory; } baseKernel = _baseKernel; baseACL = _baseAC...
constructor(IKernel _baseKernel, IACL _baseACL, EVMScriptRegistryFactory _regFactory) public { // No need to init as it cannot be killed by devops199 if (address(_regFactory) != address(0)) { regFactory = _regFactory; } baseKernel = _baseKernel; baseACL = _baseAC...
49,129
130
// Makes the contract active
isActive = true;
isActive = true;
11,088
182
// Mapping from positionId -> uint256, which stores the total amount of owedToken that has ever been repaid to the lender for each position. Does not reset.
mapping (bytes32 => uint256) totalOwedTokenRepaidToLender;
mapping (bytes32 => uint256) totalOwedTokenRepaidToLender;
35,135
108
//
* @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * h...
* @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * h...
31,051