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
38
// Pays profit (if any) of underlying option owner address of owner tokenId tokenId strike price at which the asset was protected amount principal amount that was protectedreturn profit profit of exercised option /
function _payProfit(address owner, uint tokenId, uint strike, uint amount, uint underlyingCurrentPrice) internal returns (uint profit)
function _payProfit(address owner, uint tokenId, uint strike, uint amount, uint underlyingCurrentPrice) internal returns (uint profit)
75,754
62
// - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. /
function safeTransferFrom(
function safeTransferFrom(
192
97
// update deal's locked token balance
deals[dealIndex].lockedTokensAmount = deals[dealIndex].lockedTokensAmount.add(rewardAmount); emit RewardCreated(dealIndexToId(dealIndex), _referenceHash, _purchasedTokenAmount, rewardAmount);
deals[dealIndex].lockedTokensAmount = deals[dealIndex].lockedTokensAmount.add(rewardAmount); emit RewardCreated(dealIndexToId(dealIndex), _referenceHash, _purchasedTokenAmount, rewardAmount);
47,729
5
// Woah, this one below is sneaky. I think if I didn't add this, then anyone would would be able to transfer tokens out of the zero address.
require(spender != address(0), "ERC20: approve to the zero address"); _allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount);
require(spender != address(0), "ERC20: approve to the zero address"); _allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount);
16,103
44
// Only the interface contract can run this function
modifier onlyInterfaceContract()
modifier onlyInterfaceContract()
39,786
0
// Real beneficiary address is a param to this mapping / stores total locked amounts
mapping(address => uint256[MAX_LOCK_PLANS]) private _lockTable;
mapping(address => uint256[MAX_LOCK_PLANS]) private _lockTable;
55,539
30
// Close the swap
function closeSwapIntent(address _swapCreator, uint256 _swapId) payable public whenNotPaused { require(swapList[_swapCreator][swapMatch[_swapId]].status == swapStatus.Opened, "Swap Status is not opened"); require(swapList[_swapCreator][swapMatch[_swapId]].addressTwo == msg.sender, "You're not the in...
function closeSwapIntent(address _swapCreator, uint256 _swapId) payable public whenNotPaused { require(swapList[_swapCreator][swapMatch[_swapId]].status == swapStatus.Opened, "Swap Status is not opened"); require(swapList[_swapCreator][swapMatch[_swapId]].addressTwo == msg.sender, "You're not the in...
37,027
20
// get the send() LayerZero messaging library version_userApplication - the contract address of the user application
function getSendVersion(address _userApplication) external view returns (uint16);
function getSendVersion(address _userApplication) external view returns (uint16);
16,461
17
// Mints the specified amount of tokens to the recipient and handles founder vesting
function mintBatchTo(uint256 amount, address recipient) external returns (uint256[] memory tokenIds);
function mintBatchTo(uint256 amount, address recipient) external returns (uint256[] memory tokenIds);
29,871
4
// Call the capture function of the Rescue Toad contract passing all the funds If the Rescue Toad specified by the token ID is already captures, this function will not fail, but do nothing instead tokenId The id of the Rescue Toadz to capture /
function captureRescueToad(uint256 tokenId) external payable {
function captureRescueToad(uint256 tokenId) external payable {
41,263
33
// validate all tokens being claimed and aggregate a total cost due Add claimed amount to mintTicket index to keep track of user claiming
uint256 excessPayment = msg.value; uint256 userMintedAmount = earlyAccessMintedCounts[msg.sender]; uint256 totalTicketCost = 0; for (uint i=0; i< mtIndexes.length; i++) { require(validateNonDupliateIndex(mtIndexes, mtIndexes[i]), "Index is duplicated"); require(is...
uint256 excessPayment = msg.value; uint256 userMintedAmount = earlyAccessMintedCounts[msg.sender]; uint256 totalTicketCost = 0; for (uint i=0; i< mtIndexes.length; i++) { require(validateNonDupliateIndex(mtIndexes, mtIndexes[i]), "Index is duplicated"); require(is...
80,376
13
// Retrieves total entries of players address
function playerEntries(address _player) public view returns (uint256) { address addressOfPlayer = _player; uint arrayLength = players.length; uint totalEntries = 0; for (uint256 i; i < arrayLength; i++) { if(players[i] == addressOfPlayer) { totalEntries++;...
function playerEntries(address _player) public view returns (uint256) { address addressOfPlayer = _player; uint arrayLength = players.length; uint totalEntries = 0; for (uint256 i; i < arrayLength; i++) { if(players[i] == addressOfPlayer) { totalEntries++;...
36,488
184
// for whitelist
bytes32 merkleRoot; mapping(address => uint256) public whiteUsers;
bytes32 merkleRoot; mapping(address => uint256) public whiteUsers;
43,619
186
// executed by the upgrader at the end of the upgrade process to handle custom pool logic /
function onUpgradeComplete() external override protected ownerOnly only(CONVERTER_UPGRADER)
function onUpgradeComplete() external override protected ownerOnly only(CONVERTER_UPGRADER)
26,891
20
// transfers IXTfrom User address to Recipient action Service the user is paying for/
function transferIXT(address from, address to, string action) public allowedOnly isNotPaused returns (bool) { if (isOldVersion) { IXTPaymentContract newContract = IXTPaymentContract(nextContract); return newContract.transferIXT(from, to, action); } else { uint price = actionPrices[action]; ...
function transferIXT(address from, address to, string action) public allowedOnly isNotPaused returns (bool) { if (isOldVersion) { IXTPaymentContract newContract = IXTPaymentContract(nextContract); return newContract.transferIXT(from, to, action); } else { uint price = actionPrices[action]; ...
19,012
107
// Anyone can pay the gas to create their very own Tester token
function create() public returns (uint256 _tokenId) { bytes32 sudoRandomButTotallyPredictable = keccak256(abi.encodePacked(totalSupply(),blockhash(block.number - 1))); uint8 body = (uint8(sudoRandomButTotallyPredictable[0])%5)+1; uint8 feet = (uint8(sudoRandomButTotallyPredictable[1])%7)+1; uint8 hea...
function create() public returns (uint256 _tokenId) { bytes32 sudoRandomButTotallyPredictable = keccak256(abi.encodePacked(totalSupply(),blockhash(block.number - 1))); uint8 body = (uint8(sudoRandomButTotallyPredictable[0])%5)+1; uint8 feet = (uint8(sudoRandomButTotallyPredictable[1])%7)+1; uint8 hea...
63,954
430
// pool data view functions
function getA() external view returns (uint256); function getToken(uint8 index) external view returns (IERC20); function getTokenIndex(address tokenAddress) external view returns (uint8); function getTokenBalance(uint8 index) external view returns (uint256); function getVirtualPrice() external v...
function getA() external view returns (uint256); function getToken(uint8 index) external view returns (IERC20); function getTokenIndex(address tokenAddress) external view returns (uint8); function getTokenBalance(uint8 index) external view returns (uint256); function getVirtualPrice() external v...
3,840
42
// Sets an configuration value Changes the value of a key in the configuration mapping key The configuration key for which the value will be set value The value to set the key /
function setAddressConfiguration(bytes32 key, address value) external hasAccess(this, AclFlag.SET_CONFIGURATION)
function setAddressConfiguration(bytes32 key, address value) external hasAccess(this, AclFlag.SET_CONFIGURATION)
15,837
234
// Check that token, shifter and symbol haven't already been registered
require(!LinkedList.isInList(shifterList, _shifterAddress), "ShifterRegistry: shifter already registered"); require(shifterByToken[_tokenAddress] == address(0x0), "ShifterRegistry: token already registered"); string memory symbol = ERC20Shifted(_tokenAddress).symbol(); require(tokenBySym...
require(!LinkedList.isInList(shifterList, _shifterAddress), "ShifterRegistry: shifter already registered"); require(shifterByToken[_tokenAddress] == address(0x0), "ShifterRegistry: token already registered"); string memory symbol = ERC20Shifted(_tokenAddress).symbol(); require(tokenBySym...
41,619
174
// Store the function selector of `TransferFromFailed()`.
mstore(0x00, 0x7939f424)
mstore(0x00, 0x7939f424)
28,081
64
// Reset current tier sold tokens
current_tier_sold_tokens = 0;
current_tier_sold_tokens = 0;
51,806
45
// Burn function for Baal `loot`.
function _burnLoot(address from, uint96 loot) private { members[from].loot -= loot; /*subtract `loot` for `from` account*/ unchecked { totalLoot -= loot; /*subtract from total Baal `loot`*/ } emit TransferLoot(from, address(0), loot); /*emit event reflec...
function _burnLoot(address from, uint96 loot) private { members[from].loot -= loot; /*subtract `loot` for `from` account*/ unchecked { totalLoot -= loot; /*subtract from total Baal `loot`*/ } emit TransferLoot(from, address(0), loot); /*emit event reflec...
43,867
64
// Division by zero or overflows are impossible here. solhint-disable-next-line not-rely-on-time
return (block.timestamp / 1 weeks - 1) * 1 weeks;
return (block.timestamp / 1 weeks - 1) * 1 weeks;
23,809
183
// the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => addr...
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => addr...
3,517
997
// Calculate the new cumulative interest rate
function calcUpdatedRate() public view returns (uint256 updatedRate) { updatedRate = cumulativeInterestRate .mul(_pow(savingsRate, block.timestamp - lastDripTime, ISSUANCE_RATE_DECIMALS)) .div(ISSUANCE_RATE_DECIMALS); }
function calcUpdatedRate() public view returns (uint256 updatedRate) { updatedRate = cumulativeInterestRate .mul(_pow(savingsRate, block.timestamp - lastDripTime, ISSUANCE_RATE_DECIMALS)) .div(ISSUANCE_RATE_DECIMALS); }
84,804
1
// Emits when a stream is successfully created. /
event CreateStream( uint256 indexed streamId, address indexed sender, address indexed recipient, uint256 deposit, address tokenAddress, uint256 startTime, uint256 stopTime );
event CreateStream( uint256 indexed streamId, address indexed sender, address indexed recipient, uint256 deposit, address tokenAddress, uint256 startTime, uint256 stopTime );
15,837
440
// Sets the content hash associated with an ENS node.May only be called by the owner of that node in the ENS registry.Note that this resource type is not standardized, and will likely changein future to a resource type based on multihash. node The node to update. hash The content hash to set /
function setContent(bytes32 node, bytes32 hash) public only_owner(node) { records[node].content = hash; emit ContentChanged(node, hash); }
function setContent(bytes32 node, bytes32 hash) public only_owner(node) { records[node].content = hash; emit ContentChanged(node, hash); }
4,183
1
// The token output token for the broker at the end of brokerRequestAllowance.
address tokenS;
address tokenS;
26,188
25
// Extract sub-contract init vector.
bytes memory subContractInitData = new bytes(initSize); for (uint256 trgOffset = 32; trgOffset <= initSize; trgOffset += 32) {
bytes memory subContractInitData = new bytes(initSize); for (uint256 trgOffset = 32; trgOffset <= initSize; trgOffset += 32) {
42,652
182
// todo identify how to get block time for both chains/Unlock period of 7-days for change bounty in block height.Considering aux block generation time per block is 3-secs. /
uint256 public constant BOUNTY_CHANGE_UNLOCK_PERIOD = 201600;
uint256 public constant BOUNTY_CHANGE_UNLOCK_PERIOD = 201600;
28,582
73
// Returns whether the given spender can transfer a given token ID _spender address of the spender to query _tokenId uint256 ID of the token to be transferredreturn bool whether the msg.sender is approved for the given token ID, is an operator of the owner, or is the owner of the token /
function isApprovedOrOwner( address _spender, uint256 _tokenId ) internal view returns (bool)
function isApprovedOrOwner( address _spender, uint256 _tokenId ) internal view returns (bool)
8,567
24
// function to pause Token Staking
function pauseTokenStaking() public onlyOwner { tokenPaused = true; emit Paused(); }
function pauseTokenStaking() public onlyOwner { tokenPaused = true; emit Paused(); }
6,588
27
// ╔══════════════════════════════╗
{ uint256 auctionEndTimestamp = nftContractAuctions[_nftContractAddress][ _tokenId ].auctionEnd; //if the auctionEnd is set to 0, the auction is technically on-going, however //the minimum bid price (minPrice) has not yet been met. return (auctionEndTimestamp == 0...
{ uint256 auctionEndTimestamp = nftContractAuctions[_nftContractAddress][ _tokenId ].auctionEnd; //if the auctionEnd is set to 0, the auction is technically on-going, however //the minimum bid price (minPrice) has not yet been met. return (auctionEndTimestamp == 0...
34,942
304
// Converts the string to lowercase /
function toLower(string memory str) public pure returns (string memory) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint256 i = 0; i < bStr.length; i++) { // Uppercase character if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= ...
function toLower(string memory str) public pure returns (string memory) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint256 i = 0; i < bStr.length; i++) { // Uppercase character if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= ...
10,489
140
// Event for tracking updated protocol fee.protocolFee - new protocol fee./
event ProtocolFeeUpdated(uint256 protocolFee);
event ProtocolFeeUpdated(uint256 protocolFee);
79,409
6
// Mapping every user address to his/her Claim Only one Claim possible per address
mapping(address => Claim) internal claims;
mapping(address => Claim) internal claims;
22,112
40
// allows anyone to read the redeemed Supply of a given class and bond nonce.
function burnedSupply(uint256 class, uint256 nonce) public view override returns (uint256)
function burnedSupply(uint256 class, uint256 nonce) public view override returns (uint256)
7,520
13
// Ensure that the new owner address is not the zero address (invalid).
require(newOwner != address(0), "New owner cannot be the zero address");
require(newOwner != address(0), "New owner cannot be the zero address");
23,429
19
// Get chargesheet by ChargesheetID or ComplaintID or ReportID
function getChargeSheetById( string memory id
function getChargeSheetById( string memory id
8,589
255
// States
bool public paused = false; bool public freeMintActive = true; bool public whitelistMintActive = true; bool public revealed = false;
bool public paused = false; bool public freeMintActive = true; bool public whitelistMintActive = true; bool public revealed = false;
14,608
42
// add this transaction to the wallets record and initialize the settings
self.transactionInfo[_id].length++; self.transactionInfo[_id][_number].confirmRequired = _required; self.transactionInfo[_id][_number].day = now / 1 days; self.transactions[now / 1 days].push(_id);
self.transactionInfo[_id].length++; self.transactionInfo[_id][_number].confirmRequired = _required; self.transactionInfo[_id][_number].day = now / 1 days; self.transactions[now / 1 days].push(_id);
18,460
32
// ========== SENIOR FUNCTION ========== /
) internal returns(uint256 amount0, uint256 amount1){ // Pool OBJ IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress); // Calculate Liquidity (uint160 sqrtRatioX96, , , , , , ) = pool.slot0(); uint128 liquidity = LiquidityAmounts.getLiquidityForAmounts( sqr...
) internal returns(uint256 amount0, uint256 amount1){ // Pool OBJ IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress); // Calculate Liquidity (uint160 sqrtRatioX96, , , , , , ) = pool.slot0(); uint128 liquidity = LiquidityAmounts.getLiquidityForAmounts( sqr...
21,561
15
// @notify Modify "baseUpdateCallerReward" or "maxUpdateCallerReward"reimburser The reimburser addressparameter Must be "baseUpdateCallerReward" or "maxUpdateCallerReward"data The new value for baseUpdateCallerReward or maxUpdateCallerReward/
function modifyParameters(address reimburser, bytes32 parameter, uint256 data) external isAuthorized { require(reimbursers[reimburser] == 1, "MinimalIncreasingTreasuryReimbursementOverlay/not-whitelisted"); if (either(parameter == "baseUpdateCallerReward", parameter == "maxUpdateCallerReward")) { ...
function modifyParameters(address reimburser, bytes32 parameter, uint256 data) external isAuthorized { require(reimbursers[reimburser] == 1, "MinimalIncreasingTreasuryReimbursementOverlay/not-whitelisted"); if (either(parameter == "baseUpdateCallerReward", parameter == "maxUpdateCallerReward")) { ...
13,896
19
// Define a contract 'ContributorRole' to manage this role - add, remove, check
contract Article { using SafeMath for uint; // Define events event ArticleAdded(uint aticleNum); event ArticleRemoved(uint aticleNum); event ArticleChallenged(uint aticleNum); //Not sure if we need these below event ArticleUpVoted(uint aticleNum); event ArticleDownVoted(uint aticleNum); //Define a s...
contract Article { using SafeMath for uint; // Define events event ArticleAdded(uint aticleNum); event ArticleRemoved(uint aticleNum); event ArticleChallenged(uint aticleNum); //Not sure if we need these below event ArticleUpVoted(uint aticleNum); event ArticleDownVoted(uint aticleNum); //Define a s...
31,989
85
// Get the enabled status of tier_index of tier to query return bool indicating status of tierTest(s) Need rewrite/
function getEnabled(uint256 _index) external
function getEnabled(uint256 _index) external
56,582
17
// Construct a new Want token /
constructor() public { balances[msg.sender] = uint96(totalSupply); emit Transfer(address(0), msg.sender, totalSupply); }
constructor() public { balances[msg.sender] = uint96(totalSupply); emit Transfer(address(0), msg.sender, totalSupply); }
15,512
59
// модификатор - транзакции возможны
modifier isTransactionsOn{ require( transactionsOn ); _; }
modifier isTransactionsOn{ require( transactionsOn ); _; }
52,436
1,010
// solium-disable-next-line security/no-modify-for-iter-var / take last decimal digit
bstr[i] = byte(uint8(ASCII_ZERO + (j % 10)));
bstr[i] = byte(uint8(ASCII_ZERO + (j % 10)));
617
740
// Withdraw the part owned of the pool
uint totalSupply = S.totalSupply();
uint totalSupply = S.totalSupply();
43,145
10
// Opium.Matching.Match.LibOrder contract implements EIP712 signed Order for Opium.Matching.Match
contract LibOrder is LibEIP712 { /** Structure of order Description should be considered from the order signer (maker) perspective makerMarginAddress - address of token that maker is willing to pay with takerMarginAddress - address of token that maker is willing to receive ...
contract LibOrder is LibEIP712 { /** Structure of order Description should be considered from the order signer (maker) perspective makerMarginAddress - address of token that maker is willing to pay with takerMarginAddress - address of token that maker is willing to receive ...
40,984
26
// Provides the address of the casper contract/ return Address of the casper contract
function getCasper() external view returns (address);
function getCasper() external view returns (address);
8,021
41
// represented off-chain by nominee
Nominee
Nominee
37,177
0
// Emitted when the factory admin address has been changed. previousFactoryAdmin Address of the previous factory admin. newFactoryAdmin Address of the new factory admin. /
event SetFactoryAdmin(address indexed previousFactoryAdmin, address indexed newFactoryAdmin);
event SetFactoryAdmin(address indexed previousFactoryAdmin, address indexed newFactoryAdmin);
28,416
211
// Set pending rates as current rates
t.rewardCut = rewardCut; t.feeShare = feeShare; t.pricePerSegment = pricePerSegment;
t.rewardCut = rewardCut; t.feeShare = feeShare; t.pricePerSegment = pricePerSegment;
4,791
43
// 0xa9059cbb = bytes4(keccak256("transfer(address,uint256)"))
abi.encodeWithSelector(0xa9059cbb, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 Transfer failed
abi.encodeWithSelector(0xa9059cbb, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 Transfer failed
29,781
52
// Precautionary emergency controls.
bool public rebasePaused; bool public tokenPaused;
bool public rebasePaused; bool public tokenPaused;
10,076
44
// cuando el usuario quiere sacar todos lo tokens del pool 0x9230646A9ebC810cdC893c65aE7684286786A62D, 1, 1
function withdrawTokenPool(address _user,uint256 _amount0, uint256 _amount1) external { require(usertoken[_user].amount0>=_amount0); require(usertoken[_user].amount1>=_amount1); // actualizo balance del usuario usertoken[_user].amount0= usertoken[_user].amount0-_amount0; use...
function withdrawTokenPool(address _user,uint256 _amount0, uint256 _amount1) external { require(usertoken[_user].amount0>=_amount0); require(usertoken[_user].amount1>=_amount1); // actualizo balance del usuario usertoken[_user].amount0= usertoken[_user].amount0-_amount0; use...
32,778
42
// For backwards semantic compatibility.
if (quantity == 0 || spend == 0 || quantity > offer.pay_amt || spend > offer.buy_amt) { return false; }
if (quantity == 0 || spend == 0 || quantity > offer.pay_amt || spend > offer.buy_amt) { return false; }
39,517
43
// Returns the list of the underlying assets of all the initialized reserves It does not include dropped reservesreturn The addresses of the underlying assets of the initialized reserves /
function getReservesList() external view returns (address[] memory);
function getReservesList() external view returns (address[] memory);
4,991
6
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
event Burn(address indexed from, uint256 value);
1,390
3
// Active brains of Unitroller/
address public comptrollerImplementation;
address public comptrollerImplementation;
19,118
43
// Once the token is finalized, everybody can transfer tokens.
if (finalized == FinalizeState.Finalized) { return; }
if (finalized == FinalizeState.Finalized) { return; }
14,718
229
// Arweave Image Hash
metadata = string( abi.encodePacked(metadata, ' "arweave_image_hash": "') ); metadata = string( abi.encodePacked(metadata, seriesInfo.arweaveImageHash) ); metadata = string(abi.encodePacked(metadata, '",\n'));
metadata = string( abi.encodePacked(metadata, ' "arweave_image_hash": "') ); metadata = string( abi.encodePacked(metadata, seriesInfo.arweaveImageHash) ); metadata = string(abi.encodePacked(metadata, '",\n'));
25,279
214
// Ensure the signature length is correct.
require( signature.length == 65, "Must supply a single 65-byte signature when owner is not a contract." );
require( signature.length == 65, "Must supply a single 65-byte signature when owner is not a contract." );
49,646
1,457
// Enqueue a request with the DVM.
_requestOraclePrice(disputedLiquidation.liquidationTime); emit LiquidationDisputed( sponsor, disputedLiquidation.liquidator,
_requestOraclePrice(disputedLiquidation.liquidationTime); emit LiquidationDisputed( sponsor, disputedLiquidation.liquidator,
2,052
222
// Points to resource which returns token metadata.
string public baseTokenURI;
string public baseTokenURI;
70,484
155
// Verify only the transfer quantity is subtracted
require( newBalance == existingBalance.sub(_quantity), "Invalid post transfer balance" );
require( newBalance == existingBalance.sub(_quantity), "Invalid post transfer balance" );
47,710
199
// This functions as the inverse of closeContract(). /
function setNumNiftyPermitted(uint256 num_nifty_permitted) onlyValidSender public { require(_numNiftyPermitted[niftyType] == 0, "NiftyBuilderInstance: Permitted number already set for this NFT"); require(num_nifty_permitted < 9999 && num_nifty_permitted != 0, "NiftyBuilderInstance: Illegal argument"...
function setNumNiftyPermitted(uint256 num_nifty_permitted) onlyValidSender public { require(_numNiftyPermitted[niftyType] == 0, "NiftyBuilderInstance: Permitted number already set for this NFT"); require(num_nifty_permitted < 9999 && num_nifty_permitted != 0, "NiftyBuilderInstance: Illegal argument"...
24,510
23
// Sets the `implementer` contract as ``account``'s implementer for`interfaceHash`. `account` being the zero address is an alias for the caller's address.The zero address can also be used in `implementer` to remove an old one. See {interfaceHash} to learn how these are created. Emits an {InterfaceImplementerSet} event....
function setInterfaceImplementer(address account, bytes32 interfaceHash, address implementer) external;
function setInterfaceImplementer(address account, bytes32 interfaceHash, address implementer) external;
6,286
0
// Polygon ZK-EVM address. Will be used to check if it's on emergency state.
PolygonZkEVM public immutable polygonZkEVM;
PolygonZkEVM public immutable polygonZkEVM;
6,342
26
// Reuse this contract after vesting and funds migrated Use this function only for fallback reason(new strategy failed)Requirements:- Only owner of this contract can call this function /
function reuseContract() external onlyOwner { pool = token.balanceOf(address(this)); revertVesting(); }
function reuseContract() external onlyOwner { pool = token.balanceOf(address(this)); revertVesting(); }
56,837
41
// Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0._key The key of the tree._drawnNumber The drawn number. return ID The drawn ID. `O(klog_k(n))` where `k` is the maximum number of childs per node in the tree,and `n` is the maximum number of nodes ever ap...
function draw(SortitionSumTrees storage self, bytes32 _key, uint _drawnNumber) internal view returns(bytes32 ID) { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; uint treeIndex = 0; uint currentDrawnNumber = _drawnNumber % tree.nodes[0]; while ((tree.K * treeIndex) + ...
function draw(SortitionSumTrees storage self, bytes32 _key, uint _drawnNumber) internal view returns(bytes32 ID) { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; uint treeIndex = 0; uint currentDrawnNumber = _drawnNumber % tree.nodes[0]; while ((tree.K * treeIndex) + ...
24,765
1
// Hash for the EIP712 Order Schema
bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( "Order(", "address makerAddress,", "address takerAddress,", "address feeRecipientAddress,", "address senderAddress,", "uint256 makerAssetAmount,", "uint256 takerAssetAmount,", ...
bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( "Order(", "address makerAddress,", "address takerAddress,", "address feeRecipientAddress,", "address senderAddress,", "uint256 makerAssetAmount,", "uint256 takerAssetAmount,", ...
35,193
7
// Function to burn tokens from the caller's balance
function burn(uint256 value) external { _burn(msg.sender, value); // Burn the specified amount of tokens from the caller's balance emit Burnt(msg.sender, value); // Emit the Burnt event }
function burn(uint256 value) external { _burn(msg.sender, value); // Burn the specified amount of tokens from the caller's balance emit Burnt(msg.sender, value); // Emit the Burnt event }
12,553
50
// Ensure the application exists
require(applications[jobId][applicantAddress].applicantAddress == applicantAddress, "Application does not exist.");
require(applications[jobId][applicantAddress].applicantAddress == applicantAddress, "Application does not exist.");
24,250
13
// require(networkId != chainId(), "Same chainId");
verifyFee(_networkId, abi.encode(_token, _tokenId), _feeData); _transferNonFungible(_token, _tokenId, _networkId); _payToll(_feeData);
verifyFee(_networkId, abi.encode(_token, _tokenId), _feeData); _transferNonFungible(_token, _tokenId, _networkId); _payToll(_feeData);
38,466
10
// Store newer state
channelDispute.channelStateHash = ccsHash; channelDispute.nonce = ccs.nonce; channelDispute.merkleRoot = ccs.merkleRoot;
channelDispute.channelStateHash = ccsHash; channelDispute.nonce = ccs.nonce; channelDispute.merkleRoot = ccs.merkleRoot;
42,276
3
// Adjust for decimal places
uint256 start = token().totalSupply().mul(rateDecimalsMultiply); uint256 oneDecimals = rateDecimalsMultiply; uint256 b = start.mul(2).add(oneDecimals).div(aInverse); return b;
uint256 start = token().totalSupply().mul(rateDecimalsMultiply); uint256 oneDecimals = rateDecimalsMultiply; uint256 b = start.mul(2).add(oneDecimals).div(aInverse); return b;
3,483
25
// Designate an existing document as a lien release, then propose it to GC to ratify modifier onlySC _index uint the task serial pointing to storage of the lien release _docIndex the index of the document within the task being proposed as the lien release /
function designateLienRelease(uint256 _index, uint256 _docIndex) public virtual;
function designateLienRelease(uint256 _index, uint256 _docIndex) public virtual;
39,759
33
// Ideal wstETH balances in vault and DSA
assets_.vaultBalances.wstETH = IERC20(WSTETH_ADDRESS).balanceOf( address(this) ); assets_.dsaBalances.wstETH = IERC20(WSTETH_ADDRESS).balanceOf( address(vaultDSA) );
assets_.vaultBalances.wstETH = IERC20(WSTETH_ADDRESS).balanceOf( address(this) ); assets_.dsaBalances.wstETH = IERC20(WSTETH_ADDRESS).balanceOf( address(vaultDSA) );
12,798
26
// max wallet holding of 2%
uint256 public _maxWalletToken = ( _totalSupply * 2 ) / 100; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private isFeeExempt; mapping (address => bool) isTxLimitExempt; uint256 pub...
uint256 public _maxWalletToken = ( _totalSupply * 2 ) / 100; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private isFeeExempt; mapping (address => bool) isTxLimitExempt; uint256 pub...
10,788
133
// Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.The call is not executed if the target address is not a contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
1,962
10
// get the exist storeman group info /smgIDID of storeman group / return curveID ID of elliptic curve / return PKPK of storeman group function acquireExistSmgInfo(bytes32 smgID) private view returns (uint curveID, bytes memory PK)
// { // uint origChainID; // (,,,origChainID,,curveID,,PK,,,) = storageData.smgAdminProxy.getStoremanGroupConfig(smgID); // require(origChainID != 0, "PK does not exist"); // return (curveID, PK); // }
// { // uint origChainID; // (,,,origChainID,,curveID,,PK,,,) = storageData.smgAdminProxy.getStoremanGroupConfig(smgID); // require(origChainID != 0, "PK does not exist"); // return (curveID, PK); // }
35,196
48
// these values are pretty much arbitrary since they get overwritten for every txn, but the placeholders make it easier to work with current contract.
uint256 private _taxFee; uint256 private _previousTaxFee = _taxFee; uint256 private _marketingFee; uint256 private _liquidityFee; uint256 private _previousLiquidityFee = _liquidityFee; uint256 private constant BUY = 1; uint256 private constant SELL = 2;
uint256 private _taxFee; uint256 private _previousTaxFee = _taxFee; uint256 private _marketingFee; uint256 private _liquidityFee; uint256 private _previousLiquidityFee = _liquidityFee; uint256 private constant BUY = 1; uint256 private constant SELL = 2;
7,792
124
// swap and Send to Marketing address
swapTokensForEth(contractTokenBalance.sub(tokensForLiquidity)); marketingWallet.transfer(address(this).balance); emit SwapAndLiquify(half, newBalance);
swapTokensForEth(contractTokenBalance.sub(tokensForLiquidity)); marketingWallet.transfer(address(this).balance); emit SwapAndLiquify(half, newBalance);
29,296
14
// number of shares traded tokenId => circulatationCount
mapping (uint256 => uint256) private circulationCounters;
mapping (uint256 => uint256) private circulationCounters;
27,153
209
// element title?
function set_svg( uint256 _mode, string memory _data, string memory _title
function set_svg( uint256 _mode, string memory _data, string memory _title
19,448
7
// Stored onchain to keep track of each stake's staker details for a pool.
struct StakerInfo { address staker; uint256 stakeId; }
struct StakerInfo { address staker; uint256 stakeId; }
7,140
58
// checks if voting window is open
modifier windowOpen(uint256 startTimestamp) { require( block.timestamp > startTimestamp && // voting window is one day long, starts at deadline and ends at deadline + 1 days block.timestamp < startTimestamp + 1 days ); _; }
modifier windowOpen(uint256 startTimestamp) { require( block.timestamp > startTimestamp && // voting window is one day long, starts at deadline and ends at deadline + 1 days block.timestamp < startTimestamp + 1 days ); _; }
26,470
151
// Check if contract has enough tokens to pay in case of win. Each successful flip start adds bet value in tokens to 'tokensRequiredForAllWins'
require(tokensRequiredForAllWins <= token.balanceOf(address(this)), "Not enough tokens in contract balance.");
require(tokensRequiredForAllWins <= token.balanceOf(address(this)), "Not enough tokens in contract balance.");
10,250
8
// stops mining by setting end block /
function stopMining() external onlyAuthorized { require(endBlock == 0, "Already stopped"); endBlock = block.number; }
function stopMining() external onlyAuthorized { require(endBlock == 0, "Already stopped"); endBlock = block.number; }
3,267
31
// uint256 balance = token.balanceOf(this);assert(balance > 0);token.transfer(owner, balance);
selfdestruct(owner);
selfdestruct(owner);
36,889
42
// sessionID {uint256} - id of the layer 1 stake
function unstakeV1(uint256 sessionId) external pausable {
function unstakeV1(uint256 sessionId) external pausable {
24,254
68
// ========= CONSTANT VARIABLES ======== // ========== STATE VARIABLES ========== / epoch
uint256 public startTime; uint256 public epoch = 0;
uint256 public startTime; uint256 public epoch = 0;
39,017
2
// Player start a trade for selling equipment with a certain number of silver coins invitee_address: the address of the player and the equipment wanted to sell as well as the silver number with that. in this function, player can make a trade. /
function invite_trade(address invitee_address, uint256 equipment_id, uint256 silver_number) public override { bool flag = false; for (uint256 i = 0; i < players[msg.sender].equipment_storage.length; i++) { if (players[msg.sender].equipment_storage[i].id == equipment_id) { ...
function invite_trade(address invitee_address, uint256 equipment_id, uint256 silver_number) public override { bool flag = false; for (uint256 i = 0; i < players[msg.sender].equipment_storage.length; i++) { if (players[msg.sender].equipment_storage[i].id == equipment_id) { ...
34,785
13
// 512-bit multiply [prod1 prod0] = xy. Compute the product mod 2^256 and mod 2^256 - 1, then use use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 variables such that product = prod12^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) }
uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) }
29,867
17
// hex contract setup
address internal hexAddress = 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39; IERC20 internal hexInterface = IERC20(hexAddress);
address internal hexAddress = 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39; IERC20 internal hexInterface = IERC20(hexAddress);
13,599
44
// Transfer the amount of token in. Rebalance the reserve if needed
function _transferIn( uint256 tokenIndex, uint256 amountUnnormalized ) internal
function _transferIn( uint256 tokenIndex, uint256 amountUnnormalized ) internal
22,695
2
// Modifiers /
modifier onlyCBridgeMessageBus() { if (msg.sender != address(cBridgeMessageBus)) revert UnAuthorized(); _; }
modifier onlyCBridgeMessageBus() { if (msg.sender != address(cBridgeMessageBus)) revert UnAuthorized(); _; }
14,389
9
// Function used to remove Operational Address_operationalAddress is an existing operations provider's address. /
function removeOperational( address _operationalAddress
function removeOperational( address _operationalAddress
33,550