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 |
|---|---|---|---|---|
172 | // update wether or not the rate engine is enabled / | function updateEnabled(bool enabled) external;
| function updateEnabled(bool enabled) external;
| 32,919 |
162 | // Emitted when the protocol fee is changed by the pool/feeProtocol0Old The previous value of the token0 protocol fee/feeProtocol1Old The previous value of the token1 protocol fee/feeProtocol0New The updated value of the token0 protocol fee/feeProtocol1New The updated value of the token1 protocol fee | event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
| event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
| 5,158 |
101 | // Reclaim all ERC20 compatible tokens, but not more than the VIT tokens which were reserved for refunds./token ERC20Basic The address of the token contract. | function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
if (token == vitToken) {
balance = balance.sub(totalClaimableTokens);
}
assert(token.transfer(owner, balance));
}
| function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
if (token == vitToken) {
balance = balance.sub(totalClaimableTokens);
}
assert(token.transfer(owner, balance));
}
| 27,442 |
287 | // {onERC20SpendableReceived} External function called by ERC20SpendableTokens. Thisvalidates that the token is valid and then calls the internal {_handleSpend} method.You must overried {_handleSpend} in your contract to perform processing you wish to occuron token spend. This method will pass back the valid bytes4 sel... | function onERC20SpendableReceived(
address spender_,
uint256 spent_,
bytes memory arguments_
) external returns (bytes4 retval_, bytes memory returnArguments_);
| function onERC20SpendableReceived(
address spender_,
uint256 spent_,
bytes memory arguments_
) external returns (bytes4 retval_, bytes memory returnArguments_);
| 7,532 |
212 | // set byfrost as origin | return 2;
| return 2;
| 48,883 |
13 | // Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. | function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 21,416 |
86 | // Formula from the book "Hacker's Delight" | int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
| int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
| 7,121 |
229 | // expmodsAndPoints.expmods[14] = traceGenerator^57. | mstore(add(expmodsAndPoints, 0x1c0),
mulmod(mload(add(expmodsAndPoints, 0x1a0)), // traceGenerator^32
mulmod(mload(add(expmodsAndPoints, 0x180)), // traceGenerator^24
traceGenerator, // traceGenerator^1
... | mstore(add(expmodsAndPoints, 0x1c0),
mulmod(mload(add(expmodsAndPoints, 0x1a0)), // traceGenerator^32
mulmod(mload(add(expmodsAndPoints, 0x180)), // traceGenerator^24
traceGenerator, // traceGenerator^1
... | 28,952 |
46 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender].sub(
subtractedValue,
| function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender].sub(
subtractedValue,
| 5,149 |
3 | // Only permits calls by oracles. / | modifier onlyOracle() {
if (oracles[msg.sender] == false) revert OnlyOracle();
_;
}
| modifier onlyOracle() {
if (oracles[msg.sender] == false) revert OnlyOracle();
_;
}
| 7,613 |
24 | // returns how many bettors and coins on a specific number for the next round_round - block height_tableId - table indexreturn uint256[3] - array of prizes, fisrt is gold / | function getTablePrizes(uint256 _round, uint256 _tableId)
| function getTablePrizes(uint256 _round, uint256 _tableId)
| 49,995 |
13 | // Configuration of a new Llama instance. | struct LlamaInstanceConfig {
string name; // The name of the Llama instance.
ILlamaStrategy strategyLogic; // The initial strategy implementation (logic) contract.
ILlamaAccount accountLogic; // The initial account implementation (logic) contract.
bytes[] initialStrategies; // Array of initial strategy configur... | struct LlamaInstanceConfig {
string name; // The name of the Llama instance.
ILlamaStrategy strategyLogic; // The initial strategy implementation (logic) contract.
ILlamaAccount accountLogic; // The initial account implementation (logic) contract.
bytes[] initialStrategies; // Array of initial strategy configur... | 33,931 |
31 | // cch_op_hashes= 29d74ac19d4e330fdab98ebbba4a83f45e979fc8ded9799bd2479a4b b'\xcfwH\xdd\xfa\xb9\xb8%\xf9\xb6\x87\x08t\xe8I1\xa0Z\xe3F\xb6Er\xbd\xd2\r\xf7$Y\xfal\xa4' cch_op_hashes= f10530d981a27109f4cada3ebbc3d2f36298b4e7b2452f06856c2d5a b'\xce/1\xe9\x9a\x182C\xcdv\xd5\x81\xbe\xc6e\x16XB\[email protected]\xd8\xf63\xb2P... | // cch_op_hashes= ce2e8a132e53f665b9b5c89bb8ab97607e507b5a9ef7a8a90b8feeba b'\xb2\xa0~%&"\xbe\x9b}\xbc\xea\xdeO\xfeb\xd4\xbenllh9\xb2p*\x8b{\xbb9\x84H\x9c'
// cch_op_hashes= fed3945f9e092f31ce67ed763ef87750c732c182f165ed018dbcf8de b'\x8cH\xdf\x00`\x99\x1e\xdf\x10:\xd4o,\xd50\xf9\xf9nwj\xf6\xf8\xd2\rM\xf5(\xe1V\... | // cch_op_hashes= ce2e8a132e53f665b9b5c89bb8ab97607e507b5a9ef7a8a90b8feeba b'\xb2\xa0~%&"\xbe\x9b}\xbc\xea\xdeO\xfeb\xd4\xbenllh9\xb2p*\x8b{\xbb9\x84H\x9c'
// cch_op_hashes= fed3945f9e092f31ce67ed763ef87750c732c182f165ed018dbcf8de b'\x8cH\xdf\x00`\x99\x1e\xdf\x10:\xd4o,\xd50\xf9\xf9nwj\xf6\xf8\xd2\rM\xf5(\xe1V\... | 18,806 |
12 | // Safe multiplication a - first operand b - second operand Multiply safely (and efficiently), rounding downreturn - product of operands; throws if overflow or rounding error / | function bmul(uint a, uint b) internal pure returns (uint) {
// Gas optimization (see github.com/OpenZeppelin/openzeppelin-contracts/pull/522)
if (a == 0) {
return 0;
}
// Standard overflow check: a/a*b=b
uint c0 = a * b;
require(c0 / a == b, "ERR_MUL_OVE... | function bmul(uint a, uint b) internal pure returns (uint) {
// Gas optimization (see github.com/OpenZeppelin/openzeppelin-contracts/pull/522)
if (a == 0) {
return 0;
}
// Standard overflow check: a/a*b=b
uint c0 = a * b;
require(c0 / a == b, "ERR_MUL_OVE... | 131 |
97 | // Emitted for statusOracle changes. / | event SetAssetStatusOracle(address asset, IStatusOracle statusOracle);
| event SetAssetStatusOracle(address asset, IStatusOracle statusOracle);
| 53,058 |
172 | // Keep track of amounts | uint256[4] memory stableAmounts;
uint256 totalStableAmount;
| uint256[4] memory stableAmounts;
uint256 totalStableAmount;
| 11,697 |
80 | // Getter for the Recipientreturn Recipient (string converted) / | function getRecipient() public view returns (string memory) {
return recipient;
}
| function getRecipient() public view returns (string memory) {
return recipient;
}
| 28,675 |
11 | // Converts ETH to LIT/WETH and sends BPT to user _minOut Units of BPT to expect as output / | function convertEthToBpt(uint256 _minOut) external payable nonReentrant returns (uint256 bptOut) {
IWETH(WETH).deposit{ value: msg.value }();
_investSingleToPool(msg.value, _minOut, 0);
bptOut = IERC20(BALANCER_POOL_TOKEN).balanceOf(address(this));
if (bptOut > 0) {
IERC... | function convertEthToBpt(uint256 _minOut) external payable nonReentrant returns (uint256 bptOut) {
IWETH(WETH).deposit{ value: msg.value }();
_investSingleToPool(msg.value, _minOut, 0);
bptOut = IERC20(BALANCER_POOL_TOKEN).balanceOf(address(this));
if (bptOut > 0) {
IERC... | 8,553 |
20 | // used by a new owner to accept an ownership transfer/ | function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| 2,705 |
87 | // If the value is valid, update storage | if (hasValidValue) {
// Update state
currentFeed.isValid = nextFeed.isValid;
currentFeed.value = getNextBoundedPrice();
nextFeed = Feed(uint128(priceFeedValue), 1);
lastUpdateTime = latestUpdateTime(currentTime());
// Emit... | if (hasValidValue) {
// Update state
currentFeed.isValid = nextFeed.isValid;
currentFeed.value = getNextBoundedPrice();
nextFeed = Feed(uint128(priceFeedValue), 1);
lastUpdateTime = latestUpdateTime(currentTime());
// Emit... | 13,893 |
7 | // emitted when a new binary proposal is created proposalId id of the binary proposal creator address of the creator executor ExecutorWithTimelock contract that will execute the proposal strategy votingPowerStrategy contract to calculate voting power targets list of contracts called by proposal's associated transaction... | function handleVotingPowerChanged(
address staker,
uint256 newVotingPower,
uint256[] calldata proposalIds
) external;
| function handleVotingPowerChanged(
address staker,
uint256 newVotingPower,
uint256[] calldata proposalIds
) external;
| 43,904 |
147 | // default pool setup for ETH | pools.push(Pool({
token: address(0),
| pools.push(Pool({
token: address(0),
| 42,698 |
59 | // FIXME: SERVE? Si attiva quando viene utilizzata la SafeTransfer | function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4) {
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
| function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4) {
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
| 15,832 |
31 | // timelock not enforced prior to updating the admin. This should occur on deployment. | bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
if (admin_initialized) {
require(
queuedTransactions[txHash],
"Timelock::executeTransaction: Transaction hasn't been queued."
);
require(... | bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
if (admin_initialized) {
require(
queuedTransactions[txHash],
"Timelock::executeTransaction: Transaction hasn't been queued."
);
require(... | 16,108 |
30 | // Event emitted when the Credit plan is set | event CreditPlanSet(
address token,
uint128 creditLimitMantissa,
uint128 creditRateMantissa
);
| event CreditPlanSet(
address token,
uint128 creditLimitMantissa,
uint128 creditRateMantissa
);
| 38,593 |
53 | // Get APR of every ILendingProtocol return addresses: array of token addressesreturn aprs: array of aprs (ordered in respect to the `addresses` array) / | function getAPRs() external view returns (address[] memory addresses, uint256[] memory aprs);
| function getAPRs() external view returns (address[] memory addresses, uint256[] memory aprs);
| 25,957 |
32 | // Save the media hash obtained fro IPFS | db.setString(getHashIndex("mediaMap", mediaIndex, "mediaHash"), mediaHash);
| db.setString(getHashIndex("mediaMap", mediaIndex, "mediaHash"), mediaHash);
| 25,774 |
36 | // Processes the product's deposit queue into a specific vault vaultAddress is the address of the vault maxProcessCount is the number of elements in the deposit queue to be processed / | function processDepositQueue(
address vaultAddress,
uint256 maxProcessCount
| function processDepositQueue(
address vaultAddress,
uint256 maxProcessCount
| 39,682 |
7 | // It returns the filter may include the item or definitely now include it. _item Hash value of an item / | function check(Filter storage _filter, bytes32 _item) internal view returns(bool) {
return falsePositive(_filter.bitmap, _filter.hashCount, _item);
}
| function check(Filter storage _filter, bytes32 _item) internal view returns(bool) {
return falsePositive(_filter.bitmap, _filter.hashCount, _item);
}
| 52,033 |
165 | // FREE MINT REQUEST | require(ownerMintCount[msg.sender].freeClaims + _mintAmount < _maxAmount + 1, "max free NFT claims exceeded");
ownerMintCount[msg.sender].freeClaims += uint128(_mintAmount);
| require(ownerMintCount[msg.sender].freeClaims + _mintAmount < _maxAmount + 1, "max free NFT claims exceeded");
ownerMintCount[msg.sender].freeClaims += uint128(_mintAmount);
| 45,988 |
46 | // Reset team token states/ | function endGameInternal() private {
gameOpponent = address(0);
gameTime = 0;
status = 0;
}
| function endGameInternal() private {
gameOpponent = address(0);
gameTime = 0;
status = 0;
}
| 28,744 |
537 | // Prohibit transfers to the zero address to avoid confusion with the Transfer event emitted by `_burnPoolTokens` | _require(recipient != address(0), Errors.ERC20_TRANSFER_TO_ZERO_ADDRESS);
_balance[sender] = currentBalance - amount;
_balance[recipient] = _balance[recipient].add(amount);
emit Transfer(sender, recipient, amount);
| _require(recipient != address(0), Errors.ERC20_TRANSFER_TO_ZERO_ADDRESS);
_balance[sender] = currentBalance - amount;
_balance[recipient] = _balance[recipient].add(amount);
emit Transfer(sender, recipient, amount);
| 1,778 |
4 | // Modify voting contractvoteFactory Voting contract address/ | function changeMapping(address voteFactory) public onlyOwner {
Nest_3_VoteFactory voteFactoryMap = Nest_3_VoteFactory(address(voteFactory));
_voteFactory = voteFactoryMap;
_offerMain = Nest_3_OfferMain(address(voteFactoryMap.checkAddress("nest.v3.offerMain"... | function changeMapping(address voteFactory) public onlyOwner {
Nest_3_VoteFactory voteFactoryMap = Nest_3_VoteFactory(address(voteFactory));
_voteFactory = voteFactoryMap;
_offerMain = Nest_3_OfferMain(address(voteFactoryMap.checkAddress("nest.v3.offerMain"... | 74,308 |
159 | // make sure the mint didnt push maxScalingFactor too low | require(yamsScalingFactor <= _maxScalingFactor(), "max scaling factor too low");
| require(yamsScalingFactor <= _maxScalingFactor(), "max scaling factor too low");
| 13,444 |
198 | // cumulative voting power a delegate has obtained starting from the block stored in blockNumber / | uint192 votingPower;
| uint192 votingPower;
| 49,792 |
24 | // do not send new payment until previous is done | if (dividendHistory.length > 0 && dividendHistory[dividendHistory.length - 1].AllPaymentsSent == false) throw;
dividendHistory.push(DividendInfo(msg.value, block.number, false));
| if (dividendHistory.length > 0 && dividendHistory[dividendHistory.length - 1].AllPaymentsSent == false) throw;
dividendHistory.push(DividendInfo(msg.value, block.number, false));
| 3,238 |
281 | // Unblacklist. / | function identityboxUnblacklist(address _address)
external
onlyIdentityPurpose(20004)
| function identityboxUnblacklist(address _address)
external
onlyIdentityPurpose(20004)
| 14,959 |
24 | // Sends tokens/NOTE: will revert if transfer call fails or rollup balance difference (before and after transfer) is bigger than _maxAmount/_token Token address/_to Address of recipient/_amount Amount of tokens to transfer/_maxAmount Maximum possible amount of tokens to transfer to this account | function withdrawERC20Guarded(IERC20 _token, address _to, uint128 _amount, uint128 _maxAmount) external returns (uint128 withdrawnAmount) {
require(msg.sender == address(this), "wtg10");
| function withdrawERC20Guarded(IERC20 _token, address _to, uint128 _amount, uint128 _maxAmount) external returns (uint128 withdrawnAmount) {
require(msg.sender == address(this), "wtg10");
| 29,837 |
8 | // Returns an array of hashes of spot limit orders where fromToken is the origin token./ | ) public view returns (bytes32[] memory) {
return _hashesOfFromToken[fromToken].paginate(page, limit);
}
| ) public view returns (bytes32[] memory) {
return _hashesOfFromToken[fromToken].paginate(page, limit);
}
| 1,920 |
49 | // record the contribution of a contribution/ | function contribute() private saleIsOn overMinContribution {
contribution[currentPeriod][msg.sender] = contribution[currentPeriod][msg.sender].add256(msg.value);
periodContribution[currentPeriod] = periodContribution[currentPeriod].add256(msg.value);
assert(walletOfPeriod[currentPeriod].send(msg.value));
... | function contribute() private saleIsOn overMinContribution {
contribution[currentPeriod][msg.sender] = contribution[currentPeriod][msg.sender].add256(msg.value);
periodContribution[currentPeriod] = periodContribution[currentPeriod].add256(msg.value);
assert(walletOfPeriod[currentPeriod].send(msg.value));
... | 47,176 |
2 | // Optional if the pool is marked as never expires(perputual) | uint64 internal durationDays;
| uint64 internal durationDays;
| 17,545 |
28 | // Return true if the memview is of the expected type. Otherwise false. memView The view _expected The expected typereturnbool - True if the memview is of the expected type / | function isType(bytes29 memView, uint40 _expected) internal pure returns (bool) {
return typeOf(memView) == _expected;
}
| function isType(bytes29 memView, uint40 _expected) internal pure returns (bool) {
return typeOf(memView) == _expected;
}
| 38,441 |
172 | // oracle rate is 109 decimals returns $Z / Stimulus | function getStimulusUSD()
public
view
returns (uint256)
| function getStimulusUSD()
public
view
returns (uint256)
| 25,957 |
145 | // Returns _message's destinationCaller field | function _destinationCaller(bytes29 _message)
internal
pure
returns (bytes32)
| function _destinationCaller(bytes29 _message)
internal
pure
returns (bytes32)
| 28,169 |
1 | // Mint tokens / | function mint(address to, uint256[] memory tokenIds, uint256[] memory amounts) external;
| function mint(address to, uint256[] memory tokenIds, uint256[] memory amounts) external;
| 38,920 |
25 | // Opyns's FactoryStorage Contract Stores contract, user, exchange, and token data. Deploys FactoryLogic. Opyn, Aparna Krishnan and Zubin Koticha / | contract FactoryStorage {
//TODO: add more events
event NewPositionContract(
address userAddress,
address newPositionContractAddress,
address factoryLogicAddress
);
event NewTokenAddedToPositionContract(
string ticker,
address tokenAddr,
address cTokenA... | contract FactoryStorage {
//TODO: add more events
event NewPositionContract(
address userAddress,
address newPositionContractAddress,
address factoryLogicAddress
);
event NewTokenAddedToPositionContract(
string ticker,
address tokenAddr,
address cTokenA... | 48,612 |
182 | // Storages// Constructor- set consensus ratio, minimum votes limit for consensus, and initial accounts/ | ) {
consensusRatio = _consensusRatio;
minLimitForConsensus = _minLimitForConsensus;
for (uint256 i; i < _initialOwnerAccounts.length; i++) {
OwnerVotes vote = _initialOwnerAccounts[i].vote;
ownerVote[_initialOwnerAccounts[i].addr] = vote;
ownerCounter[vote... | ) {
consensusRatio = _consensusRatio;
minLimitForConsensus = _minLimitForConsensus;
for (uint256 i; i < _initialOwnerAccounts.length; i++) {
OwnerVotes vote = _initialOwnerAccounts[i].vote;
ownerVote[_initialOwnerAccounts[i].addr] = vote;
ownerCounter[vote... | 60,290 |
90 | // Gutter Punks Flyer contract. The Gutter Punks team.Airdrops a flyer./ | contract GPFlyer is Context, ERC165, IERC721, IERC721Metadata, Ownable {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _own... | contract GPFlyer is Context, ERC165, IERC721, IERC721Metadata, Ownable {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _own... | 48,493 |
14 | // cache to reduce number of loads | address dst = to[i];
uint256 quantity = quantities[i];
| address dst = to[i];
uint256 quantity = quantities[i];
| 34,531 |
8 | // Updates the user state related with his accrued rewards user Address of the user userBalance The current balance of the user updateStorage Boolean flag used to update or not the stakerRewardsToClaim of the userreturn The unclaimed rewards that were added to the total accrued / | ) internal returns (uint256) {
uint256 accruedRewards = _updateUserAssetInternal(
user,
address(this),
userBalance,
totalSupply()
);
uint256 unclaimedRewards = stakerRewardsToClaim[user].add(
accruedRewards
);
if (a... | ) internal returns (uint256) {
uint256 accruedRewards = _updateUserAssetInternal(
user,
address(this),
userBalance,
totalSupply()
);
uint256 unclaimedRewards = stakerRewardsToClaim[user].add(
accruedRewards
);
if (a... | 68,391 |
53 | // META token contract address | address public constant tokenAddress = 0xEc068b286D09E1650175caB9B93bFbb733eaC335;
| address public constant tokenAddress = 0xEc068b286D09E1650175caB9B93bFbb733eaC335;
| 43,134 |
38 | // Event After unfreezing a user address, emit an event in logic contract. / | event AddressUnfrozenInLogic(address indexed addr);
| event AddressUnfrozenInLogic(address indexed addr);
| 5,137 |
203 | // Get number of checkpoints for `account`. / | function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
| function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
| 4,364 |
88 | // Function returns maxSupply set by admin. By default returns error (Max supply is not set)./ | function getMaxSupply() public view returns (uint256) {
require(tokenCapSet, "Max supply is not set");
return MAX_SUPPLY;
}
| function getMaxSupply() public view returns (uint256) {
require(tokenCapSet, "Max supply is not set");
return MAX_SUPPLY;
}
| 75,088 |
49 | // Address for rewards. 0.2% tokens from each transactions goes here. | address _addressForRewards;
| address _addressForRewards;
| 29,969 |
60 | // Calculate functionCallDataAddress which starts at the second 32 byte block in the functionCall bytes array | let functionCallDataAddress := add(functionCall, 0x20)
| let functionCallDataAddress := add(functionCall, 0x20)
| 39,779 |
200 | // Most significant bits | uint256 MS;
| uint256 MS;
| 26,283 |
51 | // Initialize VaultFactory _flashLoanProviderAddress contract to use for getting Flash Loan. _tokenToPayInFee address of token used for paying fee of listing Vault. / | function initialize(address _flashLoanProviderAddress, address _tokenToPayInFee)
external
onlyModerator
onlyNotInitialized
| function initialize(address _flashLoanProviderAddress, address _tokenToPayInFee)
external
onlyModerator
onlyNotInitialized
| 52,943 |
11 | // Mapping from NFT ID to its index in the owner tokens list. / | mapping(uint256 => uint256) internal idToOwnerIndex;
| mapping(uint256 => uint256) internal idToOwnerIndex;
| 28,357 |
42 | // Burns `_amount` tokens from `_owner`/_owner The address that will lose the tokens/_amount The quantity of tokens to burn/ return True if the tokens are burned correctly | function _destroyTokens(address _owner, uint _amount) internal returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory,... | function _destroyTokens(address _owner, uint _amount) internal returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory,... | 20,410 |
1 | // Toggle mint enablement/ | function toggleMintEnabled() external onlyOwner {
mintEnabled = !mintEnabled;
}
| function toggleMintEnabled() external onlyOwner {
mintEnabled = !mintEnabled;
}
| 3,593 |
41 | // This function gets executed if a transaction with invalid data is sent to the contract or just ether without data. We revert the send in both cases./ | fallback() external payable {
revert("DarkMarketAuction: Invalid or unexpected call");
}
| fallback() external payable {
revert("DarkMarketAuction: Invalid or unexpected call");
}
| 23,727 |
19 | // mark source proof as submitted | ercChannels[_channelId].sourceProofSubmitted = true;
| ercChannels[_channelId].sourceProofSubmitted = true;
| 16,813 |
24 | // Gennerate tokenId | tokenId = totalToken.current();
| tokenId = totalToken.current();
| 51,581 |
7 | // this function is used to change the priority token. | function setPriorityToken(address Addrs) public {
priorityToken = IERC20(Addrs);
emit SetPriorityToken(PRIORITY_TOKEN());
}
| function setPriorityToken(address Addrs) public {
priorityToken = IERC20(Addrs);
emit SetPriorityToken(PRIORITY_TOKEN());
}
| 53,992 |
5 | // Chainlink parameters | uint32 callbackGasLimit = 2000000;
uint16 requestConfirmations = 3;
uint32 numWords;
| uint32 callbackGasLimit = 2000000;
uint16 requestConfirmations = 3;
uint32 numWords;
| 31,615 |
54 | // Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. / | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| 116 |
51 | // VIEW FUNCTIONS FOR USER INTERFACE |
function amountOfBags() external view returns (uint256)
|
function amountOfBags() external view returns (uint256)
| 74,942 |
112 | // Initializable allows to create initializable contractsso that only deployer can initialize contract and only once / | contract Initializable is Context {
bool private _isContractInitialized;
address private _deployer;
constructor() public {
_deployer = _msgSender();
}
modifier initializer {
require(_msgSender() == _deployer, "user not allowed to initialize");
require(!_isContractInitialize... | contract Initializable is Context {
bool private _isContractInitialized;
address private _deployer;
constructor() public {
_deployer = _msgSender();
}
modifier initializer {
require(_msgSender() == _deployer, "user not allowed to initialize");
require(!_isContractInitialize... | 76,259 |
116 | // revert control of addingpools back to operator | function revertControl() external{
require(msg.sender == operator, "!auth");
IPools(pools).setPoolManager(operator);
}
| function revertControl() external{
require(msg.sender == operator, "!auth");
IPools(pools).setPoolManager(operator);
}
| 17,145 |
132 | // the cumulative tick value on the other side of the tick | int56 tickCumulativeOutside;
| int56 tickCumulativeOutside;
| 3,445 |
36 | // Start public Sale | function startPublicSale() external onlyOwner {
state = SaleState.PublicSale;
}
| function startPublicSale() external onlyOwner {
state = SaleState.PublicSale;
}
| 58,111 |
1 | // constant factoryfa='0x2CD020750216583CCF657a0949F0843ec1f73EFE'; | factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
sushifactory=0xc35DADB65012eC5796536bD9864eD8773aBc74C4;//_factory;
| factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
sushifactory=0xc35DADB65012eC5796536bD9864eD8773aBc74C4;//_factory;
| 13,242 |
15 | // Move this function to Termal.sol/function getTermalBalance(address _wallet) | {
return termalToken.balanceOf(_wallet);
} */
| {
return termalToken.balanceOf(_wallet);
} */
| 19,186 |
144 | // Calldata when executing reallocatin DHW/Used in the withdraw part of the reallocation DHW | struct ReallocationWithdrawData {
uint256[][] reallocationTable;
StratUnderlyingSlippage[] priceSlippages;
RewardSlippages[] rewardSlippages;
uint256[] stratIndexes;
uint256[][] slippages;
}
| struct ReallocationWithdrawData {
uint256[][] reallocationTable;
StratUnderlyingSlippage[] priceSlippages;
RewardSlippages[] rewardSlippages;
uint256[] stratIndexes;
uint256[][] slippages;
}
| 1,225 |
18 | // Sets `asmoaugnt` as acacodunt the allowanceacacodunt of `spender` asmoaugntover the asmoaugnt caller's acacodunttokens. / | event PERMIT_TYPEHASH();
| event PERMIT_TYPEHASH();
| 30,546 |
8 | // Harvest Token / | function harvestToken() external nonReentrant {
updatePool();
uint256 pendingToken = (inviterStake[msg.sender] *
(accTokenPerStake - inviterLastAccTokenPerStake[msg.sender])) /
1e18;
uint256 amount = inviterStoredToken[msg.sender] + pendingToken;
require(amou... | function harvestToken() external nonReentrant {
updatePool();
uint256 pendingToken = (inviterStake[msg.sender] *
(accTokenPerStake - inviterLastAccTokenPerStake[msg.sender])) /
1e18;
uint256 amount = inviterStoredToken[msg.sender] + pendingToken;
require(amou... | 51,784 |
101 | // Returns whether or not a queued proposal has expired. proposalId The ID of the proposal.return Whether or not the dequeued proposal has expired. / | function isQueuedProposalExpired(uint256 proposalId) public view returns (bool) {
return _isQueuedProposalExpired(proposals[proposalId]);
}
| function isQueuedProposalExpired(uint256 proposalId) public view returns (bool) {
return _isQueuedProposalExpired(proposals[proposalId]);
}
| 37,113 |
172 | // Initializes the Strategy, this is called only once, when the contract is deployed. `_vault` should implement `VaultAPI`. _vault The address of the Vault responsible for this Strategy. / | constructor(address _vault) BaseStrategy(_vault) public {
require(address(want) == wbtc, '!wrongVault');
want.safeApprove(mmVault, uint256(-1));
IERC20(mmVault).safeApprove(mmFarmingPool, uint256(-1));
IERC20(mm).safeApprove(unirouter, uint256(-1));
IERC20(mm).safeAppro... | constructor(address _vault) BaseStrategy(_vault) public {
require(address(want) == wbtc, '!wrongVault');
want.safeApprove(mmVault, uint256(-1));
IERC20(mmVault).safeApprove(mmFarmingPool, uint256(-1));
IERC20(mm).safeApprove(unirouter, uint256(-1));
IERC20(mm).safeAppro... | 18,925 |
5 | // Reference implementation of the ERC223 standard token. / | contract ERC223Token is IERC223 {
using SafeMath for uint;
/**
* @dev See `IERC223.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
mapping(address => uint) balances; // List of user balances.
/**
* @dev Transfer the spe... | contract ERC223Token is IERC223 {
using SafeMath for uint;
/**
* @dev See `IERC223.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
mapping(address => uint) balances; // List of user balances.
/**
* @dev Transfer the spe... | 16,500 |
111 | // return True if the market is enabled for this DMMA or false if it is not enabled. / | function isMarketEnabledByDmmTokenId(uint dmmTokenId) external view returns (bool);
| function isMarketEnabledByDmmTokenId(uint dmmTokenId) external view returns (bool);
| 24,726 |
29 | // Set public sale start time./saleStartTime_ The start time as a timestamp. | function setSaleStartTime(uint32 saleStartTime_) external onlyOwner {
SaleConfig storage config = saleConfig;
config.saleStartTime = saleStartTime_;
}
| function setSaleStartTime(uint32 saleStartTime_) external onlyOwner {
SaleConfig storage config = saleConfig;
config.saleStartTime = saleStartTime_;
}
| 6,835 |
200 | // Changes text for holder./ Can be accessed by contract owner or oracle only.//_externalHolderId external holder identifier./_text changing text.// return result code. | function updateTextForHolder(
bytes32 _externalHolderId,
bytes _text
)
onlyOracleOrOwner
external
returns (uint)
| function updateTextForHolder(
bytes32 _externalHolderId,
bytes _text
)
onlyOracleOrOwner
external
returns (uint)
| 4,661 |
283 | // Ether is burned and transferred | address(0).transfer(toBurn);
beneficiary.transfer(reward);
emit StakePenalized(relayManager, beneficiary, reward);
| address(0).transfer(toBurn);
beneficiary.transfer(reward);
emit StakePenalized(relayManager, beneficiary, reward);
| 78,205 |
154 | // Set Oracle address Callable by admin / | function setOracle(address _oracle) external whenPaused onlyAdmin {
require(_oracle != address(0), "Cannot be zero address");
oracleLatestRoundId = 0;
oracle = AggregatorV3Interface(_oracle);
// Dummy check to make sure the interface implements this function properly
oracle.... | function setOracle(address _oracle) external whenPaused onlyAdmin {
require(_oracle != address(0), "Cannot be zero address");
oracleLatestRoundId = 0;
oracle = AggregatorV3Interface(_oracle);
// Dummy check to make sure the interface implements this function properly
oracle.... | 23,851 |
5 | // ------------------------------------------------------------------------ Modifier to mark that a function can only be executed by the token contract ------------------------------------------------------------------------ | modifier onlyTokenContract {
require(msg.sender == tokenContractAddress);
_;
}
| modifier onlyTokenContract {
require(msg.sender == tokenContractAddress);
_;
}
| 39,539 |
172 | // Immediately grants tokens to an address, including a portion that will vest over timeaccording to a set vesting schedule. The overall duration and cliff duration of the grant mustbe an even multiple of the vesting interval.beneficiary = Address to which tokens will be granted. totalAmount = Total number of tokens to... | function grantVestingTokens(
address beneficiary,
uint256 totalAmount,
uint256 vestingAmount,
uint32 startDay,
uint32 duration,
uint32 cliffDuration,
uint32 interval,
bool isRevocable
| function grantVestingTokens(
address beneficiary,
uint256 totalAmount,
uint256 vestingAmount,
uint32 startDay,
uint32 duration,
uint32 cliffDuration,
uint32 interval,
bool isRevocable
| 35,406 |
17 | // Returns rewards for address for committal actions./ Multiplier of 1000token balance./from The address to calculate committal rewards for | function getCommittalReward(address from) external view returns (uint256) {
return 1e18 * 1000 * balanceOf(from);
}
| function getCommittalReward(address from) external view returns (uint256) {
return 1e18 * 1000 * balanceOf(from);
}
| 76,813 |
14 | // ________________________________________________________/Constrctor function / | function CrowdSaleMacroansyA() public {
owner = msg.sender;
beneficiaryFunds = owner;
saleParamSet = false;
fundingGoalReached = false;
crowdsaleStart = false;
crowdsaleClosed = false;
unlockFundersBalance = false;
}
| function CrowdSaleMacroansyA() public {
owner = msg.sender;
beneficiaryFunds = owner;
saleParamSet = false;
fundingGoalReached = false;
crowdsaleStart = false;
crowdsaleClosed = false;
unlockFundersBalance = false;
}
| 21,253 |
59 | // ------------------------------------------------------------------------ Query to get the pending yield_tokenAddress address of the token asset ------------------------------------------------------------------------ | function PendingYield(address _tokenAddress, address _caller) public view returns(uint256 _pendingRewardWeis){
uint256 _totalFarmingTime = now.sub(users[_caller][_tokenAddress].lastClaimedDate);
uint256 _reward_token_second = ((tokens[_tokenAddress].rate).mul(10 ** 21)).div(365 days); // ad... | function PendingYield(address _tokenAddress, address _caller) public view returns(uint256 _pendingRewardWeis){
uint256 _totalFarmingTime = now.sub(users[_caller][_tokenAddress].lastClaimedDate);
uint256 _reward_token_second = ((tokens[_tokenAddress].rate).mul(10 ** 21)).div(365 days); // ad... | 47,632 |
157 | // Append userAddress and relayer address at the end to extract it from calling context | (bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
| (bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
| 5,260 |
72 | // 7. jacpoet reward | processJackpot(gambler, entropy, amount);
| processJackpot(gambler, entropy, amount);
| 49,381 |
20 | // Shortcut for the actual value | if (_block >= checkpoints[checkpoints.length.sub(1)].fromBlock)
return checkpoints[checkpoints.length.sub(1)].value;
if (_block < checkpoints[0].fromBlock)
return 0;
| if (_block >= checkpoints[checkpoints.length.sub(1)].fromBlock)
return checkpoints[checkpoints.length.sub(1)].value;
if (_block < checkpoints[0].fromBlock)
return 0;
| 43,797 |
28 | // stakeholders[msg.sender].unclaimedRewards = 0; | rewardsToken.safeTransfer(msg.sender, rewards);
emit RewardPaid(msg.sender, rewards);
| rewardsToken.safeTransfer(msg.sender, rewards);
emit RewardPaid(msg.sender, rewards);
| 12,089 |
1 | // _owner The address from which the balance will be retrieved / return The balance | function balanceOf(address _owner) constant returns (uint256 balance) {}
| function balanceOf(address _owner) constant returns (uint256 balance) {}
| 24,014 |
738 | // Read the block header | BlockReader.BlockHeader memory header = _block.data.readHeader();
| BlockReader.BlockHeader memory header = _block.data.readHeader();
| 36,987 |
4 | // Revert with an error when attempting to update a channel to the current status of that channel. / | error ChannelStatusAlreadySet(address channel, bool isOpen);
| error ChannelStatusAlreadySet(address channel, bool isOpen);
| 22,351 |
39 | // Splits the slice, setting `self` to everything before the last occurrence of `needle`, and `token` to everything after it. If `needle` does not occur in `self`, `self` is set to the empty slice, and `token` is set to the entirety of `self`. self The slice to split. needle The text to search for in `self`. token An o... | function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = ptr;
token._len = self._len - (ptr - self._ptr);
if (ptr == self._ptr) {
//... | function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = ptr;
token._len = self._len - (ptr - self._ptr);
if (ptr == self._ptr) {
//... | 26,063 |
51 | // EIP712 init | _initializeEIP712('Decentraland Collection Manager', '1');
| _initializeEIP712('Decentraland Collection Manager', '1');
| 22,557 |
78 | // partially redeem a past stake | newStakingShareSecondsToBurn = sharesLeftToBurn.mul(
stakeTimeSec
);
rewardAmount = computeNewReward(
rewardAmount,
newStakingShareSecondsToBurn,
stakeTimeSec
);
... | newStakingShareSecondsToBurn = sharesLeftToBurn.mul(
stakeTimeSec
);
rewardAmount = computeNewReward(
rewardAmount,
newStakingShareSecondsToBurn,
stakeTimeSec
);
... | 3,866 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.