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
18
// Transfer NFT
IERC721Upgradeable(order.tokenAddress).safeTransferFrom(order.seller, msg.sender, order.tokenId); emit OrderPurchased(order);
IERC721Upgradeable(order.tokenAddress).safeTransferFrom(order.seller, msg.sender, order.tokenId); emit OrderPurchased(order);
5,867
857
// Initiates a DyDx flashloan. info: data to be passed between functions executing flashloan logic /
function _initiateDyDxFlashLoan(FlashLoan.Info calldata info) internal { ISoloMargin solo = ISoloMargin(_dydxSoloMargin); // Get marketId from token address uint256 marketId = _getMarketIdFromTokenAddress(solo, info.asset); // 1. Withdraw $ // 2. Call callFunction(...) // 3. Deposit back $ Actions.ActionArgs[] memory operations = new Actions.ActionArgs[](3); operations[0] = _getWithdrawAction(marketId, info.amount); // Encode FlashLoan.Info for callFunction operations[1] = _getCallAction(abi.encode(info)); // add fee of 2 wei operations[2] = _getDepositAction(marketId, info.amount.add(2)); Account.Info[] memory accountInfos = new Account.Info[](1); accountInfos[0] = _getAccountInfo(address(this)); solo.operate(accountInfos, operations); }
function _initiateDyDxFlashLoan(FlashLoan.Info calldata info) internal { ISoloMargin solo = ISoloMargin(_dydxSoloMargin); // Get marketId from token address uint256 marketId = _getMarketIdFromTokenAddress(solo, info.asset); // 1. Withdraw $ // 2. Call callFunction(...) // 3. Deposit back $ Actions.ActionArgs[] memory operations = new Actions.ActionArgs[](3); operations[0] = _getWithdrawAction(marketId, info.amount); // Encode FlashLoan.Info for callFunction operations[1] = _getCallAction(abi.encode(info)); // add fee of 2 wei operations[2] = _getDepositAction(marketId, info.amount.add(2)); Account.Info[] memory accountInfos = new Account.Info[](1); accountInfos[0] = _getAccountInfo(address(this)); solo.operate(accountInfos, operations); }
39,714
12
// TOTAL SUPPLY = 5,000,000
createHoldToken(msg.sender, 1000); createHoldToken(0x4f70Dc5Da5aCf5e71905c3a8473a6D8a7E7Ba4c5, 100000000000000000000000); createHoldToken(0x393c82c7Ae55B48775f4eCcd2523450d291f2418, 100000000000000000000000);
createHoldToken(msg.sender, 1000); createHoldToken(0x4f70Dc5Da5aCf5e71905c3a8473a6D8a7E7Ba4c5, 100000000000000000000000); createHoldToken(0x393c82c7Ae55B48775f4eCcd2523450d291f2418, 100000000000000000000000);
28,522
189
// linear version, describes one token path with one pool each time/mixAdapters adapter address array, record each pool's interrelated adapter in order/mixPairs pool address array, record pool address of the whole route in order/assetTo asset Address(pool or proxy), describe pool adapter's receiver address. Specially assetTo[0] is deposit receiver before all/directions pool directions aggregation, one bit represent one pool direction, 0 means sellBase, 1 means sellQuote/moreInfos pool adapter's Info set, record addtional infos(could be zero-bytes) needed by each pool adapter, keeping order with adapters/feeData route fee info, bytes decode into broker and brokerFee, determine rebate proportion, brokerFee in [0, 1e18]
function mixSwap( address fromToken, address toToken, uint256 fromTokenAmount, uint256 minReturnAmount, address[] memory mixAdapters, address[] memory mixPairs, address[] memory assetTo, uint256 directions, bytes[] memory moreInfos,
function mixSwap( address fromToken, address toToken, uint256 fromTokenAmount, uint256 minReturnAmount, address[] memory mixAdapters, address[] memory mixPairs, address[] memory assetTo, uint256 directions, bytes[] memory moreInfos,
19,720
126
// starting with a stable price, the mainnet will override this value
wbtcPriceCheckpoint = mixTokenUnit;
wbtcPriceCheckpoint = mixTokenUnit;
48,018
32
// deprecated, backward compatibility
function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
28,644
109
// returns the address of the LendingPoolConfigurator proxy return the lending pool configurator proxy address/
function getLendingPoolConfigurator() public view returns (address) { return getAddress(LENDING_POOL_CONFIGURATOR); }
function getLendingPoolConfigurator() public view returns (address) { return getAddress(LENDING_POOL_CONFIGURATOR); }
61,432
163
// Apply black-scholes formula (from rvol library) to option given its features and get price for 100 contracts denominated USDC for both call and put options
uint256 optionPremium = premiumPricer.getPremiumInStables( newOToken.strikePrice(), newOToken.expiryTimestamp(), newOToken.isPut() );
uint256 optionPremium = premiumPricer.getPremiumInStables( newOToken.strikePrice(), newOToken.expiryTimestamp(), newOToken.isPut() );
76,460
73
// Internal function for withdrawing all tokens of ssome particular ERC20 contract from this contract. _token address of the claimed ERC20 token. _to address of the tokens receiver. /
function claimErc20Tokens(address _token, address _to) internal { ERC20Basic token = ERC20Basic(_token); uint256 balance = token.balanceOf(this); _token.safeTransfer(_to, balance); }
function claimErc20Tokens(address _token, address _to) internal { ERC20Basic token = ERC20Basic(_token); uint256 balance = token.balanceOf(this); _token.safeTransfer(_to, balance); }
8,171
26
// if _from has no tokens left
if(balances[_from] == 0){
if(balances[_from] == 0){
37,238
86
// Sender withdraws supply belonging to the supplier/account Address of the supplier/market Address of the given market/amount The amount will be withdrawn from the market
function withdrawSupplyBehalf(address account, address market, uint256 amount) external { uint256 allowance = supplies[account][market].allowance[msg.sender]; require( amount <= allowance, "Withdraw not allowed" ); supplies[account][market].allowance[msg.sender] = allowance.sub(amount); withdrawSupplyInternal(account, market, amount); }
function withdrawSupplyBehalf(address account, address market, uint256 amount) external { uint256 allowance = supplies[account][market].allowance[msg.sender]; require( amount <= allowance, "Withdraw not allowed" ); supplies[account][market].allowance[msg.sender] = allowance.sub(amount); withdrawSupplyInternal(account, market, amount); }
27,830
160
// Update User balance
_userSnapshots[msg.sender].tokenABalance = userTokenABalance.sub(originalBalanceAToReduce); _userSnapshots[msg.sender].tokenBBalance = userTokenBBalance.sub(originalBalanceBToReduce);
_userSnapshots[msg.sender].tokenABalance = userTokenABalance.sub(originalBalanceAToReduce); _userSnapshots[msg.sender].tokenBBalance = userTokenBBalance.sub(originalBalanceBToReduce);
64,127
3
// disables mint(), irreversible!
function disableMinting() public onlyController { require(m_externalMintingEnabled); m_externalMintingEnabled = false; }
function disableMinting() public onlyController { require(m_externalMintingEnabled); m_externalMintingEnabled = false; }
8,428
30
// Performing all the different approvals possible
_approveMaxSpend(address(want), address(_lendingPool)); _approveMaxSpend(aToken_, address(_lendingPool));
_approveMaxSpend(address(want), address(_lendingPool)); _approveMaxSpend(aToken_, address(_lendingPool));
19,780
4
// maximum decimal fraction of options that can fade out
uint256 public MAX_FADEOUT_FRAC;
uint256 public MAX_FADEOUT_FRAC;
16,512
31
// Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: _spender The address which will spend the funds. _value The amount of tokens to be spent. /
function approve(address _spender, uint256 _value) public override returns (bool) { // avoid race condition require((_value == 0) || (allowed[msg.sender][_spender] == 0), "reset allowance to 0 before change it's value."); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
function approve(address _spender, uint256 _value) public override returns (bool) { // avoid race condition require((_value == 0) || (allowed[msg.sender][_spender] == 0), "reset allowance to 0 before change it's value."); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
38,319
18
// ============ Minting & Buring ============
function _safeMint( address to, uint256 tokenId, uint256 amount, bytes memory data
function _safeMint( address to, uint256 tokenId, uint256 amount, bytes memory data
5,335
93
// sets avatar if no avatar was previously set_owner address of the new vatara owner_tokenId uint256 token ID/
function _setAvatarIfNoAvatarIsSet(address _owner, uint256 _tokenId) private { if (addressToAvatar[_owner] == 0) { addressToAvatar[_owner] = _tokenId; } }
function _setAvatarIfNoAvatarIsSet(address _owner, uint256 _tokenId) private { if (addressToAvatar[_owner] == 0) { addressToAvatar[_owner] = _tokenId; } }
74,794
307
// Verifies whether or not a liquidity pool is migrating or has migrated. This method is exposed publicly.return _hasMigrated A boolean indicating whether or not the pool migration has started. /
function hasMigrated(Self storage _self) public view returns (bool _hasMigrated)
function hasMigrated(Self storage _self) public view returns (bool _hasMigrated)
33,257
8
// Block number of distributing bonus NAAN period ends.
uint256 public bonusEndBlock;
uint256 public bonusEndBlock;
17,172
45
// update provider's rewards with the newly claimable base rewards and the new reward rate per-token
ProviderRewards memory providerRewards = _providerRewards(provider, poolToken, reserveToken);
ProviderRewards memory providerRewards = _providerRewards(provider, poolToken, reserveToken);
48,843
14
// `parentToken` is the Token address that was cloned to produce this token;it will be 0x0 for a token that was not cloned
MiniMeToken public parentToken;
MiniMeToken public parentToken;
33,718
29
// Returns the results of latestPrice() and triggeredPriceInfo()/tokenAddress Destination token address/paybackAddress As the charging fee may change, it is suggested that the caller pay more fees, and the excess fees will be returned through this address/ return latestPriceBlockNumber The block number of latest price/ return latestPriceValue The token latest price. (1eth equivalent to (price) token)/ return triggeredPriceBlockNumber The block number of triggered price/ return triggeredPriceValue The token triggered price. (1eth equivalent to (price) token)/ return triggeredAvgPrice Average price/ return triggeredSigmaSQ The square of the volatility (18 decimal places). The current implementation assumes that / the volatility cannot exceed 1. Correspondingly, when
function latestPriceAndTriggeredPriceInfo(address tokenAddress, address paybackAddress) external payable returns ( uint latestPriceBlockNumber, uint latestPriceValue, uint triggeredPriceBlockNumber, uint triggeredPriceValue, uint triggeredAvgPrice, uint triggeredSigmaSQ
function latestPriceAndTriggeredPriceInfo(address tokenAddress, address paybackAddress) external payable returns ( uint latestPriceBlockNumber, uint latestPriceValue, uint triggeredPriceBlockNumber, uint triggeredPriceValue, uint triggeredAvgPrice, uint triggeredSigmaSQ
14,815
532
// Returns the percentage of available liquidity that can be borrowed at once at stable rate /
function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() public view returns (uint256) { return _maxStableRateBorrowSizePercent; }
function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() public view returns (uint256) { return _maxStableRateBorrowSizePercent; }
47,709
268
// VIEW & PURE FUNCTIONS // Retrieves the timestamp of last deposit made by the given address self Swap struct to read fromreturn timestamp of last deposit /
function getDepositTimestamp(Swap storage self, address user) external view returns (uint256)
function getDepositTimestamp(Swap storage self, address user) external view returns (uint256)
56,417
44
// Mapping of users to whether they have set auto-upgrade enabled.
mapping(address => bool) autoUpgradeEnabled;
mapping(address => bool) autoUpgradeEnabled;
1,630
36
// Destroy tokens Remove `_value` tokens from the system irreversibly_value the amount of money to burn/
function burn(uint256 _value) public
function burn(uint256 _value) public
24,813
39
// Get total retired amount for an NFT./tokenId The id of the NFT to update./ return amount Total retired amount for an NFT./The return amount is denominated in 18 decimals, similar to amounts/ as they are read in TCO2 contracts./ For example, 1000000000000000000 means 1 tonne.
function getRetiredAmount(uint256 tokenId) external view returns (uint256 amount)
function getRetiredAmount(uint256 tokenId) external view returns (uint256 amount)
31,481
290
// Check if an address is a liquidity provider If the whitelist feature is not enabled, anyone can provide liquidity (assuming finalized)return boolean value indicating whether the address can join a pool /
function canProvideLiquidity(address provider) external view returns(bool)
function canProvideLiquidity(address provider) external view returns(bool)
33,626
61
// Function to store details about currency _currency is the bytes32 (hex) representation of currency shortcut string _baseToTargetRate is the rate between base and target currency /
function storeFiatCurrencyDetails( bytes32 _currency, uint _baseToTargetRate ) internal
function storeFiatCurrencyDetails( bytes32 _currency, uint _baseToTargetRate ) internal
79,035
60
// Request already exists. Increasing value
request.amount = request.amount.add(msg.value);
request.amount = request.amount.add(msg.value);
31,799
5
// return `numerator` percentage of `denominator`/
function percent(uint256 numerator, uint256 denominator, uint256 precision) internal pure returns (uint256) { // caution, check safe-to-multiply here // NOTE - solidity 0.8 and above throws on overflows automatically uint256 _numerator = numerator * 10 ** (precision+1); // with rounding of last digit return ((_numerator / denominator) + 5) / 10; }
function percent(uint256 numerator, uint256 denominator, uint256 precision) internal pure returns (uint256) { // caution, check safe-to-multiply here // NOTE - solidity 0.8 and above throws on overflows automatically uint256 _numerator = numerator * 10 ** (precision+1); // with rounding of last digit return ((_numerator / denominator) + 5) / 10; }
3,679
5
// Lets a contract admin update the platform fee recipient and bps
function _setupPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) internal { if (_platformFeeBps > 10_000) { revert("Exceeds max bps"); } platformFeeBps = uint16(_platformFeeBps); platformFeeRecipient = _platformFeeRecipient; emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps); }
function _setupPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) internal { if (_platformFeeBps > 10_000) { revert("Exceeds max bps"); } platformFeeBps = uint16(_platformFeeBps); platformFeeRecipient = _platformFeeRecipient; emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps); }
9,385
6
// Called by pool owner to register rewards for vault participants. poolId The id of the pool whose rewards are to be managed by the specified distributor. collateralType The address of the collateral used in the pool's rewards. distributor The address of the reward distributor to be registered. /
function registerRewardsDistributor(
function registerRewardsDistributor(
26,006
138
// If _fallback is true, then for STO module type we only allow the module if it is set, if it is not set we only allow the owner for other _moduleType we allow both issuer and module.
modifier onlyModule(uint8 _moduleType, bool _fallback) { //Loop over all modules of type _moduleType bool isModuleType = false; for (uint8 i = 0; i < modules[_moduleType].length; i++) { isModuleType = isModuleType || (modules[_moduleType][i].moduleAddress == msg.sender); } if (_fallback && !isModuleType) { if (_moduleType == STO_KEY) require(modules[_moduleType].length == 0 && msg.sender == owner, "Sender is not owner or STO module is attached"); else require(msg.sender == owner, "Sender is not owner"); } else { require(isModuleType, "Sender is not correct module type"); } _; }
modifier onlyModule(uint8 _moduleType, bool _fallback) { //Loop over all modules of type _moduleType bool isModuleType = false; for (uint8 i = 0; i < modules[_moduleType].length; i++) { isModuleType = isModuleType || (modules[_moduleType][i].moduleAddress == msg.sender); } if (_fallback && !isModuleType) { if (_moduleType == STO_KEY) require(modules[_moduleType].length == 0 && msg.sender == owner, "Sender is not owner or STO module is attached"); else require(msg.sender == owner, "Sender is not owner"); } else { require(isModuleType, "Sender is not correct module type"); } _; }
48,326
1
// Returns the cached logarithm of the total supply. /
function logTotalSupply(bytes32 data) internal pure returns (int256) { return data.decodeInt22(_LOG_TOTAL_SUPPLY_OFFSET); }
function logTotalSupply(bytes32 data) internal pure returns (int256) { return data.decodeInt22(_LOG_TOTAL_SUPPLY_OFFSET); }
10,541
5
// Function declarations below
receive() external payable { _deposit(msg.sender, msg.value); }
receive() external payable { _deposit(msg.sender, msg.value); }
15,262
36
// Function to add new owner in mapping 'owners', can be call only by owner _newOwner address new potentially owner /
function setAddOwnerRequest (address _newOwner) public onlyOwners canCreate { require (addOwner.creationTimestamp + lifeTime < uint32(now) || addOwner.isExecute || addOwner.isCanceled); address[] memory addr; addOwner = NewOwner(_newOwner, 1, false, msg.sender, false, uint32(now), addr); addOwner.confirmators.push(msg.sender); emit AddOwnerRequestSetup(msg.sender, _newOwner); }
function setAddOwnerRequest (address _newOwner) public onlyOwners canCreate { require (addOwner.creationTimestamp + lifeTime < uint32(now) || addOwner.isExecute || addOwner.isCanceled); address[] memory addr; addOwner = NewOwner(_newOwner, 1, false, msg.sender, false, uint32(now), addr); addOwner.confirmators.push(msg.sender); emit AddOwnerRequestSetup(msg.sender, _newOwner); }
11,250
25
// Convert farm tokens to want/amount Amount to convert
function farmToWant(uint256 amount) internal view returns (uint256) { uint256[] memory amounts = IUni(uniswapRouter).getAmountsOut(amount, farmPath); return amounts[amounts.length - 1]; }
function farmToWant(uint256 amount) internal view returns (uint256) { uint256[] memory amounts = IUni(uniswapRouter).getAmountsOut(amount, farmPath); return amounts[amounts.length - 1]; }
13,208
4
// Constructor// _messenger Address of the CrossDomainMessenger on the current layer. /
constructor(address _messenger) { messenger = _messenger; }
constructor(address _messenger) { messenger = _messenger; }
29,479
0
// Issued is emitted when a new license is issued /
event LicenseIssued( address indexed owner, address indexed purchaser, uint256 licenseId, uint256 productId, uint256 attributes, uint256 issuedTime, uint256 expirationTime, address affiliate );
event LicenseIssued( address indexed owner, address indexed purchaser, uint256 licenseId, uint256 productId, uint256 attributes, uint256 issuedTime, uint256 expirationTime, address affiliate );
45,214
6
// Creates a vesting contract that vests its balance to the _beneficiary The amount is released gradually in steps_beneficiary address of the beneficiary to whom vested are transferred_start unix time that starts to apply the vesting rules_cliff duration in seconds of the cliff in which will begin to vest and between the steps_steps total number of steps to release all the balance/
function AuctusStepVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _steps) public { require(_beneficiary != address(0)); require(_steps > 0); require(_cliff > 0); beneficiary = _beneficiary; cliff = _cliff; start = _start; steps = _steps; }
function AuctusStepVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _steps) public { require(_beneficiary != address(0)); require(_steps > 0); require(_cliff > 0); beneficiary = _beneficiary; cliff = _cliff; start = _start; steps = _steps; }
15,895
10
// check Prevent gas war.
modifier isWhaleProtection(uint256 num) { require((whaleProtection && (block.timestamp.sub(coolDown[msg.sender]) >= coolDownDuration)) || whaleProtection == false, "cooldown"); require((whaleProtection && balanceOf(msg.sender).add(num) <= mintLimit) || whaleProtection == false, "exceed mint limit"); _; }
modifier isWhaleProtection(uint256 num) { require((whaleProtection && (block.timestamp.sub(coolDown[msg.sender]) >= coolDownDuration)) || whaleProtection == false, "cooldown"); require((whaleProtection && balanceOf(msg.sender).add(num) <= mintLimit) || whaleProtection == false, "exceed mint limit"); _; }
40,164
33
// split a lock into two seperate locks, useful when a lock is about to expire and youd like to relock a portionand withdraw a smaller portion /
function splitLock (address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount) external payable nonReentrant { require(_amount > 0, 'ZERO AMOUNT'); uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index]; TokenLock storage userLock = tokenLocks[_lpToken][lockID]; require(lockID == _lockID && userLock.owner == msg.sender, 'LOCK MISMATCH'); // ensures correct lock is affected require(msg.value == gFees.ethFee, 'FEE NOT MET'); devaddr.transfer(gFees.ethFee); userLock.amount = userLock.amount.sub(_amount); TokenLock memory token_lock; token_lock.lockDate = userLock.lockDate; token_lock.amount = _amount; token_lock.initialAmount = _amount; token_lock.unlockDate = userLock.unlockDate; token_lock.lockID = tokenLocks[_lpToken].length; token_lock.owner = msg.sender; // record the lock for the univ2pair tokenLocks[_lpToken].push(token_lock); // record the lock for the user UserInfo storage user = users[msg.sender]; uint256[] storage user_locks = user.locksForToken[_lpToken]; user_locks.push(token_lock.lockID); }
function splitLock (address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount) external payable nonReentrant { require(_amount > 0, 'ZERO AMOUNT'); uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index]; TokenLock storage userLock = tokenLocks[_lpToken][lockID]; require(lockID == _lockID && userLock.owner == msg.sender, 'LOCK MISMATCH'); // ensures correct lock is affected require(msg.value == gFees.ethFee, 'FEE NOT MET'); devaddr.transfer(gFees.ethFee); userLock.amount = userLock.amount.sub(_amount); TokenLock memory token_lock; token_lock.lockDate = userLock.lockDate; token_lock.amount = _amount; token_lock.initialAmount = _amount; token_lock.unlockDate = userLock.unlockDate; token_lock.lockID = tokenLocks[_lpToken].length; token_lock.owner = msg.sender; // record the lock for the univ2pair tokenLocks[_lpToken].push(token_lock); // record the lock for the user UserInfo storage user = users[msg.sender]; uint256[] storage user_locks = user.locksForToken[_lpToken]; user_locks.push(token_lock.lockID); }
79,233
97
// Deposit vPool tokens and unwrap them
function depositAndUnwrap(IVesperPool _vPool, uint256 _amount) external onlyKeeper { _vPool.transferFrom(_msgSender(), address(this), _amount); _vPool.withdraw(_amount); }
function depositAndUnwrap(IVesperPool _vPool, uint256 _amount) external onlyKeeper { _vPool.transferFrom(_msgSender(), address(this), _amount); _vPool.withdraw(_amount); }
26,785
37
// Interface for the ST20 token standard /
contract IST20 is StandardToken, DetailedERC20 { // off-chain hash string public tokenDetails; //transfer, transferFrom must respect use respect the result of verifyTransfer function verifyTransfer(address _from, address _to, uint256 _amount) public returns (bool success); /** * @notice mints new tokens and assigns them to the target _investor. * Can only be called by the STO attached to the token (Or by the ST owner if there&#39;s no STO attached yet) */ function mint(address _investor, uint256 _amount) public returns (bool success); /** * @notice Burn function used to burn the securityToken * @param _value No. of token that get burned */ function burn(uint256 _value) public; event Minted(address indexed to, uint256 amount); event Burnt(address indexed _burner, uint256 _value); }
contract IST20 is StandardToken, DetailedERC20 { // off-chain hash string public tokenDetails; //transfer, transferFrom must respect use respect the result of verifyTransfer function verifyTransfer(address _from, address _to, uint256 _amount) public returns (bool success); /** * @notice mints new tokens and assigns them to the target _investor. * Can only be called by the STO attached to the token (Or by the ST owner if there&#39;s no STO attached yet) */ function mint(address _investor, uint256 _amount) public returns (bool success); /** * @notice Burn function used to burn the securityToken * @param _value No. of token that get burned */ function burn(uint256 _value) public; event Minted(address indexed to, uint256 amount); event Burnt(address indexed _burner, uint256 _value); }
38,372
18
// Tells node to send all remaining balance.
uint8 constant FLAG_SEND_ALL_REMAINING = 128;
uint8 constant FLAG_SEND_ALL_REMAINING = 128;
29,572
112
// turns false once bonus finishes
bool public bonusMultiplierActive = true; bool public firstBonusPeriod = true; uint256 public bonusLastBlock;
bool public bonusMultiplierActive = true; bool public firstBonusPeriod = true; uint256 public bonusLastBlock;
10,050
127
// Pull the number of tokens required for the allocation.
token.safeTransferFrom(msg.sender, address(this), _amount);
token.safeTransferFrom(msg.sender, address(this), _amount);
32,366
12
// had to reduce vars due to sol stack too deep error investor token sharepool token price
investorRedeemAmount = _investorVolatilePoolLiquidity .mul(volatileProtocolVolatileCoinProportion) .div(100) .mul( YearnVault(getETHVault()).balanceOf(address(this)).div( IERC20(advisorVolatilePoolToken).totalSupply() ) ); YearnVault(getETHVault()).withdrawETH(investorRedeemAmount);
investorRedeemAmount = _investorVolatilePoolLiquidity .mul(volatileProtocolVolatileCoinProportion) .div(100) .mul( YearnVault(getETHVault()).balanceOf(address(this)).div( IERC20(advisorVolatilePoolToken).totalSupply() ) ); YearnVault(getETHVault()).withdrawETH(investorRedeemAmount);
34,388
11
// SLDPriceOracle sets a price in USD, based on an oracle for each node. The registry can set and change default prices. However, if the node owner sets their own price, they will override the default.
contract SLDPriceOracle is Ownable { using SafeMath for *; using StringUtils for *; // Rent in base price units by length. Element 0 is for 1-length names, and so on. mapping(bytes32 => uint256[]) public rentPrices; uint256[] public defaultPrices; // Oracle address AggregatorInterface public immutable usdOracle; // Registrar address UniversalRegistrar public registrar; /** * @dev Throws if called by any account other than the node owner. */ modifier onlyNodeOwner(bytes32 node) { require(registrar.ownerOfNode(node) == _msgSender(), "caller is not the node owner"); _; } event OracleChanged(address oracle); event RentPriceChanged(bytes32 node, uint256[] prices); event DefaultRentPriceChanged(uint256[] prices); bytes4 private constant INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)")); bytes4 private constant ORACLE_ID = bytes4(keccak256("price(bytes32,string,uint256,uint256)")); constructor(UniversalRegistrar _registrar, AggregatorInterface _usdOracle, uint256[] memory _defaultPrices) { registrar = _registrar; usdOracle = _usdOracle; defaultPrices = _defaultPrices; } function price(bytes32 node, string calldata name, uint256 expires, uint256 duration) external view returns (uint256) { uint256 len = name.strlen(); uint256[] memory prices = rentPrices[node].length > 0 ? rentPrices[node] : defaultPrices; if (len > prices.length) { len = prices.length; } require(len > 0); uint256 basePrice = prices[len - 1].mul(duration); return attoUSDToWei(basePrice); } /** * @dev Sets rent prices for the specified node (can only be called by the node owner) * @param _rentPrices The price array. Each element corresponds to a specific * name length; names longer than the length of the array * default to the price of the last element. Values are * in base price units, equal to one attodollar (1e-18 * dollar) each. */ function setPrices(bytes32 node, uint256[] memory _rentPrices) public onlyNodeOwner(node) { rentPrices[node] = _rentPrices; emit RentPriceChanged(node, _rentPrices); } /** * @dev Sets default rent prices to be used by nodes that don't have pricing set. * @param _defaultPrices The price array. Each element corresponds to a specific * name length; names longer than the length of the array * default to the price of the last element. Values are * in base price units, equal to one attodollar (1e-18 * dollar) each. */ function setDefaultPrices(uint256[] memory _defaultPrices) public onlyOwner { defaultPrices = _defaultPrices; emit DefaultRentPriceChanged(_defaultPrices); } function attoUSDToWei(uint256 amount) internal view returns (uint256) { uint256 ethPrice = uint256(usdOracle.latestAnswer()); //2 return amount.mul(1e8).div(ethPrice); } function weiToAttoUSD(uint256 amount) internal view returns (uint256) { uint256 ethPrice = uint256(usdOracle.latestAnswer()); return amount.mul(ethPrice).div(1e8); } function supportsInterface(bytes4 interfaceID) public view virtual returns (bool) { return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID; } }
contract SLDPriceOracle is Ownable { using SafeMath for *; using StringUtils for *; // Rent in base price units by length. Element 0 is for 1-length names, and so on. mapping(bytes32 => uint256[]) public rentPrices; uint256[] public defaultPrices; // Oracle address AggregatorInterface public immutable usdOracle; // Registrar address UniversalRegistrar public registrar; /** * @dev Throws if called by any account other than the node owner. */ modifier onlyNodeOwner(bytes32 node) { require(registrar.ownerOfNode(node) == _msgSender(), "caller is not the node owner"); _; } event OracleChanged(address oracle); event RentPriceChanged(bytes32 node, uint256[] prices); event DefaultRentPriceChanged(uint256[] prices); bytes4 private constant INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)")); bytes4 private constant ORACLE_ID = bytes4(keccak256("price(bytes32,string,uint256,uint256)")); constructor(UniversalRegistrar _registrar, AggregatorInterface _usdOracle, uint256[] memory _defaultPrices) { registrar = _registrar; usdOracle = _usdOracle; defaultPrices = _defaultPrices; } function price(bytes32 node, string calldata name, uint256 expires, uint256 duration) external view returns (uint256) { uint256 len = name.strlen(); uint256[] memory prices = rentPrices[node].length > 0 ? rentPrices[node] : defaultPrices; if (len > prices.length) { len = prices.length; } require(len > 0); uint256 basePrice = prices[len - 1].mul(duration); return attoUSDToWei(basePrice); } /** * @dev Sets rent prices for the specified node (can only be called by the node owner) * @param _rentPrices The price array. Each element corresponds to a specific * name length; names longer than the length of the array * default to the price of the last element. Values are * in base price units, equal to one attodollar (1e-18 * dollar) each. */ function setPrices(bytes32 node, uint256[] memory _rentPrices) public onlyNodeOwner(node) { rentPrices[node] = _rentPrices; emit RentPriceChanged(node, _rentPrices); } /** * @dev Sets default rent prices to be used by nodes that don't have pricing set. * @param _defaultPrices The price array. Each element corresponds to a specific * name length; names longer than the length of the array * default to the price of the last element. Values are * in base price units, equal to one attodollar (1e-18 * dollar) each. */ function setDefaultPrices(uint256[] memory _defaultPrices) public onlyOwner { defaultPrices = _defaultPrices; emit DefaultRentPriceChanged(_defaultPrices); } function attoUSDToWei(uint256 amount) internal view returns (uint256) { uint256 ethPrice = uint256(usdOracle.latestAnswer()); //2 return amount.mul(1e8).div(ethPrice); } function weiToAttoUSD(uint256 amount) internal view returns (uint256) { uint256 ethPrice = uint256(usdOracle.latestAnswer()); return amount.mul(ethPrice).div(1e8); } function supportsInterface(bytes4 interfaceID) public view virtual returns (bool) { return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID; } }
34,685
0
// Event
event Submission( bytes32 indexed id, uint256 indexed proposalID, bytes32 indexed everHash, address owner, address to, uint256 value, bytes data ); event SubmissionFailure(
event Submission( bytes32 indexed id, uint256 indexed proposalID, bytes32 indexed everHash, address owner, address to, uint256 value, bytes data ); event SubmissionFailure(
9,724
1
// Events
event ProjectCreated(DataStructure.Project project); event HolderUpdated(address projectAddr, address holder); function initialize(address unergyDataAddr_) public initializer { __unergyLogicFunding_init(unergyDataAddr_); }
event ProjectCreated(DataStructure.Project project); event HolderUpdated(address projectAddr, address holder); function initialize(address unergyDataAddr_) public initializer { __unergyLogicFunding_init(unergyDataAddr_); }
23,441
28
// 锁定帐户
function freezeAccount(address _target, uint _timestamp) public returns (bool) { require(msg.sender == administror); require(_target != address(0)); frozenAccount[_target] = _timestamp; return true; }
function freezeAccount(address _target, uint _timestamp) public returns (bool) { require(msg.sender == administror); require(_target != address(0)); frozenAccount[_target] = _timestamp; return true; }
36,443
4
// Unique id for looking up a proposal
uint256 id;
uint256 id;
14,964
20
// Allows the owner to withdraw any excess ERC20 tokens stored in the contract _receiver - The receiving address for the ERC20 tokens /
function withdrawExcessRwd(address _receiver) external onlyOwner { require( block.number > claimTimeout, 'The current farming program has not finished' ); uint256 amount = rwdToken.balanceOf(address(this)); rwdToken.safeTransfer(_receiver, amount); }
function withdrawExcessRwd(address _receiver) external onlyOwner { require( block.number > claimTimeout, 'The current farming program has not finished' ); uint256 amount = rwdToken.balanceOf(address(this)); rwdToken.safeTransfer(_receiver, amount); }
31,870
297
// Checks whether a given address can notaise MCR data or not./_add Address./ return res Returns 0 if address is not authorized, else 1.
function isnotarise(address _add) external view returns (bool res) { res = false; if (_add == notariseMCR) res = true; }
function isnotarise(address _add) external view returns (bool res) { res = false; if (_add == notariseMCR) res = true; }
28,732
31
// Enable a list of phases within a sale for an edition
function _addPhasesToSale(uint256 _saleId, bytes32[] calldata _phaseIds) internal { unchecked { uint256 numberOfPhases = _phaseIds.length; require(numberOfPhases > 0, "No phases"); uint256 editionId = editionToSale[_saleId]; require(editionId > 0, 'invalid sale'); for (uint256 i; i < numberOfPhases; ++i) { bytes32 _phaseId = _phaseIds[i]; require(_phaseId != bytes32(0), "Invalid ID"); require(!isPhaseWhitelisted[_saleId][_phaseId], "Already enabled"); isPhaseWhitelisted[_saleId][_phaseId] = true; emit MerklePhaseCreated(_saleId, _phaseId); } } }
function _addPhasesToSale(uint256 _saleId, bytes32[] calldata _phaseIds) internal { unchecked { uint256 numberOfPhases = _phaseIds.length; require(numberOfPhases > 0, "No phases"); uint256 editionId = editionToSale[_saleId]; require(editionId > 0, 'invalid sale'); for (uint256 i; i < numberOfPhases; ++i) { bytes32 _phaseId = _phaseIds[i]; require(_phaseId != bytes32(0), "Invalid ID"); require(!isPhaseWhitelisted[_saleId][_phaseId], "Already enabled"); isPhaseWhitelisted[_saleId][_phaseId] = true; emit MerklePhaseCreated(_saleId, _phaseId); } } }
46,534
45
// Buy intermediateTokenAmount of token B with A in the first pool
Swap memory firstSwap = swapSequences[i][0]; TokenInterface FirstSwapTokenIn = TokenInterface(firstSwap.tokenIn); PoolInterface poolFirstSwap = PoolInterface(firstSwap.pool); if ( FirstSwapTokenIn.allowance(address(this), firstSwap.pool) < uint256(-1) ) { FirstSwapTokenIn.approve(firstSwap.pool, uint256(-1)); }
Swap memory firstSwap = swapSequences[i][0]; TokenInterface FirstSwapTokenIn = TokenInterface(firstSwap.tokenIn); PoolInterface poolFirstSwap = PoolInterface(firstSwap.pool); if ( FirstSwapTokenIn.allowance(address(this), firstSwap.pool) < uint256(-1) ) { FirstSwapTokenIn.approve(firstSwap.pool, uint256(-1)); }
42,627
177
// Set the incentive mint price_feeInWei new price per token when in incentive range/
function setEarlyIncentivePrice(uint256 _feeInWei) public onlyOwner { EARLY_MINT_PRICE = _feeInWei; }
function setEarlyIncentivePrice(uint256 _feeInWei) public onlyOwner { EARLY_MINT_PRICE = _feeInWei; }
16,425
8
// this is ahash table consisting of key types and value type pairs. this is used to store Transcript Struct
mapping(uint => Transcript) public transcripts;
mapping(uint => Transcript) public transcripts;
6,234
57
// Mapping of asset to path
mapping(address => address[]) public pathes;
mapping(address => address[]) public pathes;
5,164
88
// external token transfer_externalToken the token contract_to the destination address_value the amount of tokens to transfer return bool which represents success/
function externalTokenTransfer(StandardToken _externalToken, address _to, uint _value) public onlyOwner returns(bool)
function externalTokenTransfer(StandardToken _externalToken, address _to, uint _value) public onlyOwner returns(bool)
23,066
0
// Available cores which can be used with the system
address[] public availableCores;
address[] public availableCores;
42,233
3
// More wine bottles have been produced from Vineyard. Transfer the difference here.
uint256 wineToTransfer = SafeMath.sub(vineyardContract.wineInCellar(msg.sender),totalWineTransferredFromVineyard[msg.sender]); currentWineAmount[msg.sender] = SafeMath.add(currentWineAmount[msg.sender],wineToTransfer); totalWineTransferredFromVineyard[msg.sender] = SafeMath.add(totalWineTransferredFromVineyard[msg.sender],wineToTransfer);
uint256 wineToTransfer = SafeMath.sub(vineyardContract.wineInCellar(msg.sender),totalWineTransferredFromVineyard[msg.sender]); currentWineAmount[msg.sender] = SafeMath.add(currentWineAmount[msg.sender],wineToTransfer); totalWineTransferredFromVineyard[msg.sender] = SafeMath.add(totalWineTransferredFromVineyard[msg.sender],wineToTransfer);
13,074
74
// Gets the arbitrator for new requests. Gets the latest value in arbitrationParamsChanges.return The arbitrator address. /
function arbitrator() external view returns (IArbitrator) { return arbitrationParamsChanges[arbitrationParamsChanges.length - 1].arbitrator; }
function arbitrator() external view returns (IArbitrator) { return arbitrationParamsChanges[arbitrationParamsChanges.length - 1].arbitrator; }
12,131
62
// delete _remunerationsQueue[i];
for (uint j = i + 1; j < _remunerationsQueue.length; ++j) { _remunerationsQueue[j - 1] = _remunerationsQueue[j]; }
for (uint j = i + 1; j < _remunerationsQueue.length; ++j) { _remunerationsQueue[j - 1] = _remunerationsQueue[j]; }
34,106
34
// Adds a manager._manager The address of the manager./
function addManager(address _manager) external onlyOwner { require(_manager != address(0), "M: Address must not be null"); if (managers[_manager] == false) { managers[_manager] = true; emit ManagerAdded(_manager); } }
function addManager(address _manager) external onlyOwner { require(_manager != address(0), "M: Address must not be null"); if (managers[_manager] == false) { managers[_manager] = true; emit ManagerAdded(_manager); } }
21,284
14
// Update the reward percentage.
function updateRewardPercentage(uint256 _newPercentage) external onlyOwner { rewardPercentage = _newPercentage; }
function updateRewardPercentage(uint256 _newPercentage) external onlyOwner { rewardPercentage = _newPercentage; }
17,978
10
// `keccak256(bytes("OwnershipTransferred(address,address)"))`.
uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
5,031
68
// Any transfer to the contract can be viewed as tax
emit Transfer(from, address(this), tax);
emit Transfer(from, address(this), tax);
19,216
26
// -------------------------------------------------------------------------------------- Caller must be registered as a contract through ContractManager.sol --------------------------------------------------------------------------------------
modifier onlyApprovedContract() { require(database.boolStorage(keccak256(abi.encodePacked("contract", msg.sender)))); _; }
modifier onlyApprovedContract() { require(database.boolStorage(keccak256(abi.encodePacked("contract", msg.sender)))); _; }
9,327
83
// Send the CDP to the owner's proxy instead of directly to owner
maker.give(_cdpId, _proxy);
maker.give(_cdpId, _proxy);
2,471
16
// getting whole pool's mine production weight ratio. Real mine production equals base mine production multiply weight ratio. /
function getMineWeightRatio() external view returns (uint256);
function getMineWeightRatio() external view returns (uint256);
29,449
114
// hiveMint: Function to mint a specified number of bee NFTs for a given address as a reward from the staking contract, which is the hive. Ensures that the sender has the appropriate "hive" role, the minted amount doesn't exceed the total supply limit, and the contract is not locked._to address - The address to mint the bee NFTs to. _amount uint256 - The number of bee NFTs to mint. /
function hiveMint( address _to, uint256 _amount
function hiveMint( address _to, uint256 _amount
3,802
459
// Cashing out the perpetual internally
_closePerpetual(perpetualID, perpetual);
_closePerpetual(perpetualID, perpetual);
30,212
672
// Revokes permission if allowed. This requires `msg.sender` to be the the permission managerRevoke from `_entity` the ability to perform actions requiring `_role` on `_app`_entity Address of the whitelisted entity to revoke access from_app Address of the app in which the role will be revoked_role Identifier for the group of actions in app being revoked/
function revokePermission(address _entity, address _app, bytes32 _role) external onlyPermissionManager(_app, _role)
function revokePermission(address _entity, address _app, bytes32 _role) external onlyPermissionManager(_app, _role)
62,850
9
// Event for token purchase loggingsimilar to TokenPurchase without the token amount purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase /
event SaleContribution(address indexed purchaser, address indexed beneficiary, uint256 value);
event SaleContribution(address indexed purchaser, address indexed beneficiary, uint256 value);
37,923
56
// isCreator()
{ if (!isPaired[myTransId]){ tradePairAddress[myTransId] = trader; tradePairId[myTransId] = traderTransactionId; isPaired[myTransId] = true; emit PairedWith(myTransId, trader, traderTransactionId); }else{ emit HadPairedWith(myTransId, trader, traderTransactionId); } // confirmTransaction(myTransId); }
{ if (!isPaired[myTransId]){ tradePairAddress[myTransId] = trader; tradePairId[myTransId] = traderTransactionId; isPaired[myTransId] = true; emit PairedWith(myTransId, trader, traderTransactionId); }else{ emit HadPairedWith(myTransId, trader, traderTransactionId); } // confirmTransaction(myTransId); }
12,984
108
// if the stake is closed return the interest, otherwise calculate it in real time
if(stakesOfOwner[_ownerAccount][i].closed == true){ interest_r[i] = stakesOfOwner[_ownerAccount][i].interest; }else{
if(stakesOfOwner[_ownerAccount][i].closed == true){ interest_r[i] = stakesOfOwner[_ownerAccount][i].interest; }else{
28,823
24
// set the presale and pledge time only by admin /
function setAllTime(uint256 _preSaleTime, uint256 _preSaleEndTime, uint256 _pledgeTime) external onlyOwner
function setAllTime(uint256 _preSaleTime, uint256 _preSaleEndTime, uint256 _pledgeTime) external onlyOwner
1,111
26
// Returns data about the RRs (if any) known to this oracle with the provided type and name. dnstype The DNS record type to query. name The name to query, in DNS label-sequence format.return inception The unix timestamp at which the signature for this RRSET was created.return inserted The unix timestamp at which this RRSET was inserted into the oracle.return hash The hash of the RRset that was inserted. /
function rrdata(uint16 dnstype, bytes calldata name) external view returns (uint32, uint64, bytes20) { RRSet storage result = rrsets[keccak256(name)][dnstype]; return (result.inception, result.inserted, result.hash); }
function rrdata(uint16 dnstype, bytes calldata name) external view returns (uint32, uint64, bytes20) { RRSet storage result = rrsets[keccak256(name)][dnstype]; return (result.inception, result.inserted, result.hash); }
18,469
8
// get list of investors
function getPools(uint256 _id) public view returns (address[] memory) { return (startups[_id].pools); }
function getPools(uint256 _id) public view returns (address[] memory) { return (startups[_id].pools); }
28,032
828
// fetch discount rate
uint256 discountRate = rates[rateId];
uint256 discountRate = rates[rateId];
53,243
16
// Use an attack power-up to attack two other players at once The power-up is burned after use victim1 The first victim's address victim2 The second victim's address /
function useAttackPowerUp(address victim1, address victim2) external gameNotPaused { require(balanceOf[msg.sender][4] > 0, "You need an Attack power-up to perform this action"); require(victim1 != address(0) && victim2 != address(0), "Invalid victim address"); // Burn the attack power-up _burn(msg.sender, 4, 1); // Attack the first victim _attack(msg.sender, victim1); // Attack the second victim _attack(msg.sender, victim2); }
function useAttackPowerUp(address victim1, address victim2) external gameNotPaused { require(balanceOf[msg.sender][4] > 0, "You need an Attack power-up to perform this action"); require(victim1 != address(0) && victim2 != address(0), "Invalid victim address"); // Burn the attack power-up _burn(msg.sender, 4, 1); // Attack the first victim _attack(msg.sender, victim1); // Attack the second victim _attack(msg.sender, victim2); }
26,723
24
// See transfer.
function _transfer( address from, address to, uint256 amount
function _transfer( address from, address to, uint256 amount
32,231
18
// TODO bad practice
Tender storage tender = tenders[_tender]; tender.contributions[msg.sender].push(Order(-amount, now)); tender.currentBalance -= amount;
Tender storage tender = tenders[_tender]; tender.contributions[msg.sender].push(Order(-amount, now)); tender.currentBalance -= amount;
8,000
192
// Hashes the `fees` array as part of computing the EIP-712 hash of an `ERC721Order` or `ERC1155Order`.
function _feesHash(Fee[] memory fees) private pure returns (bytes32 feesHash) { uint256 numFees = fees.length; // We give `fees.length == 0` and `fees.length == 1` // special treatment because we expect these to be the most common. if (numFees == 0) { feesHash = _EMPTY_ARRAY_KECCAK256; } else if (numFees == 1) { // feesHash = keccak256(abi.encodePacked(keccak256(abi.encode( // _FEE_TYPE_HASH, // fees[0].recipient, // fees[0].amount, // keccak256(fees[0].feeData) // )))); Fee memory fee = fees[0]; bytes32 dataHash = keccak256(fee.feeData); assembly { // Load free memory pointer let mem := mload(64) mstore(mem, _FEE_TYPE_HASH) // fee.recipient mstore(add(mem, 32), and(ADDRESS_MASK, mload(fee))) // fee.amount mstore(add(mem, 64), mload(add(fee, 32))) // keccak256(fee.feeData) mstore(add(mem, 96), dataHash) mstore(mem, keccak256(mem, 128)) feesHash := keccak256(mem, 32) } } else { bytes32[] memory feeStructHashArray = new bytes32[](numFees); for (uint256 i = 0; i < numFees; i++) { feeStructHashArray[i] = keccak256(abi.encode(_FEE_TYPE_HASH, fees[i].recipient, fees[i].amount, keccak256(fees[i].feeData))); } assembly { feesHash := keccak256(add(feeStructHashArray, 32), mul(numFees, 32)) } } }
function _feesHash(Fee[] memory fees) private pure returns (bytes32 feesHash) { uint256 numFees = fees.length; // We give `fees.length == 0` and `fees.length == 1` // special treatment because we expect these to be the most common. if (numFees == 0) { feesHash = _EMPTY_ARRAY_KECCAK256; } else if (numFees == 1) { // feesHash = keccak256(abi.encodePacked(keccak256(abi.encode( // _FEE_TYPE_HASH, // fees[0].recipient, // fees[0].amount, // keccak256(fees[0].feeData) // )))); Fee memory fee = fees[0]; bytes32 dataHash = keccak256(fee.feeData); assembly { // Load free memory pointer let mem := mload(64) mstore(mem, _FEE_TYPE_HASH) // fee.recipient mstore(add(mem, 32), and(ADDRESS_MASK, mload(fee))) // fee.amount mstore(add(mem, 64), mload(add(fee, 32))) // keccak256(fee.feeData) mstore(add(mem, 96), dataHash) mstore(mem, keccak256(mem, 128)) feesHash := keccak256(mem, 32) } } else { bytes32[] memory feeStructHashArray = new bytes32[](numFees); for (uint256 i = 0; i < numFees; i++) { feeStructHashArray[i] = keccak256(abi.encode(_FEE_TYPE_HASH, fees[i].recipient, fees[i].amount, keccak256(fees[i].feeData))); } assembly { feesHash := keccak256(add(feeStructHashArray, 32), mul(numFees, 32)) } } }
2,553
5
// A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
270
158
// in case the charity wallet needs to be updated
_feeWallet = payable(newWallet);
_feeWallet = payable(newWallet);
33,474
123
// deposit and stake
uint lpAmount = _deposit(_amount.add(claimedUnderlyingCoinAmount)); _stake(lpAmount); uint investLpAmount = lpAmount.mul(_amount).div(_amount.add(claimedUnderlyingCoinAmount));
uint lpAmount = _deposit(_amount.add(claimedUnderlyingCoinAmount)); _stake(lpAmount); uint investLpAmount = lpAmount.mul(_amount).div(_amount.add(claimedUnderlyingCoinAmount));
3,176
46
// burnable
event Burn(address indexed burner, uint256 value);
event Burn(address indexed burner, uint256 value);
10,267
10
// 10% and pot reserve for next round
residualBalance += poolBalance / 5 * 10 / 100 + potReserve; winner.push(keyAddress);
residualBalance += poolBalance / 5 * 10 / 100 + potReserve; winner.push(keyAddress);
39,272
60
// Returnes number of holders in array. /
function returnPayees () public constant returns (uint){ uint _ammount; _ammount= payees.length; return _ammount; }
function returnPayees () public constant returns (uint){ uint _ammount; _ammount= payees.length; return _ammount; }
84,751
53
// total ETH deposited by all contributors
uint256 public totalContributedToParty;
uint256 public totalContributedToParty;
22,485
37
// only allow execute to signers to avoid someone set an approved script failed by calling it with low gaslimit
require(isSigner[msg.sender], "sender must be signer"); Script storage script = scripts[scriptAddress]; require(script.state == ScriptState.Approved, "script state must be Approved");
require(isSigner[msg.sender], "sender must be signer"); Script storage script = scripts[scriptAddress]; require(script.state == ScriptState.Approved, "script state must be Approved");
7,208
235
// Accessory N°6 => Power Pole
function item_6() public pure returns (string memory) { return base( string( abi.encodePacked( '<path fill="#FF6F4F" stroke="#000000" stroke-width="0.75" stroke-miterlimit="10" d="M272.3,331.9l55.2-74.4c0,0,3,4.3,8.7,7.5l-54,72.3"/>', '<polygon fill="#BA513A" points="335.9,265.3 334.2,264.1 279.9,336.1 281.8,337.1"/>', '<ellipse transform="matrix(0.6516 -0.7586 0.7586 0.6516 -82.3719 342.7996)" fill="#B54E36" stroke="#000000" stroke-width="0.25" stroke-miterlimit="10" cx="332" cy="261.1" rx="1.2" ry="6.1"/>', '<path fill="none" stroke="#B09E00" stroke-miterlimit="10" d="M276.9,335.3c-52.7,31.1-119.3,49.4-120.7,49"/>' ) ) ); }
function item_6() public pure returns (string memory) { return base( string( abi.encodePacked( '<path fill="#FF6F4F" stroke="#000000" stroke-width="0.75" stroke-miterlimit="10" d="M272.3,331.9l55.2-74.4c0,0,3,4.3,8.7,7.5l-54,72.3"/>', '<polygon fill="#BA513A" points="335.9,265.3 334.2,264.1 279.9,336.1 281.8,337.1"/>', '<ellipse transform="matrix(0.6516 -0.7586 0.7586 0.6516 -82.3719 342.7996)" fill="#B54E36" stroke="#000000" stroke-width="0.25" stroke-miterlimit="10" cx="332" cy="261.1" rx="1.2" ry="6.1"/>', '<path fill="none" stroke="#B09E00" stroke-miterlimit="10" d="M276.9,335.3c-52.7,31.1-119.3,49.4-120.7,49"/>' ) ) ); }
34,012
2
// This is safe from underflow - `swapFee` cannot exceed `MAX_FEE` per previous check.
unchecked { MAX_FEE_MINUS_SWAP_FEE = MAX_FEE - _swapFee; }
unchecked { MAX_FEE_MINUS_SWAP_FEE = MAX_FEE - _swapFee; }
10,766
151
// lets now check the last tx time is less than the
if(lastTxDuration < throttledAccountInfo.timeIntervalPerTx ) { uint256 nextTxTimeInSecs = (throttledAccountInfo.timeIntervalPerTx.sub(lastTxDuration)).div(1000); revert( string(abi.encodePacked("CADA:","ACCOUNT_THROTTLED_SEND_AFTER_", nextTxTimeInSecs)) ); } //end if
if(lastTxDuration < throttledAccountInfo.timeIntervalPerTx ) { uint256 nextTxTimeInSecs = (throttledAccountInfo.timeIntervalPerTx.sub(lastTxDuration)).div(1000); revert( string(abi.encodePacked("CADA:","ACCOUNT_THROTTLED_SEND_AFTER_", nextTxTimeInSecs)) ); } //end if
7,192
8
// disburse funds
uint256 amount = msg.value; uint256 factoryShare = (amount *10) / 100; uint256 remainingShare = amount - factoryShare;
uint256 amount = msg.value; uint256 factoryShare = (amount *10) / 100; uint256 remainingShare = amount - factoryShare;
1,331