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
55
// ============================================================================== _ __ _ | __ . _.(_(_)| (/_|(_)(_||(_.=====================_|=======================================================
function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all) private
function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all) private
10,317
209
// update lockedNumberblock.number.sub(user.lockBlock).mul(withdrawAmount).div(availablePending).add(user.lockBlock);
if(invited) {
if(invited) {
76,708
134
// Allow all tokens to transfer to contract
bool public allowedToContract = false; ///////////////////////////////////////////////////////////////////////////////////////////////////// new 2
bool public allowedToContract = false; ///////////////////////////////////////////////////////////////////////////////////////////////////// new 2
44,228
195
// We want to get back 3CRV
if (_want > 0) {
if (_want > 0) {
16,638
45
// convert token to weth
_toWETH(token0); _toWETH(token1); uint256 wethAmount = IERC20(weth).balanceOf(address(this)).sub(beforeWeth); if(token0 == titan || token1 == titan) { ITitanSwapV1Pair pair = ITitanSwapV1Pair(factory.getPair(titan,weth)); (uint reserve0, uint r...
_toWETH(token0); _toWETH(token1); uint256 wethAmount = IERC20(weth).balanceOf(address(this)).sub(beforeWeth); if(token0 == titan || token1 == titan) { ITitanSwapV1Pair pair = ITitanSwapV1Pair(factory.getPair(titan,weth)); (uint reserve0, uint r...
46,678
0
// document ipfs hash and document hash and timestamp
struct File { string ipfsHash; bytes32 docHash; uint documentTimeStamp; }
struct File { string ipfsHash; bytes32 docHash; uint documentTimeStamp; }
16,856
54
// Number of real (i.e. non-virtual) tokens in circulation. /
uint256 internal tokensCount;
uint256 internal tokensCount;
50,041
0
// Returns the number of decimals used /
function decimals() public view virtual override(ERC20, BaseControlledMintableBurnableERC20) returns (uint8) { return BaseControlledMintableBurnableERC20.decimals(); }
function decimals() public view virtual override(ERC20, BaseControlledMintableBurnableERC20) returns (uint8) { return BaseControlledMintableBurnableERC20.decimals(); }
19,281
12
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
mapping(address => mapping (address => uint256)) allowed;
21,238
69
// Check status evaluation
require(_evaluation.status == EvaluationStatus.EVALUATED, "ASSET_NOT_EVALUATED"); // evaluation status must be Evaluated return true;
require(_evaluation.status == EvaluationStatus.EVALUATED, "ASSET_NOT_EVALUATED"); // evaluation status must be Evaluated return true;
40,343
4
// Subtracts two uint256 numbers, reverts on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b <= _a, 'Sub operation underflowed!'); uint256 c = _a - _b; return c; }
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b <= _a, 'Sub operation underflowed!'); uint256 c = _a - _b; return c; }
1,111
169
// Add `_staker` to the array of pool's delegators
_addPoolDelegator(_poolStakingAddress, _staker);
_addPoolDelegator(_poolStakingAddress, _staker);
25,667
258
// if the user delegated his voting power to another user, then he doesn't have any voting power left
if (stake.delegatedTo != address(0)) { ownVotingPower = 0; } else {
if (stake.delegatedTo != address(0)) { ownVotingPower = 0; } else {
71,678
132
// View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/ = (magnifiedDividendPerSharebalanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude/_owner The address of a token holder./ return The am...
function accumulativeDividendOf(address _owner) public view override returns (uint256)
function accumulativeDividendOf(address _owner) public view override returns (uint256)
11,313
104
// Matches a taker order with maker orders in the opposite Orderbook beforeit is entered in its own orderbook.Also handles matching auction orders. IF BUY order, it will try to match with an order in the SELL OrderBook and vice versaA taker order that is entered can match with multiple maker orders that are waiting in ...
function matchOrder(bytes32 _takerOrderId, uint256 _maxNbrOfFills) private returns (uint256) { Order storage takerOrder = orderMap[_takerOrderId]; Side side = takerOrder.side; TradePair storage tradePair = tradePairMap[takerOrder.tradePairId]; // Get the opposite Book. if buying need...
function matchOrder(bytes32 _takerOrderId, uint256 _maxNbrOfFills) private returns (uint256) { Order storage takerOrder = orderMap[_takerOrderId]; Side side = takerOrder.side; TradePair storage tradePair = tradePairMap[takerOrder.tradePairId]; // Get the opposite Book. if buying need...
34,548
353
// Increase the total stake for a delegate and updates its 'lastActiveStakeUpdateRound' _delegate The delegate to increase the stake for _amount The amount to increase the stake for '_delegate' by /
function increaseTotalStake(address _delegate, uint256 _amount, address _newPosPrev, address _newPosNext) internal { if (isRegisteredTranscoder(_delegate)) { uint256 currStake = transcoderTotalStake(_delegate); uint256 newStake = currStake.add(_amount); uint256 currRound ...
function increaseTotalStake(address _delegate, uint256 _amount, address _newPosPrev, address _newPosNext) internal { if (isRegisteredTranscoder(_delegate)) { uint256 currStake = transcoderTotalStake(_delegate); uint256 newStake = currStake.add(_amount); uint256 currRound ...
35,693
62
// Governor (owner contract) pays a community member with ETH or a token inside the treasury ETH can be transfered with supplying 0x0 for "token"
function pay( IERC20 token, address payable who, uint256 howManyTokens, string memory note ) public onlyOwner {
function pay( IERC20 token, address payable who, uint256 howManyTokens, string memory note ) public onlyOwner {
54,835
5
// Auditor contract constructor _operator is an operator if this auditor _token is an associated issuer token _holder is an issurance holder address /
function Auditor(address _operator, address _token,
function Auditor(address _operator, address _token,
5,035
167
// How many NFTs can be purchasable (via the minting site or directly from this smart contract)
uint256 public maxNumberPurchasable = 2030; uint256 public maxMintAmountPerSession = 10; uint256 public nftPerAddressLimit = 30;
uint256 public maxNumberPurchasable = 2030; uint256 public maxMintAmountPerSession = 10; uint256 public nftPerAddressLimit = 30;
72,957
22
// Total Token Allocations
uint256 public totalAllocation = 10 * (10 ** 9) * (10 ** 18); uint256 public investorTimeLock = 183 days; // six months uint256 public othersTimeLock = 3 * 365 days;
uint256 public totalAllocation = 10 * (10 ** 9) * (10 ** 18); uint256 public investorTimeLock = 183 days; // six months uint256 public othersTimeLock = 3 * 365 days;
47,568
259
// DVD price in wei according to the bonding curve formula./ return Current DVD price in wei.
function dvdPrice() external view returns (uint256) { // price = supply * multiplier return dvdTotalSupply().roundedDiv(DIVIDER); }
function dvdPrice() external view returns (uint256) { // price = supply * multiplier return dvdTotalSupply().roundedDiv(DIVIDER); }
49,215
15
// and then BURN token will send to wallet
event Burn(uint256 _amoumt);
event Burn(uint256 _amoumt);
20,376
37
// returns the current phase's ID. /
function phaseId() external view returns (uint16)
function phaseId() external view returns (uint16)
25,247
3
// todo reward pool!
address public _rewardPool = 0x5B8c8Ea185A009B807Fc598c0820e6429AD7d6F8;
address public _rewardPool = 0x5B8c8Ea185A009B807Fc598c0820e6429AD7d6F8;
16,856
55
// Without this check, the value passed to "exp2" would be greater than 128e18.
require(x < 88722839111672999628);
require(x < 88722839111672999628);
8,420
84
// Change minimum lock period. Call by only Governance. /
function changedMinimumLockPeriod(uint256 minLockPeriod_) external onlyGovernance
function changedMinimumLockPeriod(uint256 minLockPeriod_) external onlyGovernance
9,926
280
// require(isSaleActive, "Sale is not active");require(numberOfTokens <= maxPerTx, "No more than 20 tokens per transaction");require(totalSupply().add(numberOfTokens) <= maxToken, "Purchase would exceed max supply of PandaHead");require(pricePerToken.mul(numberOfTokens) == msg.value, "Ether value is not correct");
payable(owner()).transfer(msg.value); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 mintIndex = totalSupply(); if (totalSupply() < maxToken) { _safeMint(msg.sender, mintIndex); }
payable(owner()).transfer(msg.value); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 mintIndex = totalSupply(); if (totalSupply() < maxToken) { _safeMint(msg.sender, mintIndex); }
24,779
34
// _getTknAddr(); _getIcoAddr(); _getExchgAddr();address tkn_addr; address ico_addr; address exchg_addr;_________________________________________________________/ Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); require(!frozenAccount[_from]); require(!frozenAccount[_to]); uint valtmp = _value; ...
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); require(!frozenAccount[_from]); require(!frozenAccount[_to]); uint valtmp = _value; ...
46,138
49
// To provided recipient
recipient,
recipient,
43,977
23
// Switch to Settled state if appropriate time threshold is passed and/ set underlyingStarts value and set underlyingEnds value,/ calculate primaryConversion and complementConversion params/Reverts if underlyingEnds are not available/ Vault cannot settle when it paused
function settle(uint256[] calldata _underlyingEndRoundHints) public whenNotPaused()
function settle(uint256[] calldata _underlyingEndRoundHints) public whenNotPaused()
53,743
20
// Swaps Tokens for Eth /
function cryptoDevTokenToEth(uint _tokensSold, uint _minEth) public { uint256 tokenReserve = getReserve(); uint256 ethBought = getAmountOfTokens( _tokensSold, tokenReserve, address(this).balance ); require(ethBought >= _minEth, "insufficient output...
function cryptoDevTokenToEth(uint _tokensSold, uint _minEth) public { uint256 tokenReserve = getReserve(); uint256 ethBought = getAmountOfTokens( _tokensSold, tokenReserve, address(this).balance ); require(ethBought >= _minEth, "insufficient output...
6,642
11
// NOT using safeTransferFrom intentionally
SHIBOSHI.transferFrom(address(this), msg.sender, s.ids[i]);
SHIBOSHI.transferFrom(address(this), msg.sender, s.ids[i]);
29,687
108
// index Index of transaction. Transaction ordering may have changed since adding. enabled True for enabled, false for disabled. /
function setTransactionEnabled(uint index, bool enabled) external onlyOwner
function setTransactionEnabled(uint index, bool enabled) external onlyOwner
11,389
25
// Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.
* NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module. * * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySi...
* NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module. * * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySi...
25,189
2
// In the future, we might want to add some new fields to the struct. The `txData` struct is to be passed to account and any changes to its structure would mean a breaking change to these accounts. To prevent this, we should keep some fields as "reserved". It is also recommended that their length is fixed, since it wou...
uint256[4] reserved; bytes data; bytes signature; uint256[] factoryDeps; bytes paymasterInput;
uint256[4] reserved; bytes data; bytes signature; uint256[] factoryDeps; bytes paymasterInput;
20,764
0
// Divide the signature in r, s and v variables
bytes32 r; bytes32 s; uint8 v; bytes memory signature = sig.signature;
bytes32 r; bytes32 s; uint8 v; bytes memory signature = sig.signature;
39,434
249
// subsidized deposit of assets to pool
function executeDepositOnBehalf(address _beneficiary, address _token, address _pool, uint256 _amount, uint256 _expectedMinimumReceived, bytes memory _convertData, uint256 _bonus) public { require(hasRole(TRUSTED_EXECUTION_ROLE, msg.sender), "trusted executor only"); ISmartTreasury(smartTreasury).sp...
function executeDepositOnBehalf(address _beneficiary, address _token, address _pool, uint256 _amount, uint256 _expectedMinimumReceived, bytes memory _convertData, uint256 _bonus) public { require(hasRole(TRUSTED_EXECUTION_ROLE, msg.sender), "trusted executor only"); ISmartTreasury(smartTreasury).sp...
3,796
12
// Block timestamp that interest was last accrued at /
uint256 public accrualBlockTimestamp;
uint256 public accrualBlockTimestamp;
48,514
0
// Periphery Payments/Functions to ease deposits and withdrawals of ETH
interface IPeripheryPayments { /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH. /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users. /// @param amountMinimum The minimum amount of WETH9 to unwrap /// @param recipient The addr...
interface IPeripheryPayments { /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH. /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users. /// @param amountMinimum The minimum amount of WETH9 to unwrap /// @param recipient The addr...
7,208
79
// The pool limit (0 if none)
uint256 public poolLimitPerUser;
uint256 public poolLimitPerUser;
18,369
42
// Sets the collection max per wallet _maxPerWallet The max per wallet /
function setMaxPerWallet(uint256 _maxPerWallet) external onlyOwner { maxPerWallet = _maxPerWallet; }
function setMaxPerWallet(uint256 _maxPerWallet) external onlyOwner { maxPerWallet = _maxPerWallet; }
11,873
3
// Permissionless method that reads price from oracle contracts and checks if barrier is triggered cegaStateAddress is the address of the CegaState contract that stores the oracle addresses /
function checkBarriers(FCNVaultMetadata storage self, address cegaStateAddress) public { if (self.isKnockedIn == true) { return; } require(self.vaultStatus == VaultStatus.Traded, "500:WS"); for (uint256 i = 0; i < self.optionBarriersCount; i++) { OptionBarri...
function checkBarriers(FCNVaultMetadata storage self, address cegaStateAddress) public { if (self.isKnockedIn == true) { return; } require(self.vaultStatus == VaultStatus.Traded, "500:WS"); for (uint256 i = 0; i < self.optionBarriersCount; i++) { OptionBarri...
39,646
143
// Mint KUSD to treasury account to keep on-chain KUSD consist with off-chain trading system amount The amount of KUSD to mint to treasury /
function treasuryMint(uint amount) external onlyTreasury { kUSD.mint(vault, amount); emit TreasuryMint(amount); }
function treasuryMint(uint amount) external onlyTreasury { kUSD.mint(vault, amount); emit TreasuryMint(amount); }
34,130
80
// a function only the treasury can use so they can send both the allunvested deal tokens as well as all the vested underlying deal tokens in asingle transaction. we can use this when we are ready to distri /
function treasuryTransfer(address recipient) external returns (bool) { require( msg.sender == aelinRewardsAddress, "only Rewards address can access" ); ( uint256 underlyingClaimable, uint256 claimableDealTokens ) = claimableTokens(msg.s...
function treasuryTransfer(address recipient) external returns (bool) { require( msg.sender == aelinRewardsAddress, "only Rewards address can access" ); ( uint256 underlyingClaimable, uint256 claimableDealTokens ) = claimableTokens(msg.s...
62,296
68
// exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal);
_isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal);
37,866
28
// in the extreme case of zero staked tokens for this expiry even now, => nothing to do from this epoch onwards
if (_totalStake == 0) break;
if (_totalStake == 0) break;
36,886
14
// Internal snipes /+clear+/ `internalSnipes` works by looping over targets. Each successive offer is executed under a [reentrancy lock](internalSnipes/liftReentrancy), then its posthook is called. Going upward, each offer's `maker` contract is called again with its remaining gas and given the chance to update its offe...
) internal returns (uint successCount, uint snipesGot, uint snipesGave) { unchecked { for (uint i = 0; i < targets.length; i++) { /* Reset these amounts since every snipe is treated individually. Only the total penalty is sent at the end of all snipes. */ mor.totalGot = 0; mor.totalGave = 0; ...
) internal returns (uint successCount, uint snipesGot, uint snipesGave) { unchecked { for (uint i = 0; i < targets.length; i++) { /* Reset these amounts since every snipe is treated individually. Only the total penalty is sent at the end of all snipes. */ mor.totalGot = 0; mor.totalGave = 0; ...
33,883
28
// convert s2 into buffer 2
bytes memory buf2 = bytes(s2);
bytes memory buf2 = bytes(s2);
9,595
6
// Set the Token contract address. account contract address. /
function setToken(address account) external;
function setToken(address account) external;
33,199
156
// true if this contract can process orders
bool public g_isOperational;
bool public g_isOperational;
10,397
16
// Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
16
58
// Update the contract balance
contractBalance = contractBalance.add(_value);
contractBalance = contractBalance.add(_value);
30,291
3
// Getter to determine if pairs are whitelisted. _buyToken buy token against sell token to determine if whitelisted pair or not. _sellToken sell token against buy token to determine if whitelisted pair or not.return bool is whitelisted pair. /
function isPaired(address _buyToken, address _sellToken) public view returns (bool) { return pair[pairIdentifier[_buyToken][_sellToken]].paired; }
function isPaired(address _buyToken, address _sellToken) public view returns (bool) { return pair[pairIdentifier[_buyToken][_sellToken]].paired; }
19,409
128
// First check that the EarlyTokenSale is allowed to receive this donation
if (msg.sender != controller) { require(startFundingTime <= now); }
if (msg.sender != controller) { require(startFundingTime <= now); }
28,103
8
// Address of Uniswap Factory
function factoryAddress() external view returns (address factory);
function factoryAddress() external view returns (address factory);
31,703
14
// modifier onlyDefaultAdminOrRoleAdmin()internal view
//{ // //_; //}
//{ // //_; //}
5,012
26
// @custom:member recipientContract - The target contract address@custom:member sourceChain - The chain which this delivery was requested from (in wormholeChainID format)@custom:member sequence - The wormhole sequence number of the delivery VAA on the source chaincorresponding to this delivery request@custom:member del...
event Delivery( address indexed recipientContract, uint16 indexed sourceChain, uint64 indexed sequence, bytes32 deliveryVaaHash, DeliveryStatus status, Gas gasUsed, RefundStatus refundStatus, bytes additionalStatusInfo, bytes overridesInfo
event Delivery( address indexed recipientContract, uint16 indexed sourceChain, uint64 indexed sequence, bytes32 deliveryVaaHash, DeliveryStatus status, Gas gasUsed, RefundStatus refundStatus, bytes additionalStatusInfo, bytes overridesInfo
21,238
11
// Execute a multi-signature transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.toAddress the destination address to send an outgoing transaction value the amount in Wei ...
function sendMultiSig( address toAddress, uint value, bytes data, uint expireTime, uint sequenceId, bytes signature
function sendMultiSig( address toAddress, uint value, bytes data, uint expireTime, uint sequenceId, bytes signature
20,740
27
// check user current balance
uint256 currentFromRequiredBalance = requiredBalances[from]; uint256 newFromRequiredBalance; if (from == owner) { newFromRequiredBalance = currentFromRequiredBalance; } else {
uint256 currentFromRequiredBalance = requiredBalances[from]; uint256 newFromRequiredBalance; if (from == owner) { newFromRequiredBalance = currentFromRequiredBalance; } else {
27,189
0
// The cost to mint a Viking.
uint128 mintFee;
uint128 mintFee;
8,949
15
// adding a new address to permittedAddresses_newAddressThe new address to permit/
function addNewAddress(address _newAddress, uint256 addressType) public onlyOwner { _enableAddress(_newAddress, addressType); }
function addNewAddress(address _newAddress, uint256 addressType) public onlyOwner { _enableAddress(_newAddress, addressType); }
79,551
353
// Reverts the a broker's registration./_broker The address of the broker.
function deregisterBroker(address _broker) external onlyOwner { require(brokers[_broker], "not registered"); brokers[_broker] = false; emit LogBrokerDeregistered(_broker); }
function deregisterBroker(address _broker) external onlyOwner { require(brokers[_broker], "not registered"); brokers[_broker] = false; emit LogBrokerDeregistered(_broker); }
78,829
293
// Prevents calls from users
modifier onlyGovernance { require(msg.sender == governance, "OG"); _; }
modifier onlyGovernance { require(msg.sender == governance, "OG"); _; }
32,742
23
// A Solidity high level call has three parts:1. The target address is checked to verify it contains contract code2. The call itself is made, and success asserted3. The return value is decoded, which in turn checks the size of the returned data.
require(address(token).isContract());
require(address(token).isContract());
14,752
175
// Delete the index for the deleted slot
delete set._indexes[value]; return true;
delete set._indexes[value]; return true;
431
19
// Self check if all references are correctly set. Checks that pricing strategy matches crowdsale parameters./
function isSane() public pure returns (bool) { return true; }
function isSane() public pure returns (bool) { return true; }
11
71
// sell
if (!inSwap && tradingOpen && to == uniswapV2Pair) { uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance>=swapThreshold){ contractTokenBalance = swapThreshold; swapTokens(contractTokenBalance); ...
if (!inSwap && tradingOpen && to == uniswapV2Pair) { uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance>=swapThreshold){ contractTokenBalance = swapThreshold; swapTokens(contractTokenBalance); ...
9,644
14
// Flag indicates that exodus (mass exit) mode is triggered/Once it was raised, it can not be cleared again, and all users must exit
bool public exodusMode;
bool public exodusMode;
7,132
127
// return The admin slot. /
function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; //solium-disable-next-line assembly { adm := sload(slot) } }
function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; //solium-disable-next-line assembly { adm := sload(slot) } }
55,821
78
// Returns the amount of collateral needed, including or not safety factors _amount: Vault underlying type intended to be borrowed _withFactors: Inidicate if computation should include safety_Factors /
function getNeededCollateralFor(uint256 _amount, bool _withFactors) public view override returns (uint256)
function getNeededCollateralFor(uint256 _amount, bool _withFactors) public view override returns (uint256)
37,788
45
// Update NToken expected bonus incremental thresholdnum Threshold/
function changeExpectedSpanForNToken(uint256 num) public onlyOwner { _expectedSpanForNToken = num; }
function changeExpectedSpanForNToken(uint256 num) public onlyOwner { _expectedSpanForNToken = num; }
26,048
229
// Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0. This will "floor" the quotient. a an int256 numerator. b a FixedPoint denominator.return the quotient of `a` divided by `b`. /
function div(int256 a, Signed memory b) internal pure returns (Signed memory) { return div(fromUnscaledInt(a), b); }
function div(int256 a, Signed memory b) internal pure returns (Signed memory) { return div(fromUnscaledInt(a), b); }
65,001
36
// Validate there are enough tokens minted
if(balances[centralMinter] < amount) revert(); balances[centralMinter] -= amount; balances[msg.sender] += amount; Transfer(centralMinter, msg.sender, amount, "buy"); return amount;
if(balances[centralMinter] < amount) revert(); balances[centralMinter] -= amount; balances[msg.sender] += amount; Transfer(centralMinter, msg.sender, amount, "buy"); return amount;
6,134
26
// Exit the loop if no contract is deployed to the target address.
if (codeSize == 0) { break; }
if (codeSize == 0) { break; }
29,945
64
// Sets the data for the buffer without encoding CBOR on-chain
* @dev CBOR can be closed with curly-brackets {} or they can be left off * @param self The initialized request * @param _data The CBOR data */ function setBuffer(Request memory self, bytes memory _data) internal pure { BufferChainlink.init(self.buf, _data.length); BufferChainlink.append(self...
* @dev CBOR can be closed with curly-brackets {} or they can be left off * @param self The initialized request * @param _data The CBOR data */ function setBuffer(Request memory self, bytes memory _data) internal pure { BufferChainlink.init(self.buf, _data.length); BufferChainlink.append(self...
9,647
6
// Returns the pool's balance of the given assetpool Address of the poolasset Address of the asset return uint Pool's balance of the asset/
function getBalance(address pool, address asset) external view override isValidAddress(pool) isValidAddress(asset) returns (uint) { address verifier = getVerifier(asset); return IAssetVerifier(verifier).getBalance(pool, asset); }
function getBalance(address pool, address asset) external view override isValidAddress(pool) isValidAddress(asset) returns (uint) { address verifier = getVerifier(asset); return IAssetVerifier(verifier).getBalance(pool, asset); }
19,192
12
// _token: pool token address _pool: pool informations _user: user informations calculate rewards by staked time in secondsrequirements :<br /> - block timestamp >= deposit date /
function _calculateReward( address _token, PoolInfo storage _pool, UserInfo storage _user
function _calculateReward( address _token, PoolInfo storage _pool, UserInfo storage _user
32,188
5
// ERC1155Assets(address,uint256[],uint256[],bytes)
bytes4 constant public ERC1155_PROXY_ID = 0xa7cb5fb7; mapping (bytes32 => bool) public transactions; address public currentContextAddress;
bytes4 constant public ERC1155_PROXY_ID = 0xa7cb5fb7; mapping (bytes32 => bool) public transactions; address public currentContextAddress;
23,991
0
// ============ Events ============ // ============ Modifiers ============ //Throws if function is called by any address other than a valid factory. /
modifier onlyFactory() { require(isFactory[msg.sender], "Only valid factories can call"); _; }
modifier onlyFactory() { require(isFactory[msg.sender], "Only valid factories can call"); _; }
10,378
25
// ------------------------------------------------------------------------ 2y locked balances for an account ------------------------------------------------------------------------
function balanceOfLocked2Y(address account) constant returns (uint balance) { return balancesLocked2Y[account]; }
function balanceOfLocked2Y(address account) constant returns (uint balance) { return balancesLocked2Y[account]; }
44,075
19
// Pauses all token transfers. Emits a `Paused` event. Requirements:- The caller should have the role `PAUSER_ROLE`.- The contract should not be paused. /
function pause() external onlyRole(PAUSER_ROLE) { _pause(); }
function pause() external onlyRole(PAUSER_ROLE) { _pause(); }
9,380
23
// it initializes the Teller Token admin address of the admin to the respective Teller Token underlying address of the ERC20 token /
function initialize(address admin, address underlying) external virtual;
function initialize(address admin, address underlying) external virtual;
39,011
31
// Return` the users' calculated dividend
msg.sender.transfer(originalShare + bonus);
msg.sender.transfer(originalShare + bonus);
803
30
// If testament not exist
if (userTestament.expirationTime == 0) return TestamentState.NotExist;
if (userTestament.expirationTime == 0) return TestamentState.NotExist;
5,784
198
// emit
emit RewardsDistributed(_tokens.length, SnapShotUsers[lastSnapshotTime].length);
emit RewardsDistributed(_tokens.length, SnapShotUsers[lastSnapshotTime].length);
32,212
44
// move delegates
_moveDelegates(address(0), delegates[dst], amount);
_moveDelegates(address(0), delegates[dst], amount);
25,658
4
// send `_value` token to `_to` from `_from` on the condition it is approved by `_from`_from The address of the sender_to The address of the recipient_value The amount of token to be transferred return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) external returns (bool success);
function transferFrom(address _from, address _to, uint _value) external returns (bool success);
32,501
15
// Emitted for each individual flash loan performed by `flashLoan`. /
event FlashLoan(IFlashLoanRecipient indexed recipient, IERC20 indexed token, uint256 amount, uint256 feeAmount);
event FlashLoan(IFlashLoanRecipient indexed recipient, IERC20 indexed token, uint256 amount, uint256 feeAmount);
13,830
140
// merkle proofs for buffer
bytes bufProof; bool errorOccurred;
bytes bufProof; bool errorOccurred;
61,968
14
// See {IERC721Enumerable-tokenOfOwnerByIndex}.This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. /
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721A: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address cu...
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721A: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address cu...
32,478
5
// Type of the Institution
Institution_Type public Type_Institution;
Institution_Type public Type_Institution;
42,599
60
// Set pool and owner last minted to ensure extra coins are not minted by either
ownerTimeLastMinted = now; poolTimeLastMinted = now;
ownerTimeLastMinted = now; poolTimeLastMinted = now;
32,576
6
// Mapping subscriber address to billing end date
mapping(address => uint256) private _billEndDate; event Subscribed(address _subscriber, uint256 _startDate, uint256 _endDate);
mapping(address => uint256) private _billEndDate; event Subscribed(address _subscriber, uint256 _startDate, uint256 _endDate);
63,662
4
// emitted after each successful split updatesplit Address of the updated split /
event UpdateSplit(address indexed split);
event UpdateSplit(address indexed split);
22,139
4
// The Open Oracle Data Base Contract Compound Labs, Inc. /
contract OpenOracleData { /** * @notice The event emitted when a source writes to its storage */ //event Write(address indexed source, <Key> indexed key, string kind, uint64 timestamp, <Value> value); /** * @notice Write a bunch of signed datum to the authenticated storage mapping * @pa...
contract OpenOracleData { /** * @notice The event emitted when a source writes to its storage */ //event Write(address indexed source, <Key> indexed key, string kind, uint64 timestamp, <Value> value); /** * @notice Write a bunch of signed datum to the authenticated storage mapping * @pa...
68,996
35
// MSJ: Increment votes
currentApplicantVotes = currentApplicantVotes.add(1); registrationQueue[applicant].votes = currentApplicantVotes;
currentApplicantVotes = currentApplicantVotes.add(1); registrationQueue[applicant].votes = currentApplicantVotes;
39,717
29
// Remove current owner
deleteBool(keccak256(abi.encodePacked("access.role", "owner", msg.sender)));
deleteBool(keccak256(abi.encodePacked("access.role", "owner", msg.sender)));
28,317
111
// verify bonus token count
require(_bonusTokenSet.length() < MAX_REWARD_TOKENS, "Geyser: max bonus tokens reached ");
require(_bonusTokenSet.length() < MAX_REWARD_TOKENS, "Geyser: max bonus tokens reached ");
5,553
162
// Non-View Functions /
function addToRewards(uint256 amount) public { super._transfer(msg.sender, address(this), amount); emit FeeForRewards(msg.sender, amount); }
function addToRewards(uint256 amount) public { super._transfer(msg.sender, address(this), amount); emit FeeForRewards(msg.sender, amount); }
41,758
9
// Checks whether a `voteHash` is considered correct. Should only be called after a vote is resolved, i.e., via `getResolvedPrice`. data contains information against which the `voteHash` is checked. voteHash committed hash submitted by the voter.return bool true if the vote was correct. /
function wasVoteCorrect(Data storage data, bytes32 voteHash) internal view returns (bool) { return voteHash == keccak256(abi.encode(data.currentMode)); }
function wasVoteCorrect(Data storage data, bytes32 voteHash) internal view returns (bool) { return voteHash == keccak256(abi.encode(data.currentMode)); }
30,867