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
51
// liquify 10% of the tokens that are transfered these are dispersed to shareholders
uint256 _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_); uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee); uint256 _dividends = tokensToHex_(_tokenFee);
uint256 _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_); uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee); uint256 _dividends = tokensToHex_(_tokenFee);
27,970
10
// Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to. /
function transferOwnership(address payable newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; emit OwnershipTransferred(owner, newOwner); }
function transferOwnership(address payable newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; emit OwnershipTransferred(owner, newOwner); }
21,008
87
// Add new Pool
function addPool(address pool_address, address reward_token) public onlyOwner { require(pools[pool_address] == address(0), "poolExisted"); require(reward_token != address(0), "invalid reward token"); pools[pool_address] = reward_token; emit PoolAdded(pool_address); }
function addPool(address pool_address, address reward_token) public onlyOwner { require(pools[pool_address] == address(0), "poolExisted"); require(reward_token != address(0), "invalid reward token"); pools[pool_address] = reward_token; emit PoolAdded(pool_address); }
41,714
371
// normal initialization
initializing = lastInitializingRevision > 0 && lastInitializedRevision < topRevision; require(initializing || isConstructor() || topRevision > lastInitializedRevision, 'already initialized');
initializing = lastInitializingRevision > 0 && lastInitializedRevision < topRevision; require(initializing || isConstructor() || topRevision > lastInitializedRevision, 'already initialized');
19,640
23
// Upon unstaking, the Delegate will be given the staking amount. This is returned to the msg.sender.
if (stakedAmount > 0) { require( IERC20(indexer.stakingToken()).transfer(msg.sender, stakedAmount), "STAKING_RETURN_FAILED" ); }
if (stakedAmount > 0) { require( IERC20(indexer.stakingToken()).transfer(msg.sender, stakedAmount), "STAKING_RETURN_FAILED" ); }
35,141
20
// Struct that defines the configurations of each Category
struct Category { string desc; uint256 index; uint256 periodAfterTGE; uint256 percentClaimableAtTGE; uint256 vestingPeriodAfterTGE; }
struct Category { string desc; uint256 index; uint256 periodAfterTGE; uint256 percentClaimableAtTGE; uint256 vestingPeriodAfterTGE; }
15,401
33
// `firstblock` specifies from which block our token sale starts./ This can only be modified once by the owner of `target` address.
uint public firstblock = 0;
uint public firstblock = 0;
51,558
0
// Constructor that gives msg.sender all of existing tokens. /
constructor() public { _mint(msg.sender, INITIAL_SUPPLY); }
constructor() public { _mint(msg.sender, INITIAL_SUPPLY); }
7,467
26
// Ensure the router can perform the swap for the designated number of tokens.
token.approve(address(router), tokenAmount); router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
token.approve(address(router), tokenAmount); router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
34,451
13
// Withdraw Funds /
function withdraw(address payable recipientAddress) public onlyOwner {
function withdraw(address payable recipientAddress) public onlyOwner {
22,172
23
// After removing limits tax will be set to 3% forever.
uint256 _finalBuyTax = 3; uint256 _finalSellTax = 3; bool public tradingOpen; bool private inSwap; bool private swapEnabled; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 10_000_000 * 10**_decimals; // 10M
uint256 _finalBuyTax = 3; uint256 _finalSellTax = 3; bool public tradingOpen; bool private inSwap; bool private swapEnabled; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 10_000_000 * 10**_decimals; // 10M
23,979
25
// returns number of quarters passed from distributionStartTime /
function currentQuarterSinceStartTime() public view returns (uint256 currentQuarter){ require(distributionStartTime!=0, "distributionStartTime not set yet"); require(distributionStartTime<block.timestamp, "Vesting did not start yet"); return (block.timestamp.sub(distributionStartTime)).div(SECONDS_IN_QUARTER); }
function currentQuarterSinceStartTime() public view returns (uint256 currentQuarter){ require(distributionStartTime!=0, "distributionStartTime not set yet"); require(distributionStartTime<block.timestamp, "Vesting did not start yet"); return (block.timestamp.sub(distributionStartTime)).div(SECONDS_IN_QUARTER); }
18,254
93
// Calculate the tree's water level
function _waterLevel(TreeData storage _seed) internal view returns (int256) { uint256 _treeWaterUsePercentage = _waterUsePercentage(_seed); // In % * 100 / h uint256 _timeDifferenceInSeconds = block.timestamp - _seed.lastWateredAt; return 100 - int256(_timeDifferenceInSeconds * _treeWaterUsePercentage / (10000 * 3600)); }
function _waterLevel(TreeData storage _seed) internal view returns (int256) { uint256 _treeWaterUsePercentage = _waterUsePercentage(_seed); // In % * 100 / h uint256 _timeDifferenceInSeconds = block.timestamp - _seed.lastWateredAt; return 100 - int256(_timeDifferenceInSeconds * _treeWaterUsePercentage / (10000 * 3600)); }
25,445
8
// my own
address public iown;
address public iown;
46,276
19
// Token name (Long)
string public name;
string public name;
6,722
255
// refresh undond period
unbond.withdrawEpoch = stakeManager.epoch(); unbonds[msg.sender] = unbond; StakingInfo logger = stakingLogger; logger.logShareBurned(validatorId, msg.sender, claimAmount, shares); logger.logStakeUpdate(validatorId);
unbond.withdrawEpoch = stakeManager.epoch(); unbonds[msg.sender] = unbond; StakingInfo logger = stakingLogger; logger.logShareBurned(validatorId, msg.sender, claimAmount, shares); logger.logStakeUpdate(validatorId);
12,592
8
// Calculate the rewards for the given stake id in the staking contract.
function calculateStakingRewards(uint256 _stakeId) external;
function calculateStakingRewards(uint256 _stakeId) external;
14
47
// Add address to whitelist. _buyerAddress which needs to be whitelisted _classClass to which buyer will be assigned /
function whitelist(address _buyer, uint8 _class) external onlyAdmin { require(_class < classes.length, "Seed: incorrect class chosen"); require(!closed, "Seed: should not be closed"); require(permissionedSeed == true, "Seed: seed is not whitelisted"); whitelisted[_buyer] = true; funders[_buyer].class = _class; }
function whitelist(address _buyer, uint8 _class) external onlyAdmin { require(_class < classes.length, "Seed: incorrect class chosen"); require(!closed, "Seed: should not be closed"); require(permissionedSeed == true, "Seed: seed is not whitelisted"); whitelisted[_buyer] = true; funders[_buyer].class = _class; }
491
412
// res += val(coefficients[156] + coefficients[157]adjustments[9]).
res := addmod(res, mulmod(val, add(/*coefficients[156]*/ mload(0x17c0), mulmod(/*coefficients[157]*/ mload(0x17e0),
res := addmod(res, mulmod(val, add(/*coefficients[156]*/ mload(0x17c0), mulmod(/*coefficients[157]*/ mload(0x17e0),
20,803
14
// Event for finalization of the auction.
event AuctionFinalized();
event AuctionFinalized();
24,198
140
// KtyUniswap Responsible for : exchange ether for KTY @ziweidream /
pragma solidity ^0.5.5; library UniswapV2Library { using SafeMath for uint;
pragma solidity ^0.5.5; library UniswapV2Library { using SafeMath for uint;
20,470
148
// Universal
uint internal constant SECONDS_PER_YEAR = 365.2425 * 86400; // Gregorian calendar
uint internal constant SECONDS_PER_YEAR = 365.2425 * 86400; // Gregorian calendar
28,875
4
// Creates a new token /
function createToken(string memory _tokenURI, address _royaltyRecipient, uint256 _royaltyValue, bool _mutableMetada) public returns (uint) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _mint(msg.sender, tokenId); _setTokenURI(tokenId, _tokenURI); setApprovalForAll(marketplaceAddress, true); setApprovalForAll(loanAddress, true); if (_royaltyValue > 0) { _setTokenRoyalty(tokenId, _royaltyRecipient, _royaltyValue); } _mutableMetadataMapping[tokenId] = _mutableMetada; return tokenId; }
function createToken(string memory _tokenURI, address _royaltyRecipient, uint256 _royaltyValue, bool _mutableMetada) public returns (uint) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _mint(msg.sender, tokenId); _setTokenURI(tokenId, _tokenURI); setApprovalForAll(marketplaceAddress, true); setApprovalForAll(loanAddress, true); if (_royaltyValue > 0) { _setTokenRoyalty(tokenId, _royaltyRecipient, _royaltyValue); } _mutableMetadataMapping[tokenId] = _mutableMetada; return tokenId; }
21,000
171
// Based on the percentage of amount that's taxable, master divisor of 10000
taxRatio = taxAmt.mul(10000).div(amount);
taxRatio = taxAmt.mul(10000).div(amount);
12,594
56
// require(msg.sender == addressOrgBelongsTo);
recievers.push(user);
recievers.push(user);
9,124
237
// Because it is possible that a quotient gets truncated, we can't just call "Signed(a.rawValue.div(b))" similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed. This creates the possibility of overflow if b is very large.
return divAwayFromZero(a, fromUnscaledInt(b));
return divAwayFromZero(a, fromUnscaledInt(b));
83,957
123
// This method will can be called by the owner before the contribution period/end or by anybody after the `endBlock`. This method finalizes the contribution period/by creating the remaining tokens and transferring the controller to the configured/controller.
function finalize() public initialized onlyOwner { require(finalizedBlock == 0); finalizedBlock = getBlockNumber(); finalizedTime = now; // Percentage to sale // uint256 percentageToCommunity = percent(50); uint256 percentageToTeam = percent(18); uint256 percentageToReserve = percent(8); uint256 percentageToBounties = percent(13); uint256 percentageToAirdrop = percent(2); uint256 percentageToAdvisors = percent(7); uint256 percentageToEarlyInvestors = percent(2); // // percentageToBounties // bountiesTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensBounties, maxSupply.mul(percentageToBounties).div(percent(100)))); // // percentageToReserve // reserveTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensReserve, maxSupply.mul(percentageToReserve).div(percent(100)))); // // percentageToTeam // teamTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensTeam, maxSupply.mul(percentageToTeam).div(percent(100)))); // // percentageToAirdrop // airdropTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensAirdrop, maxSupply.mul(percentageToAirdrop).div(percent(100)))); // // percentageToAdvisors // advisorsTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensAdvisors, maxSupply.mul(percentageToAdvisors).div(percent(100)))); // // percentageToEarlyInvestors // advisorsTokens = ------------------------------ * maxSupply // percentage(100) // assert(token.generateTokens( destTokensEarlyInvestors, maxSupply.mul(percentageToEarlyInvestors).div(percent(100)))); Finalized(); }
function finalize() public initialized onlyOwner { require(finalizedBlock == 0); finalizedBlock = getBlockNumber(); finalizedTime = now; // Percentage to sale // uint256 percentageToCommunity = percent(50); uint256 percentageToTeam = percent(18); uint256 percentageToReserve = percent(8); uint256 percentageToBounties = percent(13); uint256 percentageToAirdrop = percent(2); uint256 percentageToAdvisors = percent(7); uint256 percentageToEarlyInvestors = percent(2); // // percentageToBounties // bountiesTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensBounties, maxSupply.mul(percentageToBounties).div(percent(100)))); // // percentageToReserve // reserveTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensReserve, maxSupply.mul(percentageToReserve).div(percent(100)))); // // percentageToTeam // teamTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensTeam, maxSupply.mul(percentageToTeam).div(percent(100)))); // // percentageToAirdrop // airdropTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensAirdrop, maxSupply.mul(percentageToAirdrop).div(percent(100)))); // // percentageToAdvisors // advisorsTokens = ----------------------- * maxSupply // percentage(100) // assert(token.generateTokens( destTokensAdvisors, maxSupply.mul(percentageToAdvisors).div(percent(100)))); // // percentageToEarlyInvestors // advisorsTokens = ------------------------------ * maxSupply // percentage(100) // assert(token.generateTokens( destTokensEarlyInvestors, maxSupply.mul(percentageToEarlyInvestors).div(percent(100)))); Finalized(); }
51,398
157
// Creates a new token /
function mintNFT(string memory tokenURI, address royaltyRecipient, uint256 royaltyValue) public returns (uint) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(msg.sender, newItemId); _setTokenURI(newItemId, tokenURI); setApprovalForAll(marketplaceAddress, true); if (royaltyValue > 0) { _setTokenRoyalty(newItemId, royaltyRecipient, royaltyValue); } return newItemId; }
function mintNFT(string memory tokenURI, address royaltyRecipient, uint256 royaltyValue) public returns (uint) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(msg.sender, newItemId); _setTokenURI(newItemId, tokenURI); setApprovalForAll(marketplaceAddress, true); if (royaltyValue > 0) { _setTokenRoyalty(newItemId, royaltyRecipient, royaltyValue); } return newItemId; }
72,511
2
// initialize augmented bonding curve_reserveToken this is the token which is being allocated as a reserve pool + funding pool (xDai)get's used by the bancorFormula and is equal to the connectorWeight (CW).The connectorWeight is related to Kappa as CW = 1 / (k+1).Source:https:medium.com/@billyrennekamp/converting-between-bancor-and-bonding-curve-price-formulas-9c11309062f5.Note: 142857 ~> kappa = 6_theta this is the percentage (in ppm) of funds that gets allocated to the funding pool_p0 the price at which hatchers can buy into the Curve => the price in reservetoken (dai) per native token_initialRaise (initialRaise, d0, in DAI), the goal of the Hatch phase_fundingPool the address (organization, DAO, entity) to which we transfer
constructor( uint32 _reserveRatio, uint256 _gasPrice, address _reserveToken, uint256 _friction, address _fundingPool ) public BondingCurveToken(_reserveRatio, _gasPrice)
constructor( uint32 _reserveRatio, uint256 _gasPrice, address _reserveToken, uint256 _friction, address _fundingPool ) public BondingCurveToken(_reserveRatio, _gasPrice)
36,458
23
// ================= Owner ===================
function setCantransfer(bool allowed) public onlyOwner { _CAN_TRANSFER_ = allowed; emit SetCantransfer(allowed); }
function setCantransfer(bool allowed) public onlyOwner { _CAN_TRANSFER_ = allowed; emit SetCantransfer(allowed); }
40,193
140
// Mints a new NFT with the given id, and sets the permissions for it/Will revert with OnlyHubCanExecute if the caller is not the hub/_id The id of the new NFT/_owner The owner of the new NFT/_permissions Permissions to set for the new NFT
function mint( uint256 _id, address _owner, PermissionSet[] calldata _permissions ) external;
function mint( uint256 _id, address _owner, PermissionSet[] calldata _permissions ) external;
61,773
22
// dont consider rootState as blockchain,it is a special state hash
bool isRootState = idHash == ROOT_STATE; require( !isRootState || super.totalSupplyAt(block.number) == 0, "rootState already created" ); uint256 i = 0; for (; !isRootState && i < activeBlockchains.length; i++) { if (activeBlockchains[i] == idHash) break; }
bool isRootState = idHash == ROOT_STATE; require( !isRootState || super.totalSupplyAt(block.number) == 0, "rootState already created" ); uint256 i = 0; for (; !isRootState && i < activeBlockchains.length; i++) { if (activeBlockchains[i] == idHash) break; }
45,154
30
// Constant for locked guard state
uint256 internal constant REENTRANCY_GUARD_LOCKED = 2;
uint256 internal constant REENTRANCY_GUARD_LOCKED = 2;
4,925
184
// Constants Occurances are replaced at compile time and computed to a single value if possible by the optimizer
uint256 constant MAX_FUTURE_ROUND = 2**256 - 1;
uint256 constant MAX_FUTURE_ROUND = 2**256 - 1;
1,735
16
// allows highest bidder to get the token. Signature for claimTokenFromAuction(string,uint256) : `0x70c84b22`tokenId id of the token. serialNoserial Number of the token. /
function claimTokenFromAuction( uint256 tokenId, uint256 serialNo
function claimTokenFromAuction( uint256 tokenId, uint256 serialNo
9,716
148
// marketSellOrders
bytes4 constant public MARKET_SELL_ORDERS_SELECTOR = 0x7e1d9808; bytes4 constant public MARKET_SELL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
bytes4 constant public MARKET_SELL_ORDERS_SELECTOR = 0x7e1d9808; bytes4 constant public MARKET_SELL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
14,155
18
// Update the address of the token registry _newTokenRegistry Address of the new token registry /
function updateTokenRegistry(address payable _newTokenRegistry) external onlyOwner { tokenRegistryAddress = _newTokenRegistry; }
function updateTokenRegistry(address payable _newTokenRegistry) external onlyOwner { tokenRegistryAddress = _newTokenRegistry; }
20,643
94
// Mints an NFT. Can to mint the token to the zero address and the token cannot already exist. to Address to mint to. tokenId The new token. /
function _mint(address to, uint256 tokenId) private { require(!Address.isZero(to), "CXIP: can't mint a burn"); require(!_exists(tokenId), "CXIP: token already exists"); _tokenOwner[tokenId] = to; emit Transfer(address(0), to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); }
function _mint(address to, uint256 tokenId) private { require(!Address.isZero(to), "CXIP: can't mint a burn"); require(!_exists(tokenId), "CXIP: token already exists"); _tokenOwner[tokenId] = to; emit Transfer(address(0), to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); }
72,485
47
// Transpose if pair order is different.
sellReserve := mload(0xC00) buyReserve := mload(0xC20)
sellReserve := mload(0xC00) buyReserve := mload(0xC20)
37,057
5,808
// 2905
entry "clitorised" : ENG_ADJECTIVE
entry "clitorised" : ENG_ADJECTIVE
19,517
31
// Get the royalty fee percentage for a specific ERC1155 contract. _tokenId uint256 token ID.return uint8 wei royalty fee. /
function getTokenRoyaltyPercentage( uint256 _tokenId ) external view returns (uint8);
function getTokenRoyaltyPercentage( uint256 _tokenId ) external view returns (uint8);
11,019
229
// Helper to decode actionData and execute VaultAction.AddExternalPosition
function __executeVaultActionAddExternalPosition(bytes memory _actionData) private { __addExternalPosition(abi.decode(_actionData, (address))); }
function __executeVaultActionAddExternalPosition(bytes memory _actionData) private { __addExternalPosition(abi.decode(_actionData, (address))); }
19,375
32
// No tax transfer
_balance[from] -= amount; _balance[to] += amount; emit Transfer(from, to, amount); return;
_balance[from] -= amount; _balance[to] += amount; emit Transfer(from, to, amount); return;
180
45
// Reward distributed per token since last time
uint256 _distributedPerToken = _totalToken > 0 ? _totalDistributed.rdiv(_totalToken) : 0; state.index = state.index.add(_distributedPerToken);
uint256 _distributedPerToken = _totalToken > 0 ? _totalDistributed.rdiv(_totalToken) : 0; state.index = state.index.add(_distributedPerToken);
15,478
154
// Transfer aTokens from user to contract address
_transferATokenToContractAddress(collateralATokenAddress, user, amounts0, permitSignature);
_transferATokenToContractAddress(collateralATokenAddress, user, amounts0, permitSignature);
23,542
223
// It allows owner to set the oracle address for getting avgAPR_oracle : new oracle address /
function setOracleAddress(address _oracle)
function setOracleAddress(address _oracle)
35,203
203
// OracleLibrary /
) public view returns(int24 timeWeightedAverageTick) { timeWeightedAverageTick = OracleLibrary.consult(_pool, _twapPeriod); }
) public view returns(int24 timeWeightedAverageTick) { timeWeightedAverageTick = OracleLibrary.consult(_pool, _twapPeriod); }
8,057
452
// NOTE: no need for safe-maths, above require prevents issues.
uint256 amountToWithdraw = availableToWithdraw - benefactorWithdrawalSafetyDiscount; benefactorFunds[benefactor] = benefactorWithdrawalSafetyDiscount; if (sendErc20(amountToWithdraw, benefactor)) { emit WithdrawBenefactorFundsWithSafetyDelay( benefactor, amountToWithdraw ); } else {
uint256 amountToWithdraw = availableToWithdraw - benefactorWithdrawalSafetyDiscount; benefactorFunds[benefactor] = benefactorWithdrawalSafetyDiscount; if (sendErc20(amountToWithdraw, benefactor)) { emit WithdrawBenefactorFundsWithSafetyDelay( benefactor, amountToWithdraw ); } else {
23,737
1
// the list of the available reserves, structured as a mapping for gas savings reasons
mapping(uint256 => address) internal _reservesList; uint256 internal _reservesCount; bool internal _paused; uint256 internal _maxStableRateBorrowSizePercent; uint256 internal _flashLoanPremiumTotal;
mapping(uint256 => address) internal _reservesList; uint256 internal _reservesCount; bool internal _paused; uint256 internal _maxStableRateBorrowSizePercent; uint256 internal _flashLoanPremiumTotal;
9,253
34
// Each validator cannot create too many parallel ballots
uint256 maxParallelBallotsAllowed = validatorsLength / 3; require(openCountPerPoolId[senderPoolId]++ < maxParallelBallotsAllowed); require(_duration >= MIN_DURATION); require(_duration <= MAX_DURATION); require( _reason == BAN_REASON_OFTEN_BLOCK_DELAYS || _reason == BAN_REASON_OFTEN_BLOCK_SKIPS || _reason == BAN_REASON_OFTEN_REVEAL_SKIPS ||
uint256 maxParallelBallotsAllowed = validatorsLength / 3; require(openCountPerPoolId[senderPoolId]++ < maxParallelBallotsAllowed); require(_duration >= MIN_DURATION); require(_duration <= MAX_DURATION); require( _reason == BAN_REASON_OFTEN_BLOCK_DELAYS || _reason == BAN_REASON_OFTEN_BLOCK_SKIPS || _reason == BAN_REASON_OFTEN_REVEAL_SKIPS ||
54,756
29
// Add the unstaked amount to withdrawable rewards
rewardInfo[msg.sender].availableRewards = rewardInfo[msg.sender].availableRewards.add(stakeAmount); emit Unstaked(msg.sender, stakeAmount); _updateRewards(msg.sender); // Update rewards after unstaking _updateRewardLimit(msg.sender); // Update reward limit after unstaking
rewardInfo[msg.sender].availableRewards = rewardInfo[msg.sender].availableRewards.add(stakeAmount); emit Unstaked(msg.sender, stakeAmount); _updateRewards(msg.sender); // Update rewards after unstaking _updateRewardLimit(msg.sender); // Update reward limit after unstaking
15,553
77
// Returns a boolean indicating whether or not a particular real world player is minting/_md5Token - The player to look at
function isRealWorldPlayerMintingEnabled(uint128 _md5Token) public view returns (bool) { // Have to deal with the fact that the 0th entry is a valid one. uint32 _rosterIndex = md5TokenToRosterIndex[_md5Token]; if ((_rosterIndex > 0) || ((realWorldPlayers.length > 0) && (realWorldPlayers[0].md5Token == _md5Token))) { // _rosterIndex is valid return realWorldPlayers[_rosterIndex].mintingEnabled; } else { // Tried to enable/disable minting on non-existent realWorldPlayer revert(); } }
function isRealWorldPlayerMintingEnabled(uint128 _md5Token) public view returns (bool) { // Have to deal with the fact that the 0th entry is a valid one. uint32 _rosterIndex = md5TokenToRosterIndex[_md5Token]; if ((_rosterIndex > 0) || ((realWorldPlayers.length > 0) && (realWorldPlayers[0].md5Token == _md5Token))) { // _rosterIndex is valid return realWorldPlayers[_rosterIndex].mintingEnabled; } else { // Tried to enable/disable minting on non-existent realWorldPlayer revert(); } }
41,524
6
// Withdraw liquidity tokens, pretty self-explanatory
function withdrawLiquidityTokens(uint256 numPoolTokensToWithdraw) external { require(numPoolTokensToWithdraw > 0); staker storage thisStaker = stakers[msg.sender]; require( thisStaker.poolTokenBalance >= numPoolTokensToWithdraw, "Pool token balance too low" ); uint256 daysStaked = block.timestamp.sub(thisStaker.startTimestamp) / 86400; // Calculate time staked in days require(daysStaked >= minStakeDurationDays); uint256 tokensOwed = calculateTokensOwed(msg.sender); // We give all of the rewards owed to the sender on a withdrawal, regardless of the amount withdrawn tokensOwed = tokensOwed.add(thisStaker.lockedRewardBalance); thisStaker.lockedRewardBalance = 0; thisStaker.poolTokenBalance = thisStaker.poolTokenBalance.sub( numPoolTokensToWithdraw ); thisStaker.startTimestamp = block.timestamp; // Reset staking timer on withdrawal thisStaker.lastTimestamp = block.timestamp; obelixToken.transfer(msg.sender, tokensOwed); uniswapPair.transfer(msg.sender, numPoolTokensToWithdraw); }
function withdrawLiquidityTokens(uint256 numPoolTokensToWithdraw) external { require(numPoolTokensToWithdraw > 0); staker storage thisStaker = stakers[msg.sender]; require( thisStaker.poolTokenBalance >= numPoolTokensToWithdraw, "Pool token balance too low" ); uint256 daysStaked = block.timestamp.sub(thisStaker.startTimestamp) / 86400; // Calculate time staked in days require(daysStaked >= minStakeDurationDays); uint256 tokensOwed = calculateTokensOwed(msg.sender); // We give all of the rewards owed to the sender on a withdrawal, regardless of the amount withdrawn tokensOwed = tokensOwed.add(thisStaker.lockedRewardBalance); thisStaker.lockedRewardBalance = 0; thisStaker.poolTokenBalance = thisStaker.poolTokenBalance.sub( numPoolTokensToWithdraw ); thisStaker.startTimestamp = block.timestamp; // Reset staking timer on withdrawal thisStaker.lastTimestamp = block.timestamp; obelixToken.transfer(msg.sender, tokensOwed); uniswapPair.transfer(msg.sender, numPoolTokensToWithdraw); }
6,060
30
// Alexander 'rmi7' Remie/Users contract
contract Users { // // // Variables // // IEmergencyStop private breaker; mapping(address => bool) private addrIsAdmin; mapping(address => bool) private addrIsStoreowner; address[] public storeowners; mapping(address => uint) private storeownerToIndex; // // // Events // // event AdminAdded(address indexed newAdmin, address indexed byAdmin); event StoreownerAdded(address indexed newStoreOwner, address indexed byAdmin); event StoreownerRemoved(address indexed removedStoreOwner, address indexed byAdmin); // // // Constructor // // /// @notice contract constructor /// @param breakerContract_ The address of the EmergencyStop contract constructor(address breakerContract_) public { require(breakerContract_ != address(0), "breaker contract address should not be 0x0"); breaker = IEmergencyStop(breakerContract_); // set deployer as the initial only admin addrIsAdmin[msg.sender] = true; } // // // Functions: Setters // // /// @notice add a new admin /// @dev will throw if emergency stop is active /// @param addr_ The address of the admin function addAdmin(address addr_) external { require(breaker.breakerIsDisabled(), "contract breaker is active"); require(isAdmin(msg.sender), "caller is not an admin"); require(isShopper(addr_), "arg is not a shopper"); addrIsAdmin[addr_] = true; emit AdminAdded(addr_, msg.sender); } /// @notice add a new storeowner /// @dev will throw if emergency stop is active /// @param addr_ The address of the storeowner function addStoreowner(address addr_) external { require(breaker.breakerIsDisabled(), "contract breaker is active"); require(isAdmin(msg.sender), "caller is not an admin"); require(isShopper(addr_), "arg is not a shopper"); addrIsStoreowner[addr_] = true; // - append addr to storeowners array // - save index of added item to storeowners array in a: mapping(addr) = idx // - cannot undeflow storeownerToIndex[addr_] = storeowners.push(addr_) - 1; emit StoreownerAdded(addr_, msg.sender); } /// @notice remove a storeowner /// @dev will throw if emergency stop is active /// @param addr_ The address of the storeowner function removeStoreowner(address addr_) external { require(breaker.breakerIsDisabled(), "contract breaker is active"); require(isAdmin(msg.sender), "caller is not an admin"); require(isStoreowner(addr_), "arg is not a storeowner"); addrIsStoreowner[addr_] = false; // we need to: // - remove it from storeowners array // - update storeownerToIndex // get its idx inside storeowners array uint storeownerIndex = storeownerToIndex[addr_]; // replace the storeowner at this idx inside the array 'storeowners' // with the last item in the storeowners array, this could be the current // item itself, but that doesn't matter ,update always works address lastStoreowner = storeowners[SafeMath.sub(storeowners.length, 1)]; // move the last storeowner to the index of the to-be-removed storeowner storeowners[storeownerIndex] = lastStoreowner; // update index of previous last storeowner storeownerToIndex[lastStoreowner] = storeownerIndex; // remove last item from stored array storeowners.length = SafeMath.sub(storeowners.length, 1); emit StoreownerRemoved(addr_, msg.sender); } // // // Functions: Getters // // /// @notice check if an address is an admin /// @dev will work even if emergency stop is active /// @param addr_ The address to check /// @return true if admin, false otherwise function isAdmin(address addr_) public view returns(bool) { return addrIsAdmin[addr_]; } /// @notice check if an address is a storeowner /// @dev will work even if emergency stop is active /// @param addr_ The address to check /// @return true if storeowner, false otherwise function isStoreowner(address addr_) public view returns(bool) { return addrIsStoreowner[addr_]; } /// @notice check if an address is a shopper /// @dev will work even if emergency stop is active /// @param addr_ The address to check /// @return true if shopper, false otherwise function isShopper(address addr_) public view returns(bool) { return addrIsAdmin[addr_] == false && addrIsStoreowner[addr_] == false; } /// @notice get the number of store owners /// @dev will work even if emergency stop is active /// @return the number of store owners function getStoreownerCount() external view returns(uint) { return storeowners.length; } }
contract Users { // // // Variables // // IEmergencyStop private breaker; mapping(address => bool) private addrIsAdmin; mapping(address => bool) private addrIsStoreowner; address[] public storeowners; mapping(address => uint) private storeownerToIndex; // // // Events // // event AdminAdded(address indexed newAdmin, address indexed byAdmin); event StoreownerAdded(address indexed newStoreOwner, address indexed byAdmin); event StoreownerRemoved(address indexed removedStoreOwner, address indexed byAdmin); // // // Constructor // // /// @notice contract constructor /// @param breakerContract_ The address of the EmergencyStop contract constructor(address breakerContract_) public { require(breakerContract_ != address(0), "breaker contract address should not be 0x0"); breaker = IEmergencyStop(breakerContract_); // set deployer as the initial only admin addrIsAdmin[msg.sender] = true; } // // // Functions: Setters // // /// @notice add a new admin /// @dev will throw if emergency stop is active /// @param addr_ The address of the admin function addAdmin(address addr_) external { require(breaker.breakerIsDisabled(), "contract breaker is active"); require(isAdmin(msg.sender), "caller is not an admin"); require(isShopper(addr_), "arg is not a shopper"); addrIsAdmin[addr_] = true; emit AdminAdded(addr_, msg.sender); } /// @notice add a new storeowner /// @dev will throw if emergency stop is active /// @param addr_ The address of the storeowner function addStoreowner(address addr_) external { require(breaker.breakerIsDisabled(), "contract breaker is active"); require(isAdmin(msg.sender), "caller is not an admin"); require(isShopper(addr_), "arg is not a shopper"); addrIsStoreowner[addr_] = true; // - append addr to storeowners array // - save index of added item to storeowners array in a: mapping(addr) = idx // - cannot undeflow storeownerToIndex[addr_] = storeowners.push(addr_) - 1; emit StoreownerAdded(addr_, msg.sender); } /// @notice remove a storeowner /// @dev will throw if emergency stop is active /// @param addr_ The address of the storeowner function removeStoreowner(address addr_) external { require(breaker.breakerIsDisabled(), "contract breaker is active"); require(isAdmin(msg.sender), "caller is not an admin"); require(isStoreowner(addr_), "arg is not a storeowner"); addrIsStoreowner[addr_] = false; // we need to: // - remove it from storeowners array // - update storeownerToIndex // get its idx inside storeowners array uint storeownerIndex = storeownerToIndex[addr_]; // replace the storeowner at this idx inside the array 'storeowners' // with the last item in the storeowners array, this could be the current // item itself, but that doesn't matter ,update always works address lastStoreowner = storeowners[SafeMath.sub(storeowners.length, 1)]; // move the last storeowner to the index of the to-be-removed storeowner storeowners[storeownerIndex] = lastStoreowner; // update index of previous last storeowner storeownerToIndex[lastStoreowner] = storeownerIndex; // remove last item from stored array storeowners.length = SafeMath.sub(storeowners.length, 1); emit StoreownerRemoved(addr_, msg.sender); } // // // Functions: Getters // // /// @notice check if an address is an admin /// @dev will work even if emergency stop is active /// @param addr_ The address to check /// @return true if admin, false otherwise function isAdmin(address addr_) public view returns(bool) { return addrIsAdmin[addr_]; } /// @notice check if an address is a storeowner /// @dev will work even if emergency stop is active /// @param addr_ The address to check /// @return true if storeowner, false otherwise function isStoreowner(address addr_) public view returns(bool) { return addrIsStoreowner[addr_]; } /// @notice check if an address is a shopper /// @dev will work even if emergency stop is active /// @param addr_ The address to check /// @return true if shopper, false otherwise function isShopper(address addr_) public view returns(bool) { return addrIsAdmin[addr_] == false && addrIsStoreowner[addr_] == false; } /// @notice get the number of store owners /// @dev will work even if emergency stop is active /// @return the number of store owners function getStoreownerCount() external view returns(uint) { return storeowners.length; } }
25,989
10
// Moves `amount` tokens from `sender` to `recipient` using theallowance mechanism. `amount` is then deducted from the caller'sallowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. /
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
7,770
12
// converts bytes to uint and returns data digest array dataDigestBytes_: data digest in bytes /
function toUintFromBytes(bytes memory dataDigestBytes_) internal pure returns (uint256[] memory dataDigest)
function toUintFromBytes(bytes memory dataDigestBytes_) internal pure returns (uint256[] memory dataDigest)
15,364
3
// Request variable bytes from the oracle /
function requestBytes( ) public
function requestBytes( ) public
8,081
36
// endIco closes down the ICO/
function endIco() internal { currentStage = Stages.icoEnd; // Transfer any remaining tokens if(remainingTokens > 0) balances[owner] = balances[owner].add(remainingTokens); // transfer any remaining ETH balance in the contract to the owner owner.transfer(address(this).balance); }
function endIco() internal { currentStage = Stages.icoEnd; // Transfer any remaining tokens if(remainingTokens > 0) balances[owner] = balances[owner].add(remainingTokens); // transfer any remaining ETH balance in the contract to the owner owner.transfer(address(this).balance); }
42,762
1
// Calculates the total amount of liquidity represented by the liquidity curve object.Result always rounds down from the real value, assuming that the feeaccumulation fields are conservative lower-bound rounded. curve - The currently active liqudity curve state. Remember this curvestate is only known to be valid within the current tick.return - The total scalar liquidity. Equivalent to sqrt(XY) in an equivalent constant-product AMM. /
function activeLiquidity (CurveState memory curve) internal pure returns (uint128) { uint128 ambient = CompoundMath.inflateLiqSeed (curve.ambientSeeds_, curve.seedDeflator_); return LiquidityMath.addLiq(ambient, curve.concLiq_); }
function activeLiquidity (CurveState memory curve) internal pure returns (uint128) { uint128 ambient = CompoundMath.inflateLiqSeed (curve.ambientSeeds_, curve.seedDeflator_); return LiquidityMath.addLiq(ambient, curve.concLiq_); }
13,513
18
// Used to define how an LP Account farms an external protocol /
interface IZap is INameIdentifier { /** * @notice Deploy liquidity to a protocol (i.e. enter a farm) * @dev Implementation should add liquidity and stake LP tokens * @param amounts Amount of each token to deploy */ function deployLiquidity(uint256[] calldata amounts) external; /** * @notice Unwind liquidity from a protocol (i.e exit a farm) * @dev Implementation should unstake LP tokens and remove liquidity * @dev If there is only one token to unwind, `index` should be 0 * @param amount Amount of liquidity to unwind * @param index Which token should be unwound */ function unwindLiquidity(uint256 amount, uint8 index) external; /** * @notice Claim accrued rewards from the protocol (i.e. harvest yield) */ function claim() external; /** * @notice Retrieves the LP token balance */ function getLpTokenBalance(address account) external view returns (uint256); /** * @notice Order of tokens for deploy `amounts` and unwind `index` * @dev Implementation should use human readable symbols * @dev Order should be the same for deploy and unwind * @return The array of symbols in order */ function sortedSymbols() external view returns (string[] memory); /** * @notice Asset allocations to include in TVL * @dev Requires all allocations that track value deployed to the protocol * @return An array of the asset allocation names */ function assetAllocations() external view returns (string[] memory); /** * @notice ERC20 asset allocations to include in TVL * @dev Should return addresses for all tokens that get deployed or unwound * @return The array of ERC20 token addresses */ function erc20Allocations() external view returns (IERC20[] memory); }
interface IZap is INameIdentifier { /** * @notice Deploy liquidity to a protocol (i.e. enter a farm) * @dev Implementation should add liquidity and stake LP tokens * @param amounts Amount of each token to deploy */ function deployLiquidity(uint256[] calldata amounts) external; /** * @notice Unwind liquidity from a protocol (i.e exit a farm) * @dev Implementation should unstake LP tokens and remove liquidity * @dev If there is only one token to unwind, `index` should be 0 * @param amount Amount of liquidity to unwind * @param index Which token should be unwound */ function unwindLiquidity(uint256 amount, uint8 index) external; /** * @notice Claim accrued rewards from the protocol (i.e. harvest yield) */ function claim() external; /** * @notice Retrieves the LP token balance */ function getLpTokenBalance(address account) external view returns (uint256); /** * @notice Order of tokens for deploy `amounts` and unwind `index` * @dev Implementation should use human readable symbols * @dev Order should be the same for deploy and unwind * @return The array of symbols in order */ function sortedSymbols() external view returns (string[] memory); /** * @notice Asset allocations to include in TVL * @dev Requires all allocations that track value deployed to the protocol * @return An array of the asset allocation names */ function assetAllocations() external view returns (string[] memory); /** * @notice ERC20 asset allocations to include in TVL * @dev Should return addresses for all tokens that get deployed or unwound * @return The array of ERC20 token addresses */ function erc20Allocations() external view returns (IERC20[] memory); }
10,847
13
// if gaugeAddr has been set, withdraw from gauge and get reward token addresses
address[8] memory _rewardTokenAddr; if (_liqGaugeAddr != address(0)) { _rewardTokenAddr = _getRewardTokensAndWithdrawFromGauge( _liqGaugeAddr, repayAmount, repayAmountLeft ); }
address[8] memory _rewardTokenAddr; if (_liqGaugeAddr != address(0)) { _rewardTokenAddr = _getRewardTokensAndWithdrawFromGauge( _liqGaugeAddr, repayAmount, repayAmountLeft ); }
38,220
231
// Will no-op if msg.value == 0
_input.uniTransferFromSender(msg.value, address(theExchange)); uint256 inputETHAmount = address(theExchange).balance; boughtAmount = unifiedSwap(_input, _output, recipient, inputETHAmount, minBuyAmount, auxiliaryData);
_input.uniTransferFromSender(msg.value, address(theExchange)); uint256 inputETHAmount = address(theExchange).balance; boughtAmount = unifiedSwap(_input, _output, recipient, inputETHAmount, minBuyAmount, auxiliaryData);
56,283
228
// Update the given pool's PIGGY allocation point. Can only be called by the owner.
function setAllocPoint(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } //update totalAllocPoint totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); //update poolInfo poolInfo[_pid].allocPoint = _allocPoint; }
function setAllocPoint(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } //update totalAllocPoint totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); //update poolInfo poolInfo[_pid].allocPoint = _allocPoint; }
43,506
23
// Checks if a registration request is valid by comparing the v, r, s params/ and the hashed params with the customer address./v - recovery ID of the ETH signature. - https:github.com/ethereum/EIPs/issues/155/r - R output of ECDSA signature./s - S output of ECDSA signature./_pullPayment - pull payment to be validated./ return bool - if the v, r, s params with the hashed params match the customer address
function isValidRegistration( uint8 v, bytes32 r, bytes32 s, PullPayment memory _pullPayment ) internal pure returns (bool)
function isValidRegistration( uint8 v, bytes32 r, bytes32 s, PullPayment memory _pullPayment ) internal pure returns (bool)
40,793
13
// Unpause it.
function unpause() public onlyOwner { _unpause(); }
function unpause() public onlyOwner { _unpause(); }
3,449
16
// lock immediately, transfer directly to staker to skip an erc20 transfer
IERC20(crvBpt).safeTransferFrom(msg.sender, staker, _amount); _lockCurve(); if(incentiveCrv > 0){
IERC20(crvBpt).safeTransferFrom(msg.sender, staker, _amount); _lockCurve(); if(incentiveCrv > 0){
3,031
39
// transfer the Contribution Tokens from this contact.
emit Withdraw(userAddr, amount, user.deposited, totalDeposit); lpErc.transfer(userAddr, amount);
emit Withdraw(userAddr, amount, user.deposited, totalDeposit); lpErc.transfer(userAddr, amount);
5,428
5
// Transfers value amount of tokens to address to, and MUST fire the Transfer event. The function SHOULD throw if the message caller’s account balance does not have enough tokens to spend. Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.
function transfer(address to, uint256 value) external returns (bool success);
function transfer(address to, uint256 value) external returns (bool success);
31,454
8
// Checks if rounding error >= 0.1% when rounding down./numerator Numerator./denominator Denominator./target Value to multiply with numerator/denominator./ return isError Rounding error is present.
function isRoundingErrorFloor( uint256 numerator, uint256 denominator, uint256 target
function isRoundingErrorFloor( uint256 numerator, uint256 denominator, uint256 target
66,588
184
// Executes a percentage division value The value of which the percentage needs to be calculated percentage The percentage of the value to be calculatedreturn The value divided the percentage /
function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256) { require(percentage != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfPercentage = percentage / 2; require( value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage; }
function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256) { require(percentage != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfPercentage = percentage / 2; require( value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage; }
16,623
0
// Call the function to buy TOKEN/NTOKEN from a posted price sheet/bite TOKEN(NTOKEN) by ETH,(+ethNumBal, -tokenNumBal)/token The address of token(ntoken)/index The position of the sheet in priceSheetList[token]/biteNum The amount of bitting (in the unit of ETH), realAmount = biteNumnewTokenAmountPerEth/newTokenAmountPerEth The new price of token (1 ETH : some TOKEN), here some means newTokenAmountPerEth
function _biteToken( MiningV1Data.State storage state, address token, uint256 index, uint256 biteNum, uint256 newTokenAmountPerEth ) external
function _biteToken( MiningV1Data.State storage state, address token, uint256 index, uint256 biteNum, uint256 newTokenAmountPerEth ) external
82,206
182
// updates the referenced oracle/ return true if the update is effective
function updateOracle() public override returns (bool) { return oracle.update(); }
function updateOracle() public override returns (bool) { return oracle.update(); }
29,796
58
// Reclaim all ERC20Basic compatible tokens missing_token ERC20Basic The address of the token contract (missing_token) /
function recoverERC20Token_SendbyMistake(ERC20Basic missing_token) external onlyOwner { uint256 balance = missing_token.balanceOf(this); missing_token.safeTransfer(owner, balance); }
function recoverERC20Token_SendbyMistake(ERC20Basic missing_token) external onlyOwner { uint256 balance = missing_token.balanceOf(this); missing_token.safeTransfer(owner, balance); }
32,474
194
// lowers hasminted from the caller's allocation/
function lowerHasMinted(uint256 amount) public onlyWhitelisted { if (hasMinted[msg.sender] < amount) { hasMinted[msg.sender] = 0; } else { hasMinted[msg.sender] = hasMinted[msg.sender].sub(amount); } }
function lowerHasMinted(uint256 amount) public onlyWhitelisted { if (hasMinted[msg.sender] < amount) { hasMinted[msg.sender] = 0; } else { hasMinted[msg.sender] = hasMinted[msg.sender].sub(amount); } }
34,937
33
// Delete crowdsale start time
database.deleteUint(keccak256(abi.encodePacked("crowdsale.start", _assetAddress)));
database.deleteUint(keccak256(abi.encodePacked("crowdsale.start", _assetAddress)));
50,636
281
// Mints new tokens and assigns them to the target _investor. Can only be called by the issuer or STO attached to the token. _investors A list of addresses to whom the minted tokens will be dilivered _values A list of number of tokens get minted and transfer to corresponding address of the investor from _investor[] listreturn success /
function mintMulti(address[] _investors, uint256[] _values) external returns (bool success) { require(_investors.length == _values.length, "Incorrect inputs"); for (uint256 i = 0; i < _investors.length; i++) { mint(_investors[i], _values[i]); } return true; }
function mintMulti(address[] _investors, uint256[] _values) external returns (bool success) { require(_investors.length == _values.length, "Incorrect inputs"); for (uint256 i = 0; i < _investors.length; i++) { mint(_investors[i], _values[i]); } return true; }
26,287
1
// administrator,which should be professor, or other grader
constructor () public { administrator = msg.sender; createGrade("comp3010","PRO","7777777",100,35,100,35,100,40); }
constructor () public { administrator = msg.sender; createGrade("comp3010","PRO","7777777",100,35,100,35,100,40); }
21,034
16
// Gets the stable rate borrowing state of the reserve self The reserve configurationreturn The stable rate borrowing state /
{ return (self.data & ~STABLE_BORROWING_MASK) != 0; }
{ return (self.data & ~STABLE_BORROWING_MASK) != 0; }
4,368
83
// return the cliff time of the token vesting. /
function cliff() public view returns (uint256) { return _cliff; }
function cliff() public view returns (uint256) { return _cliff; }
7,979
4
// simplify by checking only in the end, only when adding new accounts
require(_whitelistGroup.length() <= maxWhitelistSize, 'Whitelist: too many addresses');
require(_whitelistGroup.length() <= maxWhitelistSize, 'Whitelist: too many addresses');
11,861
124
// to recieve ETH from uniswapV2Router when swaping
receive() external payable {} function _getValues(uint256 tAmount, bool isSelling) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues( tAmount, _taxFee, _teamFee, isSelling ); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tTeam, currentRate ); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); }
receive() external payable {} function _getValues(uint256 tAmount, bool isSelling) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues( tAmount, _taxFee, _teamFee, isSelling ); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tTeam, currentRate ); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); }
55,519
169
// Invert denominator mod 2256 Now that denominator is an odd number, it has an inverse modulo 2256 such that denominatorinv = 1 mod 2256. Compute the inverse by starting with a seed that is correct correct for four bits. That is, denominatorinv = 1 mod 24
uint256 inv = (3 * denominator) ^ 2;
uint256 inv = (3 * denominator) ^ 2;
14,855
67
// Amount that is currently locked for selling options
uint104 lockedAmount;
uint104 lockedAmount;
48,703
147
// cannot overflow as supply cannot overflow
++_balances[collectionId][to];
++_balances[collectionId][to];
10,197
109
// Return DVM for this network. /
function _getOracle() internal view returns (OracleAncillaryInterface) { return OracleAncillaryInterface(finder.getImplementationAddress(OracleInterfaces.Oracle)); }
function _getOracle() internal view returns (OracleAncillaryInterface) { return OracleAncillaryInterface(finder.getImplementationAddress(OracleInterfaces.Oracle)); }
12,761
41
// Handle remaining execution inside handleDeposit() function
return true;
return true;
36,273
3
// anyone may claim an iteration /
function claimAuthorship(address _author, bytes32 _proof) public { AuthorshipClaim(_author, _proof); }
function claimAuthorship(address _author, bytes32 _proof) public { AuthorshipClaim(_author, _proof); }
7,691
245
// Details of a voting proposal:
struct MultiCallProposal { address[] contractsToCall; bytes[] callsData; uint256[] values; bool exist; bool passed; }
struct MultiCallProposal { address[] contractsToCall; bytes[] callsData; uint256[] values; bool exist; bool passed; }
24,114
3
// Checks if particular address is registered in entityMap
modifier exists( mapping(address => Entity) storage entityMap, address addr
modifier exists( mapping(address => Entity) storage entityMap, address addr
26,867
22
// EVERYTHING CHECKED OUT, WRITE OR OVERWRITE THE HEXES IN OCCUPADO
if(tile.blocks[index][3] >= 0) // If the previous z was greater than 0 (i.e. not hidden) ... { for(uint8 l = 0; l < 24; l+=3) // loop 8 times,find the previous occupado entries and overwrite them { for(uint o = 0; o < tile.occupado.length; o++) { if(didoccupy[l] == tile.occupado[o][0] && didoccupy[l+1] == tile.occupado[o][1] && didoccupy[l+2] == tile.occupado[o][2]) // x,y,z equal? { tile.occupado[o][0] = wouldoccupy[l]; // found it. Overwrite it
if(tile.blocks[index][3] >= 0) // If the previous z was greater than 0 (i.e. not hidden) ... { for(uint8 l = 0; l < 24; l+=3) // loop 8 times,find the previous occupado entries and overwrite them { for(uint o = 0; o < tile.occupado.length; o++) { if(didoccupy[l] == tile.occupado[o][0] && didoccupy[l+1] == tile.occupado[o][1] && didoccupy[l+2] == tile.occupado[o][2]) // x,y,z equal? { tile.occupado[o][0] = wouldoccupy[l]; // found it. Overwrite it
11,805
48
// perform a distributed swap
function swap( SwapParams memory _swap, DistributionParams memory _distribution
function swap( SwapParams memory _swap, DistributionParams memory _distribution
45,673
100
// If the user was already registered, ensure that the new caps do not conflict previous contributions /
function validateUpdatedRegistration(address addr, uint _cap) internal constant returns(bool)
function validateUpdatedRegistration(address addr, uint _cap) internal constant returns(bool)
32,296
8
// Validate a HardWithdrawal execution error proof. priorStateRoot State root prior to the transaction. stateProof Inclusion proof of the account inthe tree with root `priorStateRoot`. transaction Transaction to check for fraud. /
function validateExecutionErrorProof( bytes32 priorStateRoot, bytes memory stateProof, Tx.HardWithdrawal memory transaction
function validateExecutionErrorProof( bytes32 priorStateRoot, bytes memory stateProof, Tx.HardWithdrawal memory transaction
10,831
45
// - Based on the past transactions and feedback from the buyer, the sellers will be given a trust score.
require(rating > 5, "Rating should be within the range of 1 to 5!"); seller_rating_map[seller] = rating;
require(rating > 5, "Rating should be within the range of 1 to 5!"); seller_rating_map[seller] = rating;
36,196
19
// Send them their redemption value
msg.sender.call.value(amountToSend).gas(1000000)();
msg.sender.call.value(amountToSend).gas(1000000)();
7,278
261
// Mints 7000 Warriors/
function mintWarriors(uint256 numberOfTokens) external payable { require(IS_WARRIORS_MINT_ACTIVE, "Warriors Mint is Not Active"); require((totalSupply()+numberOfTokens) <= 10000, "Warriors Mint Finished"); require(msg.value == (numberOfTokens * WARRIORS_PRICE), "Wrong Eth value sent"); for(uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } }
function mintWarriors(uint256 numberOfTokens) external payable { require(IS_WARRIORS_MINT_ACTIVE, "Warriors Mint is Not Active"); require((totalSupply()+numberOfTokens) <= 10000, "Warriors Mint Finished"); require(msg.value == (numberOfTokens * WARRIORS_PRICE), "Wrong Eth value sent"); for(uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } }
36,118
1
// Maximum value signed 64.64-bit fixed point number may have./
int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
1,623
7
// helper metod to pass in vault address instead of tokenId/
function transferFromWithVault(address _from, address _to, address _vault, uint256 _amount, bytes calldata _data) external;
function transferFromWithVault(address _from, address _to, address _vault, uint256 _amount, bytes calldata _data) external;
16,771
28
// " stroke-dasharray='calc('", getDashArray(tokenId, index),"pxvar(--n, 1)) calc(40pxvar(--n, 1)) calc(20pxvar(--n, 10))calc(10pxvar(--n, 1)) !important; stroke-dashoffset: calc(10pxvar(--n, 10)) !important;'", "'/>");}
function getDashArray(uint256 tokenId, uint256 offset) internal view returns (string memory) { return string.concat(
function getDashArray(uint256 tokenId, uint256 offset) internal view returns (string memory) { return string.concat(
12,580
13
// Function for register a patent
function registerPatent(string memory _invention_title, string memory _inventor_details, string memory _technical_field, string memory _technical_problem, string memory _technical_solution, string memory _invention_description, string memory _registered_date, string memory _end_date, string memory _license_details, string memory _renewal_status,
function registerPatent(string memory _invention_title, string memory _inventor_details, string memory _technical_field, string memory _technical_problem, string memory _technical_solution, string memory _invention_description, string memory _registered_date, string memory _end_date, string memory _license_details, string memory _renewal_status,
12,743