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
17
// external with ABIEncoderV2 Struct is not supported in solidity < 0.6.4
require(_isValidChainId(message.chainId), "INVALID_CHAIN_ID"); _checkSigner(message, signatureType, signature);
require(_isValidChainId(message.chainId), "INVALID_CHAIN_ID"); _checkSigner(message, signatureType, signature);
4,429
95
// Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted...
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public canTransfer(_tokenId)
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public canTransfer(_tokenId)
2,823
846
// Returns array with owner addresses, which confirmed transaction./transactionId Transaction ID./ return _confirmations Returns array of owner addresses.
function getConfirmations(uint transactionId) public view returns (address[] memory _confirmations)
function getConfirmations(uint transactionId) public view returns (address[] memory _confirmations)
5,839
127
// can not be overridden by state variable due to type `Deciaml.decimal`
function getSettlementPrice() external view returns (Decimal.decimal memory); function getBaseAssetDeltaThisFundingPeriod() external view returns (SignedDecimal.signedDecimal memory); function getCumulativeNotional() external view returns (SignedDecimal.signedDecimal memory); function getMaxHoldingBa...
function getSettlementPrice() external view returns (Decimal.decimal memory); function getBaseAssetDeltaThisFundingPeriod() external view returns (SignedDecimal.signedDecimal memory); function getCumulativeNotional() external view returns (SignedDecimal.signedDecimal memory); function getMaxHoldingBa...
27,664
19
// Use along with {balanceOf} to enumerate all of ``owner``'s tokens. /
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
8,165
20
// Amount of decimals for display purposes
decimals = 0;
decimals = 0;
28,401
111
// withdraw function to unstake LP Tokens
function withdraw(uint amountToWithdraw) public noContractsAllowed { require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens!"); require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "You recently deposi...
function withdraw(uint amountToWithdraw) public noContractsAllowed { require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens!"); require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "You recently deposi...
37,583
26
// We verify if the order has arrived to its final destination
}else if(keccak256(abi.encodePacked(currentLocation))==keccak256(abi.encodePacked(orders[id].finalDestination))){
}else if(keccak256(abi.encodePacked(currentLocation))==keccak256(abi.encodePacked(orders[id].finalDestination))){
38,531
133
// bytes4(keccak256("ZeroCantBeAuthorizedError()"))
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
35,993
28
// Rejects the specified bid. _NFTid The Id of the NFTDetail _bidId The Id of the bid. /
function rejectBid(uint256 _NFTid, uint256 _bidId) external whenNotPaused nonReentrant { require(!Bids[_NFTid][_bidId].withdrawn, "Already withdrawn"); require(!Bids[_NFTid][_bidId].bidAccepted, "Bid Already Accepted"); require( NFTdetails[_NFTid].tokenIdOwner == msg.sender, ...
function rejectBid(uint256 _NFTid, uint256 _bidId) external whenNotPaused nonReentrant { require(!Bids[_NFTid][_bidId].withdrawn, "Already withdrawn"); require(!Bids[_NFTid][_bidId].bidAccepted, "Bid Already Accepted"); require( NFTdetails[_NFTid].tokenIdOwner == msg.sender, ...
32,349
13
// receive ETH
receive() external payable;
receive() external payable;
53,147
4
// total ether submitted before fees.
uint256 _submitted = 0; uint256 public tier = 0;
uint256 _submitted = 0; uint256 public tier = 0;
40,520
35
// Nethny [TIIK]
contract Hub is ERC721, Ownable{ using Counters for Counters.Counter; constructor() ERC721("Dublicate_RMRK","DRMRK"){} Counters.Counter private _tokenIdCounter; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; function tokenURI(uint256 tokenId) public view vir...
contract Hub is ERC721, Ownable{ using Counters for Counters.Counter; constructor() ERC721("Dublicate_RMRK","DRMRK"){} Counters.Counter private _tokenIdCounter; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; function tokenURI(uint256 tokenId) public view vir...
30,993
323
// Construct a new Configurable Rights Pool (wrapper around BPool) _initialTokens and _swapFee are only used for temporary storage between construction and create pool, and should not be used thereafter! _initialTokens is destroyed in createPool to prevent this, and _swapFee is kept in sync (defensively), but should ne...
constructor( address factoryAddress, PoolParams memory poolParams, RightsManager.Rights memory rightsStruct
constructor( address factoryAddress, PoolParams memory poolParams, RightsManager.Rights memory rightsStruct
16,218
340
// Automated market maker that lets users buy and sell options from it Creates a long token representing a call/put option and a short tokenrepresenting a covered call option. This contract is used for for both call and put options since they are inversesof each other. For example a ETH/USD call option with a strike of...
function initialize( address _baseToken, address _oracle, bool _isPutMarket, uint256 _strikePrice, uint256 _alpha, uint256 _expiryTime, address _longToken, address _shortToken
function initialize( address _baseToken, address _oracle, bool _isPutMarket, uint256 _strikePrice, uint256 _alpha, uint256 _expiryTime, address _longToken, address _shortToken
38,721
40
// Retrieves current maximum amount of tokens per one transfer for a particular token contract._token address of the token contract. return maximum amount on tokens that can be sent through the bridge in one transfer./
function maxPerTx(address _token) public view returns (uint256) { return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))]; }
function maxPerTx(address _token) public view returns (uint256) { return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))]; }
20,944
51
// Emitted when an offer is cancelled.
event CancelledOffer(address indexed offeror, uint256 indexed offerId);
event CancelledOffer(address indexed offeror, uint256 indexed offerId);
7,329
3
// The ROLL TOKEN!
RollToken public roll; address public devAddress; address public feeAddress;
RollToken public roll; address public devAddress; address public feeAddress;
4,721
25
// ADMIN//
function enableCollection( uint256 collectionId
function enableCollection( uint256 collectionId
11,536
54
// Deposit native tokens to bridge /
function depositNativeTokens() external payable { emit TokensDeposit(msg.sender, msg.value); }
function depositNativeTokens() external payable { emit TokensDeposit(msg.sender, msg.value); }
4,264
65
// -----------Private Varibales---------------/-----------Mapping---------------/-----------Arrays--------------/-----------enums---------------
enum Status {CREATED, ACTIVE} /*----------Modifier------------- -----------------------------------*/ modifier onlyOwner(){ require(msg.sender == owner,"only owner"); _; }
enum Status {CREATED, ACTIVE} /*----------Modifier------------- -----------------------------------*/ modifier onlyOwner(){ require(msg.sender == owner,"only owner"); _; }
64,827
4
// =================Transactions================Constructor
function Owner(address _ownerAddress, uint _idCustomer) { creatorAddress = msg.sender; ownerAddress = _ownerAddress; idCustomer = _idCustomer; isInitiated = true; }
function Owner(address _ownerAddress, uint _idCustomer) { creatorAddress = msg.sender; ownerAddress = _ownerAddress; idCustomer = _idCustomer; isInitiated = true; }
44,658
84
// Change the duration of the challenge period. _challengePeriodDuration The new duration of the challenge period. /
function changeChallengePeriodDuration(uint256 _challengePeriodDuration) external onlyGovernor { challengePeriodDuration = _challengePeriodDuration; }
function changeChallengePeriodDuration(uint256 _challengePeriodDuration) external onlyGovernor { challengePeriodDuration = _challengePeriodDuration; }
25,235
111
// get vote status._id data source id./
function isVoteOpen(uint256 _id) external view returns (bool) { return (votes[_id].deadline > 0) && (now <= votes[_id].deadline); }
function isVoteOpen(uint256 _id) external view returns (bool) { return (votes[_id].deadline > 0) && (now <= votes[_id].deadline); }
29,259
56
// buys
if(zeroBuyTaxmode){ if(tradingOpen && from == uniswapV2Pair) { currenttotalFee=0; }
if(zeroBuyTaxmode){ if(tradingOpen && from == uniswapV2Pair) { currenttotalFee=0; }
13,347
19
// Activate role
function giveRole(uint256 role, address actor) external onlyOwnerExec { _giveRole(role, actor); }
function giveRole(uint256 role, address actor) external onlyOwnerExec { _giveRole(role, actor); }
46,905
3
// Cancel all pending orders for a sender minNonce minimum user nonce /
function cancelAllOrdersForSender(uint256 minNonce) external { require(minNonce > userMinOrderNonce[msg.sender], "Cancel: Order nonce lower than current"); require(minNonce < userMinOrderNonce[msg.sender] + 500000, "Cancel: Cannot cancel more orders"); userMinOrderNonce[msg.sender] = minNonc...
function cancelAllOrdersForSender(uint256 minNonce) external { require(minNonce > userMinOrderNonce[msg.sender], "Cancel: Order nonce lower than current"); require(minNonce < userMinOrderNonce[msg.sender] + 500000, "Cancel: Cannot cancel more orders"); userMinOrderNonce[msg.sender] = minNonc...
15,491
22
// 打开锁定期自动释放开关/
function openAutoFree(address who) whenAdministrator(msg.sender) public { delete autoFreeLockBalance[who]; emit OpenAutoFree(msg.sender, who); }
function openAutoFree(address who) whenAdministrator(msg.sender) public { delete autoFreeLockBalance[who]; emit OpenAutoFree(msg.sender, who); }
30,997
123
// e.g. assume scale = fullScale z = 10e189e17 = 9e36 return 9e38 / 1e18 = 9e18
return (x * y) / scale;
return (x * y) / scale;
15,461
0
// msg represent the current message received by the contracts
msg.sender; // address of sender msg.value; // amount of ether provided to this contract in wei msg.data; // bytes, complete call data msg.gas; // remaining gas msg.sig; // return the first four bytes of the call data
msg.sender; // address of sender msg.value; // amount of ether provided to this contract in wei msg.data; // bytes, complete call data msg.gas; // remaining gas msg.sig; // return the first four bytes of the call data
45,451
14
// 清空使用者
function removeAllWorkers() external ensure_owner() returns(uint count) { count = 0; for (uint i; i < allWorkers.length ; i++) { address addr = allWorkers[i]; if(getWorker[addr].exists) { delete getWorker[addr]; count++; } }...
function removeAllWorkers() external ensure_owner() returns(uint count) { count = 0; for (uint i; i < allWorkers.length ; i++) { address addr = allWorkers[i]; if(getWorker[addr].exists) { delete getWorker[addr]; count++; } }...
3,833
48
// handling the pushing of local receipts_message message/
function pushReceipt(uint256 id, bytes memory _message) internal { push_receipt_counter = push_receipt_counter + 1; uint256 receipt_id = id + receipt_flag; Message memory message = Message(receipt_id, _message, block.number, true); batches[available_batch_id] = message; outbo...
function pushReceipt(uint256 id, bytes memory _message) internal { push_receipt_counter = push_receipt_counter + 1; uint256 receipt_id = id + receipt_flag; Message memory message = Message(receipt_id, _message, block.number, true); batches[available_batch_id] = message; outbo...
20,063
7
// Cash Faucet Faucet contract for Tesnet CASH (Dai) /
contract CashFaucet is ICashFaucet { IDaiVat public vat; IDaiJoin public daiJoin; IERC20 public col; IDaiJoin public colJoin; bytes32 public colIlk; IDaiFaucet public mcdFaucet; IERC20 public dai; constructor(IAugur _augur) public { vat = IDaiVat(_augur.lookup("DaiVat")); ...
contract CashFaucet is ICashFaucet { IDaiVat public vat; IDaiJoin public daiJoin; IERC20 public col; IDaiJoin public colJoin; bytes32 public colIlk; IDaiFaucet public mcdFaucet; IERC20 public dai; constructor(IAugur _augur) public { vat = IDaiVat(_augur.lookup("DaiVat")); ...
32,868
156
// used for giveaways
uint256 public amountForDevs = 144;
uint256 public amountForDevs = 144;
29,605
7
// solhint-disable-next-line avoid-low-level-calls /decode return value of execute:
(callSuccess, ret) = abi.decode(ret, (bool, bytes));
(callSuccess, ret) = abi.decode(ret, (bool, bytes));
7,331
260
// Removes every address from the list/self The Mapping struct that this function is attached to
function clearAll(Mapping storage self) internal { address currentAddress = self.addressMap[SENTINEL]; while (currentAddress != address(0) && currentAddress != SENTINEL) { address nextAddress = self.addressMap[currentAddress]; delete self.addressMap[currentAddress]; currentAddress = nextAddr...
function clearAll(Mapping storage self) internal { address currentAddress = self.addressMap[SENTINEL]; while (currentAddress != address(0) && currentAddress != SENTINEL) { address nextAddress = self.addressMap[currentAddress]; delete self.addressMap[currentAddress]; currentAddress = nextAddr...
13,664
4
// Standard math utilities missing in the Solidity language. /
library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uin...
library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uin...
1,007
49
// Total = 100% (1000)
uint256 public marketingPortionOfSwap = 500; // 50% uint256 public devPortionOfSwap = 200; // 20% uint256 public teamPortionOfSwap = 150; // 15% uint256 public lpPortionOfSwap = 150; // 15% IPancakeV2Router public router; address public pair; mapping (address => uint256) inter...
uint256 public marketingPortionOfSwap = 500; // 50% uint256 public devPortionOfSwap = 200; // 20% uint256 public teamPortionOfSwap = 150; // 15% uint256 public lpPortionOfSwap = 150; // 15% IPancakeV2Router public router; address public pair; mapping (address => uint256) inter...
34,737
91
// Calculate token distribution.
uint256 platformFee = calculatePlatformFee(_amount); uint256 idvFee = platformFee > 0 ? _amount.sub(platformFee) : _amount;
uint256 platformFee = calculatePlatformFee(_amount); uint256 idvFee = platformFee > 0 ? _amount.sub(platformFee) : _amount;
15,668
63
// Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender`...
function _transfer(
function _transfer(
4,094
105
// Constructor function/
constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); }
constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); }
19,994
21
// 14: no partial fills, only offerer or zone can execute
ERC20_TO_ERC1155_FULL_RESTRICTED,
ERC20_TO_ERC1155_FULL_RESTRICTED,
30,178
4
// Apply the transition and record the resulting storage slots
if (transitionType == tn.TN_TYPE_DEPOSIT) { require(_infos.accountInfos.length == 1, ErrMsg.REQ_ONE_ACCT); dt.DepositTransition memory deposit = tn.decodePackedDepositTransition(_transition); updatedInfos.accountInfos[0] = transitionApplier1.applyDepositTransition(deposit, _i...
if (transitionType == tn.TN_TYPE_DEPOSIT) { require(_infos.accountInfos.length == 1, ErrMsg.REQ_ONE_ACCT); dt.DepositTransition memory deposit = tn.decodePackedDepositTransition(_transition); updatedInfos.accountInfos[0] = transitionApplier1.applyDepositTransition(deposit, _i...
53,797
7
// Delegates execution to an implementation contract.This is a low level function that doesn't return to its internal call site.It will return to the external caller whatever the implementation returns. implementation Address to delegate. /
function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calld...
function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calld...
4,808
140
// Calculate the remaining amount.
uint256 total = allocation.total; uint256 remainder = total.sub(allocation.claimed);
uint256 total = allocation.total; uint256 remainder = total.sub(allocation.claimed);
77,599
44
// See IMedia /
function finalize() external override onlyOwner
function finalize() external override onlyOwner
9,450
16
// Emits a {BatchMinted} eventCollateral token, nonce, token ids, batch size, and quantities are encoded,hashed and stored as the ERC1155CollateralWrapper token ID. token Collateral token address tokenIds List of token ids quantities List of quantities /
function mint( address token, uint256[] calldata tokenIds, uint256[] calldata quantities ) external nonReentrant returns (uint256) {
function mint( address token, uint256[] calldata tokenIds, uint256[] calldata quantities ) external nonReentrant returns (uint256) {
34,163
6
// The timestamp of the last sending of tokens to community vault/ return The timestamp truncated to 32 bits
function communityFeeLastTimestamp() external view returns (uint32);
function communityFeeLastTimestamp() external view returns (uint32);
23,017
1
// allow identification of user
UserIdentity ui;
UserIdentity ui;
15,437
11
// Remind people to commit before submitting the solution
require(commitment[msg.sender].timestamp != 0); bytes memory keyHash = getHash(_publicKey);
require(commitment[msg.sender].timestamp != 0); bytes memory keyHash = getHash(_publicKey);
26,568
84
// Calculates the expected returned swap amount/amount The given input amount of tokens/yieldShareIn Specifies whether to calculate the swap from TYS to TPS (if true) or from TPS to TYS/ return The expected returned amount of outToken
function getExpectedReturnGivenIn(uint256 amount, bool yieldShareIn) external view returns (uint256);
function getExpectedReturnGivenIn(uint256 amount, bool yieldShareIn) external view returns (uint256);
43,683
105
// e.g. 13814538111.399...e18 / 1e18 = 13814538111
return ceil.div(FULL_SCALE);
return ceil.div(FULL_SCALE);
25,445
6
// Returns true if a `leafs` can be proved to be a part of a Merkle treedefined by `root`. For this, `proofs` for each leaf must be provided, containingsibling hashes on the branch from the leaf to the root of the tree. Then'proofFlag' designates the nodes needed for the multi proof. /
function multiProofVerify( bytes32 root, bytes32[] memory leafs, bytes32[] memory proofs, bool[] memory proofFlag
function multiProofVerify( bytes32 root, bytes32[] memory leafs, bytes32[] memory proofs, bool[] memory proofFlag
2,964
796
// Each external function is dynamically assigned an action identifier as the hash of the disambiguator and the function selector. Disambiguation is necessary to avoid potential collisions in the function selectors of multiple contracts.
return keccak256(abi.encodePacked(_actionIdDisambiguator, selector));
return keccak256(abi.encodePacked(_actionIdDisambiguator, selector));
15,179
4
// Emitted when a new implementation upgrade is queued.
event UpgradeAnnounced(address newImplementation);
event UpgradeAnnounced(address newImplementation);
71,645
157
// Retrieves the period (index-1 based) for the specified cycle and period length. reverts if the specified cycle is zero. cycle The cycle within the period to retrieve. periodLengthInCycles_ Length of a period, in cycles.return The period (index-1 based) for the specified cycle and period length. /
function _getPeriod(uint16 cycle, uint16 periodLengthInCycles_) internal pure returns (uint16) { require(cycle != 0, "NftStaking: cycle cannot be zero"); return (cycle - 1) / periodLengthInCycles_ + 1; }
function _getPeriod(uint16 cycle, uint16 periodLengthInCycles_) internal pure returns (uint16) { require(cycle != 0, "NftStaking: cycle cannot be zero"); return (cycle - 1) / periodLengthInCycles_ + 1; }
68,137
77
// 超过每轮目标部分退款
if (result[0] > 0) { msg.sender.transfer(result[0]); }
if (result[0] > 0) { msg.sender.transfer(result[0]); }
8,266
320
// round 39
ark(i, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393); sbox_partial(i, q); mix(i, q);
ark(i, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393); sbox_partial(i, q); mix(i, q);
32,601
264
// Helper to add liquidity
function __uniswapV2Lend( address _recipient, address _tokenA, address _tokenB, uint256 _amountADesired, uint256 _amountBDesired, uint256 _amountAMin, uint256 _amountBMin
function __uniswapV2Lend( address _recipient, address _tokenA, address _tokenB, uint256 _amountADesired, uint256 _amountBDesired, uint256 _amountAMin, uint256 _amountBMin
83,855
117
// 5. postStakeOut (quasar->star nft; burn quasar)
if (campaignStakeConfigs[_cid].burnRequired) { _starNFT.burn(msg.sender, _nftID); } else {
if (campaignStakeConfigs[_cid].burnRequired) { _starNFT.burn(msg.sender, _nftID); } else {
52,692
20
// Returns the URI of the token with the given tokenId./tokenId Token Id of the NFT that you are getting the URI./ return Base64-encoded token metadata.
function tokenURI(uint256 tokenId) public view override returns (string memory) { Token memory token = tokens[tokenId]; return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( abi.enc...
function tokenURI(uint256 tokenId) public view override returns (string memory) { Token memory token = tokens[tokenId]; return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( abi.enc...
30,894
0
// import files from common directory
interface TokenInterface { function allowance(address, address) external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address, uint) external; function transfer(address, uint) external returns (bool); function transferFrom(address, address, uint) ex...
interface TokenInterface { function allowance(address, address) external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address, uint) external; function transfer(address, uint) external returns (bool); function transferFrom(address, address, uint) ex...
39,489
119
// Fill in index 0 to null requests
CSCPreSaleItem memory _Obj = CSCPreSaleItem(0, stringToBytes32("DummyAsset"), 0, 0, address(this), true); allPreSaleItems.push(_Obj);
CSCPreSaleItem memory _Obj = CSCPreSaleItem(0, stringToBytes32("DummyAsset"), 0, 0, address(this), true); allPreSaleItems.push(_Obj);
18,667
67
// Approve `spender` to transfer up to `amount` from `src`/This will overwrite the approval amount for `spender`/and is subject to issues noted [here](https:eips.ethereum.org/EIPS/eip-20approve)/spender The address of the account which may transfer tokens/amount The number of tokens that are approved/ return success Wh...
function approve(address spender, uint256 amount) external returns (bool success);
function approve(address spender, uint256 amount) external returns (bool success);
52,662
143
// Finalize the crowdsale and token minting, and transfer ownership ofthe token, can be called only by owner /
function finalization() internal { super.finalization(); // Multiplying tokens sold by 0,219512195122 // 18 / 82 = 0,219512195122 , which means that for every token sold in ICO // 0,219512195122 extra tokens will be issued. uint256 extraTokens = token.totalSupply().mul(219512195122).div(100000000...
function finalization() internal { super.finalization(); // Multiplying tokens sold by 0,219512195122 // 18 / 82 = 0,219512195122 , which means that for every token sold in ICO // 0,219512195122 extra tokens will be issued. uint256 extraTokens = token.totalSupply().mul(219512195122).div(100000000...
34,989
2
// Passenger mapping
mapping(address => Passenger) public insurancePassengers;
mapping(address => Passenger) public insurancePassengers;
30,119
19
// Require that the total pay at least the arbitration cost.
require(transaction.senderFee >= arbitrationCost, "The sender fee must cover arbitration costs."); transaction.lastInteraction = now;
require(transaction.senderFee >= arbitrationCost, "The sender fee must cover arbitration costs."); transaction.lastInteraction = now;
814
98
// Allowlist Mint
function setAllowlistMint(bool bool_, uint256 time_) external onlyOwner { _setAllowlistMint(bool_, time_); }
function setAllowlistMint(bool bool_, uint256 time_) external onlyOwner { _setAllowlistMint(bool_, time_); }
4,216
177
// Public functions
function freeETH( address manager, address ethJoin, address end, uint cdp
function freeETH( address manager, address ethJoin, address end, uint cdp
6,963
47
// See {IERC20-totalSupply}. /
function totalSupply() public view virtual override returns (uint256) { return _totalSupply; }
function totalSupply() public view virtual override returns (uint256) { return _totalSupply; }
21,277
146
// no dumping
require(lastManualSwapTime < block.timestamp, "Not yet."); if (amount > threshold.swap) { amount = threshold.swap; }
require(lastManualSwapTime < block.timestamp, "Not yet."); if (amount > threshold.swap) { amount = threshold.swap; }
28,737
84
// Returns whether the address is locked. /
function isLocked(address account) public view returns (bool) { return _locks[account]; }
function isLocked(address account) public view returns (bool) { return _locks[account]; }
25,800
41
// Disables all GPO transfers if the token has been paused by GoldPesa
require(!paused(), "ERC20Pausable: token transfer while paused");
require(!paused(), "ERC20Pausable: token transfer while paused");
45,920
41
// send funds to the contract to fund future security deposits, must have a valuereturn uint256 the new security deposit balance of the user /
function fundDeposit() public payable whenNotPaused returns (uint256) { require(msg.value > 0, "Thing: Sent value <= 0"); //FIXME there is probably a security problem here uint256 newBalance = balances[msg.sender].add(msg.value); balances[msg.sender] = newBalance; //emit De...
function fundDeposit() public payable whenNotPaused returns (uint256) { require(msg.value > 0, "Thing: Sent value <= 0"); //FIXME there is probably a security problem here uint256 newBalance = balances[msg.sender].add(msg.value); balances[msg.sender] = newBalance; //emit De...
27,200
98
// allows execution by staker only /
modifier onlyStaker() { require(votes[msg.sender] > 0, "ERR_NOT_STAKER"); _; }
modifier onlyStaker() { require(votes[msg.sender] > 0, "ERR_NOT_STAKER"); _; }
19,844
87
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
address oldPendingAdmin = pendingAdmin;
8,785
0
// Seconds available to redeem once the cooldown period is fullfilled
uint256 public immutable UNSTAKE_WINDOW;
uint256 public immutable UNSTAKE_WINDOW;
5,092
15
// Reverts as this module should not be removable after added. Users should alwayshave a way to redeem their Sets /
function removeModule() external override { revert("The BasicIssuanceModule module cannot be removed"); }
function removeModule() external override { revert("The BasicIssuanceModule module cannot be removed"); }
9,916
13
// increase level of ghost.
function _levelUp(uint256 _tokenId) internal { require(_owns(msg.sender, _tokenId)); // TODO: setting limit of level ghosts[_tokenId].level++; emit LevelUp(msg.sender, _tokenId, ghosts[_tokenId].level); }
function _levelUp(uint256 _tokenId) internal { require(_owns(msg.sender, _tokenId)); // TODO: setting limit of level ghosts[_tokenId].level++; emit LevelUp(msg.sender, _tokenId, ghosts[_tokenId].level); }
31,531
300
// Store current crowdsale tier (offset by 1)
Contract.set(currentTier()).to(uint(1));
Contract.set(currentTier()).to(uint(1));
8,769
96
// Retrieves the DR hash of the id from the WRB./_id The unique identifier of the data request./ return The hash of the DR
function readDrHash (uint256 _id) external view returns(uint256);
function readDrHash (uint256 _id) external view returns(uint256);
6,727
52
// this method is used to SET user's nickname/
function setOwnerNickName(address _owner, string _nickName) external { require(msg.sender == _owner); ownerToNickname[_owner] = _nickName; // set nickname }
function setOwnerNickName(address _owner, string _nickName) external { require(msg.sender == _owner); ownerToNickname[_owner] = _nickName; // set nickname }
8,607
35
// Implement ERC165/ With three or more supported interfaces (including ERC165 itself as a required supported interface),/ the mapping approach (in every case) costs less gas than the pure approach (at worst case).
function supportsInterface(bytes4 interfaceID) external view returns (bool) { return interfaceID == this.supportsInterface.selector || interfaceID == this.stake.selector ^ this.stakeFor.selector ^ this.unstake.selector ^ this.totalStakedFor.selector ^ this.totalStaked.selector ^ this.token.selector ^ ...
function supportsInterface(bytes4 interfaceID) external view returns (bool) { return interfaceID == this.supportsInterface.selector || interfaceID == this.stake.selector ^ this.stakeFor.selector ^ this.unstake.selector ^ this.totalStakedFor.selector ^ this.totalStaked.selector ^ this.token.selector ^ ...
18,854
62
// discrepancy between heads' outputs or throw behavior wrapper will pay bounty
_revertVal(uint(~0));
_revertVal(uint(~0));
46,746
3
// boost market to nerf shrimp hoarding
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,10));
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,10));
39,108
165
// Gets a price of the asset/_ilk Ilk of the CDP
function getPrice(bytes32 _ilk) public view returns (uint256) { (, uint256 mat) = spotter.ilks(_ilk); (, , uint256 spot, , ) = vat.ilks(_ilk); return rmul(rmul(spot, spotter.par()), mat); }
function getPrice(bytes32 _ilk) public view returns (uint256) { (, uint256 mat) = spotter.ilks(_ilk); (, , uint256 spot, , ) = vat.ilks(_ilk); return rmul(rmul(spot, spotter.par()), mat); }
26,850
5
// Getting the equity of an investor in hadcoins
function equity_in_hadcoins(address investor) external constant return (uint) { return equity_hadcoins[investor]; }
function equity_in_hadcoins(address investor) external constant return (uint) { return equity_hadcoins[investor]; }
20,409
23
// create new item
GameItem memory item = GameItem(price, maxSupply, 0, itemType, name, imageUrl, animationUrl);
GameItem memory item = GameItem(price, maxSupply, 0, itemType, name, imageUrl, animationUrl);
3,772
41
// send half the price to buy the packs
pack.purchaseFor.value(half)(msg.sender, uint16(kittyIDs.length), referrer);
pack.purchaseFor.value(half)(msg.sender, uint16(kittyIDs.length), referrer);
56,458
327
// don't allow creating a contract with a permanently revoked registry
if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); }
if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); }
34,437
57
// Given the two swap tokens and the swap kind, returns which one is the 'calculated' token (the token whoseamount is calculated by the Pool). /
function _tokenCalculated( SwapKind kind, IERC20 tokenIn, IERC20 tokenOut
function _tokenCalculated( SwapKind kind, IERC20 tokenIn, IERC20 tokenOut
82,018
112
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(_SELECTOR, to, value)); success = success && (data.length == 0 || abi.decode(data, (bool))); if(!success) { // for failsafe address graContractOwner = IGraSwapToken(graContract).owner();
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(_SELECTOR, to, value)); success = success && (data.length == 0 || abi.decode(data, (bool))); if(!success) { // for failsafe address graContractOwner = IGraSwapToken(graContract).owner();
38,762
27
// Only the marketEmergencyHandler can call this function, when its in emergencyMode this will allow a spender to spend the whole balance of the specified tokens the spender should ideally be a contract with logic for users to withdraw out their funds.
function setUpEmergencyMode(address spender) external override { (, bool emergencyMode) = pausingManager.checkMarketStatus(factoryId, address(this)); require(emergencyMode, "NOT_EMERGENCY"); (address marketEmergencyHandler, , ) = pausingManager.marketEmergencyHandler(); require(msg.s...
function setUpEmergencyMode(address spender) external override { (, bool emergencyMode) = pausingManager.checkMarketStatus(factoryId, address(this)); require(emergencyMode, "NOT_EMERGENCY"); (address marketEmergencyHandler, , ) = pausingManager.marketEmergencyHandler(); require(msg.s...
71,077
32
// requires that the function is called within the owner delay window /
modifier ownerDelay() { require((block.timestamp >= txWindowStart && block.timestamp <= txWindowEnd) || initialized == false, "Owner function can only be called within the time window"); //and before launch _; }
modifier ownerDelay() { require((block.timestamp >= txWindowStart && block.timestamp <= txWindowEnd) || initialized == false, "Owner function can only be called within the time window"); //and before launch _; }
31,294
35
// passing KYC for investor
function passKYC(address _investor) external managerOnly { kyc[_investor] = true; }
function passKYC(address _investor) external managerOnly { kyc[_investor] = true; }
43,443
11
// Withdraw native token
function withdrawNativeToken(address recipient, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { require(depositedQuantity[recipient] > 0, "Not enough quantity for this recipient"); require(address(this).balance >= amount, "Not enough balance"); (bool sent, ) = payable(recipient).cal...
function withdrawNativeToken(address recipient, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { require(depositedQuantity[recipient] > 0, "Not enough quantity for this recipient"); require(address(this).balance >= amount, "Not enough balance"); (bool sent, ) = payable(recipient).cal...
31,656
122
// Yeld Calc to redeem before updating balances
uint256 stablecoinsToWithdraw = (pool.mul(_shares)).div(_totalSupply); _balances[msg.sender] = _balances[msg.sender].sub(_shares, "redeem amount exceeds balance"); _totalSupply = _totalSupply.sub(_shares); emit Transfer(msg.sender, address(0), _shares);
uint256 stablecoinsToWithdraw = (pool.mul(_shares)).div(_totalSupply); _balances[msg.sender] = _balances[msg.sender].sub(_shares, "redeem amount exceeds balance"); _totalSupply = _totalSupply.sub(_shares); emit Transfer(msg.sender, address(0), _shares);
9,741
6
// Takes some of the code length 2 codes that are near the poles and assigns them. Team is unable to take/ tokens until all other tokens are allocated from sale./ recipientthe account that is assigned the tokens/ indexFromOne a number in the closed range [1, 54]
function mintWaterAndIceReserve(address recipient, uint256 indexFromOne) external onlyOwner { require(RandomDropVending._inventoryForSale() == 0, "Cannot take during sale"); uint256 tokenId = PlusCodes.getNthCodeLength2CodeNearPoles(indexFromOne); AreaNFT._mint(recipient, tokenId); }
function mintWaterAndIceReserve(address recipient, uint256 indexFromOne) external onlyOwner { require(RandomDropVending._inventoryForSale() == 0, "Cannot take during sale"); uint256 tokenId = PlusCodes.getNthCodeLength2CodeNearPoles(indexFromOne); AreaNFT._mint(recipient, tokenId); }
58,451
199
// 0.5% of uToken supply is sent to feeToAddress if fee is on
feeAmount = cap.div(200); _mint(feeTo, feeAmount);
feeAmount = cap.div(200); _mint(feeTo, feeAmount);
21,600
63
// Actually perform the safeTransferFrom
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) private canTransfer(_tokenId, _from, _to)
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) private canTransfer(_tokenId, _from, _to)
20,880