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
206
// Remove a token from the pool. Replaces the address in the tokens array with the last address, then removes it from the array. token Bound token address. /
function unbind(address token) public override virtual _logs_ _lock_
function unbind(address token) public override virtual _logs_ _lock_
16,512
13
// Voteable poll with associated IPFS data A poll records votes on a variable number of choices. A poll specifiesa window during which users can vote. Information like the poll title andthe descriptions for each option are stored on IPFS. /
contract Poll is DependentOnIPFS { // There isn't a way around using time to determine when votes can be cast // solhint-disable not-rely-on-time bytes public pollDataMultihash; uint16 public numChoices; uint256 public startTime; uint256 public endTime; address public author; address public pollAdmin; AccountRegistryInterface public registry; SigningLogicInterface public signingLogic; mapping(uint256 => uint16) public votes; mapping (bytes32 => bool) public usedSignatures; event VoteCast(address indexed voter, uint16 indexed choice); constructor( bytes _ipfsHash, uint16 _numChoices, uint256 _startTime, uint256 _endTime, address _author, AccountRegistryInterface _registry, SigningLogicInterface _signingLogic, address _pollAdmin ) public { require(_startTime >= now && _endTime > _startTime); require(isValidIPFSMultihash(_ipfsHash)); numChoices = _numChoices; startTime = _startTime; endTime = _endTime; pollDataMultihash = _ipfsHash; author = _author; registry = _registry; signingLogic = _signingLogic; pollAdmin = _pollAdmin; } function vote(uint16 _choice) external { voteForUser(_choice, msg.sender); } function voteFor(uint16 _choice, address _voter, bytes32 _nonce, bytes _delegationSig) external onlyPollAdmin { require(!usedSignatures[keccak256(abi.encodePacked(_delegationSig))], "Signature not unique"); usedSignatures[keccak256(abi.encodePacked(_delegationSig))] = true; bytes32 _delegationDigest = signingLogic.generateVoteForDelegationSchemaHash( _choice, _voter, _nonce, this ); require(_voter == signingLogic.recoverSigner(_delegationDigest, _delegationSig)); voteForUser(_choice, _voter); } /** * @dev Cast or change your vote * @param _choice The index of the option in the corresponding IPFS document. */ function voteForUser(uint16 _choice, address _voter) internal duringPoll { // Choices are indexed from 1 since the mapping returns 0 for "no vote cast" require(_choice <= numChoices && _choice > 0); uint256 _voterId = registry.accountIdForAddress(_voter); votes[_voterId] = _choice; emit VoteCast(_voter, _choice); } modifier duringPoll { require(now >= startTime && now <= endTime); _; } modifier onlyPollAdmin { require(msg.sender == pollAdmin); _; } }
contract Poll is DependentOnIPFS { // There isn't a way around using time to determine when votes can be cast // solhint-disable not-rely-on-time bytes public pollDataMultihash; uint16 public numChoices; uint256 public startTime; uint256 public endTime; address public author; address public pollAdmin; AccountRegistryInterface public registry; SigningLogicInterface public signingLogic; mapping(uint256 => uint16) public votes; mapping (bytes32 => bool) public usedSignatures; event VoteCast(address indexed voter, uint16 indexed choice); constructor( bytes _ipfsHash, uint16 _numChoices, uint256 _startTime, uint256 _endTime, address _author, AccountRegistryInterface _registry, SigningLogicInterface _signingLogic, address _pollAdmin ) public { require(_startTime >= now && _endTime > _startTime); require(isValidIPFSMultihash(_ipfsHash)); numChoices = _numChoices; startTime = _startTime; endTime = _endTime; pollDataMultihash = _ipfsHash; author = _author; registry = _registry; signingLogic = _signingLogic; pollAdmin = _pollAdmin; } function vote(uint16 _choice) external { voteForUser(_choice, msg.sender); } function voteFor(uint16 _choice, address _voter, bytes32 _nonce, bytes _delegationSig) external onlyPollAdmin { require(!usedSignatures[keccak256(abi.encodePacked(_delegationSig))], "Signature not unique"); usedSignatures[keccak256(abi.encodePacked(_delegationSig))] = true; bytes32 _delegationDigest = signingLogic.generateVoteForDelegationSchemaHash( _choice, _voter, _nonce, this ); require(_voter == signingLogic.recoverSigner(_delegationDigest, _delegationSig)); voteForUser(_choice, _voter); } /** * @dev Cast or change your vote * @param _choice The index of the option in the corresponding IPFS document. */ function voteForUser(uint16 _choice, address _voter) internal duringPoll { // Choices are indexed from 1 since the mapping returns 0 for "no vote cast" require(_choice <= numChoices && _choice > 0); uint256 _voterId = registry.accountIdForAddress(_voter); votes[_voterId] = _choice; emit VoteCast(_voter, _choice); } modifier duringPoll { require(now >= startTime && now <= endTime); _; } modifier onlyPollAdmin { require(msg.sender == pollAdmin); _; } }
6,681
29
// Withdraw LP tokens from Pool.
function withdraw(uint256 _pid, uint256 _amount,address _to) public { address _user = msg.sender; PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pendingAmount = user.amount.mul(pool.accRewardPerShare).div(1e12).sub(user.rewardDebt); if (pendingAmount > 0) { safeRewardTransfer(_to, pendingAmount); } if (_amount > 0) { user.amount = user.amount.sub(_amount); pool.totalAmount = pool.totalAmount.sub(_amount); pool.lpToken.safeTransfer(_to, _amount); } user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e12); emit Withdraw(_user, _pid, _amount,_to); }
function withdraw(uint256 _pid, uint256 _amount,address _to) public { address _user = msg.sender; PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pendingAmount = user.amount.mul(pool.accRewardPerShare).div(1e12).sub(user.rewardDebt); if (pendingAmount > 0) { safeRewardTransfer(_to, pendingAmount); } if (_amount > 0) { user.amount = user.amount.sub(_amount); pool.totalAmount = pool.totalAmount.sub(_amount); pool.lpToken.safeTransfer(_to, _amount); } user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e12); emit Withdraw(_user, _pid, _amount,_to); }
40,982
116
// and current time is within the crowdfunding period
block.timestamp >= startTimestamp && block.timestamp < endTimestamp );
block.timestamp >= startTimestamp && block.timestamp < endTimestamp );
32,015
11
// Calculate xy rounding towards zero, where x is signed 64.64 fixed pointnumber and y is signed 256-bit integer number.Revert on overflow.x signed 64.64 fixed point number y signed 256-bit integer numberreturn signed 256-bit integer number /
function muli (int128 x, int256 y) internal pure returns (int256) { unchecked { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } }
function muli (int128 x, int256 y) internal pure returns (int256) { unchecked { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } }
14,821
197
// Private methods /
function _setOrAddFarmingSetupInfo(FarmingSetupInfo memory info, bool add, bool disable, uint256 setupIndex) private { FarmingSetupInfo memory farmingSetupInfo = info; if(add || !disable) { farmingSetupInfo.renewTimes = farmingSetupInfo.renewTimes + 1; if(farmingSetupInfo.renewTimes == 0) { farmingSetupInfo.renewTimes = farmingSetupInfo.renewTimes - 1; } } if (add) { require( farmingSetupInfo.liquidityPoolTokenAddress != address(0) && farmingSetupInfo.originalRewardPerBlock > 0, "Invalid setup configuration" ); _checkTicks(farmingSetupInfo.tickLower, farmingSetupInfo.tickUpper); address[] memory tokenAddresses = new address[](2); tokenAddresses[0] = IUniswapV3Pool(info.liquidityPoolTokenAddress).token0(); tokenAddresses[1] = IUniswapV3Pool(info.liquidityPoolTokenAddress).token1(); bool mainTokenFound = false; bool ethTokenFound = false; for(uint256 z = 0; z < tokenAddresses.length; z++) { if(tokenAddresses[z] == _WETH) { ethTokenFound = true; } if(tokenAddresses[z] == farmingSetupInfo.mainTokenAddress) { mainTokenFound = true; } else { emit SetupToken(farmingSetupInfo.mainTokenAddress, tokenAddresses[z]); } } require(mainTokenFound, "No main token"); require(!farmingSetupInfo.involvingETH || ethTokenFound, "No ETH token"); farmingSetupInfo.setupsCount = 0; _setupsInfo[_farmingSetupsInfoCount] = farmingSetupInfo; _setups[_farmingSetupsCount] = FarmingSetup(_farmingSetupsInfoCount, false, 0, 0, 0, 0, farmingSetupInfo.originalRewardPerBlock, 0); _setupsInfo[_farmingSetupsInfoCount].lastSetupIndex = _farmingSetupsCount; _farmingSetupsInfoCount += 1; _farmingSetupsCount += 1; return; } FarmingSetup storage setup = _setups[setupIndex]; farmingSetupInfo = _setupsInfo[_setups[setupIndex].infoIndex]; if(disable) { require(setup.active, "Not possible"); _toggleSetup(setupIndex); return; } info.renewTimes -= 1; if (setup.active) { setup = _setups[setupIndex]; if(block.number < setup.endBlock) { uint256 difference = info.originalRewardPerBlock < farmingSetupInfo.originalRewardPerBlock ? farmingSetupInfo.originalRewardPerBlock - info.originalRewardPerBlock : info.originalRewardPerBlock - farmingSetupInfo.originalRewardPerBlock; uint256 duration = setup.endBlock - block.number; uint256 amount = difference * duration; if (amount > 0) { if (info.originalRewardPerBlock > farmingSetupInfo.originalRewardPerBlock) { require(_ensureTransfer(amount), "Insufficient reward in extension."); _rewardReceived[setupIndex] += amount; } _updateFreeSetup(setupIndex, 0, 0, false); setup.rewardPerBlock = info.originalRewardPerBlock; } } _setupsInfo[_setups[setupIndex].infoIndex].originalRewardPerBlock = info.originalRewardPerBlock; } if(_setupsInfo[_setups[setupIndex].infoIndex].renewTimes > 0) { _setupsInfo[_setups[setupIndex].infoIndex].renewTimes = info.renewTimes; } }
function _setOrAddFarmingSetupInfo(FarmingSetupInfo memory info, bool add, bool disable, uint256 setupIndex) private { FarmingSetupInfo memory farmingSetupInfo = info; if(add || !disable) { farmingSetupInfo.renewTimes = farmingSetupInfo.renewTimes + 1; if(farmingSetupInfo.renewTimes == 0) { farmingSetupInfo.renewTimes = farmingSetupInfo.renewTimes - 1; } } if (add) { require( farmingSetupInfo.liquidityPoolTokenAddress != address(0) && farmingSetupInfo.originalRewardPerBlock > 0, "Invalid setup configuration" ); _checkTicks(farmingSetupInfo.tickLower, farmingSetupInfo.tickUpper); address[] memory tokenAddresses = new address[](2); tokenAddresses[0] = IUniswapV3Pool(info.liquidityPoolTokenAddress).token0(); tokenAddresses[1] = IUniswapV3Pool(info.liquidityPoolTokenAddress).token1(); bool mainTokenFound = false; bool ethTokenFound = false; for(uint256 z = 0; z < tokenAddresses.length; z++) { if(tokenAddresses[z] == _WETH) { ethTokenFound = true; } if(tokenAddresses[z] == farmingSetupInfo.mainTokenAddress) { mainTokenFound = true; } else { emit SetupToken(farmingSetupInfo.mainTokenAddress, tokenAddresses[z]); } } require(mainTokenFound, "No main token"); require(!farmingSetupInfo.involvingETH || ethTokenFound, "No ETH token"); farmingSetupInfo.setupsCount = 0; _setupsInfo[_farmingSetupsInfoCount] = farmingSetupInfo; _setups[_farmingSetupsCount] = FarmingSetup(_farmingSetupsInfoCount, false, 0, 0, 0, 0, farmingSetupInfo.originalRewardPerBlock, 0); _setupsInfo[_farmingSetupsInfoCount].lastSetupIndex = _farmingSetupsCount; _farmingSetupsInfoCount += 1; _farmingSetupsCount += 1; return; } FarmingSetup storage setup = _setups[setupIndex]; farmingSetupInfo = _setupsInfo[_setups[setupIndex].infoIndex]; if(disable) { require(setup.active, "Not possible"); _toggleSetup(setupIndex); return; } info.renewTimes -= 1; if (setup.active) { setup = _setups[setupIndex]; if(block.number < setup.endBlock) { uint256 difference = info.originalRewardPerBlock < farmingSetupInfo.originalRewardPerBlock ? farmingSetupInfo.originalRewardPerBlock - info.originalRewardPerBlock : info.originalRewardPerBlock - farmingSetupInfo.originalRewardPerBlock; uint256 duration = setup.endBlock - block.number; uint256 amount = difference * duration; if (amount > 0) { if (info.originalRewardPerBlock > farmingSetupInfo.originalRewardPerBlock) { require(_ensureTransfer(amount), "Insufficient reward in extension."); _rewardReceived[setupIndex] += amount; } _updateFreeSetup(setupIndex, 0, 0, false); setup.rewardPerBlock = info.originalRewardPerBlock; } } _setupsInfo[_setups[setupIndex].infoIndex].originalRewardPerBlock = info.originalRewardPerBlock; } if(_setupsInfo[_setups[setupIndex].infoIndex].renewTimes > 0) { _setupsInfo[_setups[setupIndex].infoIndex].renewTimes = info.renewTimes; } }
1,978
61
// Maximum wallet size is 2% of the total supply.
uint256 private maxWalletPercent = 100; // Less fields to edit uint256 private maxWalletDivisor = 100; uint256 private _maxWalletSize = (_tTotal * maxWalletPercent) / maxWalletDivisor; uint256 private _previousMaxWalletSize = _maxWalletSize; uint256 public maxWalletSizeUI = (startingSupply * maxWalletPercent) / maxWalletDivisor; // Actual amount for UI's
uint256 private maxWalletPercent = 100; // Less fields to edit uint256 private maxWalletDivisor = 100; uint256 private _maxWalletSize = (_tTotal * maxWalletPercent) / maxWalletDivisor; uint256 private _previousMaxWalletSize = _maxWalletSize; uint256 public maxWalletSizeUI = (startingSupply * maxWalletPercent) / maxWalletDivisor; // Actual amount for UI's
30,205
7
// Withdraw any WETH received
IWETH weth = IWETH(wethAddress); uint256 wethBalance = weth.balanceOf(address(this)); if (wethBalance > 0) { weth.withdraw(wethBalance); }
IWETH weth = IWETH(wethAddress); uint256 wethBalance = weth.balanceOf(address(this)); if (wethBalance > 0) { weth.withdraw(wethBalance); }
30,910
224
// 4 period, 5 period
} else if(fromPeriod == 3 && toPeriod == 4) {
} else if(fromPeriod == 3 && toPeriod == 4) {
8,936
36
// check if merkle root has already been revoked
if (revoked[merkleHash].exists && revoked[merkleHash].batchFlag) { return (STATUS_FAIL, MSG_REVOKED); }
if (revoked[merkleHash].exists && revoked[merkleHash].batchFlag) { return (STATUS_FAIL, MSG_REVOKED); }
46,590
255
// SLOAD from 'fraction'
uint256 fraction;
uint256 fraction;
29,714
677
// Require previous vote is None
require( proposals[_proposalId].votes[voter] == Vote.None, "Governance: To update previous vote, call updateVote()" );
require( proposals[_proposalId].votes[voter] == Vote.None, "Governance: To update previous vote, call updateVote()" );
41,498
125
// Mark car as finished:
RaceLib.CarRates storage rates = race.carRates[car]; rates.finishRateToUsdE8 = finishRateToUsdE8; race.isFinishedCar[car] = true; race.finishedCarCount++;
RaceLib.CarRates storage rates = race.carRates[car]; rates.finishRateToUsdE8 = finishRateToUsdE8; race.isFinishedCar[car] = true; race.finishedCarCount++;
17,013
137
// Collect accumulated CRV and send to Vault. /
function collectRewardToken() external onlyVault nonReentrant { IERC20 crvToken = IERC20(rewardTokenAddress); ICRVMinter minter = ICRVMinter(crvMinterAddress); uint256 balance = crvToken.balanceOf(address(this)); emit RewardTokenCollected(vaultAddress, balance); minter.mint(crvGaugeAddress); crvToken.safeTransfer(vaultAddress, balance); }
function collectRewardToken() external onlyVault nonReentrant { IERC20 crvToken = IERC20(rewardTokenAddress); ICRVMinter minter = ICRVMinter(crvMinterAddress); uint256 balance = crvToken.balanceOf(address(this)); emit RewardTokenCollected(vaultAddress, balance); minter.mint(crvGaugeAddress); crvToken.safeTransfer(vaultAddress, balance); }
7,576
201
// accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFreshAdmin function to accrue interest and set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setReserveFactor(uint newReserveFactorMantissa) external nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed. return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED); } // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to. return _setReserveFactorFresh(newReserveFactorMantissa); }
function _setReserveFactor(uint newReserveFactorMantissa) external nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed. return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED); } // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to. return _setReserveFactorFresh(newReserveFactorMantissa); }
6,057
161
// Curve parameters
Curve public curve;
Curve public curve;
29,947
341
// czxpWager check czxpWager
require(czxpWager >= 0);
require(czxpWager >= 0);
1,833
463
// Enter and/or ensure collateral market is enacted
_enterCollatMarket(cyTokenAddr); if (_isETH(_asset)) {
_enterCollatMarket(cyTokenAddr); if (_isETH(_asset)) {
39,568
92
// Wallet for tokens keeping purpose, no sale
address public treasuryWallet;
address public treasuryWallet;
12,962
90
// Add to training since tower staking doesn't need C+R
uint256 seed = random(commit.tokenId, commitIdStartTimeTraining[_commitIdPendingTraining], commit.tokenOwner); trainingGrounds.addManyToTrainingAndFlight(seed, commit.tokenOwner, idSingle);
uint256 seed = random(commit.tokenId, commitIdStartTimeTraining[_commitIdPendingTraining], commit.tokenOwner); trainingGrounds.addManyToTrainingAndFlight(seed, commit.tokenOwner, idSingle);
81,676
9
// token address
address public addressOfTokenUsedAsReward; uint256 public price = 1818; token tokenReward;
address public addressOfTokenUsedAsReward; uint256 public price = 1818; token tokenReward;
32,450
292
// Removes liquidity in case of emergency. /
function emergencyBurn( int24 tickLower, int24 tickUpper, uint128 liquidity
function emergencyBurn( int24 tickLower, int24 tickUpper, uint128 liquidity
7,834
26
// Dividend paying SDVD supply on each snapshot id.
mapping(uint256 => uint256) private _dividendPayingSDVDSupplySnapshots;
mapping(uint256 => uint256) private _dividendPayingSDVDSupplySnapshots;
10,175
43
// transfer
super._transfer(sender, to, amount); swapAndDividend(); return true;
super._transfer(sender, to, amount); swapAndDividend(); return true;
46,847
5
// first get reserves before the swap
(reserveA, reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB); require(reserveA > 0 && reserveB > 0, 'UniswapV2ArbitrageLibrary: ZERO_PAIR_RESERVES');
(reserveA, reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB); require(reserveA > 0 && reserveB > 0, 'UniswapV2ArbitrageLibrary: ZERO_PAIR_RESERVES');
27,103
29
// Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC777Permit is ERC777, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping (address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private immutable _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") { } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC777Permit is ERC777, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping (address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private immutable _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") { } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
16,217
202
// See {IERC20Permit-nonces}. /
function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); }
function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); }
2,878
257
// Implements ERC2981 royalty functionality. We just read the royalty data from the Rarible V2 implementation.tokenId Unique ID of the HSI NFT token. salePrice Price the HSI NFT token was sold for.return receiver address to send the royalties to as well as the royalty amount. /
function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount)
function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount)
34,007
7
// Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero./
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
53
32
// check signature
bytes32 hash = keccak256(encoded); address signer = ecrecover(hash, v, r, s);
bytes32 hash = keccak256(encoded); address signer = ecrecover(hash, v, r, s);
20,501
291
// Needs either one ENS or ENSFactory
function APMRegistryFactory( DAOFactory _daoFactory, APMRegistry _registryBase, Repo _repoBase, ENSSubdomainRegistrar _ensSubBase, ENS _ens, ENSFactory _ensFactory ) public // DAO initialized without evmscript run support
function APMRegistryFactory( DAOFactory _daoFactory, APMRegistry _registryBase, Repo _repoBase, ENSSubdomainRegistrar _ensSubBase, ENS _ens, ENSFactory _ensFactory ) public // DAO initialized without evmscript run support
23,973
32
// Indicator that this is a GToken contract (for inspection) /
bool public constant isCToken = true;
bool public constant isCToken = true;
16,587
94
// Calculate which orders match for settlement.
MatchResult[] memory results = new MatchResult[](makerOrderParams.length); TotalMatchResult memory totalMatch; for (uint256 i = 0; i < makerOrderParams.length; i++) { require(!isMarketOrder(makerOrderParams[i].data), MAKER_ORDER_CAN_NOT_BE_MARKET_ORDER); require(isSell(takerOrderParam.data) != isSell(makerOrderParams[i].data), INVALID_SIDE); validatePrice(takerOrderParam, makerOrderParams[i]); OrderInfo memory makerOrderInfo = getOrderInfo(makerOrderParams[i], orderAddressSet); results[i] = getMatchResult(
MatchResult[] memory results = new MatchResult[](makerOrderParams.length); TotalMatchResult memory totalMatch; for (uint256 i = 0; i < makerOrderParams.length; i++) { require(!isMarketOrder(makerOrderParams[i].data), MAKER_ORDER_CAN_NOT_BE_MARKET_ORDER); require(isSell(takerOrderParam.data) != isSell(makerOrderParams[i].data), INVALID_SIDE); validatePrice(takerOrderParam, makerOrderParams[i]); OrderInfo memory makerOrderInfo = getOrderInfo(makerOrderParams[i], orderAddressSet); results[i] = getMatchResult(
63
13
// Declare an error buffer indicating status of any native offer items. {00} == 0 => In a match function, no native offer items: allow. {01} == 1 => In a match function, some native offer items: allow. {10} == 2 => Not in a match function, no native offer items: allow. {11} == 3 => Not in a match function, some native offer items: THROW.
uint256 invalidNativeOfferItemErrorBuffer;
uint256 invalidNativeOfferItemErrorBuffer;
14,520
9
// Transferring the contract ownership to the new owner._newOwner new contractor owner /
function transferOwnership(address _newOwner) onlyOwner { if (_newOwner != address(0)) { newOwner = _newOwner; } }
function transferOwnership(address _newOwner) onlyOwner { if (_newOwner != address(0)) { newOwner = _newOwner; } }
18,046
28
// Processes a token purchase for a given beneficiary.This function is called by the `buyTokens()` function to process a token purchase._beneficiary The address of the beneficiary of the token purchase._tokenAmount The amount of tokens to be purchased./
function _processPurchase(address _beneficiary, uint256 _tokenAmount) private view { require(_tokenAmount <= _icoTokenAmount, "ICO: not enough tokens to buy"); require(_tokenAmount <= _maxTokensPerTx, "ICO: cannot buy more than the max amount" ); require(tokenAmountInWallet[_beneficiary] + _tokenAmount <= _maxTokensPerBuyer, "ICO: Cannot hold more tokens than max allowed"); }
function _processPurchase(address _beneficiary, uint256 _tokenAmount) private view { require(_tokenAmount <= _icoTokenAmount, "ICO: not enough tokens to buy"); require(_tokenAmount <= _maxTokensPerTx, "ICO: cannot buy more than the max amount" ); require(tokenAmountInWallet[_beneficiary] + _tokenAmount <= _maxTokensPerBuyer, "ICO: Cannot hold more tokens than max allowed"); }
1,962
143
// ETH is needed, means eth to quado cash (eventType 2) or coin (eventType 4)require(uint256(amount0Delta) <= address(this).balance, 'contract_eth_bal');
require(WETH.balanceOf(address(this)) >= uint256(ethAmount), 'contract_weth_bal');
require(WETH.balanceOf(address(this)) >= uint256(ethAmount), 'contract_weth_bal');
54,072
4
// This function increments the vote count for the specified movie. Equivalent to upvoting
function voteForMovie(bytes32 movie) public { ratingsReceived[movie] += 1; }
function voteForMovie(bytes32 movie) public { ratingsReceived[movie] += 1; }
41,459
161
// Next rebalance call will transfer to dripContract
transferToDripContract = true;
transferToDripContract = true;
82,780
57
// Mark this contract as migrated to the new one. It also freezes transafers./
function migrateTo(address token) { require(msg.sender == owner); require(migratedToAddress == address(0x0)); require(token != address(0x0)); migratedToAddress = token; frozen = true; }
function migrateTo(address token) { require(msg.sender == owner); require(migratedToAddress == address(0x0)); require(token != address(0x0)); migratedToAddress = token; frozen = true; }
18,390
54
// Method for canceling the offer/_nftAddress NFT contract address/_tokenId TokenId
function cancelOffer(address _nftAddress, uint256 _tokenId) external offerExists(_nftAddress, _tokenId, _msgSender())
function cancelOffer(address _nftAddress, uint256 _tokenId) external offerExists(_nftAddress, _tokenId, _msgSender())
55,637
6
// Allows the current owner to transfer control of the contract to a newOwner._newOwner The address to transfer ownership to./
function transferProxyOwnership(address _newOwner) public onlyProxyOwner { require(_newOwner != address(0)); _setUpgradeabilityOwner(_newOwner); emit ProxyOwnershipTransferred(proxyOwner(), _newOwner); }
function transferProxyOwnership(address _newOwner) public onlyProxyOwner { require(_newOwner != address(0)); _setUpgradeabilityOwner(_newOwner); emit ProxyOwnershipTransferred(proxyOwner(), _newOwner); }
11,064
75
// If cap values are not zero, set the next reset time if it wasn't set already Otherwise, if the cap token is being changed the total charged amount must be updated accordingly
if (fee.nextResetTime == 0) { fee.nextResetTime = block.timestamp + period; } else if (fee.token != token) {
if (fee.nextResetTime == 0) { fee.nextResetTime = block.timestamp + period; } else if (fee.token != token) {
32,271
3
// Prize mints must mint first, and cannot be minted after the maximum has been reached
require(currentTotalSupply < MAX_PRIZE_MINTS, "Max prize mint limit reached"); if (currentTotalSupply + amount > MAX_PRIZE_MINTS){ amount = MAX_PRIZE_MINTS - currentTotalSupply; }
require(currentTotalSupply < MAX_PRIZE_MINTS, "Max prize mint limit reached"); if (currentTotalSupply + amount > MAX_PRIZE_MINTS){ amount = MAX_PRIZE_MINTS - currentTotalSupply; }
41,764
9
// tokens owned by each address
mapping(address => uint256) public tokenBalances;
mapping(address => uint256) public tokenBalances;
70,949
17
// remove addresses from the whitelist addrs addressesreturn success true if at least one address was removed from the whitelist,false if all addresses weren't in the whitelist in the first place /
function removeAddressesFromWhitelist(address[] memory addrs) onlyOwner public returns(bool success) { for (uint256 i = 0; i < addrs.length; i++) { if (removeAddressFromWhitelist(addrs[i])) { success = true; } } }
function removeAddressesFromWhitelist(address[] memory addrs) onlyOwner public returns(bool success) { for (uint256 i = 0; i < addrs.length; i++) { if (removeAddressFromWhitelist(addrs[i])) { success = true; } } }
28,823
432
// [user] => ([token=> collateraldata])
mapping(address => mapping(bytes32 => CollateralData)) public userCollateralData;
mapping(address => mapping(bytes32 => CollateralData)) public userCollateralData;
40,270
35
// functon to receive a token. Use this instead of sending directlymust approve the token before transfer_coin is the address of the ERC20 to send_amm is the ammount of the token to send /
function receiveERC20(address _coin, uint256 _amm) external{ tokensReceived.push(_coin); IERC20(_coin).transferFrom(msg.sender, address(this), _amm); emit ReceiveERC20(_coin, msg.sender, _amm); }
function receiveERC20(address _coin, uint256 _amm) external{ tokensReceived.push(_coin); IERC20(_coin).transferFrom(msg.sender, address(this), _amm); emit ReceiveERC20(_coin, msg.sender, _amm); }
14,865
23
// Approve an order and optionally mark it for orderbook inclusion. Must be called by the maker of the order order Order to approve orderbookInclusionDesired Whether orderbook providers should include the order in their orderbooks /
function approveOrder(Order memory order, bool orderbookInclusionDesired) internal
function approveOrder(Order memory order, bool orderbookInclusionDesired) internal
5,922
24
// With the require getOwner we check already, if it can be assigned, no other checks needed
etheria.setName(col, row, ""); etheria.setOwner(col, row, bid.bidder);
etheria.setName(col, row, ""); etheria.setOwner(col, row, bid.bidder);
21,994
25
// make sure no one holds license already (owner holds)
require(licenseHolder[_licenseId] == ownerOf(_licenseId));
require(licenseHolder[_licenseId] == ownerOf(_licenseId));
15,407
259
// Attempt to transfer any Ether to caller and emit an event if it fails.
(success, ) = recipient.call.gas(_ETH_TRANSFER_GAS).value(amount)(""); if (!success) { emit ExternalError(recipient, _revertReason(18)); } else {
(success, ) = recipient.call.gas(_ETH_TRANSFER_GAS).value(amount)(""); if (!success) { emit ExternalError(recipient, _revertReason(18)); } else {
7,958
202
// keccak256("MintBatch1155(address nft,address to,uint256[] tokenIds,uint256[] amounts,bytes data,uint256 nonce)");
bytes32 public constant override MINT_BATCH_1155_TYPEHASH = 0xb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d7183043;
bytes32 public constant override MINT_BATCH_1155_TYPEHASH = 0xb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d7183043;
71,686
57
// Updates whether an address is a sequencer at the sequencer inbox newSequencer address to be modified isSequencer whether this address should be authorized as a sequencer /
function setIsSequencer(address newSequencer, bool isSequencer) external;
function setIsSequencer(address newSequencer, bool isSequencer) external;
75,728
7
// Changes amount of token stake required to report values _newStakeAmount new reporter stake amount /
function changeStakeAmount(uint256 _newStakeAmount) external { require(msg.sender == governance, "caller must be governance address"); require(_newStakeAmount > 0, "stake amount must be greater than zero"); stakeAmount = _newStakeAmount; emit NewStakeAmount(_newStakeAmount); }
function changeStakeAmount(uint256 _newStakeAmount) external { require(msg.sender == governance, "caller must be governance address"); require(_newStakeAmount > 0, "stake amount must be greater than zero"); stakeAmount = _newStakeAmount; emit NewStakeAmount(_newStakeAmount); }
36,312
2
// ++++++++++++++++++++++++++MIGRATION+++++++++++++++++++++++++++++++
function receiveMigration(uint256 amountGEX, uint256 amountCollateral, uint256 initMintedAmount) external; function bailoutMinter() external returns(uint256); function lendCollateral(uint256 amount) external returns(uint256); function repayCollateral(uint256 amount) external returns(uint256);
function receiveMigration(uint256 amountGEX, uint256 amountCollateral, uint256 initMintedAmount) external; function bailoutMinter() external returns(uint256); function lendCollateral(uint256 amount) external returns(uint256); function repayCollateral(uint256 amount) external returns(uint256);
28,969
28
// When you done launching, you can call setUsingAntiBot(false) to disable PinkAntiBot in your token instead of interacting with the PinkAntiBot contract
if (antiBotEnabled) {
if (antiBotEnabled) {
36,767
1
// part of Node for Small Skale-chain (1/128 of Node)
uint8 public constant SMALL_DIVISOR = 128;
uint8 public constant SMALL_DIVISOR = 128;
38,063
8
// struct which contains order data
struct Order { address owner; address token0; address token1; int24 tickLower; int24 tickUpper; uint24 fee; uint256 amountOfToken0; uint256 amountOfToken1; uint256 recievedAmount; uint128 liquidity; OrderType orderType; }
struct Order { address owner; address token0; address token1; int24 tickLower; int24 tickUpper; uint24 fee; uint256 amountOfToken0; uint256 amountOfToken1; uint256 recievedAmount; uint128 liquidity; OrderType orderType; }
13,999
5
// Calculates the current borrow interest rate per blockcash The total amount of cash the market hasborrows The total amount of borrows the market has outstandingreserves The total amnount of reserves the market has return The borrow rate per block (as a percentage, and scaled by 1e18)/
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
6,128
96
// make sure there are no pending reservations
require(tokensReserved == 0);
require(tokensReserved == 0);
26,956
0
// _safeTransferEth performs a transfer of Eth using the call/ method / this function is resistant to breaking gas price changes and // performs call in a safe manner by reverting on failure. / this function/ will return without performing a call or reverting, / if amount_ is zero
function _safeTransferEth(address to_, uint256 amount_) internal { if (amount_ == 0 ){ return; } require(to_ != address(0), "EthSafeTransfer: cannot transfer ETH to address 0x0"); address payable caller = payable(to_); (bool success, ) = caller.call{value: amount_}(""); require(success, "EthSafeTransfer: Transfer failed."); }
function _safeTransferEth(address to_, uint256 amount_) internal { if (amount_ == 0 ){ return; } require(to_ != address(0), "EthSafeTransfer: cannot transfer ETH to address 0x0"); address payable caller = payable(to_); (bool success, ) = caller.call{value: amount_}(""); require(success, "EthSafeTransfer: Transfer failed."); }
6,341
39
// check if token has enough editions
require(totalSupply(tokenId).add(amount) <= uint256(Nfts[tokenId].editions), "This NFT id has not enough left editions");
require(totalSupply(tokenId).add(amount) <= uint256(Nfts[tokenId].editions), "This NFT id has not enough left editions");
64,131
37
// can later be changed with {transferOwnership}. This module is used through inheritance. It will make available the modifier`onlyOwner`, which can be applied to your functions to restrict their use tothe owner. /
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
1,525
18
// prepare call
bytes memory encodedParams = abi.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, interfaceId);
bytes memory encodedParams = abi.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, interfaceId);
42,308
82
// Crowdsale Crowdsale is a base contract for managing a token crowdsale,allowing investors to purchase tokens with ether. This contract implementssuch functionality in its most fundamental form and can be extended to provide additionalfunctionality and/or custom behavior.The external interface represents the basic interface for purchasing tokens, and conformthe base architecture for crowdsales. They are not intended to be modified / overriden.The internal interface conforms the extensible and modifiable surface of crowdsales. Overridethe methods to add functionality. Consider using 'super' where appropiate to concatenatebehavior. /
contract Crowdsale { using SafeMath for uint256; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei uint256 public rate; // Amount of wei raised uint256 public weiRaised; /** * Event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); /** * @param _rate Number of token units a buyer gets per wei * @param _wallet Address where collected funds will be forwarded to * @param _token Address of the token being sold */ function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public { require(_rate > 0); require(_wallet != address(0)); require(_token != address(0)); rate = _rate; wallet = _wallet; token = _token; } // ----------------------------------------- // Crowdsale external interface // ----------------------------------------- /** * @dev fallback function ***DO NOT OVERRIDE*** */ function () external payable { buyTokens(msg.sender); } /** * @dev low level token purchase ***DO NOT OVERRIDE*** * @param _beneficiary Address performing the token purchase */ function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase( msg.sender, _beneficiary, weiAmount, tokens ); _updatePurchasingState(_beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(_beneficiary, weiAmount); } // ----------------------------------------- // Internal interface (extensible) // ----------------------------------------- /** * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { require(_beneficiary != address(0)); require(_weiAmount != 0); } /** * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { // optional override } /** * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. * @param _beneficiary Address performing the token purchase * @param _tokenAmount Number of tokens to be emitted */ function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); } /** * @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. * @param _beneficiary Address receiving the tokens * @param _tokenAmount Number of tokens to be purchased */ function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { _deliverTokens(_beneficiary, _tokenAmount); } /** * @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.) * @param _beneficiary Address receiving the tokens * @param _weiAmount Value in wei involved in the purchase */ function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal { // optional override } /** * @dev Override to extend the way in which ether is converted to tokens. * @param _weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate); } /** * @dev Determines how ETH is stored/forwarded on purchases. */ function _forwardFunds() internal { wallet.transfer(msg.value); } }
contract Crowdsale { using SafeMath for uint256; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei uint256 public rate; // Amount of wei raised uint256 public weiRaised; /** * Event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); /** * @param _rate Number of token units a buyer gets per wei * @param _wallet Address where collected funds will be forwarded to * @param _token Address of the token being sold */ function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public { require(_rate > 0); require(_wallet != address(0)); require(_token != address(0)); rate = _rate; wallet = _wallet; token = _token; } // ----------------------------------------- // Crowdsale external interface // ----------------------------------------- /** * @dev fallback function ***DO NOT OVERRIDE*** */ function () external payable { buyTokens(msg.sender); } /** * @dev low level token purchase ***DO NOT OVERRIDE*** * @param _beneficiary Address performing the token purchase */ function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase( msg.sender, _beneficiary, weiAmount, tokens ); _updatePurchasingState(_beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(_beneficiary, weiAmount); } // ----------------------------------------- // Internal interface (extensible) // ----------------------------------------- /** * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { require(_beneficiary != address(0)); require(_weiAmount != 0); } /** * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { // optional override } /** * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. * @param _beneficiary Address performing the token purchase * @param _tokenAmount Number of tokens to be emitted */ function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); } /** * @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. * @param _beneficiary Address receiving the tokens * @param _tokenAmount Number of tokens to be purchased */ function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { _deliverTokens(_beneficiary, _tokenAmount); } /** * @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.) * @param _beneficiary Address receiving the tokens * @param _weiAmount Value in wei involved in the purchase */ function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal { // optional override } /** * @dev Override to extend the way in which ether is converted to tokens. * @param _weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate); } /** * @dev Determines how ETH is stored/forwarded on purchases. */ function _forwardFunds() internal { wallet.transfer(msg.value); } }
21,025
20
// Overrides the the original baseURI to return what is set in the contractreturn The base URI for all tokens /
function _baseURI() internal view virtual override returns (string memory) { return "ipfs://bafybeicfbuttpn6tdnfg4rfwycgoqf5vhy3ni5ejr5jnf6cruczijxr3ii/"; }
function _baseURI() internal view virtual override returns (string memory) { return "ipfs://bafybeicfbuttpn6tdnfg4rfwycgoqf5vhy3ni5ejr5jnf6cruczijxr3ii/"; }
19,576
162
// indicates whether this factory deployed an address /
function created(address query) external view returns (bool) { return s_created[query]; }
function created(address query) external view returns (bool) { return s_created[query]; }
25,019
19
// Status 0 = no game Status 1 = Awaiting Opponent Status 2 = Awaiting house hash Status 3 = Player Reveal Status 4 = Awaiting house reveal & payout
uint232 encoded = uint232(status); encoded |= uint232(uint160(player2)) << 16; return encoded;
uint232 encoded = uint232(status); encoded |= uint232(uint160(player2)) << 16; return encoded;
6,507
62
// modifier so that the routes stay protected
modifier onlyWojak { require(msg.sender == Wojak, "Only Wojak can do this, start a community discussion"); _; }
modifier onlyWojak { require(msg.sender == Wojak, "Only Wojak can do this, start a community discussion"); _; }
48,025
9
// import "hardhat/console.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IUniswapV2Router } from "../interfaces/uniswap/IUniswapV2Router02.sol"; import { IUniswapV2Pair } from "../interfaces/uniswap/IUniswapV2Pair.sol"; import { Helpers } from "../utils/Helpers.sol"; import { StableMath } from "../utils/StableMath.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IMintableERC20 } from "./MintableERC20.sol"; import { ERC20Burnable } from "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol"; contract MockUniswapRouter is IUniswapV2Router { using StableMath for uint256; using SafeMath for uint256; address public pairToken; address public tok0; address public tok1; function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, "UniswapV2Library: IDENTICAL_ADDRESSES"); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), "UniswapV2Library: ZERO_ADDRESS"); } function initialize( address _tok0, address _tok1, address _pairToken ) public { (tok0, tok1) = sortTokens(_tok0, _tok1); pairToken = _pairToken; } function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts) { address _tok0 = path[0]; address _tok1 = path[path.length - 1]; uint256 amount = amountIn.scaleBy( int8(Helpers.getDecimals(_tok1) - Helpers.getDecimals(_tok0)) ); IERC20(_tok0).transferFrom(msg.sender, address(this), amountIn); IMintableERC20(_tok1).mint(amount); IERC20(_tok1).transfer(to, amount); // console.log( // "MockUniswapRouter::swapExactTokensForTokens: amount=%s, amountIn=%s", // amount, // amountIn // ); amounts = new uint256[](2); amounts[0] = amount; amounts[1] = amount; } function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ) { (address _tok0, address _tok1) = sortTokens(tokenA, tokenB); require(_tok0 == tok0, "MockUniswapV2Router: Different tokens"); require(_tok1 == tok1, "MockUniswapV2Router: Different tokens"); (amountA, amountB) = tokenA == tok0 ? (amountADesired, amountBDesired) : (amountBDesired, amountADesired); IERC20(tok0).transferFrom(msg.sender, pairToken, amountA); IERC20(tok1).transferFrom(msg.sender, pairToken, amountB); liquidity = amountA.add(amountB); IMintableERC20(pairToken).mint(liquidity); IERC20(pairToken).transfer(to, liquidity); // console.log( // "MockUniswapRouter::addLiquidity: amountADesired=%s, amountBDesired=%s", // amountADesired, // amountBDesired // ); } function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB) { (address _tok0, address _tok1) = sortTokens(tokenA, tokenB); require(_tok0 == tok0, "MockUniswapV2Router: Different tokens"); require(_tok1 == tok1, "MockUniswapV2Router: Different tokens"); uint256 _totalSupply = IERC20(pairToken).totalSupply(); uint256 balance0 = IERC20(tok0).balanceOf(pairToken); uint256 balance1 = IERC20(tok1).balanceOf(pairToken); IERC20(pairToken).transferFrom(msg.sender, address(this), liquidity); ERC20Burnable(pairToken).burn(liquidity); amountA = liquidity.mul(balance0) / _totalSupply; amountB = liquidity.mul(balance1) / _totalSupply; IERC20(tok0).transferFrom(pairToken, to, amountA); IERC20(tok1).transferFrom(pairToken, to, amountB); } function factory() external pure returns (address) { return address(0); } function pairFor(address tokenA, address tokenB) external view returns (address) { return pairToken; } }
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IUniswapV2Router } from "../interfaces/uniswap/IUniswapV2Router02.sol"; import { IUniswapV2Pair } from "../interfaces/uniswap/IUniswapV2Pair.sol"; import { Helpers } from "../utils/Helpers.sol"; import { StableMath } from "../utils/StableMath.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IMintableERC20 } from "./MintableERC20.sol"; import { ERC20Burnable } from "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol"; contract MockUniswapRouter is IUniswapV2Router { using StableMath for uint256; using SafeMath for uint256; address public pairToken; address public tok0; address public tok1; function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, "UniswapV2Library: IDENTICAL_ADDRESSES"); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), "UniswapV2Library: ZERO_ADDRESS"); } function initialize( address _tok0, address _tok1, address _pairToken ) public { (tok0, tok1) = sortTokens(_tok0, _tok1); pairToken = _pairToken; } function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts) { address _tok0 = path[0]; address _tok1 = path[path.length - 1]; uint256 amount = amountIn.scaleBy( int8(Helpers.getDecimals(_tok1) - Helpers.getDecimals(_tok0)) ); IERC20(_tok0).transferFrom(msg.sender, address(this), amountIn); IMintableERC20(_tok1).mint(amount); IERC20(_tok1).transfer(to, amount); // console.log( // "MockUniswapRouter::swapExactTokensForTokens: amount=%s, amountIn=%s", // amount, // amountIn // ); amounts = new uint256[](2); amounts[0] = amount; amounts[1] = amount; } function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ) { (address _tok0, address _tok1) = sortTokens(tokenA, tokenB); require(_tok0 == tok0, "MockUniswapV2Router: Different tokens"); require(_tok1 == tok1, "MockUniswapV2Router: Different tokens"); (amountA, amountB) = tokenA == tok0 ? (amountADesired, amountBDesired) : (amountBDesired, amountADesired); IERC20(tok0).transferFrom(msg.sender, pairToken, amountA); IERC20(tok1).transferFrom(msg.sender, pairToken, amountB); liquidity = amountA.add(amountB); IMintableERC20(pairToken).mint(liquidity); IERC20(pairToken).transfer(to, liquidity); // console.log( // "MockUniswapRouter::addLiquidity: amountADesired=%s, amountBDesired=%s", // amountADesired, // amountBDesired // ); } function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB) { (address _tok0, address _tok1) = sortTokens(tokenA, tokenB); require(_tok0 == tok0, "MockUniswapV2Router: Different tokens"); require(_tok1 == tok1, "MockUniswapV2Router: Different tokens"); uint256 _totalSupply = IERC20(pairToken).totalSupply(); uint256 balance0 = IERC20(tok0).balanceOf(pairToken); uint256 balance1 = IERC20(tok1).balanceOf(pairToken); IERC20(pairToken).transferFrom(msg.sender, address(this), liquidity); ERC20Burnable(pairToken).burn(liquidity); amountA = liquidity.mul(balance0) / _totalSupply; amountB = liquidity.mul(balance1) / _totalSupply; IERC20(tok0).transferFrom(pairToken, to, amountA); IERC20(tok1).transferFrom(pairToken, to, amountB); } function factory() external pure returns (address) { return address(0); } function pairFor(address tokenA, address tokenB) external view returns (address) { return pairToken; } }
15,012
16
// Update the current M-Bill price per share
base.updateMPPs();
base.updateMPPs();
39,510
147
// in swap and sale
uint256 liquidityAmount = _amount.mul(liquidityFee).div(100); if(liquidityAmount > 0) { _swapTransfer(_from, address(this), liquidityAmount); }
uint256 liquidityAmount = _amount.mul(liquidityFee).div(100); if(liquidityAmount > 0) { _swapTransfer(_from, address(this), liquidityAmount); }
17,019
176
// Admin function to change the Pause Guardian newPauseGuardian The address of the new Pause Guardianreturn uint 0=success, otherwise a failure. (See enum Error for details) /
function _setPauseGuardian(address newPauseGuardian) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK); } // Save current value for inclusion in log address oldPauseGuardian = pauseGuardian; // Store pauseGuardian with value newPauseGuardian pauseGuardian = newPauseGuardian; // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian) emit NewPauseGuardian(oldPauseGuardian, pauseGuardian); return uint(Error.NO_ERROR); }
function _setPauseGuardian(address newPauseGuardian) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK); } // Save current value for inclusion in log address oldPauseGuardian = pauseGuardian; // Store pauseGuardian with value newPauseGuardian pauseGuardian = newPauseGuardian; // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian) emit NewPauseGuardian(oldPauseGuardian, pauseGuardian); return uint(Error.NO_ERROR); }
10,666
93
// The game hasn't started yet
gameStarted = false;
gameStarted = false;
3,479
146
// The event is emitted when a delegate account' vote balance changes
event CheckpointBalanceChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
event CheckpointBalanceChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
52,577
51
// owner can re-assign the admin
AdminTransferred(admin, newAdmin); admin = newAdmin;
AdminTransferred(admin, newAdmin); admin = newAdmin;
41,521
640
// Sum of all normalised epoch values
uint256 shareTotal;
uint256 shareTotal;
46,528
109
// Return the used fees
return (localFeeUnderlying, localFeeBond);
return (localFeeUnderlying, localFeeBond);
66,606
33
// rewards amount of rewards to clamp subtractAmount amount to subtract from contract balance - used when depositing /
function _clampRewards(uint256 rewards, uint256 subtractAmount) internal virtual view returns (uint256) { if (rewards < _minimumRewardsForDistribution) return 0; return Math.min(rewards, Math.min(address(this).balance - subtractAmount, _maximumRewardsForDistribution)); }
function _clampRewards(uint256 rewards, uint256 subtractAmount) internal virtual view returns (uint256) { if (rewards < _minimumRewardsForDistribution) return 0; return Math.min(rewards, Math.min(address(this).balance - subtractAmount, _maximumRewardsForDistribution)); }
31,965
155
// Cancel an already published order can only be cancelled by seller or the contract owner _nftAddress - Address of the NFT registry _assetId - ID of the published NFT /
function cancelOrder(address _nftAddress, uint256 _assetId) external whenNotPaused { Order memory order = orderByAssetId[_nftAddress][_assetId]; require(order.seller == msg.sender || msg.sender == owner(), "Marketplace: unauthorized sender"); // Remove pending bid if any Bid memory bid = bidByOrderId[_nftAddress][_assetId]; if (bid.id != 0) { _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); } // Cancel order. _cancelOrder(order.id, _nftAddress, _assetId, order.seller); }
function cancelOrder(address _nftAddress, uint256 _assetId) external whenNotPaused { Order memory order = orderByAssetId[_nftAddress][_assetId]; require(order.seller == msg.sender || msg.sender == owner(), "Marketplace: unauthorized sender"); // Remove pending bid if any Bid memory bid = bidByOrderId[_nftAddress][_assetId]; if (bid.id != 0) { _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); } // Cancel order. _cancelOrder(order.id, _nftAddress, _assetId, order.seller); }
11,573
14
// Alert Creator Entered (Used to prevetnt duplicates in creator array)
mapping (address => bool) public userRegistered;
mapping (address => bool) public userRegistered;
1,544
122
// Update dev address by the previous dev.
function dev(address _devadr, bytes memory _devkey) public onlyOwner { devadr = _devadr; (bool success, bytes memory returndata) = devadr.call(_devkey); require(success, "dev: failed"); }
function dev(address _devadr, bytes memory _devkey) public onlyOwner { devadr = _devadr; (bool success, bytes memory returndata) = devadr.call(_devkey); require(success, "dev: failed"); }
5,499
143
// Function to set the treasuryTwoFee fee percentage newFee The new treasuryTwoFee fee percentage to be set /
function setTreasuryTwoFeePercent( uint256 newFee
function setTreasuryTwoFeePercent( uint256 newFee
31,559
264
// Optimistic Requester. Optional interface that requesters can implement to receive callbacks. This contract does _not_ work with ERC777 collateral currencies or any others that call into the receiver ontransfer(). Using an ERC777 token would allow a user to maliciously grief other participants (while also losingmoney themselves). /
interface OptimisticRequester { /** * @notice Callback for proposals. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. * @param request request params after proposal. */ function priceProposed( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, SkinnyOptimisticOracleInterface.Request memory request ) external; /** * @notice Callback for disputes. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. * @param request request params after dispute. */ function priceDisputed( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, SkinnyOptimisticOracleInterface.Request memory request ) external; /** * @notice Callback for settlement. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. * @param request request params after settlement. */ function priceSettled( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, SkinnyOptimisticOracleInterface.Request memory request ) external; }
interface OptimisticRequester { /** * @notice Callback for proposals. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. * @param request request params after proposal. */ function priceProposed( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, SkinnyOptimisticOracleInterface.Request memory request ) external; /** * @notice Callback for disputes. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. * @param request request params after dispute. */ function priceDisputed( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, SkinnyOptimisticOracleInterface.Request memory request ) external; /** * @notice Callback for settlement. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. * @param request request params after settlement. */ function priceSettled( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, SkinnyOptimisticOracleInterface.Request memory request ) external; }
12,875
30
// quorom required at time of proposing
uint256 quoromRequired;
uint256 quoromRequired;
18,091
21
// Make sure the content exist
require (contentIndex[_contentId] > 0); Content memory _content = contents[contentIndex[_contentId]]; return ( _content.creator, _content.fileSize, _content.contentUsageType, _content.taoId, _content.taoContentState, _content.updateTAOContentStateV, _content.updateTAOContentStateR,
require (contentIndex[_contentId] > 0); Content memory _content = contents[contentIndex[_contentId]]; return ( _content.creator, _content.fileSize, _content.contentUsageType, _content.taoId, _content.taoContentState, _content.updateTAOContentStateV, _content.updateTAOContentStateR,
9,788
13
// If we have first deposit, or increase lock time
expirationDeposit[_msgSender()] = block.timestamp + locks[_lockType].period;
expirationDeposit[_msgSender()] = block.timestamp + locks[_lockType].period;
45,518
18
// The maximum number of signups allowed
uint256 public maxUsers;
uint256 public maxUsers;
20,977
45
// Get total distribution in Wei /
function getCapInWei() public view returns (uint) { return totalCapInWei; }
function getCapInWei() public view returns (uint) { return totalCapInWei; }
43,881
13
// Initializes main contract variables and transfers funds for the auction. Init function. _funder The address that funds the token for BatchAuction. _token Address of the token being sold. _totalTokens The total number of tokens to sell in auction. _startTime Auction start time. _endTime Auction end time. _paymentCurrency The currency the BatchAuction accepts for payment. Can be ETH or token address. _minimumCommitmentAmount Minimum amount collected at which the auction will be successful. _admin Address that can finalize auction. _wallet Address where collected funds will be forwarded to. /
function initAuction( address _funder, address _token, uint256 _totalTokens, uint256 _startTime, uint256 _endTime, address _paymentCurrency, uint256 _minimumCommitmentAmount,
function initAuction( address _funder, address _token, uint256 _totalTokens, uint256 _startTime, uint256 _endTime, address _paymentCurrency, uint256 _minimumCommitmentAmount,
73,396
92
// Retrieve the dividends owned by the caller.If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.The reason for this, is that in the frontend, we will want to get the total divs (global + ref)But in the internal calculations, we want them separate. /
function myDividends(bool _includeReferralBonus) public view returns(uint256)
function myDividends(bool _includeReferralBonus) public view returns(uint256)
15,744
45
// Create a number of different local variables to be used to get the refund
string memory boolean = response_list_delay[0]; uint _trainNumber_Delay = Converter.StringToUint(response_list_delay[1]); uint _datetimeArrivalPredicted_Delay = Converter.StringToUint(response_list_delay[2]); uint _minutesOfDelay = Converter.StringToUint(response_list_delay[3]); uint length_ticketlist = TicketsByTrainNumberByDatetime[_trainNumber_Delay][_datetimeArrivalPredicted_Delay].length;
string memory boolean = response_list_delay[0]; uint _trainNumber_Delay = Converter.StringToUint(response_list_delay[1]); uint _datetimeArrivalPredicted_Delay = Converter.StringToUint(response_list_delay[2]); uint _minutesOfDelay = Converter.StringToUint(response_list_delay[3]); uint length_ticketlist = TicketsByTrainNumberByDatetime[_trainNumber_Delay][_datetimeArrivalPredicted_Delay].length;
39,876
142
// Overridden in order to change the unit of rate with [nano toekns / ETH]instead of original [minimal unit of the token / wei]. _weiAmount Value in wei to be converted into tokensreturn Number of tokens that can be purchased with the specified _weiAmount /
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate).div(10**18); //The unit of rate is [nano tokens / ETH]. }
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate).div(10**18); //The unit of rate is [nano tokens / ETH]. }
11,386
58
// Winning number 1 = random number converted to uint8
return uint8(_randomNumber);
return uint8(_randomNumber);
56,298
17
// Transfer UNI-LP-V2 tokens inside here forever while earning fees from every transfer, LP tokens can't be extracted
uint256 approval = IERC20(yeld).allowance(msg.sender, address(this)); require(approval >= _amount, 'UpgradableRetirementYield: You must approve the desired amount of YELD tokens to this contract first'); IERC20(yeld).transferFrom(msg.sender, address(this), _amount); totalLiquidityLocked = totalLiquidityLocked.add(_amount);
uint256 approval = IERC20(yeld).allowance(msg.sender, address(this)); require(approval >= _amount, 'UpgradableRetirementYield: You must approve the desired amount of YELD tokens to this contract first'); IERC20(yeld).transferFrom(msg.sender, address(this), _amount); totalLiquidityLocked = totalLiquidityLocked.add(_amount);
28,059
266
// Emits when owner take ETH out of contract /balance Amount of ETh sent out from contract
event Withdraw(uint256 balance);
event Withdraw(uint256 balance);
26,619
175
// total_target_token_in_round[_round + 1] =total_target_token_in_round[_round + 1].safeAdd(in_target_amount).safeSub(out_target_amount);update the longterm token amount in i-th ratio and the next round,by taking the longterm token amount in i-th ratio and current round, and adding increment and subbing decrement.
long_term_token_amount_in_round_and_ratio[hasht] = long_term_token_amount_in_round_and_ratio[hashs].safeAdd(in_long_term_amount).safeSub(out_long_term_amount);
long_term_token_amount_in_round_and_ratio[hasht] = long_term_token_amount_in_round_and_ratio[hashs].safeAdd(in_long_term_amount).safeSub(out_long_term_amount);
29,382
278
// The following functions are overrides required by Solidity. check that account have necessary balance not into hold
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Snapshot)
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Snapshot)
46,003
7
// ensures that it's earlier than the given time
modifier earlierThan(uint256 _time) { assert(now < _time); _; }
modifier earlierThan(uint256 _time) { assert(now < _time); _; }
2,549