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
56
// Returns an `Bytes32Slot` with member `value` located at `slot`. /
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } }
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } }
93
17
// returns the length of retirees list /
function getRetiredCount() external view returns (uint256);
function getRetiredCount() external view returns (uint256);
13,499
332
// if (compareStrings(cToken.symbol(), "cETH")) { return 1e18; } else { return prices[address(CErc20(address(cToken)).underlying())]; }
address _aggregator = aggregator[address(CErc20(address(cToken)).underlying())]; return uint(AccessControlledAggregator(_aggregator).latestAnswer());
address _aggregator = aggregator[address(CErc20(address(cToken)).underlying())]; return uint(AccessControlledAggregator(_aggregator).latestAnswer());
41,718
276
// Fail gracefully if protocol has insufficient underlying cash
if (getCashPrior() < reduceAmount) { return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE); }
if (getCashPrior() < reduceAmount) { return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE); }
13,668
23
// Standard ERC20 token Based on code by FirstBlood: /
contract StandardToken is BasicToken, ERC20 { mapping(address => mapping(address => uint256)) private allowed; function transferFrom( address _from, address _to, uint256 _value ) public override returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; // Ch...
contract StandardToken is BasicToken, ERC20 { mapping(address => mapping(address => uint256)) private allowed; function transferFrom( address _from, address _to, uint256 _value ) public override returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; // Ch...
23,941
3
// Whether or not new Noun parts can be added
bool public override arePartsLocked;
bool public override arePartsLocked;
36,115
37
// Gauge whether message sender is operator or not/ return true if msg.sender is operator, else false
function isOperator() internal view returns (bool)
function isOperator() internal view returns (bool)
39,965
70
// delete the rest of the data in the record
delete self.proposal_[_whatProposal];
delete self.proposal_[_whatProposal];
242
215
// MANAGER ONLY. Adds a module into a PENDING state; Module must later be initialized via module's initialize function /
function addModule(address _module) external onlyManager { require(moduleStates[_module] == ISetToken.ModuleState.NONE, "Module must not be added"); require(controller.isModule(_module), "Must be enabled on Controller"); moduleStates[_module] = ISetToken.ModuleState.PENDING; emit M...
function addModule(address _module) external onlyManager { require(moduleStates[_module] == ISetToken.ModuleState.NONE, "Module must not be added"); require(controller.isModule(_module), "Must be enabled on Controller"); moduleStates[_module] = ISetToken.ModuleState.PENDING; emit M...
25,902
303
// Calculate the combined boost
uint256 liquidity = thisStake.liquidity; uint256 combined_boosted_amount = liquidity + ((liquidity * (midpoint_lock_multiplier + midpoint_vefxs_multiplier)) / MULTIPLIER_PRECISION); new_combined_weight += combined_boosted_amount;
uint256 liquidity = thisStake.liquidity; uint256 combined_boosted_amount = liquidity + ((liquidity * (midpoint_lock_multiplier + midpoint_vefxs_multiplier)) / MULTIPLIER_PRECISION); new_combined_weight += combined_boosted_amount;
17,892
115
// Claims pixels and requires to have the sender enough unlocked tokens. Has a modifier to take some of the "stack burden" from the proxy function.
function claimShortParams(Rect _rect) enoughTokens(_rect.width, _rect.height) internal returns (uint id)
function claimShortParams(Rect _rect) enoughTokens(_rect.width, _rect.height) internal returns (uint id)
26,424
9
// 10. send this contract's remaining ETH to the attacker
payable(attacker).sendValue(address(this).balance);
payable(attacker).sendValue(address(this).balance);
26,192
4
// turn on/off public mint /
function flipMintStatePublic() external onlyOwner { mintIsActivePublic = !mintIsActivePublic; }
function flipMintStatePublic() external onlyOwner { mintIsActivePublic = !mintIsActivePublic; }
12,342
2
// Returns the latest price return latest price /
function getLatestPrice() internal view returns (uint256) { AggregatorV3Interface priceFeed = getPriceFeed(); (, int256 price, , , ) = priceFeed.latestRoundData(); uint256 newPrice = uint256(price); return newPrice; // $1500 }
function getLatestPrice() internal view returns (uint256) { AggregatorV3Interface priceFeed = getPriceFeed(); (, int256 price, , , ) = priceFeed.latestRoundData(); uint256 newPrice = uint256(price); return newPrice; // $1500 }
35,746
28
// this locks in the pass into the staking contract for X amount of time, this will give access to the application until the lock up period is over
function lockIn(uint256 tokenId, uint256 period) public isLockupAvailable isNotContract { LockedUp storage _lockedup = lockedup[msg.sender]; require(!_lockedup.hasToken, "You need to withdraw your current token first"); require(period > 0 && period <= 3, "You can only lock in your token for...
function lockIn(uint256 tokenId, uint256 period) public isLockupAvailable isNotContract { LockedUp storage _lockedup = lockedup[msg.sender]; require(!_lockedup.hasToken, "You need to withdraw your current token first"); require(period > 0 && period <= 3, "You can only lock in your token for...
29,969
8
// Retrieve output token addresses
function getOutputTokens() external view returns (address[] memory) { return outputTokens; }
function getOutputTokens() external view returns (address[] memory) { return outputTokens; }
35,895
109
// fprintf(stdout, "INFO: PQCLEAN_FALCON512_CLEAN_to_ntt_monty() ENTRY\n");
mq_NTT(h, logn); mq_poly_tomonty(h, logn);
mq_NTT(h, logn); mq_poly_tomonty(h, logn);
14,292
153
// Get the total supply of a campaign _id Campaign to get the supply of /
function totalSupply(uint256 _id) external view returns (uint256) { return tokenSupply[_id]; }
function totalSupply(uint256 _id) external view returns (uint256) { return tokenSupply[_id]; }
32,957
75
// enable trading once enabled, it can't be disabled /
function enableTrading () external onlyOwner { require (!isTradingEnabled, "trading is already live"); isTradingEnabled = true; }
function enableTrading () external onlyOwner { require (!isTradingEnabled, "trading is already live"); isTradingEnabled = true; }
42,945
180
// escrow finalization task, called when owner calls finalize() /
function finalization() internal { if (goalReached()) { escrow.close(); escrow.beneficiaryWithdraw(); } else { escrow.enableRefunds(); } super.finalization(); }
function finalization() internal { if (goalReached()) { escrow.close(); escrow.beneficiaryWithdraw(); } else { escrow.enableRefunds(); } super.finalization(); }
3,366
4
// Allows to upgrade the contract. This can only be done via a Safe transaction./_masterCopy New contract address.
function changeMasterCopy(address _masterCopy) public authorized
function changeMasterCopy(address _masterCopy) public authorized
16,412
30
// Returns the symbol of the token, usually a shorter version of thename. /
function symbol() public view virtual returns (string memory) { return _symbol; }
function symbol() public view virtual returns (string memory) { return _symbol; }
1,016
39
// {ERC20-approve}, and its usage is discouraged. /
function safeApprove( IERC20 token, address spender, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); }
function safeApprove( IERC20 token, address spender, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); }
15,449
67
// Contract that will work with ERC223 tokens./
contract ERC223ReceivingContract { /** * @dev Standard ERC223 function that will handle incoming token transfers. * * @param _from Token sender address. * @param _value Amount of tokens. * @param _data Transaction metadata. */ function tokenFallback(address _from, uint _value, bytes _data)...
contract ERC223ReceivingContract { /** * @dev Standard ERC223 function that will handle incoming token transfers. * * @param _from Token sender address. * @param _value Amount of tokens. * @param _data Transaction metadata. */ function tokenFallback(address _from, uint _value, bytes _data)...
79,927
14
// 正如其名, 这个是增发gas用的..
function addSupply(uint256 _value) public returns (bool success) { require(owner == msg.sender); balanceOf[msg.sender] += _value; totalSupply += _value; emit AddSupply(msg.sender, _value); return true; }
function addSupply(uint256 _value) public returns (bool success) { require(owner == msg.sender); balanceOf[msg.sender] += _value; totalSupply += _value; emit AddSupply(msg.sender, _value); return true; }
19,116
183
// assetModify is suToken
if (vars.isSuToken) { vars.sumCollateral = mul_ScalarTruncateAddUInt( vars.suTokenCollateralRate, groupVars[i].cTokenBalanceSum, vars.sumCollateral ); vars.sumCollateral = mul_ScalarTruncateAddUInt( vars.inGroupSuTokenCollateralRate, ...
if (vars.isSuToken) { vars.sumCollateral = mul_ScalarTruncateAddUInt( vars.suTokenCollateralRate, groupVars[i].cTokenBalanceSum, vars.sumCollateral ); vars.sumCollateral = mul_ScalarTruncateAddUInt( vars.inGroupSuTokenCollateralRate, ...
28,517
28
// This is removed for optimization (lower gas consumption for each call) Please see 'setAllSupply' function allBalances+=tokenCount
}
}
17,545
662
// moved to initializer to fit proxy safe requirements
_remixContract = remixContract; //set once, never changes _commitmentId = 1; //set once, can never be set again (contract updates this value) _verifyAttestation = verificationContract; _remixFeePercentage = 0; _dvpContract = dvpContract; _attestorAddress = 0x5380803055609...
_remixContract = remixContract; //set once, never changes _commitmentId = 1; //set once, can never be set again (contract updates this value) _verifyAttestation = verificationContract; _remixFeePercentage = 0; _dvpContract = dvpContract; _attestorAddress = 0x5380803055609...
36,312
9
// Check if the active jackpot is full and finish it if so
if (activeJackpotId != 0 && activeJackpot.participants.length == maxParticipants) { _finishJackpot(activeJackpotId); }
if (activeJackpotId != 0 && activeJackpot.participants.length == maxParticipants) { _finishJackpot(activeJackpotId); }
27,826
1
// Indicates an error related to the current `balance` of a `sender`. Used in transfers. sender Address whose tokens are being transferred. balance Current balance for the interacting account. needed Minimum amount required to perform a transfer. /
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
4,311
110
// Fees are added after scaling happens, to reduce the complexity of the rounding direction analysis. This is amount + fee amount, so we round up (favoring a higher fee amount).
return amountIn.divUp(getSwapFeePercentage().complement());
return amountIn.divUp(getSwapFeePercentage().complement());
52,196
15
// Minting Tokens
function unlockMintingTokens(uint256 _amount) external onlyAdmin { require(_mintingTokensUnlocked <= _mintingTokens); _mintingTokensUnlocked = add(_mintingTokensUnlocked, _amount); _totalsupply = add(_totalsupply, _amount); balances[mintingAdmin] ...
function unlockMintingTokens(uint256 _amount) external onlyAdmin { require(_mintingTokensUnlocked <= _mintingTokens); _mintingTokensUnlocked = add(_mintingTokensUnlocked, _amount); _totalsupply = add(_totalsupply, _amount); balances[mintingAdmin] ...
41,383
3
// Used to send unclaimed IERC20 funds after claim close date to default destination. Can be called only byadmins. /
function sendUnclaimedFunds() public override onlyAdmin { super.sendUnclaimedFunds(); Season memory season = seasons[seasonIndex]; SafeERC20.safeTransfer( IERC20(tokenAddress), season.defaultDestination, season.totalRewards - season.claimedRewards ); }
function sendUnclaimedFunds() public override onlyAdmin { super.sendUnclaimedFunds(); Season memory season = seasons[seasonIndex]; SafeERC20.safeTransfer( IERC20(tokenAddress), season.defaultDestination, season.totalRewards - season.claimedRewards ); }
18,912
173
// IdleAdapter Contract/Enzyme Council <[email protected]>/Adapter for Idle Lending <https:idle.finance/>/There are some idiosyncrasies of reward accrual and claiming in IdleTokens that/ are handled by this adapter:/ - Rewards accrue to the IdleToken holder, but the accrued/ amount is passed to the recipient of a trans...
contract IdleAdapter is AdapterBase2, IdleV4ActionsMixin, UniswapV2ActionsMixin { using AddressArrayLib for address[]; address private immutable IDLE_PRICE_FEED; address private immutable WETH_TOKEN; constructor( address _integrationManager, address _idlePriceFeed, address _we...
contract IdleAdapter is AdapterBase2, IdleV4ActionsMixin, UniswapV2ActionsMixin { using AddressArrayLib for address[]; address private immutable IDLE_PRICE_FEED; address private immutable WETH_TOKEN; constructor( address _integrationManager, address _idlePriceFeed, address _we...
60,838
23
// This loses control of execution, yet no variables are set yet This means no interim state will be represented if asked Combined with the re-entrancy guard, this is secure
universalSingularTransferFrom(listing.currency, amount);
universalSingularTransferFrom(listing.currency, amount);
48,320
128
// ERC20 modified transfer that also update the delegatesrecipient : recipient account amount : value to transferreturn : flag whether transfer was successful or not /
function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(msg.sender, recipient, amount); _moveDelegates(delegates[msg.sender], delegates[recipient], amount); return true; }
function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(msg.sender, recipient, amount); _moveDelegates(delegates[msg.sender], delegates[recipient], amount); return true; }
55,250
56
// If no period is desired, instead set startBonus = 100% and bonusPeriod to a small value like 1sec.
require(bonusPeriodSec_ != 0, 'TokenGeyser: bonus period is zero'); require(initialSharesPerToken > 0, 'TokenGeyser: initialSharesPerToken is zero'); _stakingPool = new TokenPool(stakingToken); _unlockedPool = new TokenPool(distributionToken); _lockedPool = new TokenPool(distrib...
require(bonusPeriodSec_ != 0, 'TokenGeyser: bonus period is zero'); require(initialSharesPerToken > 0, 'TokenGeyser: initialSharesPerToken is zero'); _stakingPool = new TokenPool(stakingToken); _unlockedPool = new TokenPool(distributionToken); _lockedPool = new TokenPool(distrib...
23,560
154
// name Name of the token symbol A symbol to be used as ticker /
constructor (string memory name, string memory symbol) ERC20(name, symbol) { // register the supported interfaces to conform to ERC1363 via ERC165 _registerInterface(_INTERFACE_ID_ERC1363_TRANSFER); _registerInterface(_INTERFACE_ID_ERC1363_APPROVE); }
constructor (string memory name, string memory symbol) ERC20(name, symbol) { // register the supported interfaces to conform to ERC1363 via ERC165 _registerInterface(_INTERFACE_ID_ERC1363_TRANSFER); _registerInterface(_INTERFACE_ID_ERC1363_APPROVE); }
2,163
35
// Returns the addition of two signed integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. /
function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; }
function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; }
14,371
108
// @Dev use better naming conventions next time (actually just updates internal accting)
function depositToIdle(address depositor, uint256 amount, uint256 shares) internal { require(amount != 0, "no tokens to deposit"); totalDeposits += int(amount); uint256 mintedTokens = amount; // Update internal accounting members[depositor].iTB += amount; mem...
function depositToIdle(address depositor, uint256 amount, uint256 shares) internal { require(amount != 0, "no tokens to deposit"); totalDeposits += int(amount); uint256 mintedTokens = amount; // Update internal accounting members[depositor].iTB += amount; mem...
1,529
70
// added this
function setBot(address blist) external onlyOwner returns (bool){ bot[blist] = !bot[blist]; return bot[blist]; }
function setBot(address blist) external onlyOwner returns (bool){ bot[blist] = !bot[blist]; return bot[blist]; }
12,109
22
// Testing refuseSale() function
function testOnlyInvestorCanRefusePurchase() public { protocol.buyAsset.value(1050 finney)(assets[0]); protocol.buyAsset.value(1050 finney)(assets[1]); protocol.buyAsset.value(1050 finney)(assets[2]); address(throwableProtocol).call(abi.encodeWithSignature("refuseSale(address[])", as...
function testOnlyInvestorCanRefusePurchase() public { protocol.buyAsset.value(1050 finney)(assets[0]); protocol.buyAsset.value(1050 finney)(assets[1]); protocol.buyAsset.value(1050 finney)(assets[2]); address(throwableProtocol).call(abi.encodeWithSignature("refuseSale(address[])", as...
3,414
4
// return {bytes} payload for a `createdBlock` call to an external contract or proxy/
function createdBlock( )public pure override returns( bytes memory ){ return abiEncoderEIP801.SIG_CREATED_BLOCK; }
function createdBlock( )public pure override returns( bytes memory ){ return abiEncoderEIP801.SIG_CREATED_BLOCK; }
42,119
285
// if the user is redirecting his interest towards someone else,we update the redirected balance of the redirection address by adding the accrued interestand the amount deposited
updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease.add(_amount), 0);
updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease.add(_amount), 0);
15,205
68
// check the dnsName (byte format) for validity/
function isAValidDNSNameString(string _dnsName) public view returns (bool _isValid) { //get bytes32 representation of the _dnsName bytes32 dnsNameLookupValue = toBytes32(_dnsName); return isAValidDNSName(dnsNameLookupValue); }
function isAValidDNSNameString(string _dnsName) public view returns (bool _isValid) { //get bytes32 representation of the _dnsName bytes32 dnsNameLookupValue = toBytes32(_dnsName); return isAValidDNSName(dnsNameLookupValue); }
53,572
29
// Size must be 20 / 40 / 60 pixels
require(_size == 1 || _size == 2 || _size == 3); require(maxBridgeHeight >= (_y + _size) && maxBridgeWidth >= (_x + _size)); require(msg.value >= calculateCost(_size, _skin));
require(_size == 1 || _size == 2 || _size == 3); require(maxBridgeHeight >= (_y + _size) && maxBridgeWidth >= (_x + _size)); require(msg.value >= calculateCost(_size, _skin));
37,698
3
// Transfers vested tokens to beneficiary. /
function release() external { uint256 vested = vestedAmount(); require(vested > 0, "Cliff: No tokens to release"); released = released.add(vested); token.safeTransfer(beneficiary, vested); emit Released(vested); }
function release() external { uint256 vested = vestedAmount(); require(vested > 0, "Cliff: No tokens to release"); released = released.add(vested); token.safeTransfer(beneficiary, vested); emit Released(vested); }
17,124
126
// View function to see pending reward on frontend. _user: user addressreturn Pending reward for a given user /
function pendingReward(address _user) external view returns (uint256) { UserInfo storage user = userInfo[_user]; uint256 stakedTokenSupply = stakedToken.balanceOf(address(this)); if (block.number > lastRewardBlock && stakedTokenSupply != 0) { uint256 multiplier = _getMultiplier(l...
function pendingReward(address _user) external view returns (uint256) { UserInfo storage user = userInfo[_user]; uint256 stakedTokenSupply = stakedToken.balanceOf(address(this)); if (block.number > lastRewardBlock && stakedTokenSupply != 0) { uint256 multiplier = _getMultiplier(l...
17,314
350
// If there is no debt to repay we can withdraw all the locked collateral
if (totalDebt == 0) { return totalCollateral; }
if (totalDebt == 0) { return totalCollateral; }
69,475
40
// Addresses allowed to create tokens /
mapping (address => bool) public isMintingManager;
mapping (address => bool) public isMintingManager;
50,761
47
// refund user
address(uint160(member.userAddress)).transfer( member.amtContributed );
address(uint160(member.userAddress)).transfer( member.amtContributed );
23,407
1
// Net Asset Value, can't store as float
uint256 totalValue; uint256 totalUnit;
uint256 totalValue; uint256 totalUnit;
25,876
35
// contract addresses
address public adapterDeployer; address public assessor; address public poolAdmin; address public seniorTranche; address public juniorTranche; address public seniorOperator; address public juniorOperator; ...
address public adapterDeployer; address public assessor; address public poolAdmin; address public seniorTranche; address public juniorTranche; address public seniorOperator; address public juniorOperator; ...
42,919
9
// Convert an hexadecimal string to raw bytes
function fromHex(string memory s) public pure returns (bytes memory) { bytes memory ss = bytes(s); require(ss.length%2 == 0); // length must be even bytes memory r = new bytes(ss.length/2); for (uint i=0; i<ss.length/2; ++i) { r[i] = bytes1(fromHexChar(uint8(ss[2*i])) * 1...
function fromHex(string memory s) public pure returns (bytes memory) { bytes memory ss = bytes(s); require(ss.length%2 == 0); // length must be even bytes memory r = new bytes(ss.length/2); for (uint i=0; i<ss.length/2; ++i) { r[i] = bytes1(fromHexChar(uint8(ss[2*i])) * 1...
18,356
126
// pool does not exist
return 0;
return 0;
38,538
102
// --- Core Auction Logic ---/ Start a new collateral auction forgoneCollateralReceiver Who receives leftover collateral that is not auctioned auctionIncomeRecipient Who receives the amount raised in the auction amountToRaise Total amount of coins to raise (rad) amountToSell Total amount of collateral available to sell...
function startAuction( address forgoneCollateralReceiver, address auctionIncomeRecipient, uint256 amountToRaise, uint256 amountToSell, uint256 initialBid
function startAuction( address forgoneCollateralReceiver, address auctionIncomeRecipient, uint256 amountToRaise, uint256 amountToSell, uint256 initialBid
22,029
255
// Calldata version of {verify} _Available since v4.7._ /
function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; }
function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; }
47,962
6
// Borrower creates a loan proposal. /
function create(uint256 _itemId, uint256 _loanAmount, uint256 _feeAmount, uint256 _minutesDuration) public { require(_loanAmount >= 1 * (10**18), "CoralLoan: Minimum loan amount is 1 REEF."); require(_feeAmount >= 1 * (10**18), "CoralLoan: Minimum fee amount is 1 REEF."); require(_minutesDuration > 0 && _minutes...
function create(uint256 _itemId, uint256 _loanAmount, uint256 _feeAmount, uint256 _minutesDuration) public { require(_loanAmount >= 1 * (10**18), "CoralLoan: Minimum loan amount is 1 REEF."); require(_feeAmount >= 1 * (10**18), "CoralLoan: Minimum fee amount is 1 REEF."); require(_minutesDuration > 0 && _minutes...
41,114
62
// buy
newAmount = _takeFee(from, to, amount, true);
newAmount = _takeFee(from, to, amount, true);
38,857
93
// exclude from the Max wallet balance
_isExcludedFromMaxWallet[owner()] = true; _isExcludedFromMaxWallet[address(this)] = true; _isExcludedFromMaxWallet[_burnAddress] = true; _isExcludedFromMaxWallet[_devAddress] = true;
_isExcludedFromMaxWallet[owner()] = true; _isExcludedFromMaxWallet[address(this)] = true; _isExcludedFromMaxWallet[_burnAddress] = true; _isExcludedFromMaxWallet[_devAddress] = true;
37,816
0
// Simplified contract of a `../Swapper.sol` /
contract SwapperLike { function fromDaiToBTU(address, uint256) external; }
contract SwapperLike { function fromDaiToBTU(address, uint256) external; }
20,509
6
// do bookkeeping
accruedRewards[msg.sender] = accruedRewards[msg.sender] + stakeAmounts[msg.sender]*(block.timestamp - stakeTimes[msg.sender]); ISTAKING(staking).unstakeFor(msg.sender, amount, msg.sender); stakeAmounts[msg.sender] = stakeAmounts[msg.sender] - amount; stakeTimes[msg.sender] = block.timest...
accruedRewards[msg.sender] = accruedRewards[msg.sender] + stakeAmounts[msg.sender]*(block.timestamp - stakeTimes[msg.sender]); ISTAKING(staking).unstakeFor(msg.sender, amount, msg.sender); stakeAmounts[msg.sender] = stakeAmounts[msg.sender] - amount; stakeTimes[msg.sender] = block.timest...
50,318
116
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public onlyMembers(msg.sender)
function allowance(address tokenOwner, address spender) public onlyMembers(msg.sender)
15,220
3
// Internal Functions // /
function _processResponse( TellerCommon.InterestRequest memory request, TellerCommon.InterestResponse memory response, bytes32 requestHash
function _processResponse( TellerCommon.InterestRequest memory request, TellerCommon.InterestResponse memory response, bytes32 requestHash
8,834
142
// Set initial PLOT/ETH pair cummulative price /
function setInitialCummulativePrice() public { require(msg.sender == initiater); require(plotETHpair == address(0),"Already initialised"); plotETHpair = uniswapFactory.getPair(plotToken, weth); UniswapPriceData storage _priceData = uniswapPairData[plotETHpair]; ( uint256 pric...
function setInitialCummulativePrice() public { require(msg.sender == initiater); require(plotETHpair == address(0),"Already initialised"); plotETHpair = uniswapFactory.getPair(plotToken, weth); UniswapPriceData storage _priceData = uniswapPairData[plotETHpair]; ( uint256 pric...
26,807
46
// 15% for founders
uint256 constant FOUNDERS_AMOUNT = 15 * onePercent;
uint256 constant FOUNDERS_AMOUNT = 15 * onePercent;
8,568
10
// Estimate reinvest rewardreturn reward tokens /
function estimateReinvestReward() external view returns (uint256) { uint256 unclaimedRewards = checkReward(); if (unclaimedRewards >= MIN_TOKENS_TO_REINVEST) { return unclaimedRewards.mul(REINVEST_REWARD_BIPS).div(BIPS_DIVISOR); } return 0; }
function estimateReinvestReward() external view returns (uint256) { uint256 unclaimedRewards = checkReward(); if (unclaimedRewards >= MIN_TOKENS_TO_REINVEST) { return unclaimedRewards.mul(REINVEST_REWARD_BIPS).div(BIPS_DIVISOR); } return 0; }
2,388
11
// Ownership of a position was transferred to a new address /
event PositionTransferred(
event PositionTransferred(
39,071
11
// Attempt to cancel an authorization Works only if the authorization is not yet used. authorizerAuthorizer's address nonce Nonce of the authorization v v of the signature r r of the signature s s of the signature /
function cancelAuthorization( address authorizer, bytes32 nonce, uint8 v, bytes32 r, bytes32 s
function cancelAuthorization( address authorizer, bytes32 nonce, uint8 v, bytes32 r, bytes32 s
24,485
5
// ERC20Basic Simpler version of ERC20 interface /
contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); }
contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); }
74,260
329
// Put all ERC20 tokens into the first Particlon to save a lot of gas
_chargeParticlon(newTokenId, "generic", assetAmount);
_chargeParticlon(newTokenId, "generic", assetAmount);
16,463
38
// Function to mint tokens_to The address that will recieve the minted tokens._amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint(address _to, uint256 _amount) whenNotPaused onlyOwner returns (bool) { return mintInternal(_to, _amount); }
function mint(address _to, uint256 _amount) whenNotPaused onlyOwner returns (bool) { return mintInternal(_to, _amount); }
22,903
62
// Returns the threshold before swap and liquify. /
function minTokensBeforeSwap() external view virtual returns (uint256) { return _minTokensBeforeSwap; }
function minTokensBeforeSwap() external view virtual returns (uint256) { return _minTokensBeforeSwap; }
21,667
71
// husd3crv->husd
token.safeApprove(curve, 0); token.safeApprove(curve, uint(-1));
token.safeApprove(curve, 0); token.safeApprove(curve, uint(-1));
7,494
54
// Deprecated, use {_burn} instead.owner owner of the token to burntokenId uint256 ID of the token being burned/
function _burn(address owner, uint256 tokenId) internal { require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); ...
function _burn(address owner, uint256 tokenId) internal { require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); ...
39,070
87
// //Migrate AAVE `aToken` underlying `amount` into COMP/CREAM `cToken` for benefit of `to` by batching calls to `aave` and `cToken`.
function aaveToCompound(address aToken, address cToken, address to, uint256 amount) external { IERC20(aToken).safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` `aToken` `amount` into this contract address underlying = IAaveBridge(aToken).UNDERLYING_ASSET_ADDRESS(); // sani...
function aaveToCompound(address aToken, address cToken, address to, uint256 amount) external { IERC20(aToken).safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` `aToken` `amount` into this contract address underlying = IAaveBridge(aToken).UNDERLYING_ASSET_ADDRESS(); // sani...
38,763
24
// total_withdraw is how much the participant has withdrawn during the lifetime of the channel. The actual amount which the participant withdrew is `total_withdraw - total_withdraw_from_previous_event_or_zero`
event ChannelWithdraw( uint256 indexed channel_identifier, address indexed participant, uint256 total_withdraw ); event ChannelClosed( uint256 indexed channel_identifier, address indexed closing_participant, uint256 indexed nonce
event ChannelWithdraw( uint256 indexed channel_identifier, address indexed participant, uint256 total_withdraw ); event ChannelClosed( uint256 indexed channel_identifier, address indexed closing_participant, uint256 indexed nonce
16,871
78
// Called by Armor for now--we confirm a hack happened and give a timestamp for what time it was. _protocol The address of the protocol that has been hacked (address that would be on yNFT). _hackTime The timestamp of the time the hack occurred./
{ require(_hackTime < now, "Cannot confirm future"); bytes32 hackId = keccak256(abi.encodePacked(_protocol, _hackTime)); confirmedHacks[hackId] = true; emit ConfirmedHack(hackId, _protocol, _hackTime); }
{ require(_hackTime < now, "Cannot confirm future"); bytes32 hackId = keccak256(abi.encodePacked(_protocol, _hackTime)); confirmedHacks[hackId] = true; emit ConfirmedHack(hackId, _protocol, _hackTime); }
64,569
2
// bridge router contract
BridgeRouter public immutable bridge;
BridgeRouter public immutable bridge;
7,087
11
// - both parties can {lock} for `resolver`. /receiver The account that receives funds./resolver The account that unlock funds./token The asset used for funds./value The amount of funds - if `nft`, the 'tokenId' in first value is used./termination Unix time upon which `depositor` can claim back funds./nft If 'false', E...
function deposit( address receiver, address resolver, address token, uint256 value, uint256 termination, bool nft, string memory details ) public payable returns (uint256 registration) { require(resolvers[resolver].active, "resolver not active"...
function deposit( address receiver, address resolver, address token, uint256 value, uint256 termination, bool nft, string memory details ) public payable returns (uint256 registration) { require(resolvers[resolver].active, "resolver not active"...
16,317
20
// Time to mint some tokens
_mintPoolToken(balance1, 0, _reservePair1, anchorPoolToken, _to, true); _mintPoolToken(balance0, 0, _reservePair0, floatPoolToken, _to, false);
_mintPoolToken(balance1, 0, _reservePair1, anchorPoolToken, _to, true); _mintPoolToken(balance0, 0, _reservePair0, floatPoolToken, _to, false);
44,317
34
// _amount is the amount of EC20 token sent with the transaction. should be > 0
if (_amount == 0 || msg.value > 0) { revert BadPayment(); }
if (_amount == 0 || msg.value > 0) { revert BadPayment(); }
16,785
18
// Users want to know when the auction ends, seconds from 1970-01-01
function auctionEndTime() constant returns (uint256) { return auctionStart + biddingPeriod; }
function auctionEndTime() constant returns (uint256) { return auctionStart + biddingPeriod; }
22,250
75
// create the lp data for the amm
(LiquidityPoolData memory liquidityPoolData, uint256 mainTokenAmount) = _addLiquidity(request.setupIndex, request);
(LiquidityPoolData memory liquidityPoolData, uint256 mainTokenAmount) = _addLiquidity(request.setupIndex, request);
40,065
10
// Emitted when the timelock controller used to queue a proposal to the timelock. /
event ProposalQueued(uint256 proposalId, uint256 eta);
event ProposalQueued(uint256 proposalId, uint256 eta);
24,030
45
// assignOperators _role operator role. May be a role not defined yet. _operators addresses /
function assignOperators(bytes32 _role, address[] memory _operators) public onlySysOp returns (bool)
function assignOperators(bytes32 _role, address[] memory _operators) public onlySysOp returns (bool)
30,460
10
// Calculate the cost of a number of items (in ether)
function getItemsCost(uint _items) public view returns(uint) { return _items * itemCost; }
function getItemsCost(uint _items) public view returns(uint) { return _items * itemCost; }
53,805
37
// Reward logic but will have to address decimals problem in ERC20 contracts If enter stake of 31,536,000 will get APY in years in seconds
uint256 aprPerSecond = (staker.lockedAPY * avoidFloat) / 365 / 86400; uint256 reward = (aprPerSecond * (block.timestamp - staker.startTime) * depositAmount) / (avoidFloat * 100) - staker.rewardClaimed; if (reward == 0) { revert("No rewa...
uint256 aprPerSecond = (staker.lockedAPY * avoidFloat) / 365 / 86400; uint256 reward = (aprPerSecond * (block.timestamp - staker.startTime) * depositAmount) / (avoidFloat * 100) - staker.rewardClaimed; if (reward == 0) { revert("No rewa...
4,936
69
// Remainig tokens that are left after week 155
uint256 FOR_156_WEEK = 151110 * SCALING_FACTOR; uint256 week = 1 weeks;
uint256 FOR_156_WEEK = 151110 * SCALING_FACTOR; uint256 week = 1 weeks;
38,443
0
// transfer token to a contract address with additional data if the recipient is a contact._to The address to transfer to._value The amount to be transferred._data The extra data to be passed to the receiving contract./
function transferAndCall(address _to, uint _value, bytes memory _data) public override returns (bool success)
function transferAndCall(address _to, uint _value, bytes memory _data) public override returns (bool success)
14,220
44
// User does not have permissions to join garden
uint256 internal constant USER_CANNOT_JOIN = 29;
uint256 internal constant USER_CANNOT_JOIN = 29;
15,859
191
// withdraw any available funds left in the contract, up to _amount, after accounting for the funds due to participants in past reports _recipient address to send funds to _amount maximum amount to withdraw, denominated in LINK-wei. access control provided by billingAccessController /
function withdrawFunds(address _recipient, uint256 _amount) external
function withdrawFunds(address _recipient, uint256 _amount) external
26,015
32
// check if address is member of Blocksquare_member Address of member return True if member is member of Blocksquare, false instead/
function isBS(address _member) public constant returns (bool) { return memberOfBS[_member]; }
function isBS(address _member) public constant returns (bool) { return memberOfBS[_member]; }
28,901
75
// {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and {safeDecreaseAllowance} instead./
function safeApprove( IERC20 token, address spender, uint256 value ) internal {
function safeApprove( IERC20 token, address spender, uint256 value ) internal {
35,883
28
// limit in wei for stage 612 + 1296 + 2052 + 2880
uint[4] internal stageLimits = [ 612 ether, //4800000 tokens 10% of ICO tokens (ICO token 40% of all (48 000 000) ) 1296 ether, //9600000 tokens 20% of ICO tokens 2052 ether, //14400000 tokens 30% of ICO tokens 2880 ether //19200000 tokens 40% of ICO tokens ]; mapping(address => ...
uint[4] internal stageLimits = [ 612 ether, //4800000 tokens 10% of ICO tokens (ICO token 40% of all (48 000 000) ) 1296 ether, //9600000 tokens 20% of ICO tokens 2052 ether, //14400000 tokens 30% of ICO tokens 2880 ether //19200000 tokens 40% of ICO tokens ]; mapping(address => ...
8,915
14
// Update integral of 1/supply
if (block.timestamp > _st.period_time) { uint256 _prev_week_time = _st.period_time; uint256 _week_time; unchecked { _week_time = min( ((_st.period_time + WEEK) / WEEK) * WEEK, block.timestamp ); ...
if (block.timestamp > _st.period_time) { uint256 _prev_week_time = _st.period_time; uint256 _week_time; unchecked { _week_time = min( ((_st.period_time + WEEK) / WEEK) * WEEK, block.timestamp ); ...
79,562
51
// Reverts if not in crowdsale time range. /
modifier onlyWhileOpen { require(now >= openingTime && now <= closingTime); _; }
modifier onlyWhileOpen { require(now >= openingTime && now <= closingTime); _; }
50,688
35
// Return the epoch calculated from current timestamp /
function getCurrentEpochId() external view returns (uint256) { BeaconSpec memory beaconSpec = _getBeaconSpec(); return _getCurrentEpochId(beaconSpec); }
function getCurrentEpochId() external view returns (uint256) { BeaconSpec memory beaconSpec = _getBeaconSpec(); return _getCurrentEpochId(beaconSpec); }
27,070
22
// Ensure buyer chose a valid eshop
require(po.eShopId.length > 0, "eShopId must be specified"); IPoTypes.Eshop memory eShop = businessPartnerStorageGlobal.getEshop(po.eShopId); require(eShop.purchasingContractAddress != address(0), "eShop has no purchasing address"); require(eShop.quoteSignerCount > 0, "No quote signers f...
require(po.eShopId.length > 0, "eShopId must be specified"); IPoTypes.Eshop memory eShop = businessPartnerStorageGlobal.getEshop(po.eShopId); require(eShop.purchasingContractAddress != address(0), "eShop has no purchasing address"); require(eShop.quoteSignerCount > 0, "No quote signers f...
8,198
7
// Set the initial tracked addresses
for (uint256 i = 0; i < _initial_tracked_addresses.length; i++){ address tracked_addr = _initial_tracked_addresses[i]; tracked_addresses.push(tracked_addr); is_address_tracked[tracked_addr] = true; }
for (uint256 i = 0; i < _initial_tracked_addresses.length; i++){ address tracked_addr = _initial_tracked_addresses[i]; tracked_addresses.push(tracked_addr); is_address_tracked[tracked_addr] = true; }
48,003