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
30
// Also guarantees that the denominator cannot be zero.
require(denominator > numerator, "ETHmxMinter: cannot set lpShare >= 1"); _lpShareNum = numerator; _lpShareDen = denominator; emit LpShareSet(_msgSender(), numerator, denominator);
require(denominator > numerator, "ETHmxMinter: cannot set lpShare >= 1"); _lpShareNum = numerator; _lpShareDen = denominator; emit LpShareSet(_msgSender(), numerator, denominator);
17,852
19
// approve safely, needs to be set to zero, then max.
for (uint256 k = 0; k < _newApprovals.length; k++){ _approveMax(_newApprovals[k].token, _newApprovals[k].allow); }
for (uint256 k = 0; k < _newApprovals.length; k++){ _approveMax(_newApprovals[k].token, _newApprovals[k].allow); }
4,638
20
// starting time and closing time of Crowdsale scheduled start on Monday, August 27th 2018 at 5:00pm GMT+1
uint public openingTime = 1535990400; uint public closingTime = openingTime.add(7 days);
uint public openingTime = 1535990400; uint public closingTime = openingTime.add(7 days);
9,575
0
// Artem Token PoolDerived from Compound's Reservoir// ERC 20 Token Standard Interface /
interface EIP20Interface { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); /** * @notice Get the total number of tokens in circulation * @return The supply of tokens ...
interface EIP20Interface { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); /** * @notice Get the total number of tokens in circulation * @return The supply of tokens ...
41,673
25
// get the address of team
function getTeamAddress() public view returns(address addr) { addr = teamAddress; }
function getTeamAddress() public view returns(address addr) { addr = teamAddress; }
4,926
356
// Remove pending bid if any
Bid memory bid = bidByOrderId[_nftAddress][_assetId]; if (bid.id != 0) { _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); }
Bid memory bid = bidByOrderId[_nftAddress][_assetId]; if (bid.id != 0) { _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); }
81,545
46
// process fee payment
IERC20Upgradeable(_token).safeTransfer(treasury, platformFee);
IERC20Upgradeable(_token).safeTransfer(treasury, platformFee);
27,630
24
// Transfer the specified amount of tokens to the specified address. Invokes the tokenFallback function if the recipient is a contract. The token transfer fails if the recipient is a contract but does not implement the tokenFallback function or the fallback function to receive funds._toReceiver address. _value Amount o...
function transfer(address _to, uint _value, bytes _data) public returns (bool ok) { // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . uint codeLength; require (_to != 0x0); assembly { // Retri...
function transfer(address _to, uint _value, bytes _data) public returns (bool ok) { // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . uint codeLength; require (_to != 0x0); assembly { // Retri...
37,855
185
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most signat...
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); }
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); }
4,352
127
// Deposit ERC20 tokens with permit aka gasless approval. amount ERC20 token amount. deadline The time at which signature will expire v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair /
function depositWithPermit( uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
function depositWithPermit( uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
1,805
1
// store accounts that have voted
mapping(address => bool) public voters;
mapping(address => bool) public voters;
44,474
251
// make sure theres not 2x spaces in a row
if (_temp[i] == 0x20) require( _temp[i+1] != 0x20, "string cannot contain consecutive spaces");
if (_temp[i] == 0x20) require( _temp[i+1] != 0x20, "string cannot contain consecutive spaces");
11,473
154
// On a normal send() or transfer() this fallback is never executed as it will beintercepted by the Proxy (see aragonOS281)/
function () external payable isInitialized { require(msg.data.length == 0, ERROR_DATA_NON_ZERO); _deposit(ETH, msg.value); }
function () external payable isInitialized { require(msg.data.length == 0, ERROR_DATA_NON_ZERO); _deposit(ETH, msg.value); }
9,018
50
// Given a token Id, returns a byte array that is supposed to be converted into string.
function getMetadata(uint256 _tokenId, string) public view returns (bytes32[4] buffer, uint256 count) { if (_tokenId == 1) { buffer[0] = "Hello World! :D"; count = 15; } else if (_tokenId == 2) { buffer[0] = "I would definitely choose a medi"; buffer[1...
function getMetadata(uint256 _tokenId, string) public view returns (bytes32[4] buffer, uint256 count) { if (_tokenId == 1) { buffer[0] = "Hello World! :D"; count = 15; } else if (_tokenId == 2) { buffer[0] = "I would definitely choose a medi"; buffer[1...
28,412
27
// charge fee from user receive amount
lpFeeBase = DecimalMath.mul(amount, _LP_FEE_RATE_); mtFeeBase = DecimalMath.mul(amount, _MT_FEE_RATE_); uint256 buyBaseAmount = amount.add(lpFeeBase).add(mtFeeBase); if (_R_STATUS_ == Types.RStatus.ONE) {
lpFeeBase = DecimalMath.mul(amount, _LP_FEE_RATE_); mtFeeBase = DecimalMath.mul(amount, _MT_FEE_RATE_); uint256 buyBaseAmount = amount.add(lpFeeBase).add(mtFeeBase); if (_R_STATUS_ == Types.RStatus.ONE) {
20,470
2
// Initialize the market
initialize(underlying_, comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
initialize(underlying_, comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
59,924
14
// update currentPrice
currentPrice = latestPrice;
currentPrice = latestPrice;
12,454
48
// Miminal tokens funding goal in USD cents, if this goal isn't reached during ICO, refund will begin
uint public constant MIN_ICO_GOAL = 1e7;
uint public constant MIN_ICO_GOAL = 1e7;
39,563
10
// maintains the safety of mathematical operations. /
library Math { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; //require(c >= a); //require(c >= b); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; requi...
library Math { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; //require(c >= a); //require(c >= b); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; requi...
118
15
// pool -> isCallPool -> PoolInfo
mapping(address => mapping(bool => PoolInfo)) poolInfo;
mapping(address => mapping(bool => PoolInfo)) poolInfo;
21,725
2
// Cost to buy sumbissions
uint256 public costETH; address payable owner; event Locked(string, string); constructor() public
uint256 public costETH; address payable owner; event Locked(string, string); constructor() public
27,085
37
// Pausable tokenStandardToken modified with pausable transfers. /
contract PausableToken is StandardToken, Pausable { using SafeMath for uint256; function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bo...
contract PausableToken is StandardToken, Pausable { using SafeMath for uint256; function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bo...
31,541
24
// adds a single Dragon to the Flight account the address of the staker tokenId the ID of the Dragon to add to the Flight /
function _addDragonToFlight(address account, uint256 tokenId) internal { uint8 rank = _rankForDragon(tokenId); stats.totalRankStaked += rank; // Portion of earnings ranges from 8 to 5 flightIndices[tokenId] = flight[rank].length; // Store the location of the dragon in the Flight flight[rank].push(Stak...
function _addDragonToFlight(address account, uint256 tokenId) internal { uint8 rank = _rankForDragon(tokenId); stats.totalRankStaked += rank; // Portion of earnings ranges from 8 to 5 flightIndices[tokenId] = flight[rank].length; // Store the location of the dragon in the Flight flight[rank].push(Stak...
32,179
20
// One way function to release the tokens to the wild. Can be called only from the release agent that is the final ICO contract. It is only called if the crowdsale has been success (first milestone reached). /
function releaseTokenTransfer() public onlyReleaseAgent { released = true; }
function releaseTokenTransfer() public onlyReleaseAgent { released = true; }
23,234
16
// check mint case
if (from != address(0)) { require( controller.isInvestorAddressActive(from), "ERC1155CurioAssetRoles: transfer permission denied" ); }
if (from != address(0)) { require( controller.isInvestorAddressActive(from), "ERC1155CurioAssetRoles: transfer permission denied" ); }
41,282
188
// feature state management
bool public spendState; // Goop spending state bool public rerollState; // reroll function state bool public stakingState; // staking state bool public transferState; // Goop P2P transfer state bool public claimStatus; // Goop claim status bool public verifyVRF; // can only be set once, used to ...
bool public spendState; // Goop spending state bool public rerollState; // reroll function state bool public stakingState; // staking state bool public transferState; // Goop P2P transfer state bool public claimStatus; // Goop claim status bool public verifyVRF; // can only be set once, used to ...
49,348
92
// - return Number of keys/
function getPoolsCount() public view returns(uint256) { return poolInfo.length; }
function getPoolsCount() public view returns(uint256) { return poolInfo.length; }
23,439
197
// Setting the version as a function so that it can be overriden
function version() public pure virtual returns(string memory) { return "1"; } /** * @dev See {IERC2612-permit}. * * In cases where the free option is not a concern, deadline can simply be * set to uint(-1), so it should be seen as an optional parameter */ function permit(address ow...
function version() public pure virtual returns(string memory) { return "1"; } /** * @dev See {IERC2612-permit}. * * In cases where the free option is not a concern, deadline can simply be * set to uint(-1), so it should be seen as an optional parameter */ function permit(address ow...
51,501
95
// Append : the LockMechanism functions by owner/
function LockMechanismByOwner ( address _addr, uint256 _tokens ) external onlyOwner whenFunding
function LockMechanismByOwner ( address _addr, uint256 _tokens ) external onlyOwner whenFunding
24,341
172
// Internal deposit logic to be implemented by Stratgies
function _deposit(uint256 _want) internal virtual;
function _deposit(uint256 _want) internal virtual;
19,158
222
// should be external
function signDatasetOrder(IexecODBLibOrders.DatasetOrder memory _datasetorder) public returns (bool)
function signDatasetOrder(IexecODBLibOrders.DatasetOrder memory _datasetorder) public returns (bool)
56,761
0
// second for loop missing
return string(bconcat);
return string(bconcat);
26,680
12
// Burn MBC from user address._value The quantity of MBC./
function burn(uint256 _value)
function burn(uint256 _value)
45,084
91
// _tOwned[account] = 0;
_tOwned[account] = _rOwned[account]; // change by auditor recommendations _isExcluded[account] = false; _excluded.pop(); break;
_tOwned[account] = _rOwned[account]; // change by auditor recommendations _isExcluded[account] = false; _excluded.pop(); break;
3,723
109
// ==========================================
{ // data setup // address _userId = msg.sender; uint _undividedDividends = SafeMath.div(SafeMath.mul(_etherIn, buyFee_), 100); uint _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, affComm_), 100); uint _dividends = SafeMath.sub(_undividedDividends, _referralB...
{ // data setup // address _userId = msg.sender; uint _undividedDividends = SafeMath.div(SafeMath.mul(_etherIn, buyFee_), 100); uint _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, affComm_), 100); uint _dividends = SafeMath.sub(_undividedDividends, _referralB...
178
78
// distribution as dividend to token holders
uint256 _dividends = SafeMath.mul(_incomingEthereum, dividendFee_) / 100;
uint256 _dividends = SafeMath.mul(_incomingEthereum, dividendFee_) / 100;
42,775
9
// Mints tokens/account Address that will receive the minted tokens/amount Amount that will be minted
function mint(address account, uint256 amount) external override { require(isMinter[msg.sender], "Only minters are allowed to mint"); _mint(account, amount); }
function mint(address account, uint256 amount) external override { require(isMinter[msg.sender], "Only minters are allowed to mint"); _mint(account, amount); }
16,411
13
// Set the token uri prefix /
function setTokenURIPrefix(string calldata prefix) external;
function setTokenURIPrefix(string calldata prefix) external;
14,614
194
// Returns the downcasted int8 from int256, reverting onoverflow (when the input is less than smallest int8 orgreater than largest int8). Counterpart to Solidity's `int8` operator. Requirements: - input must fit into 8 bits _Available since v3.1._ /
function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); }
function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); }
974
30
// Specifies service account /
function specifyController(address _controller) external onlyOwner { controller = _controller; isControllerSpecified = true; }
function specifyController(address _controller) external onlyOwner { controller = _controller; isControllerSpecified = true; }
28,899
32
// Using Address.sendValue() here would mask the revertMsg upon reentrancy, but we want to expose it to allow for more precise testing. This otherwise uses the exact same pattern as Address.sendValue(). solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returnData) = reimburse.call{ value: refund }("");
(bool success, bytes memory returnData) = reimburse.call{ value: refund }("");
27,779
7
// Locks the addresses for this ENS node. node The node to lock. /
function lockAddr( bytes32 node
function lockAddr( bytes32 node
7,029
198
// This will return the expected balance during normal situations
} else {
} else {
3,319
5
// Conversions from Integer to Floating-Point
function uint_to_float32( uint a ) internal returns ( float32 r, bytes1 errorFlags ) { if ( a == 0 ) { return; } uint16 leadingZeros = countLeadingZeros( uint256(a) ); uint16 exp = (127+255) - leadingZeros; bytes32 frac = bytes32( a ) << ( leadingZeros + 1 ); ...
function uint_to_float32( uint a ) internal returns ( float32 r, bytes1 errorFlags ) { if ( a == 0 ) { return; } uint16 leadingZeros = countLeadingZeros( uint256(a) ); uint16 exp = (127+255) - leadingZeros; bytes32 frac = bytes32( a ) << ( leadingZeros + 1 ); ...
23,175
7
// Now we populate the top scores array.
if(TopScores.length < m_maxScores) {
if(TopScores.length < m_maxScores) {
11,711
11
// 이벤트 발생
emit Transfer(0x0, msg.sender, partId); break;
emit Transfer(0x0, msg.sender, partId); break;
18,393
7
// ADMIN
function _baseURI() internal view override returns (string memory) { return _metadataBaseURI; }
function _baseURI() internal view override returns (string memory) { return _metadataBaseURI; }
49,990
174
// VZT to revert
uint256 vztValue = purchaseLog[buyer].vztValue;
uint256 vztValue = purchaseLog[buyer].vztValue;
32,101
127
// define local variable for old owner
address oldOwner = owner;
address oldOwner = owner;
29,848
0
// proposal id
uint id;
uint id;
21,206
37
// early exit
if(operationFound && uploadedFound) break;
if(operationFound && uploadedFound) break;
29,406
29
// Set Item Cost
items[id] = cost;
items[id] = cost;
77,394
260
// Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } }
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } }
36,513
45
// As it didn't finish, pay a fee of 10% (before first half) or 5% (after first half)
uint8 penalty = _isFirstHalf(stake.createdOn, stake.lockupPeriod) ? 10 : 5; totalPenalty = totalRewards.mul(penalty).div(100);
uint8 penalty = _isFirstHalf(stake.createdOn, stake.lockupPeriod) ? 10 : 5; totalPenalty = totalRewards.mul(penalty).div(100);
25,866
6
// now affect the trade to the reserves
if (aToB) { uint amountOut = FOHLE_Library.getAmountOut(amountIn, reserveA, reserveB); reserveA += amountIn; reserveB -= amountOut; } else {
if (aToB) { uint amountOut = FOHLE_Library.getAmountOut(amountIn, reserveA, reserveB); reserveA += amountIn; reserveB -= amountOut; } else {
23,705
12
// PUBLIC FUNCTIONS
function read_demurrage_config() public constant returns (uint256 _collector_balance, uint256 _base, uint256 _rate, address _collector)
function read_demurrage_config() public constant returns (uint256 _collector_balance, uint256 _base, uint256 _rate, address _collector)
15,645
123
// If we still need more offers
offerId = getWorseOffer(offerId); //We look for the next best offer require(offerId != 0); //Fails if there are not enough offers to complete
offerId = getWorseOffer(offerId); //We look for the next best offer require(offerId != 0); //Fails if there are not enough offers to complete
10,148
205
// Helper to transfer fund shares from one account to another
function __vaultActionTransferShares(bytes memory _actionData) private { (address from, address to, uint256 amount) = abi.decode( _actionData, (address, address, uint256) ); IVault(vaultProxy).transferShares(from, to, amount); }
function __vaultActionTransferShares(bytes memory _actionData) private { (address from, address to, uint256 amount) = abi.decode( _actionData, (address, address, uint256) ); IVault(vaultProxy).transferShares(from, to, amount); }
18,559
13
// Internally tracks clone deployment under eip-1167 proxy pattern
bool private initialized; mapping (bytes32 => bool) public queuedTransactions;
bool private initialized; mapping (bytes32 => bool) public queuedTransactions;
14,142
108
// NOTE: requires that delegate key which sent the original proposal cancels, msg.sender == proposal.proposer
function cancelProposal(uint256 proposalId) public nonReentrant { Proposal storage proposal = proposals[proposalId]; require(!proposal.flags[0], "proposal has already been sponsored"); require(!proposal.flags[3], "proposal has already been cancelled"); require(msg.sender == proposal....
function cancelProposal(uint256 proposalId) public nonReentrant { Proposal storage proposal = proposals[proposalId]; require(!proposal.flags[0], "proposal has already been sponsored"); require(!proposal.flags[3], "proposal has already been cancelled"); require(msg.sender == proposal....
8,178
8
// Enrol user
users[_username] = User(_pool, msg.sender, _username);
users[_username] = User(_pool, msg.sender, _username);
18,200
138
// Emitted when the liquidation limit of an underlying token is updated.//underlyingToken The address of the underlying token./maximum The updated maximum liquidation limit./blocksThe updated number of blocks it will take for the maximum liquidation limit to be replenished when it is completely exhausted.
event LiquidationLimitUpdated(address indexed underlyingToken, uint256 maximum, uint256 blocks);
event LiquidationLimitUpdated(address indexed underlyingToken, uint256 maximum, uint256 blocks);
56,698
30
// An event to make the transfer easy to find on the blockchain
Transfer(_from, _to, _value); return true;
Transfer(_from, _to, _value); return true;
49,727
28
// Sets the max token supply and emits an event.newMaxSupply The new max supply to set. /
function setMaxSupply(uint256 newMaxSupply) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the max supply does not exceed the maximum value of uint64. if (newMaxSupply > 2**64 - 1) { revert CannotExceedMaxSupplyOfUint6...
function setMaxSupply(uint256 newMaxSupply) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the max supply does not exceed the maximum value of uint64. if (newMaxSupply > 2**64 - 1) { revert CannotExceedMaxSupplyOfUint6...
12,747
17
// Helper: Returns boolean if we are before the execution window. /
function isBeforeWindow(ExecutionWindow storage self) returns (bool) { return getNow(self) < self.windowStart; }
function isBeforeWindow(ExecutionWindow storage self) returns (bool) { return getNow(self) < self.windowStart; }
35,359
21
// Join
function _onJoinPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, bytes memory userData
function _onJoinPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, bytes memory userData
21,854
12
// Require that sufficient funds are available to pay for the query. require(oraclize_getPrice(ORACLE_DATA_SOURCE, QUERY_CALLBACK_GAS) < this.balance); NOTE: Currently the first oracle query call to oraclize.it is free. Since our expiration query will always be the first, there is no needed pre-funding amount to create...
bytes32 queryId = oraclize_query( EXPIRATION, ORACLE_DATA_SOURCE, ORACLE_QUERY, QUERY_CALLBACK_GAS ); require(queryId != 0); validQueryIDs[queryId] = true;
bytes32 queryId = oraclize_query( EXPIRATION, ORACLE_DATA_SOURCE, ORACLE_QUERY, QUERY_CALLBACK_GAS ); require(queryId != 0); validQueryIDs[queryId] = true;
6,897
23
// This function lets a user buy her reserved NFTs
function buyNFT(uint256 _dropHash) public payable { require( nftOwnerships[_dropHash][0].dropTime <= block.timestamp, "Droptime not yet reached!" ); require( nftOwnerships[_dropHash][0].weiPrice * nftReservationInformationOfUsers[msg.sender...
function buyNFT(uint256 _dropHash) public payable { require( nftOwnerships[_dropHash][0].dropTime <= block.timestamp, "Droptime not yet reached!" ); require( nftOwnerships[_dropHash][0].weiPrice * nftReservationInformationOfUsers[msg.sender...
32,689
421
// Tests equality of two byte arrays./lhs First byte array to compare./rhs Second byte array to compare./ return True if arrays are the same. False otherwise.
function equals( bytes memory lhs, bytes memory rhs ) internal pure returns (bool equal)
function equals( bytes memory lhs, bytes memory rhs ) internal pure returns (bool equal)
28,799
2
// Numerai Model ID which is used to upload via Numerapi or similar
string public dataScientistModelId; string public buyerModelId;
string public dataScientistModelId; string public buyerModelId;
43,551
303
// Admin owned tokens can be rolled while paused for testing purposes, but no chance of jackpot
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || tokens[tid].level < paused_level,"Rolling paused"); require(num> 0 && num <= 10,"Number of rolls must be in range 1 - 10"); require(msg.value >= roll_price*num, "Must send minimum value to purchase!"); require(LINK.balanceOf(address(this...
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || tokens[tid].level < paused_level,"Rolling paused"); require(num> 0 && num <= 10,"Number of rolls must be in range 1 - 10"); require(msg.value >= roll_price*num, "Must send minimum value to purchase!"); require(LINK.balanceOf(address(this...
43,407
5
// to get the needed token functions in the contract
contract Token { function transfer(address, uint) returns(bool); function balanceOf(address) constant returns (uint); }
contract Token { function transfer(address, uint) returns(bool); function balanceOf(address) constant returns (uint); }
41,071
6
// Calculates floor(xy÷denominator) with full precision.//Credit to Remco Bloemen under MIT license https:xn--2-umb.com/21/muldiv.// Requirements:/ - The denominator cannot be zero./ - The result must fit within uint256.// Caveats:/ - This function does not work with fixed-point numbers.//x The multiplicand as an uint2...
function mulDiv( uint256 x, uint256 y, uint256 denominator
function mulDiv( uint256 x, uint256 y, uint256 denominator
3,204
43
// get num keys
function getKeysCount(bytes32 nodeId) view public returns (uint) { if(!canRead(nodeId, msg.sender)) return 0; return Nodes[nodeId].keys.length; }
function getKeysCount(bytes32 nodeId) view public returns (uint) { if(!canRead(nodeId, msg.sender)) return 0; return Nodes[nodeId].keys.length; }
46,667
32
// Function to withdraw Treum fee balance from EB contract /
function withdrawEB() public onlyOwner { IEulerBeats(EulerBeats).withdraw(); msg.sender.transfer(address(this).balance); }
function withdrawEB() public onlyOwner { IEulerBeats(EulerBeats).withdraw(); msg.sender.transfer(address(this).balance); }
39,009
126
// Reset rewards pool
lastRewardTime = now; rewardPool = 0; emit PayoutSnapshotTaken(totalTopHolders, totalPayoutSent, now);
lastRewardTime = now; rewardPool = 0; emit PayoutSnapshotTaken(totalTopHolders, totalPayoutSent, now);
10,738
157
// PRIVATE HELPERS FUNCTION
function safeSend(address addr, uint value)
function safeSend(address addr, uint value)
7,545
227
// score calculatorbase the base amount taken from bases for the weapon classtokenId id of the token being scoredoutput weapon class or description /
function getScore( uint256 base, uint256 tokenId, string memory output
function getScore( uint256 base, uint256 tokenId, string memory output
20,592
3
// The ERC20 token the owner of this contract wants to exchange for ETH
IERC20Metadata public immutable paymentToken;
IERC20Metadata public immutable paymentToken;
2,697
9
// ISVG image library types interface/Allows Solidity files to reference the library's input and return types without referencing the library itself
interface ISVGTypes { /// Represents a color in RGB format with alpha struct Color { uint8 red; uint8 green; uint8 blue; uint8 alpha; } /// Represents a color attribute in an SVG image file enum ColorAttribute { Fill, Stroke, Stop } /// Represents t...
interface ISVGTypes { /// Represents a color in RGB format with alpha struct Color { uint8 red; uint8 green; uint8 blue; uint8 alpha; } /// Represents a color attribute in an SVG image file enum ColorAttribute { Fill, Stroke, Stop } /// Represents t...
11,594
105
// deployer + self administration
_setupRole(TIMELOCK_ADMIN_ROLE, _msgSender()); _setupRole(TIMELOCK_ADMIN_ROLE, address(this));
_setupRole(TIMELOCK_ADMIN_ROLE, _msgSender()); _setupRole(TIMELOCK_ADMIN_ROLE, address(this));
5,734
3
// https:etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
39,684
203
// dynamic buy or sell fee
if (automatedMarketMakerPairs[from]) { if (buyTaxAmount[feeIndex] > 0) { fees = amount.mul(buyTaxAmount[feeIndex]).div(100); }
if (automatedMarketMakerPairs[from]) { if (buyTaxAmount[feeIndex] > 0) { fees = amount.mul(buyTaxAmount[feeIndex]).div(100); }
76,857
74
// Add/remove any number of addresses who are blacklisted/ from receiving airdropping rewards/blacklistCuts BlacklistCut_[]
function blacklistCut( SLib.BlacklistCut_[] calldata blacklistCuts
function blacklistCut( SLib.BlacklistCut_[] calldata blacklistCuts
2,659
12
// The minimum allowed initial margin.
uint256 minInitialMargin;
uint256 minInitialMargin;
23,603
173
// check if Ico is still opened
require(hasClosed(), "JPEGVaultICO: not closed"); uint256 amount = balances[beneficiary]; require(amount > 0, "JPEGVaultICO: beneficiary is not due any tokens"); uint256 tokenAmount = getTokenClaimable(balances[beneficiary]); balances[beneficiary] = 0;
require(hasClosed(), "JPEGVaultICO: not closed"); uint256 amount = balances[beneficiary]; require(amount > 0, "JPEGVaultICO: beneficiary is not due any tokens"); uint256 tokenAmount = getTokenClaimable(balances[beneficiary]); balances[beneficiary] = 0;
58,337
1
// flags
bool public initialized = false;
bool public initialized = false;
16,069
25
// retrieve _poolTokenAddress token balance per user per epoch
function _getUserBalancePerEpoch(address userAddress, uint128 epochId) internal view returns (uint){ return _staking.getEpochUserBalance(userAddress, _poolTokenAddress, _stakingEpochId(epochId)); }
function _getUserBalancePerEpoch(address userAddress, uint128 epochId) internal view returns (uint){ return _staking.getEpochUserBalance(userAddress, _poolTokenAddress, _stakingEpochId(epochId)); }
15,957
27
// 20% of the total penalty is burned
stakingToken.burn(splitPenalty - originPenalty);
stakingToken.burn(splitPenalty - originPenalty);
24,509
55
// Gets allowance owner owner address spender spender addressreturn allowance /
function allowance( address owner, address spender ) external view override returns (uint256)
function allowance( address owner, address spender ) external view override returns (uint256)
7,099
158
// Allows the owner to withdraw any Ethereum that was accidentally sent to this contract
function rescueEth() external onlyOwner { payable(owner()).transfer(address(this).balance); }
function rescueEth() external onlyOwner { payable(owner()).transfer(address(this).balance); }
446
23
// The maintainer's extra karma is computed (1 extra karma for each 100 redeemed by a user)
uint newMaintainerKarma = newUserKarma / 100;
uint newMaintainerKarma = newUserKarma / 100;
78,971
4
// Leaf nodes and extension nodes always have two elements, a `path` and a `value`.
uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;
uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;
22,962
97
// Only crowdsale contract could take actions /
modifier onlyCrowdsale { require(msg.sender == _crowdsale, "The caller is not the crowdsale contract"); _; }
modifier onlyCrowdsale { require(msg.sender == _crowdsale, "The caller is not the crowdsale contract"); _; }
22,290
92
// deploy a Name _name The name of the Name _originId The eth address the creates the Name _datHash The datHash of this Name _database The database for this Name _keyValue The key/value pair to be checked on the database _contentId The contentId related to this Name _nameTAOVaultAddress The address of NameTAOVault /
function deployName(string memory _name, address _originId, string memory _datHash, string memory _database, string memory _keyValue, bytes32 _contentId, address _nameTAOVaultAddress
function deployName(string memory _name, address _originId, string memory _datHash, string memory _database, string memory _keyValue, bytes32 _contentId, address _nameTAOVaultAddress
47,053
94
// check lockup duration after _stashRewards, which has erased previous lockup if it has unlocked already
LockedDelegation storage ld = getLockupInfo[delegator][toValidatorID]; require(lockupDuration >= ld.duration, "lockup duration cannot decrease"); ld.lockedStake = ld.lockedStake.add(amount); ld.fromEpoch = currentEpoch(); ld.endTime = endTime; ld.duration = lockupDuratio...
LockedDelegation storage ld = getLockupInfo[delegator][toValidatorID]; require(lockupDuration >= ld.duration, "lockup duration cannot decrease"); ld.lockedStake = ld.lockedStake.add(amount); ld.fromEpoch = currentEpoch(); ld.endTime = endTime; ld.duration = lockupDuratio...
8,283
169
// apply the formula and return
return (_weight * rewardPerWeight) / REWARD_PER_WEIGHT_MULTIPLIER;
return (_weight * rewardPerWeight) / REWARD_PER_WEIGHT_MULTIPLIER;
31,472
34
// Check if the user is getting registered for the first time
if (userAccounts[msg.sender].intRound == 0) {
if (userAccounts[msg.sender].intRound == 0) {
16,831
164
// seriesSum holds the accumulated sum of each term in the series, starting with the initial z
int256 seriesSum = num;
int256 seriesSum = num;
5,643
8
// transfer cc.sender_wallet cc.amount
ITONTokenWallet(cc.token_wallet).transfer{value: Constants.FOR_RETURN_TOKEN, flag: 1}(cc.sender_wallet, cc.amount, 0, cc.original_gas_to, true, new_payload);
ITONTokenWallet(cc.token_wallet).transfer{value: Constants.FOR_RETURN_TOKEN, flag: 1}(cc.sender_wallet, cc.amount, 0, cc.original_gas_to, true, new_payload);
26,258