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... | 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... | 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 * _treeWaterUse... | 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 * _treeWaterUse... | 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;
... | 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;
... | 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)... | 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)... | 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 p... | function finalize() public initialized onlyOwner {
require(finalizedBlock == 0);
finalizedBlock = getBlockNumber();
finalizedTime = now;
// Percentage to sale
// uint256 percentageToCommunity = percent(50);
uint256 percentageToTeam = percent(18);
uint256 p... | 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... | 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... | 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-betwe... | 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,
... | uint256 amountToWithdraw =
availableToWithdraw - benefactorWithdrawalSafetyDiscount;
benefactorFunds[benefactor] = benefactorWithdrawalSafetyDiscount;
if (sendErc20(amountToWithdraw, benefactor)) {
emit WithdrawBenefactorFundsWithSafetyDelay(
benefactor,
... | 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 ||
... | uint256 maxParallelBallotsAllowed = validatorsLength / 3;
require(openCountPerPoolId[senderPoolId]++ < maxParallelBallotsAllowed);
require(_duration >= MIN_DURATION);
require(_duration <= MAX_DURATION);
require(
_reason == BAN_REASON_OFTEN_BLOCK_DELAYS ||
... | 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 == _md... | 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 == _md... | 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"
... | function withdrawLiquidityTokens(uint256 numPoolTokensToWithdraw) external {
require(numPoolTokensToWithdraw > 0);
staker storage thisStaker = stakers[msg.sender];
require(
thisStaker.poolTokenBalance >= numPoolTokensToWithdraw,
"Pool token balance too low"
... | 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 Ad... | 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 Ad... | 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(th... | 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(th... | 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... | 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;
/**
... | 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;
/**
... | 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
... | 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
... | 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./... | 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_OVER... | 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_OVER... | 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/newTokenAmountP... | 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[] lis... | 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,
_ta... | 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,
_ta... | 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(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++)
{
... | 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");
... | 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");
... | 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 _licens... | 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 _licens... | 12,743 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.