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
113
// Exposes internal function that withdraws a quantity of tokens from the vault anddeattributes the tokens respectively, to system modules. _fromAddress to decredit for withdraw_toAddress to transfer tokens to_token Address of token being withdrawn_quantityAmount of tokens to withdraw /
function withdrawModule(
function withdrawModule(
27,492
10
// uint256 _academicYearStart, uint256 _academicYearEnd,
string memory _merit )
string memory _merit )
24,265
156
// Updates address of 'trustedWallet_B' _trustedWalletNew address for 'trustedWallet_B' /
function setTrustedWallet_B(address _trustedWallet) external onlyRole(DEFAULT_ADMIN_ROLE) { trustedWallet_B = _trustedWallet; }
function setTrustedWallet_B(address _trustedWallet) external onlyRole(DEFAULT_ADMIN_ROLE) { trustedWallet_B = _trustedWallet; }
58,027
7
// main contract
abstract contract Main is ERC20 { // ---------------------------------------- data string public merchantName; string public productName; uint256 public cost; uint256 public timeFrame; address payable public merchantAddress; constructor (string memory merchantName_, string memory productN...
abstract contract Main is ERC20 { // ---------------------------------------- data string public merchantName; string public productName; uint256 public cost; uint256 public timeFrame; address payable public merchantAddress; constructor (string memory merchantName_, string memory productN...
41,258
134
// oraclize calback gas price is set to 4 gwei, should be quite ok
oraclize_setCustomGasPrice(4000000000);
oraclize_setCustomGasPrice(4000000000);
31,432
50
// paymnent must be greater than 1GWei and less than 100k ETH
require((msg.value > 1000000000) && (msg.value < 100000000000000000000000), "payment invalid"); _;
require((msg.value > 1000000000) && (msg.value < 100000000000000000000000), "payment invalid"); _;
21,476
21
// error handling
contract TestThrows { function testAssert() public pure { assert(1 == 2); } function testRequire() public pure { require(2 == 1); } function testRevert() public pure { revert(); } function testThrow() public pure { throw; } }
contract TestThrows { function testAssert() public pure { assert(1 == 2); } function testRequire() public pure { require(2 == 1); } function testRevert() public pure { revert(); } function testThrow() public pure { throw; } }
30,336
12
// Total amount of claimed tokens
uint256 public totalTokensClaimed;
uint256 public totalTokensClaimed;
20,682
16
// Return the owner of an NFT. If the result is the zero address,/ the token is considered invalid and we throw/tokenID The identifier for an NFT/ return The address of the owner of the NFT
function ownerOf(uint256 tokenID) external view isValidToken(tokenID) returns (address) { return _ownerOf[tokenID]; }
function ownerOf(uint256 tokenID) external view isValidToken(tokenID) returns (address) { return _ownerOf[tokenID]; }
52,684
0
// Creates request for Oraclize to get the BTC price payment_ The amount of WETH used as payment for Oraclize /
function getAssetPrice(uint128 payment_) internal returns (bytes32 queryId) { weth.withdraw(payment_); require(oraclize_getPrice("URL", gasLimit) <= address(this).balance, "CryptoWatch.getAssetPrice: Ether balance is less than oraclize price"); queryId = oraclize_query("URL", "json(https://a...
function getAssetPrice(uint128 payment_) internal returns (bytes32 queryId) { weth.withdraw(payment_); require(oraclize_getPrice("URL", gasLimit) <= address(this).balance, "CryptoWatch.getAssetPrice: Ether balance is less than oraclize price"); queryId = oraclize_query("URL", "json(https://a...
9,035
26
// Declare a state variable representing the global seed. This value is set upon completion of the reveal phase and is used as a component of metadata generation for each token.
bytes32 public globalSeed;
bytes32 public globalSeed;
31,869
5
// The return value should match this arithmetic
oracle.latestBlockTimestamp() + oracle.SUBMISSION_INTERVAL() );
oracle.latestBlockTimestamp() + oracle.SUBMISSION_INTERVAL() );
30,407
1
// Locks baseUri when set to true
bool private _baseUri_frozen;
bool private _baseUri_frozen;
20,180
10
// The owners of the users.
mapping(uint256 userId => address) userOwners;
mapping(uint256 userId => address) userOwners;
23,069
62
// the next line is the loop condition: while(uint256(mc < end) + cb == 2)
for { } eq(add(lt(mc, end), cb), 2) {
for { } eq(add(lt(mc, end), cb), 2) {
20,830
68
// Core of the governance system, designed to be extended though various modules. This contract is abstract and requires several function to be implemented in various modules:
* - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote} * - A voting module must implement {_getVotes} * - Additionanly, the {votingPeriod} must also be implemented * * _Available since v4.3._ */ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Re...
* - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote} * - A voting module must implement {_getVotes} * - Additionanly, the {votingPeriod} must also be implemented * * _Available since v4.3._ */ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Re...
17,129
324
// Decrease the sponsors position tokens size. Ensure it is above the min sponsor size.
FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(numTokens); require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position"); positionData.tokensOutstanding = newTokenCount;
FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(numTokens); require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position"); positionData.tokensOutstanding = newTokenCount;
2,638
1
// mint it
_mint(theList[x], _nextUp()); _oneTeamMint();
_mint(theList[x], _nextUp()); _oneTeamMint();
4,688
2
// array of Applications Objects
mapping (uint => mapping (uint => uint)) private AppsOBJprice; // AppsOBJ[_app][_obj] = price; (in virtual units (PMC)) mapping (uint => mapping (uint => uint)) private AppsOBJduration;
mapping (uint => mapping (uint => uint)) private AppsOBJprice; // AppsOBJ[_app][_obj] = price; (in virtual units (PMC)) mapping (uint => mapping (uint => uint)) private AppsOBJduration;
31,983
27
// OwnableThe Ownable contract has an owner address, and provides basicauthorization control functions, this simplifies the implementation of "user permissions"./
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { requi...
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { requi...
39,468
55
// Return array of all whitelisted addresses return address[]Array of addresses /
function validAddresses() external view returns (address[] memory)
function validAddresses() external view returns (address[] memory)
26,983
5
// Creator Royalty Interface
IERC721CreatorRoyalty public iERC721CreatorRoyalty;
IERC721CreatorRoyalty public iERC721CreatorRoyalty;
2,456
101
// lock everything that is lockable
_lockLiquidity(balanceOf(address(this)));
_lockLiquidity(balanceOf(address(this)));
43,667
18
// owner可以退回合约内的token. /
function revoke() public { require (msg.sender == owner); uint256 amount = token.balanceOf(this); require(amount > 0); token.safeTransfer(owner, amount); }
function revoke() public { require (msg.sender == owner); uint256 amount = token.balanceOf(this); require(amount > 0); token.safeTransfer(owner, amount); }
8,556
5
// Check if an airline is registered/
function isRegistered(address airline) external returns (bool);
function isRegistered(address airline) external returns (bool);
32,387
257
// save last committed period to the storage if both periods will be empty after minting because we won't be able to calculate last committed period see getLastCommittedPeriod(address)
StakerInfo storage info = stakerInfo[msg.sender]; uint16 previousPeriod = getCurrentPeriod() - 1; if (info.nextCommittedPeriod <= previousPeriod && info.nextCommittedPeriod != 0) { info.lastCommittedPeriod = info.nextCommittedPeriod; }
StakerInfo storage info = stakerInfo[msg.sender]; uint16 previousPeriod = getCurrentPeriod() - 1; if (info.nextCommittedPeriod <= previousPeriod && info.nextCommittedPeriod != 0) { info.lastCommittedPeriod = info.nextCommittedPeriod; }
50,093
5
// Logged when an operator is added or removed.
event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); function setRecord( bytes32 node, address owner, address resolver,
event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); function setRecord( bytes32 node, address owner, address resolver,
31,012
3
// Increase the PlanetAdded by User
_mint(msg.sender, newItemId);
_mint(msg.sender, newItemId);
26,734
118
// - The max supply. /
uint256 internal constant MAX_SUPPLY = 26_930_000e18;
uint256 internal constant MAX_SUPPLY = 26_930_000e18;
13,448
4
// free memory pointer
let memPtr := mload(0x40)
let memPtr := mload(0x40)
11,111
141
// check oracle type
require(vault.oracleType(asset, msg.sender) == ORACLE_TYPE, "Unit Protocol: WRONG_ORACLE_TYPE");
require(vault.oracleType(asset, msg.sender) == ORACLE_TYPE, "Unit Protocol: WRONG_ORACLE_TYPE");
74,958
24
// Mutually exclusive reentrancy protection into the pool to/from a method. This method also prevents entrance/ to a function before the pool is initialized. The reentrancy guard is required throughout the contract because/ we use balance checks to determine the payment status of interactions such as mint, swap and fla...
modifier lock() { require(slot0.unlocked, 'LOK'); slot0.unlocked = false; _; slot0.unlocked = true; }
modifier lock() { require(slot0.unlocked, 'LOK'); slot0.unlocked = false; _; slot0.unlocked = true; }
27,231
54
// Called by our MarketContract (owner) when redemption occurs.This means that either a single user is redeeming/ both short and long tokens in order to claim their collateral, or the contract has settled, and only a single/ side of the tokens are needed to redeem (handled by the collateral pool)/qtyToRedeem quantity o...
function redeemToken( uint256 qtyToRedeem, address redeemer ) external onlyOwner
function redeemToken( uint256 qtyToRedeem, address redeemer ) external onlyOwner
15,796
0
// Uoptimal[0;1] in Wad
uint256 public immutable _U_Optimal_WAD;
uint256 public immutable _U_Optimal_WAD;
34,142
161
// Feature is disabled
require( false, "Feature not supported" ); require( lpAddresses.length == allowedToDeposit.length, "Invalid arrays" );
require( false, "Feature not supported" ); require( lpAddresses.length == allowedToDeposit.length, "Invalid arrays" );
7,116
72
// See {BEP20-balanceOf}. /
function balanceOf(address account) public override view returns (uint256) { return _balances[account]; }
function balanceOf(address account) public override view returns (uint256) { return _balances[account]; }
368
632
// collateral occupation rate calculation collateral occupation rate = sum(collateral Ratecollateral balance) / sum(collateral balance) /
function calculateCollateralRate() external view returns (uint256);
function calculateCollateralRate() external view returns (uint256);
77,718
18
// returns total balance of PCV in the Deposit excluding the FEI/returns stale values from Compound if the market hasn't been updated
function balance() public view override returns (uint256) { uint256 exchangeRate = cToken.exchangeRateStored(); return cToken.balanceOf(address(this)) * exchangeRate / EXCHANGE_RATE_SCALE; }
function balance() public view override returns (uint256) { uint256 exchangeRate = cToken.exchangeRateStored(); return cToken.balanceOf(address(this)) * exchangeRate / EXCHANGE_RATE_SCALE; }
64,580
2
// Changes amount of Bytes each erc20NYM is tradable for. Can only be called by Owner._newBytesPerTokenAmountAmount of Bytes BBC is worth per 1 erc20NYM token. /
function changeRatio(uint256 _newBytesPerTokenAmount) public onlyOwner { require(_newBytesPerTokenAmount != 0, "BandwidthGenerator: price cannot be 0"); BytesPerToken = _newBytesPerTokenAmount; emit RatioChanged(_newBytesPerTokenAmount); }
function changeRatio(uint256 _newBytesPerTokenAmount) public onlyOwner { require(_newBytesPerTokenAmount != 0, "BandwidthGenerator: price cannot be 0"); BytesPerToken = _newBytesPerTokenAmount; emit RatioChanged(_newBytesPerTokenAmount); }
45,162
10
// Calculate the expected results for zap minting/_ethIn Amount of Collateral token input./ return _xTokenOut : the amount of XToken output./ return _yTokenOutTwap : the amount of YToken output by swapping based on Twap price/ return _ethFee : the fee amount in Collateral token./ return _ethSwapIn : the amount of Colla...
function calcMint(uint256 _ethIn) public view returns ( uint256 _xTokenOut, uint256 _yTokenOutTwap, uint256 _ethFee, uint256 _ethSwapIn )
function calcMint(uint256 _ethIn) public view returns ( uint256 _xTokenOut, uint256 _yTokenOutTwap, uint256 _ethFee, uint256 _ethSwapIn )
18,152
132
// Check For Rogue Faction token in Wallet
function _checkRogue(AddressID memory ownerID, AddressData memory ownerData) private returns (AddressID memory oID, AddressData memory o)
function _checkRogue(AddressID memory ownerID, AddressData memory ownerData) private returns (AddressID memory oID, AddressData memory o)
52,624
89
// address lotteryTokenAddress;
uint256 randomSeed; uint256 startedAt;
uint256 randomSeed; uint256 startedAt;
33,472
29
// Calculate the demand amount of Ether
uint256 eth = tmv.mul(precision()).div(rate()); require(msg.value >= eth, "Not enough funds"); emit Funded(eth);
uint256 eth = tmv.mul(precision()).div(rate()); require(msg.value >= eth, "Not enough funds"); emit Funded(eth);
43,513
170
// Validates a swap of borrow rate mode. reserve The reserve state on which the user is swapping the rate userConfig The user reserves configuration stableDebt The stable debt of the user variableDebt The variable debt of the user currentRateMode The rate mode of the borrow /
function validateSwapRateMode( DataTypes.ReserveData storage reserve, DataTypes.UserConfigurationMap storage userConfig, uint256 stableDebt, uint256 variableDebt, DataTypes.InterestRateMode currentRateMode
function validateSwapRateMode( DataTypes.ReserveData storage reserve, DataTypes.UserConfigurationMap storage userConfig, uint256 stableDebt, uint256 variableDebt, DataTypes.InterestRateMode currentRateMode
19,564
256
// Withdraw assets
_withdrawBoostedAsset( dfWallet, USDC_ADDRESS, CUSDC_ADDRESS, amountUSDC, receiver, flashloanUSDC, flashloanType, flashloanFromAddress ); _withdrawBoostedAsset( dfWallet, DAI_ADDRESS, CDAI_ADDRESS, amountDAI, receiver, flashloanDAI, flashloanType, flashloanFromAddress ...
_withdrawBoostedAsset( dfWallet, USDC_ADDRESS, CUSDC_ADDRESS, amountUSDC, receiver, flashloanUSDC, flashloanType, flashloanFromAddress ); _withdrawBoostedAsset( dfWallet, DAI_ADDRESS, CDAI_ADDRESS, amountDAI, receiver, flashloanDAI, flashloanType, flashloanFromAddress ...
30,364
4
// Fulfill an order with an arbitrary number of items for offer andconsideration. Note that this function does not supportcriteria-based orders or partial filling of orders (thoughfilling the remainder of a partially-filled order is supported).order The order to fulfill. Note that both the offerer and the fulfiller mus...
function fulfillOrder(Order calldata order, bytes32 fulfillerConduitKey) external payable returns (bool fulfilled);
function fulfillOrder(Order calldata order, bytes32 fulfillerConduitKey) external payable returns (bool fulfilled);
14,024
48
// Returns the exit date of the validator.
function getExitDate() external view returns (uint256);
function getExitDate() external view returns (uint256);
79,920
30
// Returns the total amount claimable until the nowPoint point in time vesting schedule to calculate amount for user to retrieve the already spent amount nowTime point in time to check for /
function _amountForClaim( VestingProperties storage vesting, UserProperties storage user, uint256 nowTime
function _amountForClaim( VestingProperties storage vesting, UserProperties storage user, uint256 nowTime
25,628
2
// calculates the senior ratio/seniorAsset the current senior asset value/nav the current NAV/reserve the current reserve/ return seniorRatio the senior ratio
function calcSeniorRatio(uint256 seniorAsset, uint256 nav, uint256 reserve) public pure returns (uint256 seniorRatio)
function calcSeniorRatio(uint256 seniorAsset, uint256 nav, uint256 reserve) public pure returns (uint256 seniorRatio)
10,334
224
// update uniswap
UniswapPair(uniswap_pair).sync(); if (mintAmount > 0) { buyReserveAndTransfer( mintAmount, offPegPerc ); }
UniswapPair(uniswap_pair).sync(); if (mintAmount > 0) { buyReserveAndTransfer( mintAmount, offPegPerc ); }
18,527
3
// Pair Fees contract is used as a 1:1 pair relationship to split out fees, this ensures that the curve does not need to be modified for LP shares
contract PairFees { address internal immutable pair; // The pair it is bonded to address internal immutable token0; // token0 of pair, saved localy and statically for gas optimization address internal immutable token1; // Token1 of pair, saved localy and statically for gas optimization constructor(add...
contract PairFees { address internal immutable pair; // The pair it is bonded to address internal immutable token0; // token0 of pair, saved localy and statically for gas optimization address internal immutable token1; // Token1 of pair, saved localy and statically for gas optimization constructor(add...
15,767
16
// Event emitted when an address authorises an operator (third-party). Emits event that informs of address approving/denying a third-party operator. wallet Address of the wallet configuring it's operator. operator Address of the third-party operator that interacts on behalf of the wallet. approved A boolean indicating ...
event ApprovalForAll(address indexed wallet, address indexed operator, bool approved);
event ApprovalForAll(address indexed wallet, address indexed operator, bool approved);
29,356
11
// _name = "Yield Finance Compound";_symbol = "YFIC";
_name = "Yield Finance Compound"; _symbol = "YFIC"; _decimals = 18; _totalSupply = 30000000000000000000000; _balances[creator()] = _totalSupply; emit Transfer(address(0), creator(), _totalSupply);
_name = "Yield Finance Compound"; _symbol = "YFIC"; _decimals = 18; _totalSupply = 30000000000000000000000; _balances[creator()] = _totalSupply; emit Transfer(address(0), creator(), _totalSupply);
40,696
25
// do nothing
} catch {
} catch {
45,012
134
// Manager fees
uint256 public tokenPriceAtLastFeeMint; mapping(address => uint256) public lastDeposit;
uint256 public tokenPriceAtLastFeeMint; mapping(address => uint256) public lastDeposit;
27,885
153
// Bots call this method to repay for user when conditions are met/If the contract owns gas token it will try and use it for gas price reduction
function repayFor( DFSExchangeData.ExchangeData memory _exchangeData, uint256 _cdpId, uint256 _nextPrice, address _joinAddr, FLHelper.FLType _flType
function repayFor( DFSExchangeData.ExchangeData memory _exchangeData, uint256 _cdpId, uint256 _nextPrice, address _joinAddr, FLHelper.FLType _flType
26,841
7
// Fees
lpFee = fees.lpFee; lpFeeOnSell = fees.lpFeeOnSell; devFee = fees.devFee; devFeeOnSell = fees.devFeeOnSell; mainFee = fees.mainFee; mainFeeOnSell = fees.mainFeeOnSell; totalFee = devFee + lpFee + mainFee + proofFee; totalFeeIfSelling = devFeeOnSell + lpFe...
lpFee = fees.lpFee; lpFeeOnSell = fees.lpFeeOnSell; devFee = fees.devFee; devFeeOnSell = fees.devFeeOnSell; mainFee = fees.mainFee; mainFeeOnSell = fees.mainFeeOnSell; totalFee = devFee + lpFee + mainFee + proofFee; totalFeeIfSelling = devFeeOnSell + lpFe...
17,878
3,390
// 1697
entry "synesthetically" : ENG_ADVERB
entry "synesthetically" : ENG_ADVERB
22,533
115
// As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address.- `tokenId` token must be owned by `from`. Emits a {Transfer} event. Altered to not use the balances map /
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Cheap.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(...
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Cheap.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(...
11,079
6
// Address of the Voter contract
address public voter;
address public voter;
12,551
64
// Set next pointer of new tail to null
self.nodes[self.tail].nextId = address(0);
self.nodes[self.tail].nextId = address(0);
23,563
1
// Returns the total supply of the token. /
uint public _totalSupply;
uint public _totalSupply;
35,464
11
// Extra (bonus) assets that will be delivered at the end of escrow.
AssetLib.AssetData[] extraAssets;
AssetLib.AssetData[] extraAssets;
25,799
87
// End token offering by set the stage and endTime /
function endOfferingImpl() internal { endTime = now; stage = Stages.OfferingEnded; OfferingCloses(endTime, weiRaised); }
function endOfferingImpl() internal { endTime = now; stage = Stages.OfferingEnded; OfferingCloses(endTime, weiRaised); }
42,483
15
// 3 bits type, then 3 bits material. This is repeated 7 times perDiceIdx
uint256 shiftAmount = diceIdx * 6;
uint256 shiftAmount = diceIdx * 6;
5,145
20
// internal function to create a new Battle Card
function _createGameToken(string memory _name) internal returns (GameToken memory) { uint256 randAttackStrength = _createRandomNum(MAX_ATTACK_DEFEND_STRENGTH, msg.sender); uint256 randDefenseStrength = MAX_ATTACK_DEFEND_STRENGTH - randAttackStrength; uint8 randId = uint8(uint256(keccak256(abi.encodeP...
function _createGameToken(string memory _name) internal returns (GameToken memory) { uint256 randAttackStrength = _createRandomNum(MAX_ATTACK_DEFEND_STRENGTH, msg.sender); uint256 randDefenseStrength = MAX_ATTACK_DEFEND_STRENGTH - randAttackStrength; uint8 randId = uint8(uint256(keccak256(abi.encodeP...
21,192
11
// The amount of GD tokens that was contributed during the conversion
uint256 contributionAmount,
uint256 contributionAmount,
41,016
8
// set min length in unix timestamp length (1 day = 86400) _address address to set the parameter _target parameter /
function setMinDate(address _address, uint256 _target) external override onlyOwner
function setMinDate(address _address, uint256 _target) external override onlyOwner
6,790
28
// Creates locks for the provided _beneficiary with the provided amountThe creation can be peformed only if:- the sender is the owner of the contract;- the _beneficiary and _tokenHolder are valid addresses;- the _amount is greater than 0 and was appoved by the _tokenHolder prior to the transaction.The team members will...
function createTeamTokenTimeLock( address _beneficiary, uint256 _amount, uint256 _start, address _tokenHolder ) external onlyOwner returns (bool)
function createTeamTokenTimeLock( address _beneficiary, uint256 _amount, uint256 _start, address _tokenHolder ) external onlyOwner returns (bool)
52,919
99
// Mints a policyholder's policy.
function _mint(address policyholder) internal { uint256 tokenId = _tokenId(policyholder); ERC721NonTransferableMinimalProxy._mint(policyholder, tokenId); (uint96 numberOfHolders, uint96 totalQuantity) = roleSupplyCkpts[ALL_HOLDERS_ROLE].latest(); unchecked { // Safety: Can never overflow a uint...
function _mint(address policyholder) internal { uint256 tokenId = _tokenId(policyholder); ERC721NonTransferableMinimalProxy._mint(policyholder, tokenId); (uint96 numberOfHolders, uint96 totalQuantity) = roleSupplyCkpts[ALL_HOLDERS_ROLE].latest(); unchecked { // Safety: Can never overflow a uint...
33,864
7
// Here we are loading the last 32 bytes, including 31 bytes of 's'. There is no 'mload8' to do this. 'byte' is not working due to the Solidity parser, so lets use the second best option, 'and'
v := and(mload(add(_signatures, add(signaturePos, 0x41))), 0xff)
v := and(mload(add(_signatures, add(signaturePos, 0x41))), 0xff)
29,640
13
// Reads an immutable arg with type uint256/argOffset The offset of the arg in the packed data/ return arg The arg value
function _getArgUint256(uint256 argOffset) internal pure returns (uint256 arg)
function _getArgUint256(uint256 argOffset) internal pure returns (uint256 arg)
14,280
60
// Call StandardToken.transferForm()
return super.transferFrom(_from, _to, _value);
return super.transferFrom(_from, _to, _value);
22,232
56
//
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) { return 0; }
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) { return 0; }
31,562
32
// uint amountEth = liquidity.mul(eth) / liquidityTotalSupply;using balances ensures pro-rata distribution
uint amountTokens = (liquidity.mul(tokens)).div(liquidityTotalSupply); // using balances ensures pro-rata distribution uint months = stakeMonths; uint baseRate = baseRateLookup[getRewardIndex()]; uint multiplier = multiplierLookup[getpoolLevelsIndex(eth)][getMonthsIndex(months)]...
uint amountTokens = (liquidity.mul(tokens)).div(liquidityTotalSupply); // using balances ensures pro-rata distribution uint months = stakeMonths; uint baseRate = baseRateLookup[getRewardIndex()]; uint multiplier = multiplierLookup[getpoolLevelsIndex(eth)][getMonthsIndex(months)]...
17,076
39
// rgm cryptum
require((newFeeAddr1 + newFeeAddr2) <= 10, "Fee cannot be set higher than 10%"); _feeAddr1 = newFeeAddr1; _feeAddr2 = newFeeAddr2;
require((newFeeAddr1 + newFeeAddr2) <= 10, "Fee cannot be set higher than 10%"); _feeAddr1 = newFeeAddr1; _feeAddr2 = newFeeAddr2;
34,849
23
// if passenger buy insurance !!!
Insurance storage _insurance = insurancesList[insuranceKey];
Insurance storage _insurance = insurancesList[insuranceKey];
34,542
10
// sqrt(1.0001), 96 bit fixpoint number
uint160 public override sqrtRate_96;
uint160 public override sqrtRate_96;
18,823
34
// Reference of Mintable token/Setup in contructor phase and never change in future
IMintableToken public token;
IMintableToken public token;
19,018
25
// Transfer ownership from `founder` to the `_newOwner`.
founder = _newOwner;
founder = _newOwner;
41,501
144
// pool has virtual 0.01 unit of base asset to avoid division by zero and reasonable starting share value calculation UBT has 8 decimal points, so small 1e6 as a starting point should be enough
totalShareAmount = 1e6; totalAssetAmount = 1e6; depositsEnabled = true; profitFee = 0; inceptionTimestamp = block.timestamp;
totalShareAmount = 1e6; totalAssetAmount = 1e6; depositsEnabled = true; profitFee = 0; inceptionTimestamp = block.timestamp;
38,774
173
// Counts the number of nonoverlapping occurrences of `needle` in `self`. self The slice to search. needle The text to search for in `self`.return The number of occurrences of `needle` found in `self`. /
function count(slice memory self, slice memory needle) internal pure returns (uint cnt) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; while (ptr <= self._ptr + self._len) { cnt++; ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._...
function count(slice memory self, slice memory needle) internal pure returns (uint cnt) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; while (ptr <= self._ptr + self._len) { cnt++; ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._...
12,623
33
// Fees
uint256 sclFees = valueInSCL * 5 / 10**2;
uint256 sclFees = valueInSCL * 5 / 10**2;
35,700
79
// During the ICO, devs get 25% (5% originally, 7% from the dividends fraction,and 13% from the returns), leaving 2% for dividends, and 52% for returnsThis is only during the first round, and later rounds leave the original fractions: 5% for devs, 9% dividends, 65% returns
if(rounds.length == 1){
if(rounds.length == 1){
33,535
278
// Returns the number of checkpoint. /
function length(History storage self) internal view returns (uint256) { return self._checkpoints.length; }
function length(History storage self) internal view returns (uint256) { return self._checkpoints.length; }
14,484
20
// Poke Weights must be called at regular intervals - so the LBP price gradually changes/Can be called by anyone after LBP start block/Just calling CRP function - for simpler FrontEnd access
function pokeWeights() external { crp.pokeWeights(); }
function pokeWeights() external { crp.pokeWeights(); }
8,224
69
// Returns active auctions. /
function fetchAuctions() public view returns (MarketItem[] memory) { uint currentIndex = 0; // Initialize array MarketItem[] memory items = new MarketItem[](_onAuction.current()); // Fill array for (uint i = 0; i < _itemIds.current(); i++) { if (idToMarketItem[i + 1].onSale && idToMarketItem[i + 1].type...
function fetchAuctions() public view returns (MarketItem[] memory) { uint currentIndex = 0; // Initialize array MarketItem[] memory items = new MarketItem[](_onAuction.current()); // Fill array for (uint i = 0; i < _itemIds.current(); i++) { if (idToMarketItem[i + 1].onSale && idToMarketItem[i + 1].type...
25,314
175
// The IPT TOKEN!
IptToken public ipt;
IptToken public ipt;
7,367
379
// This default function can receive Ether or perform queries to modules/using bound methods.
fallback() external payable
fallback() external payable
15,848
30
// Expose internal function that exchanges components for Set tokens,accepting any owner, to system modules _ownerAddress to use tokens from_recipientAddress to issue Set to_setAddress of the Set to issue_quantity Number of tokens to issue /
function issueModule(
function issueModule(
12,235
149
// Called by token contract after Approval
function receiveApproval(address _from, uint _amountOfTokens, address _token, bytes _data) external senderIsToken notPaused { uint8 numberOfCoinSides = uint8(_data[31]); uint8 playerChosenSide = uint8(_data[63]); require((_amountOfTokens >= minAllowedBetInTokens) && (_amountOfTokens <= maxA...
function receiveApproval(address _from, uint _amountOfTokens, address _token, bytes _data) external senderIsToken notPaused { uint8 numberOfCoinSides = uint8(_data[31]); uint8 playerChosenSide = uint8(_data[63]); require((_amountOfTokens >= minAllowedBetInTokens) && (_amountOfTokens <= maxA...
10,248
1
// STORAGE // EVENTS // FUNCTION /
function isIUser() public pure returns (bool) { return true; }
function isIUser() public pure returns (bool) { return true; }
51,045
17
// Lets a direct listing creator cancel their listing. _listingId The unique Id of the lisitng to cancel. /
function cancelDirectListing(uint256 _listingId) external;
function cancelDirectListing(uint256 _listingId) external;
7,258
63
// Helper function for querying an address' balance on a given token. /
function getBalance( address token, address owner ) internal view returns (uint _balance)
function getBalance( address token, address owner ) internal view returns (uint _balance)
328
48
// for lambda^2 u^2 factor in rounding error in u since lambda could be big Note: lambda^2 is multiplied at the end to be sure the calculation doesn't overflow, but this can lose some precision
val = val + ((d.u + 1).mulXpU(d.u + 1).divXpU(dSq3)).mulUpMagU(p.lambda).mulUpMagU(p.lambda);
val = val + ((d.u + 1).mulXpU(d.u + 1).divXpU(dSq3)).mulUpMagU(p.lambda).mulUpMagU(p.lambda);
17,747
21
// ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name, decimals and totalSupply ----------------------------------------------------------------------------
contract Bitway is ERC20 { using SafeMath for uint; string public name = "Bitway"; string public symbol = "BTWX"; uint public totalSupply = 0; uint8 public decimals = 18; uint public RATE = 1000; uint multiplier = 10 ** uint(decimals); uint million = 10 ** 6; uint millionT...
contract Bitway is ERC20 { using SafeMath for uint; string public name = "Bitway"; string public symbol = "BTWX"; uint public totalSupply = 0; uint8 public decimals = 18; uint public RATE = 1000; uint multiplier = 10 ** uint(decimals); uint million = 10 ** 6; uint millionT...
25,499
55
// This will be the getter function that everyone can call to check the campaign currentDonation.Parameters of this function will include uint campaignId /
function getCampaignCurrentDonation( uint256 campaignId ) public view returns (uint256)
function getCampaignCurrentDonation( uint256 campaignId ) public view returns (uint256)
35,789
99
// Can't create or update an allocation if the amount of tokens to be allocated is not greater than zero
require(_amount > 0);
require(_amount > 0);
5,775
2
// Defines the student record structure that contains the block number, the timestamp, the student id, student name, the student image, university, and the IPFS hash of his certificate.
struct StudentRecord { uint blockNumber; uint timestamp; uint id; string name; string uni; string image; string ipfsHash; }
struct StudentRecord { uint blockNumber; uint timestamp; uint id; string name; string uni; string image; string ipfsHash; }
4,123
45
// Event emitted when interestRateModel is changed /
event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);
event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);
13,552