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 |
|---|---|---|---|---|
28 | // Copy over the first `submod` bytes of the new data as in case 1 above. | let slengthmod := mod(slength, 32)
let mlengthmod := mod(mlength, 32)
let submod := sub(32, slengthmod)
let mc := add(_postBytes, submod)
let end := add(_postBytes, mlength)
let mask := sub(exp(0x100, submod), 1)
sstore(sc, add(sload(sc), and(mload(mc), mask)))
... | let slengthmod := mod(slength, 32)
let mlengthmod := mod(mlength, 32)
let submod := sub(32, slengthmod)
let mc := add(_postBytes, submod)
let end := add(_postBytes, mlength)
let mask := sub(exp(0x100, submod), 1)
sstore(sc, add(sload(sc), and(mload(mc), mask)))
... | 28,220 |
67 | // If the wallet has a main UTXO hash set, cross-check it with the provided plain-text parameter and get the transaction output value as BTC balance. Otherwise, the BTC balance is just zero. | if (walletMainUtxoHash != bytes32(0)) {
require(
keccak256(
abi.encodePacked(
walletMainUtxo.txHash,
walletMainUtxo.txOutputIndex,
walletMainUtxo.txOutputValue
)
... | if (walletMainUtxoHash != bytes32(0)) {
require(
keccak256(
abi.encodePacked(
walletMainUtxo.txHash,
walletMainUtxo.txOutputIndex,
walletMainUtxo.txOutputValue
)
... | 10,914 |
18 | // sale functions ------------------------------------------------------------------------ | function setSupply(uint256 _MAX_FRENS, uint256 _MAX_MINT_PER_TX) external onlySaleNotActive onlyOwner {
require(_MAX_FRENS >= RESERVED_FRENS, "MAX_FRENS_MUST_GREATER_THAN_RESERVED_FRENS");
MAX_FRENS = _MAX_FRENS;
MAX_MINT_PER_TX = _MAX_MINT_PER_TX;
emit supplyChanged(_MAX_FRENS, _MAX... | function setSupply(uint256 _MAX_FRENS, uint256 _MAX_MINT_PER_TX) external onlySaleNotActive onlyOwner {
require(_MAX_FRENS >= RESERVED_FRENS, "MAX_FRENS_MUST_GREATER_THAN_RESERVED_FRENS");
MAX_FRENS = _MAX_FRENS;
MAX_MINT_PER_TX = _MAX_MINT_PER_TX;
emit supplyChanged(_MAX_FRENS, _MAX... | 77,922 |
64 | // Contract mapping identifiers to accounts / | contract Attestations is IAttestations, Ownable, Initializable, UsingRegistry {
using SafeMath for uint256;
using SafeMath for uint128;
using SafeMath for uint96;
event AttestationsRequested(
bytes32 indexed identifier,
address indexed account,
uint256 attestationsRequested,
address attestati... | contract Attestations is IAttestations, Ownable, Initializable, UsingRegistry {
using SafeMath for uint256;
using SafeMath for uint128;
using SafeMath for uint96;
event AttestationsRequested(
bytes32 indexed identifier,
address indexed account,
uint256 attestationsRequested,
address attestati... | 49,709 |
5 | // quantity of ERC-20 deposited as collateral in the vault for each ERC-20 address in collateralAssets | uint256[] collateralAmounts;
| uint256[] collateralAmounts;
| 14,464 |
50 | // find max mostF1Earnerd | softMostF1(refAdress);
| softMostF1(refAdress);
| 33,656 |
70 | // Burn pxCVX | pxCvx.burn(msg.sender, assets);
emit Stake(rounds, f, assets, receiver);
| pxCvx.burn(msg.sender, assets);
emit Stake(rounds, f, assets, receiver);
| 17,681 |
4 | // The VestedERC20 used as the template for all clones created | VestedERC20 public immutable implementation;
constructor(VestedERC20 implementation_) {
implementation = implementation_;
}
| VestedERC20 public immutable implementation;
constructor(VestedERC20 implementation_) {
implementation = implementation_;
}
| 6,988 |
1,694 | // Information about reserves/_tokenAddresses Array of tokens addresses/ return tokens Array of reserves infomartion | function getTokensInfo(address[] memory _tokenAddresses) public view returns(TokenInfo[] memory tokens) {
address lendingPoolCoreAddress = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES).getLendingPoolCore();
address priceOracleAddress = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES... | function getTokensInfo(address[] memory _tokenAddresses) public view returns(TokenInfo[] memory tokens) {
address lendingPoolCoreAddress = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES).getLendingPoolCore();
address priceOracleAddress = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES... | 31,645 |
1 | // queried by others ({ERC165Checker}).For an implementation, see {ERC165}./ Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30 000 gas. / | function supportsInterface(bytes4 interfaceId) external view returns (bool);
| function supportsInterface(bytes4 interfaceId) external view returns (bool);
| 2,795 |
8 | // facet addresses | address[] facetAddresses;
| address[] facetAddresses;
| 34,243 |
44 | // transferERC20 standard transfer wrapped with `activated` modifier / | function transfer(address to, uint256 value) public activated returns (bool) {
return super.transfer(to, value);
}
| function transfer(address to, uint256 value) public activated returns (bool) {
return super.transfer(to, value);
}
| 1,855 |
544 | // undo timeline so that validator is normal validator | updateTimeline(int256(amount.add(validators[validatorId].delegatedAmount)), 1, 0);
validators[validatorId].status = Status.Active;
address signer = validators[validatorId].signer;
logger.logUnjailed(validatorId, signer);
| updateTimeline(int256(amount.add(validators[validatorId].delegatedAmount)), 1, 0);
validators[validatorId].status = Status.Active;
address signer = validators[validatorId].signer;
logger.logUnjailed(validatorId, signer);
| 12,661 |
10 | // Moves `amount` tokens from `sender` to `recipient` using theallowance mechanism. `amount` is then deducted from the caller'sallowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. / | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| 13,233 |
111 | // Unpauses HAs functions | function unpause() external override onlyRole(GUARDIAN_ROLE) {
_unpause();
}
| function unpause() external override onlyRole(GUARDIAN_ROLE) {
_unpause();
}
| 31,057 |
13 | // Check the signature length - case 65: r,s,v signature (standard) - case 64: r,vs signature (cf https:eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ | if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
| if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
| 28,611 |
7 | // Error thrown when the owner of the contract tries to burn tokens continuously. | error OwnerCanNotContinuousBurn();
| error OwnerCanNotContinuousBurn();
| 24,733 |
29 | // Overrides the `_startTokenId` function from ERC721A to start at token id `1`.This is to avoid future possible problems since `0` is usually used to signal values that have not been set or have been removed. / | function _startTokenId() internal view virtual override returns (uint256) {
return 1;
}
| function _startTokenId() internal view virtual override returns (uint256) {
return 1;
}
| 1,475 |
24 | // register player if unregistered | Player storage player = players[msg.sender];
if(player.id == 0)
toRegisterPlayer = true;
| Player storage player = players[msg.sender];
if(player.id == 0)
toRegisterPlayer = true;
| 23,789 |
29 | // permission related | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
require(newOwner != address(this));
require(newOwner != admin);
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
}
| function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
require(newOwner != address(this));
require(newOwner != admin);
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
}
| 52,729 |
23 | // transfer profit to the user | shieldMiningInfo[_policyBook].rewardsToken.safeTransfer(
_user,
DecimalsConverter.convertFrom18(reward, _tokenDecimals)
);
shieldMiningInfo[_policyBook].rewardTokensLocked -= reward;
emit ShieldMiningClaimed(_user, _policyBook, reward);
| shieldMiningInfo[_policyBook].rewardsToken.safeTransfer(
_user,
DecimalsConverter.convertFrom18(reward, _tokenDecimals)
);
shieldMiningInfo[_policyBook].rewardTokensLocked -= reward;
emit ShieldMiningClaimed(_user, _policyBook, reward);
| 50,625 |
21 | // Stored in a mapping indexed by commitment_id, a hash of commitment hash, question, bond. | struct Commitment {
uint32 reveal_ts;
bool is_revealed;
bytes32 revealed_answer;
}
| struct Commitment {
uint32 reveal_ts;
bool is_revealed;
bytes32 revealed_answer;
}
| 66,185 |
14 | // The address is unregistered so we throw and log event This method and callers have to overriden as non-constant to emit events if ( subjectCount == 0 ) { GotUnregisteredPaymentAddress( paymentAddress ); revert(); } |
require(subjectCount > 0);
return subjectCount;
|
require(subjectCount > 0);
return subjectCount;
| 50,276 |
275 | // Determine if a tokenId exists (has been sold) | function sold(uint256 _tokenId) public view returns (bool) {
return token.exists(_tokenId);
}
| function sold(uint256 _tokenId) public view returns (bool) {
return token.exists(_tokenId);
}
| 68,025 |
51 | // Provides the granularity of the token return uint256/ | function granularity() external view returns(uint256);
| function granularity() external view returns(uint256);
| 3,355 |
7 | // Get the `pos`-th checkpoint for `account`. / | function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoints.Checkpoint208 memory) {
return _checkpoints(account, pos);
}
| function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoints.Checkpoint208 memory) {
return _checkpoints(account, pos);
}
| 562 |
27 | // get that token from all safe trees token mapping and create a memory of it defined as (struct => KDZTokenStruct) | KDZTokenStruct memory updatedToken = _kdzTokens[_tokenId];
| KDZTokenStruct memory updatedToken = _kdzTokens[_tokenId];
| 10,784 |
18 | // Transfers vested tokens to given address. token ERC20 token which is being vested receiver Address receiving the token amount Amount of tokens to be transferred / | function releaseToAddress(IERC20 token, address receiver, uint256 amount) public {
require(_msgSender() == _beneficiary, "TokenVesting::setBeneficiary: Not contract beneficiary");
require(amount > 0, "TokenVesting::_releaseToAddress: amount should be greater than 0");
require(receiver != ad... | function releaseToAddress(IERC20 token, address receiver, uint256 amount) public {
require(_msgSender() == _beneficiary, "TokenVesting::setBeneficiary: Not contract beneficiary");
require(amount > 0, "TokenVesting::_releaseToAddress: amount should be greater than 0");
require(receiver != ad... | 13,329 |
218 | // stETH and rETH token contracts | IstETH internal constant steth =
IstETH(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
IwstETH internal constant wsteth =
IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);
IERC20 internal constant reth =
IERC20(0xae78736Cd615f374D3085123A210448E74Fc6393);
| IstETH internal constant steth =
IstETH(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
IwstETH internal constant wsteth =
IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);
IERC20 internal constant reth =
IERC20(0xae78736Cd615f374D3085123A210448E74Fc6393);
| 3,706 |
56 | // We restrict transferFrom by overriding it / | function transferFrom(address from, address to, uint value) public canTransfer(from) returns (bool success) {
// Call StandardToken.transferForm()
return super.transferFrom(from, to, value);
}
| function transferFrom(address from, address to, uint value) public canTransfer(from) returns (bool success) {
// Call StandardToken.transferForm()
return super.transferFrom(from, to, value);
}
| 24,299 |
91 | // Buy and burn | uint256 rewardForCaller = tokensForBuyAndBurn.mul(_rebalanceCallerFee).div(10 ** (_feeDecimal + 2));
uint256 amountToBurn = tokensForBuyAndBurn.sub(rewardForCaller);
uint256 rate = _getReflectionRate();
_reflectionBalance[tx.origin] = _reflectionBalance[tx.origin].add(rewardForCaller.m... | uint256 rewardForCaller = tokensForBuyAndBurn.mul(_rebalanceCallerFee).div(10 ** (_feeDecimal + 2));
uint256 amountToBurn = tokensForBuyAndBurn.sub(rewardForCaller);
uint256 rate = _getReflectionRate();
_reflectionBalance[tx.origin] = _reflectionBalance[tx.origin].add(rewardForCaller.m... | 17,139 |
224 | // Used to change `strategist`.This may only be called by governance or the existing strategist. _strategist The new address to assign as `strategist`. / | function setStrategist(address _strategist) external onlyAuthorized {
require(_strategist != address(0));
strategist = _strategist;
emit UpdatedStrategist(_strategist);
}
| function setStrategist(address _strategist) external onlyAuthorized {
require(_strategist != address(0));
strategist = _strategist;
emit UpdatedStrategist(_strategist);
}
| 3,165 |
2 | // Transfer shares from contract owner to the buyer | nft.sharesLeft -= _sharesToBuy;
userNFTBalances[msg.sender][_tokenId] += _sharesToBuy;
emit NFTBought(_tokenId, msg.sender, _sharesToBuy);
| nft.sharesLeft -= _sharesToBuy;
userNFTBalances[msg.sender][_tokenId] += _sharesToBuy;
emit NFTBought(_tokenId, msg.sender, _sharesToBuy);
| 25,238 |
2 | // Admin for financial contracts in the UMA system. Allows appropriately permissioned admin roles to interact with financial contracts. / | contract FinancialContractsAdmin is Ownable {
/**
* @notice Calls emergency shutdown on the provided financial contract.
* @param financialContract address of the FinancialContract to be shut down.
*/
function callEmergencyShutdown(address financialContract) external onlyOwner {
Administr... | contract FinancialContractsAdmin is Ownable {
/**
* @notice Calls emergency shutdown on the provided financial contract.
* @param financialContract address of the FinancialContract to be shut down.
*/
function callEmergencyShutdown(address financialContract) external onlyOwner {
Administr... | 53,166 |
60 | // pay pending reward | uint256 pending = user.amount.mul(pool.accEarningsPerShare).div(1e18).sub(
user.rewardDebt
);
if (pending > 0) {
safeEarningsTransfer(msg.sender, pending);
payReferralCommission(msg.sender, pending);
}
| uint256 pending = user.amount.mul(pool.accEarningsPerShare).div(1e18).sub(
user.rewardDebt
);
if (pending > 0) {
safeEarningsTransfer(msg.sender, pending);
payReferralCommission(msg.sender, pending);
}
| 3,317 |
6 | // It is emitted if an operator is removed from the global allowlist. operator Operator address / | event OperatorRemoved(address operator);
| event OperatorRemoved(address operator);
| 46,341 |
163 | // Send market fees to owner |
if (FeeManager.cutPerMillion > 0) {
|
if (FeeManager.cutPerMillion > 0) {
| 11,580 |
10 | // ============ Constructor ============ //Set core. Also requires a minimum rebalance interval and minimum proposal periods that are enforcedon RebalancingSetToken _core Address of deployed core contract_componentWhitelist Address of deployed whitelist contract_minimumRebalanceInterval Minimum amount of time between r... | constructor(
address _core,
address _componentWhitelist,
uint256 _minimumRebalanceInterval,
uint256 _minimumProposalPeriod,
uint256 _minimumTimeToPivot,
uint256 _maximumTimeToPivot,
uint256 _minimumNaturalUnit,
uint256 _maximumNaturalUnit
)
| constructor(
address _core,
address _componentWhitelist,
uint256 _minimumRebalanceInterval,
uint256 _minimumProposalPeriod,
uint256 _minimumTimeToPivot,
uint256 _maximumTimeToPivot,
uint256 _minimumNaturalUnit,
uint256 _maximumNaturalUnit
)
| 49,116 |
315 | // The Black Bear SVG renderer | IBearRenderer private _blackBearRenderer;
| IBearRenderer private _blackBearRenderer;
| 14,124 |
238 | // Make sure the strategy meets some criteria | require(strategies[_strategy].isSupported, "Strategy not approved");
IStrategy strategy = IStrategy(_strategy);
require(assets[_asset].isSupported, "Asset is not supported");
require(
strategy.supportsAsset(_asset),
"Asset not supported by ... | require(strategies[_strategy].isSupported, "Strategy not approved");
IStrategy strategy = IStrategy(_strategy);
require(assets[_asset].isSupported, "Asset is not supported");
require(
strategy.supportsAsset(_asset),
"Asset not supported by ... | 25,968 |
35 | // Gets Stanley address. | function getStanley() external view returns (address);
| function getStanley() external view returns (address);
| 41,948 |
30 | // Registers the exist layer2 on DAO/_layer2 Layer2 contract address to be registered/_memo A memo for the candidate | function registerLayer2Candidate(
address _layer2,
string memory _memo
)
external
override
validSeigManager
validLayer2Registry
validCommitteeL2Factory
| function registerLayer2Candidate(
address _layer2,
string memory _memo
)
external
override
validSeigManager
validLayer2Registry
validCommitteeL2Factory
| 5,110 |
17 | // Query if a contract implements an interface _interfaceId The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This functionuses less than 30,000 gas. / | function supportsInterface(bytes4 _interfaceId) external view returns (bool);
| function supportsInterface(bytes4 _interfaceId) external view returns (bool);
| 37,941 |
15 | // Only allow this to call itself since any call to a facet should be to the guardian contract address | require(address(this) == msg.sender, 'Call only allowed from guardian or facet contracts');
success = exec(_to, _value, _data, _operation);
return success;
| require(address(this) == msg.sender, 'Call only allowed from guardian or facet contracts');
success = exec(_to, _value, _data, _operation);
return success;
| 46,259 |
72 | // Note: do a direct access to avoid the validity check. | return _getPendingRegularFeeAdjustedCollateral(_getFeeAdjustedCollateral(positions[sponsor].rawCollateral));
| return _getPendingRegularFeeAdjustedCollateral(_getFeeAdjustedCollateral(positions[sponsor].rawCollateral));
| 19,280 |
20 | // It mints a new token for a Tier index. tierIndex Tier to mint token on. owner The owner of the new token. Requirements: - Caller must be an authorized minter / | function mint(uint256 tierIndex, address owner)
external
override
onlyMinter
| function mint(uint256 tierIndex, address owner)
external
override
onlyMinter
| 9,363 |
84 | // Structure holding information about a transaction/id Unique identifier of the transaction/from Address of the user from whose account tokens were transfered/to Address of the user to whom the tokens were transfered/token Address of the tokens which were transfered/amount Amount of the transfered tokens/note Each tra... | struct Transaction
| struct Transaction
| 23,529 |
84 | // Contract constructor sets initial owners, required number of confirmations, and time lock. _owners List of initial owners._required Number of required confirmations._secondsTimeLockedDuration needed after a transaction is confirmed and before itbecomes executable, in seconds. / | constructor (
address[] memory _owners,
uint256 _required,
uint32 _secondsTimeLocked
)
public
MultiSig(_owners, _required)
| constructor (
address[] memory _owners,
uint256 _required,
uint32 _secondsTimeLocked
)
public
MultiSig(_owners, _required)
| 33,630 |
65 | // Resume a previously suspended ICO. / | function resume() public onlyOwner isSuspended {
state = State.Active;
ICOResumed(endAt, lowCapWei, hardCapWei, lowCapTxWei, hardCapTxWei);
touch();
}
| function resume() public onlyOwner isSuspended {
state = State.Active;
ICOResumed(endAt, lowCapWei, hardCapWei, lowCapTxWei, hardCapTxWei);
touch();
}
| 16,979 |
58 | // See {ERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}; Requirements:- `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for `... | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| 5,562 |
23 | // pragma solidity >0.4.13; / | contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) intern... | contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) intern... | 61,681 |
170 | // make a function to toss a proposal if no one can call enact based on time limt_changeDelegationMinimumsetBuoysetBPoolsetSwapFeechangeOwnersetStakingActivesetSwapingActive changeOwnerchangeWeightchangeStakingMaxchangeStakingShareupdate weights must be passed weights as a stringadd token needs amount of token to add i... | contract GovernanceProxy {
using BalancerSafeMath for uint256;
uint256 public lastProposed;
uint256 public proposalCount; //used to assign a unique ID to each proposal
uint256 public proposalsVoted; //used to keep track of which proposals have been decided on
uint256 proposalDelegationMinimum =... | contract GovernanceProxy {
using BalancerSafeMath for uint256;
uint256 public lastProposed;
uint256 public proposalCount; //used to assign a unique ID to each proposal
uint256 public proposalsVoted; //used to keep track of which proposals have been decided on
uint256 proposalDelegationMinimum =... | 9,236 |
3 | // pay outstanding interest to lender | _payInterest(
msg.sender, // lender
loanToken
);
| _payInterest(
msg.sender, // lender
loanToken
);
| 36,518 |
68 | // executes a function on the ERC20 token and reverts upon failure the main purpose of this function is to prevent a non standard ERC20 token from failing silently_token ERC20 token address_datadata to pass in to the token's contract for execution/ | function execute(IERC20Token _token, bytes memory _data) private {
uint256[1] memory ret = [uint256(1)];
assembly {
let success := call(
gas, // gas remaining
_token, // destination address
0, // no ether
... | function execute(IERC20Token _token, bytes memory _data) private {
uint256[1] memory ret = [uint256(1)];
assembly {
let success := call(
gas, // gas remaining
_token, // destination address
0, // no ether
... | 1,554 |
4 | // Creates an RLPItem from an array of RLP encoded bytes./self The RLP encoded bytes./strict Will revert() if the data is not RLP encoded./ return An RLPItem | function toRLPItem(bytes memory self, bool strict) internal pure returns (RLPLib.RLPItem memory) {
RLPLib.RLPItem memory item = toRLPItem(self);
if(strict) {
uint len = self.length;
if(_payloadOffset(item) > len)
revert();
if(_itemLength(item._unsa... | function toRLPItem(bytes memory self, bool strict) internal pure returns (RLPLib.RLPItem memory) {
RLPLib.RLPItem memory item = toRLPItem(self);
if(strict) {
uint len = self.length;
if(_payloadOffset(item) > len)
revert();
if(_itemLength(item._unsa... | 9,468 |
76 | // Address where funds are collected | address payable private _wallet;
address private admin;
| address payable private _wallet;
address private admin;
| 5,558 |
34 | // Convert Tokens (token) to Tokens (exchange_addr.token). Allows trades through contracts that were not deployed from the same factory. User specifies exact input && minimum output. tokens_sold Amount of Tokens sold. min_tokens_bought Minimum Tokens (token_addr) purchased. min_trx_bought Minimum TRX purchased as inter... | function tokenToExchangeSwapInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_trx_bought,
uint256 deadline,
address payable exchange_addr)
public returns (uint256)
| function tokenToExchangeSwapInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_trx_bought,
uint256 deadline,
address payable exchange_addr)
public returns (uint256)
| 54,069 |
11 | // BasicToken Basic version of Token, with no allowances. / | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* BasicToken transfer function
* @dev transfer token for a specified address
* @param _to address to transfer to.
* @param _value amount to be transferred.
*/
function transfer(address _to, ... | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* BasicToken transfer function
* @dev transfer token for a specified address
* @param _to address to transfer to.
* @param _value amount to be transferred.
*/
function transfer(address _to, ... | 39,932 |
52 | // Sets a new comptroller for the market Admin function to set a new comptrollerreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _setComptroller(ComptrollerInterface newComptroller)
public
override
returns (uint256)
| function _setComptroller(ComptrollerInterface newComptroller)
public
override
returns (uint256)
| 14,910 |
162 | // Voken reserved. | Allocations.Allocation memory __allocation = __allocations[i];
__reserved = __reserved.add(__allocation.amount);
if (now >= __allocation.timestamp.add(90 days)) {
| Allocations.Allocation memory __allocation = __allocations[i];
__reserved = __reserved.add(__allocation.amount);
if (now >= __allocation.timestamp.add(90 days)) {
| 46,827 |
606 | // Allow any amount of gas to be used on this withdrawal (which allows the transfer to be skipped) | withdrawal.minGas = 0;
| withdrawal.minGas = 0;
| 32,405 |
160 | // This is a basic function to read price, although this is a public function,It is not recommended, the recommended function is `assetPrices(asset)`.If `asset` does not has a reader to reader price, then read price from originalstructure `_assetPrices`;If `asset` has a reader to read price, first gets the price of rea... | function _getReaderPrice(address _asset) internal view returns (uint256) {
Reader storage reader = readers[_asset];
if (reader.asset == address(0)) return _assetPrices[_asset].mantissa;
uint256 readerPrice = _assetPrices[reader.asset].mantissa;
if (reader.decimalsDifference < 0)
... | function _getReaderPrice(address _asset) internal view returns (uint256) {
Reader storage reader = readers[_asset];
if (reader.asset == address(0)) return _assetPrices[_asset].mantissa;
uint256 readerPrice = _assetPrices[reader.asset].mantissa;
if (reader.decimalsDifference < 0)
... | 17,834 |
84 | // Gets total amount of deposits that has left after users&39; bonus withdrawals/ return amount of deposits available for bonus payments | function getTotalDepositsAmountLeft() public view returns (uint _amount) {
uint _lastDepositDate = lastDepositDate;
for (
uint _startDate = firstDepositDate;
_startDate <= _lastDepositDate || _startDate != 0;
_startDate = distributionDeposits[_startDate].nextDepos... | function getTotalDepositsAmountLeft() public view returns (uint _amount) {
uint _lastDepositDate = lastDepositDate;
for (
uint _startDate = firstDepositDate;
_startDate <= _lastDepositDate || _startDate != 0;
_startDate = distributionDeposits[_startDate].nextDepos... | 7,291 |
3 | // @inheritdoc ITransferStrategyBase | function getIncentivesController() external view override returns (address) {
return INCENTIVES_CONTROLLER;
}
| function getIncentivesController() external view override returns (address) {
return INCENTIVES_CONTROLLER;
}
| 31,600 |
7 | // verifyClaim(_dropMsgSender(), _quantity, _currency, _pricePerToken, _allowlistProof); |
bool verified = BTVerifyClaim(_receiver,proof, root);
if(!verified) {
revert("not in allowlist");
}
|
bool verified = BTVerifyClaim(_receiver,proof, root);
if(!verified) {
revert("not in allowlist");
}
| 31,506 |
40 | // its goal is to return the total number of DAppNode packages/ return the total number of DAppNode packages | function numberOfDAppNodePackages() view public returns (uint) {
return DAppNodePackages.length;
}
| function numberOfDAppNodePackages() view public returns (uint) {
return DAppNodePackages.length;
}
| 77,320 |
24 | // ERC20 interface / | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) ... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) ... | 13,146 |
36 | // (oracleCosttotalTweSupply) / (denominatorlinkBalance) | (uint oracleCost, ) = oracleCost();
return (oracleCost.wadMul(totalSupply())).wadDiv(tweetherDenominator.wadMul(linkBalance()));
| (uint oracleCost, ) = oracleCost();
return (oracleCost.wadMul(totalSupply())).wadDiv(tweetherDenominator.wadMul(linkBalance()));
| 3,209 |
30 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:... | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:... | 1,787 |
15 | // Checks if everyone is allowed to participate after delay. / | function isEveryoneAllowedToParticipateAfterDelay() public view returns (bool) {
return _isEveryoneAllowedToParticipateAfterDelay;
}
| function isEveryoneAllowedToParticipateAfterDelay() public view returns (bool) {
return _isEveryoneAllowedToParticipateAfterDelay;
}
| 51,491 |
6 | // return the time when the tokens are released. / | function releaseTime() public view returns (uint256) {
return _releaseTime;
}
| function releaseTime() public view returns (uint256) {
return _releaseTime;
}
| 23,925 |
6 | // Retrieve the tokens | lpToken.transferFrom(msg.sender, address(this), balance);
| lpToken.transferFrom(msg.sender, address(this), balance);
| 5,405 |
20 | // Get underlying tokens | for (uint8 i = 0; i < 8; i++) {
try
MetaSwapDeposit(inputData.metaSwapDepositAddress).getToken(
i
)
returns (IERC20 token) {
require(address(token) != address(0), "PR: token is 0");
... | for (uint8 i = 0; i < 8; i++) {
try
MetaSwapDeposit(inputData.metaSwapDepositAddress).getToken(
i
)
returns (IERC20 token) {
require(address(token) != address(0), "PR: token is 0");
... | 15,484 |
33 | // LXL `client` or `clientOracle` can release milestone `amount` to `provider`.registration Registered LXL number. / | function release(uint256 registration) external nonReentrant {
Locker storage locker = lockers[registration];
uint256 milestone = locker.currentMilestone-1;
uint256 payment = locker.amount[milestone];
uint256 released = locker.released;
uint256 sum = locker.sum;
re... | function release(uint256 registration) external nonReentrant {
Locker storage locker = lockers[registration];
uint256 milestone = locker.currentMilestone-1;
uint256 payment = locker.amount[milestone];
uint256 released = locker.released;
uint256 sum = locker.sum;
re... | 7,632 |
5 | // Notice period before activation preparation status of upgrade mode | function getNoticePeriod() external pure override returns (uint256) {
return UPGRADE_NOTICE_PERIOD;
}
| function getNoticePeriod() external pure override returns (uint256) {
return UPGRADE_NOTICE_PERIOD;
}
| 10,994 |
58 | // len < = length(tokenList) + 1 | require(len == tokenList.length + 1, "Nest: Pool: !assetsList");
uint256[] memory list = new uint256[](len);
list[0] = _eth_ledger[address(msg.sender)];
for (uint i = 0; i < len - 1; i++) {
address _token = tokenList[i];
list[i+1] = _token_ledger[_token][address(m... | require(len == tokenList.length + 1, "Nest: Pool: !assetsList");
uint256[] memory list = new uint256[](len);
list[0] = _eth_ledger[address(msg.sender)];
for (uint i = 0; i < len - 1; i++) {
address _token = tokenList[i];
list[i+1] = _token_ledger[_token][address(m... | 24,586 |
5 | // 每一期的购买人地址信息 期数=》地址 | mapping(uint256 => address[]) lotteryPlayers;
| mapping(uint256 => address[]) lotteryPlayers;
| 35,296 |
125 | // Migrate the deed | Entry storage h = _entries[_hash];
h.deed.setRegistrar(registrar);
| Entry storage h = _entries[_hash];
h.deed.setRegistrar(registrar);
| 34,018 |
527 | // Round up to ensure the maker's exchange rate does not exceed the price specified by the order. We favor the maker when the exchange rate must be rounded. | matchedFillResults.right.takerAssetFilledAmount = LibMath.safeGetPartialAmountCeil(
rightOrder.takerAssetAmount,
rightOrder.makerAssetAmount,
leftTakerAssetAmountRemaining // matchedFillResults.right.makerAssetFilledAmount
);
| matchedFillResults.right.takerAssetFilledAmount = LibMath.safeGetPartialAmountCeil(
rightOrder.takerAssetAmount,
rightOrder.makerAssetAmount,
leftTakerAssetAmountRemaining // matchedFillResults.right.makerAssetFilledAmount
);
| 2,495 |
97 | // Gets the queue element at a particular index. _index Index of the queue element to access.return _element Queue element at the given index. / | function getQueueElement(
| function getQueueElement(
| 6,227 |
2 | // Add rewards for Nest-Nodes, only governance or NestMining (contract) are allowed/ The rewards need to pull from NestPool/_amount The amount of Nest token as the rewards to each nest-node | function addNNReward(uint256 _amount) external;
| function addNNReward(uint256 _amount) external;
| 24,589 |
131 | // Registers a potential new internal token in the bank Can not be a reserved token or an available token token The address of the token / | function registerPotentialNewInternalToken(address token)
external
hasExtensionAccess(AclFlag.REGISTER_NEW_INTERNAL_TOKEN)
| function registerPotentialNewInternalToken(address token)
external
hasExtensionAccess(AclFlag.REGISTER_NEW_INTERNAL_TOKEN)
| 63,461 |
169 | // multipliers for each pooled token's precision to get to POOL_PRECISION_DECIMALS for example, TBTC has 18 decimals, so the multiplier should be 1. WBTC has 8, so the multiplier should be 1018 / 108 => 1010 | uint256[] tokenPrecisionMultipliers;
| uint256[] tokenPrecisionMultipliers;
| 17,336 |
18 | // GNOSIS_EASY_AUCTION is Gnosis protocol's contract for initiating auctions and placing bids https:github.com/gnosis/ido-contracts/blob/main/contracts/EasyAuction.sol | address public immutable GNOSIS_EASY_AUCTION;
| address public immutable GNOSIS_EASY_AUCTION;
| 45,357 |
93 | // Unlocks WETH amount from the CDP | frob(manager, cdp, -toInt(wad), 0);
| frob(manager, cdp, -toInt(wad), 0);
| 51,173 |
165 | // Max amount of token to Gift per time/ | uint public MAX_GIFT;
| uint public MAX_GIFT;
| 18,873 |
165 | // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and then delete the last slot (swap and pop). |
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
|
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
| 17,932 |
80 | // Tells the address that generated the message on the other network that is currently being executed by the AMB bridge. return the address of the message sender./ | function messageSender() internal view returns (address) {
return bridgeContract().messageSender();
}
| function messageSender() internal view returns (address) {
return bridgeContract().messageSender();
}
| 51,492 |
14 | // 2.2.2) add new shares to the shares mapping and the finalShares array | uint256 newShareIdA = shareCount;
shareCount++;
uint256 newShareIdB = shareCount;
shareCount++;
finalShares.push(newShareIdA);
finalShares.push(newShareIdB);
shares[newShareIdA] = Share(participantA, finalSharePercentageA, parentShareId, true);
shares[ne... | uint256 newShareIdA = shareCount;
shareCount++;
uint256 newShareIdB = shareCount;
shareCount++;
finalShares.push(newShareIdA);
finalShares.push(newShareIdB);
shares[newShareIdA] = Share(participantA, finalSharePercentageA, parentShareId, true);
shares[ne... | 21,851 |
97 | // All joins are disabled while the contract is paused. |
uint256[] memory normalizedWeights = _normalizedWeights();
|
uint256[] memory normalizedWeights = _normalizedWeights();
| 10,613 |
8 | // payout for the deposit = amount / price wherepayout = FLOOR outamount = quote tokens inprice = quote tokens : floor (i.e. 42069 DAI : FLOOR) 1e18 = FLOOR decimals (9) + price decimals (9) / | payout_ = (_amount * 1e18 / price) / (10 ** metadata[_id].quoteDecimals);
| payout_ = (_amount * 1e18 / price) / (10 ** metadata[_id].quoteDecimals);
| 33,340 |
153 | // Sets a sender address of the failed message that came from the other side._messageId id of the message from the other side that triggered a call._receiver address of the receiver./ | function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal {
addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver;
}
| function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal {
addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver;
}
| 43,442 |
30 | // Converts a `uint256` to its ASCII `string` hexadecimal representation. / | function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, l... | function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, l... | 152 |
60 | // Update operator status | operators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
| operators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
| 14,041 |
28 | // add recipients | if (_recipientAddresses.length > 0) {
addRecipients(campaignId, _recipientAddresses);
}
| if (_recipientAddresses.length > 0) {
addRecipients(campaignId, _recipientAddresses);
}
| 16,780 |
55 | // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. | _balances[account] += amount;
| _balances[account] += amount;
| 37,296 |
1,528 | // If in the past, this was the voting round where this price was resolved. If current or the upcoming round, this is the voting round where this price will be voted on, but not necessarily resolved. | uint256 lastVotingRound;
| uint256 lastVotingRound;
| 17,872 |
184 | // Enters the Compound market so it can be deposited/borrowed/_cTokenAddr CToken address of the token | function enterMarket(address _cTokenAddr) public {
address[] memory markets = new address[](1);
markets[0] = _cTokenAddr;
ComptrollerInterface(COMPTROLLER_ADDR).enterMarkets(markets);
}
| function enterMarket(address _cTokenAddr) public {
address[] memory markets = new address[](1);
markets[0] = _cTokenAddr;
ComptrollerInterface(COMPTROLLER_ADDR).enterMarkets(markets);
}
| 13,488 |
96 | // // | function balanceToBento(IERC20 token, address to) external returns (uint256 amountOut, uint256 shareOut) {
(amountOut, shareOut) = bento.deposit(token, address(this), to, token.safeBalanceOfSelf(), 0);
}
| function balanceToBento(IERC20 token, address to) external returns (uint256 amountOut, uint256 shareOut) {
(amountOut, shareOut) = bento.deposit(token, address(this), to, token.safeBalanceOfSelf(), 0);
}
| 51,682 |
86 | // owners between swapped slots should't be renumbered - that saves a lot of gas | m_owners[free] = m_owners[m_numOwners];
m_ownerIndex[m_owners[free]] = free;
m_owners[m_numOwners] = 0;
| m_owners[free] = m_owners[m_numOwners];
m_ownerIndex[m_owners[free]] = free;
m_owners[m_numOwners] = 0;
| 41,336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.