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 |
|---|---|---|---|---|
74 | // If we have enough "free" tokens, allocate them | if (freeTokens >= allocated){
freeTokens = SafeMath.sub(freeTokens, allocated);
gameTokenAmount[game] = allocated;
}
| if (freeTokens >= allocated){
freeTokens = SafeMath.sub(freeTokens, allocated);
gameTokenAmount[game] = allocated;
}
| 28,003 |
6 | // Requires the expected and actual data arguments are equal | require(_data.length == _expectedSetupForAugurData.length && keccak256(_data) == keccak256(_expectedSetupForAugurData));
| require(_data.length == _expectedSetupForAugurData.length && keccak256(_data) == keccak256(_expectedSetupForAugurData));
| 4,379 |
238 | // Returns true if msg.sender is grantee eligible to trigger stake/ undelegation for this operator. Function checks both standard grantee/ and managed grantee case./operator The operator tokens are delegated to./tokenGrant KEEP token grant contract reference. | function canUndelegate(
Storage storage self,
address operator,
TokenGrant tokenGrant
| function canUndelegate(
Storage storage self,
address operator,
TokenGrant tokenGrant
| 6,914 |
6 | // Emergency Stop | function halt() public onlyAdmin {
icoState = State.halted;
}
| function halt() public onlyAdmin {
icoState = State.halted;
}
| 15,595 |
16 | // I mint TB token to msg.sender to be able to track collateral ownership. Minted amount equals debt increase. | _mint(msg.sender, debtAfter - debtBefore);
| _mint(msg.sender, debtAfter - debtBefore);
| 13,999 |
86 | // Internal Out Of Gas/Throw: revert this transaction too; Call Stack Depth Limit reached: n/a after HF 4; Recursive Call: safe, all changes already made. | ProxyEventsEmitter(proxies[_symbol]).emitTransfer(_address(_fromId), _address(_toId), _value);
| ProxyEventsEmitter(proxies[_symbol]).emitTransfer(_address(_fromId), _address(_toId), _value);
| 6,887 |
11 | // With the xDai AMB, it is best practice to also check the source chainId https:docs.tokenbridge.net/amb-bridge/how-to-develop-xchain-apps-by-ambreceive-a-method-call-from-the-amb-bridge | require(l1MessengerAddress.messageSourceChainId() == l2ChainId, "L2_XDAI_BRG: Invalid source Chain ID");
| require(l1MessengerAddress.messageSourceChainId() == l2ChainId, "L2_XDAI_BRG: Invalid source Chain ID");
| 50,024 |
16 | // allow owner to remove arbitrary tokens included just in case contract receives wrong token | function withdrawToken(address _token, uint256 _value) onlyOwner returns (bool ok)
| function withdrawToken(address _token, uint256 _value) onlyOwner returns (bool ok)
| 8,248 |
26 | // The OpenSea operator filter registry. | address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
| address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
| 19,576 |
81 | // generate the pancakeswap pair path of token -> weth | address[] memory path = new address[](2);
path[0] = pancakeswapV2Router.WAVAX();
path[1] = address(this);
| address[] memory path = new address[](2);
path[0] = pancakeswapV2Router.WAVAX();
path[1] = address(this);
| 9,724 |
41 | // Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) bypresenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't/ Sets `value` as the allowance of `spender` over `owner`'s tokens,given `owner`'s signed app... | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
| function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
| 1,408 |
170 | // Join a pool self - ConfigurableRightsPool instance calling the library bPool - Core BPool the CRP is wrapping poolAmountOut - number of pool tokens to receive maxAmountsIn - Max amount of asset tokens to spendreturn actualAmountsIn - calculated values of the tokens to pull in / | function joinPool(
IConfigurableRightsPool self,
IBPool bPool,
uint poolAmountOut,
uint[] calldata maxAmountsIn
)
external
view
returns (uint[] memory actualAmountsIn)
| function joinPool(
IConfigurableRightsPool self,
IBPool bPool,
uint poolAmountOut,
uint[] calldata maxAmountsIn
)
external
view
returns (uint[] memory actualAmountsIn)
| 30,745 |
158 | // maximum number of worker accounts allowed per manager | uint256 maxWorkerCount;
| uint256 maxWorkerCount;
| 104 |
34 | // Give the multisig wallet all initial tokens (unissued tokens) | balances[multiSigWallet] = totalSupply;
emit TRANSFER664(address(0), multiSigWallet, totalSupply);
| balances[multiSigWallet] = totalSupply;
emit TRANSFER664(address(0), multiSigWallet, totalSupply);
| 13,782 |
117 | // WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist.- `to` cannot be the zero address. Emits a {Transfer} event. / | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to... | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to... | 113 |
113 | // InvestaX X-Token Lite (c) Copyright 2020 IC SG PTE LTD, all rights reserved. Contract: Investa AdminNo part of this source code may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, printing, photocopying,recording, or otherwise, without the prior written permissio... | abstract contract TransferState is InvestaAdmin {
bool private _transfersEnabled = false;
/**
* @dev Emitted when transfer state is disabled.
* @param disabledBy The address of the administrator who performed this operation.
*/
event TransfersDisabled(address indexed disabledBy);
/**
* @dev Emitted wh... | abstract contract TransferState is InvestaAdmin {
bool private _transfersEnabled = false;
/**
* @dev Emitted when transfer state is disabled.
* @param disabledBy The address of the administrator who performed this operation.
*/
event TransfersDisabled(address indexed disabledBy);
/**
* @dev Emitted wh... | 14,561 |
2 | // Map of users address and their configuration data (userAddress => userConfiguration) | mapping(address => DataTypes.UserConfigurationMap) internal _usersConfig;
| mapping(address => DataTypes.UserConfigurationMap) internal _usersConfig;
| 10,872 |
0 | // Construct a new Fund Oracles contractmed_ The address of the Medianizerlink_ The LINK token addressweth_ The WETH token addressuniswapExchange_ The address of the LINK to ETH Uniswap Exchange/ | constructor(MedianizerInterface med_, ERC20 link_, WETH weth_, UniswapExchangeInterface uniswapExchange_) public {
med = med_;
link = link_;
weth = weth_;
uniswapExchange = uniswapExchange_;
}
| constructor(MedianizerInterface med_, ERC20 link_, WETH weth_, UniswapExchangeInterface uniswapExchange_) public {
med = med_;
link = link_;
weth = weth_;
uniswapExchange = uniswapExchange_;
}
| 43,786 |
53 | // REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
public
| function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
public
| 17,147 |
173 | // Creator: | address(this),
| address(this),
| 42,984 |
33 | // subclasses should add their custom withdraw logic in this function. Note that security fee has already been deducted, so it shouldn't be deducted again within this function. / | function _withdraw(uint256 _amount) internal virtual;
| function _withdraw(uint256 _amount) internal virtual;
| 33,002 |
227 | // issueId => nomatch | mapping (uint256 => uint256) public nomatch;
| mapping (uint256 => uint256) public nomatch;
| 22,871 |
43 | // Core creator implementation / | abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
using Strings for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using AddressUpgradeable for address;
/// @custom:oz-upgrades-unsafe-allow state-variable-assignment
uint256 _tokenCount = 0;
// Track registere... | abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
using Strings for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using AddressUpgradeable for address;
/// @custom:oz-upgrades-unsafe-allow state-variable-assignment
uint256 _tokenCount = 0;
// Track registere... | 6,470 |
11 | // get Dydx Solo Address / | function getDydxAddress() public pure returns (address addr) {
addr = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
}
| function getDydxAddress() public pure returns (address addr) {
addr = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
}
| 24,765 |
62 | // Query if an address is an authorized operator for another address/_owner The address that owns the WARs/_operator The address that acts on behalf of the owner/ return True if `_operator` is an approved operator for `_owner`, false otherwise | function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return operatorToApprovals[_owner][_operator];
}
| function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return operatorToApprovals[_owner][_operator];
}
| 31,325 |
273 | // adjustments[10]/mload(0x4000), Constraint expression for pedersen/hash0/ec_subset_sum/bit_extraction_end: column4_row0. | let val := /*column4_row0*/ mload(0x2360)
| let val := /*column4_row0*/ mload(0x2360)
| 60,122 |
497 | // Collective Canvas contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract CollectiveCanvas is ERC721, Ownable {
enum ValidationState {
LOOKING_FOR_OPEN_TAG_OPEN_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE,
LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET,
LOOKING_FOR_CLOSE_TAG_SLASH,
LOOKING_FOR_CLOSE_TAG_CLOSE... | contract CollectiveCanvas is ERC721, Ownable {
enum ValidationState {
LOOKING_FOR_OPEN_TAG_OPEN_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE,
LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET,
LOOKING_FOR_CLOSE_TAG_SLASH,
LOOKING_FOR_CLOSE_TAG_CLOSE... | 83,340 |
1 | // the liquidity index. Expressed in ray | uint128 liquidityIndex;
| uint128 liquidityIndex;
| 2,507 |
134 | // Constraint expression for cpu/operands/mem0_addr: column5_row4 + half_offset_size - (cpu__decode__opcode_rc__bit_1column7_row9 + (1 - cpu__decode__opcode_rc__bit_1)column7_row1 + column7_row8). | let val := addmod(
addmod(/*column5_row4*/ mload(0x1780), /*half_offset_size*/ mload(0xc0), PRIME),
sub(
PRIME,
addmod(
addmod(
mulmod(
| let val := addmod(
addmod(/*column5_row4*/ mload(0x1780), /*half_offset_size*/ mload(0xc0), PRIME),
sub(
PRIME,
addmod(
addmod(
mulmod(
| 20,239 |
21 | // Repay debt to protocol amount Assets to repay to the protocol / | function repayToProtocol(uint256 amount) internal virtual;
| function repayToProtocol(uint256 amount) internal virtual;
| 19,858 |
447 | // distribute wpc | if (distributeWpcPaused == false) {
piggyDistribution.distributeBorrowWpc(pToken, borrower, false);
}
| if (distributeWpcPaused == false) {
piggyDistribution.distributeBorrowWpc(pToken, borrower, false);
}
| 13,762 |
16 | // ========== MUTATIVE FUNCTIONS ========== / Mint and lock new tokens Minted and locked tokens incur a 50% penalty when withdrawn before lockDuration has passed. | function lock(address user, uint256 amount) external onlyRole(MINTER_ROLE) {
require(amount > 0, "Cannot lock 0");
balances[user] = balances[user] + amount;
uint256 unlockTime = block.timestamp + lockDuration;
LockedBalance[] storage locks = userLocks[user];
uint256 idx = loc... | function lock(address user, uint256 amount) external onlyRole(MINTER_ROLE) {
require(amount > 0, "Cannot lock 0");
balances[user] = balances[user] + amount;
uint256 unlockTime = block.timestamp + lockDuration;
LockedBalance[] storage locks = userLocks[user];
uint256 idx = loc... | 1,523 |
5 | // Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId. | function getBaseURI(uint256 _tokenId) internal view returns (string memory) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
return baseURI[indi... | function getBaseURI(uint256 _tokenId) internal view returns (string memory) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
return baseURI[indi... | 31,012 |
138 | // Delete any fixed credits per token | delete nonRebasingCreditsPerToken[msg.sender];
| delete nonRebasingCreditsPerToken[msg.sender];
| 19,738 |
20 | // durationYears = duration; | startTime = Now();
uint32 dur = math.min(durationYears, Sys.MaxTimingYearsPeriod);
bidEnds = startTime + Sys.BidPeriodPerYear * dur;
revEnds = bidEnds + Sys.RevealPeriodPerYear * dur;
uint256 exp = uint256(math.max(revEnds, expiryBase)) +
uint256(durationYea... | startTime = Now();
uint32 dur = math.min(durationYears, Sys.MaxTimingYearsPeriod);
bidEnds = startTime + Sys.BidPeriodPerYear * dur;
revEnds = bidEnds + Sys.RevealPeriodPerYear * dur;
uint256 exp = uint256(math.max(revEnds, expiryBase)) +
uint256(durationYea... | 36,754 |
192 | // Used to change `keeper`.`keeper` is the only address that may call `tend()` or `harvest()`, other than `governance()` or `strategist`. However, unlike `governance()` or `strategist`, `keeper` may only call `tend()` and `harvest()`, and no other authorized functions, following the principle of least privilege.This ma... | function setKeeper(address _keeper) external onlyAuthorized {
keeper = _keeper;
emit UpdatedKeeper(_keeper);
}
| function setKeeper(address _keeper) external onlyAuthorized {
keeper = _keeper;
emit UpdatedKeeper(_keeper);
}
| 7,374 |
87 | // get this address from whitlist. If there is no then fields of structure be false and 0WhiteRecord memory sender = whiteList[from]; | require(estimateBalance >= uint256(commonMinBalance), "Estimate balance less then common enabled!");
if (whiteListEnable == true) {
require(whiteList[from].transferEnabled, "Sender is not whitelist member!");
require(
estimateBalance >= uint25... | require(estimateBalance >= uint256(commonMinBalance), "Estimate balance less then common enabled!");
if (whiteListEnable == true) {
require(whiteList[from].transferEnabled, "Sender is not whitelist member!");
require(
estimateBalance >= uint25... | 60,716 |
1,104 | // 553 | entry "unsandwiched" : ENG_ADJECTIVE
| entry "unsandwiched" : ENG_ADJECTIVE
| 17,165 |
32 | // Calculate x + y.Special values behave in the following way: NaN + x = NaN for any x.Infinity + x = Infinity for any finite x.-Infinity + x = -Infinity for any finite x.Infinity + Infinity = Infinity.-Infinity + -Infinity = -Infinity.Infinity + -Infinity = -Infinity + Infinity = NaN.x quadruple precision number y qua... | function add(bytes16 x, bytes16 y) internal pure returns (bytes16) {
uint256 xExponent = (uint128(x) >> 112) & 0x7FFF;
uint256 yExponent = (uint128(y) >> 112) & 0x7FFF;
if (xExponent == 0x7FFF) {
if (yExponent == 0x7FFF) {
if (x == y) return x;
el... | function add(bytes16 x, bytes16 y) internal pure returns (bytes16) {
uint256 xExponent = (uint128(x) >> 112) & 0x7FFF;
uint256 yExponent = (uint128(y) >> 112) & 0x7FFF;
if (xExponent == 0x7FFF) {
if (yExponent == 0x7FFF) {
if (x == y) return x;
el... | 5,749 |
41 | // Transfer tokens to a secified address (For Only Owner) to The address to transfer to. value The amount to be transferred.return Transfer status in true or false / | function transferByOwner(address to, uint256 value, uint8 lockingTime) public AllTransfersLockStatus onlyOwner returns (bool) {
addLockingTime(to,lockingTime,value);
_transfer(msg.sender, to, value);
return true;
}
| function transferByOwner(address to, uint256 value, uint8 lockingTime) public AllTransfersLockStatus onlyOwner returns (bool) {
addLockingTime(to,lockingTime,value);
_transfer(msg.sender, to, value);
return true;
}
| 24,500 |
19 | // Get the address of the itoken based on the pool Id. pid Daa Pool Index id. / | function getcoin(uint256 pid) external view returns(address){
return deployeditokens[pid];
}
| function getcoin(uint256 pid) external view returns(address){
return deployeditokens[pid];
}
| 34,780 |
17 | // Gas correction offset | uint256 public initialGasOffsetCorrection;
uint256 public gasOffsetCorrection;
| uint256 public initialGasOffsetCorrection;
uint256 public gasOffsetCorrection;
| 48,855 |
3 | // Mint bBTC with Sett LP tokenInvoking pool.sett.safeTransferFrom() before core.mint(), will mess up core.totalSystemAssets() calculationpoolId System internal ID of the whitelisted curve poolinAmount Amount of Sett LP token to mint bBTC with return outAmount Amount of bBTC minted to user's account/ | function mint(uint poolId, uint inAmount, bytes32[] calldata merkleProof)
override
external
defend
blockLocked
returns(uint outAmount)
| function mint(uint poolId, uint inAmount, bytes32[] calldata merkleProof)
override
external
defend
blockLocked
returns(uint outAmount)
| 11,976 |
41 | // Internal function to mint a new tokenReverts if the given token ID already exists_to The address that will own the minted token_tokenId uint256 ID of the token to be minted by the msg.sender/ | function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
Transfer(address(0), _to, _tokenId);
}
| function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
Transfer(address(0), _to, _tokenId);
}
| 85,914 |
2 | // EIP-20 token decimals for this token | uint8 public constant decimals = 18;
| uint8 public constant decimals = 18;
| 28,813 |
144 | // Public Functions | function mint(uint256 _numTokens) external payable {
require(isSaleActive, "The sale is paused.");
require(_numTokens <= MAX_MINT_PER_TX, "You cannot mint that many in one transaction.");
require(mintedPerWallet[msg.sender] + _numTokens <= MAX_MINT_PER_TX, "You cannot mint that many total.")... | function mint(uint256 _numTokens) external payable {
require(isSaleActive, "The sale is paused.");
require(_numTokens <= MAX_MINT_PER_TX, "You cannot mint that many in one transaction.");
require(mintedPerWallet[msg.sender] + _numTokens <= MAX_MINT_PER_TX, "You cannot mint that many total.")... | 22,485 |
75 | // background N°7 => Artistic | function item_7() public pure returns (string memory) {
return base("FF00E3", "E8E18B", "00C4AD");
}
| function item_7() public pure returns (string memory) {
return base("FF00E3", "E8E18B", "00C4AD");
}
| 33,868 |
61 | // fallback function / | function() payable public {
buy(msg.sender);
}
| function() payable public {
buy(msg.sender);
}
| 5,274 |
200 | // our simple algo get the lowest apr strat cycle through and see who could take its funds plus want for the highest apr | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
... | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
... | 61,467 |
95 | // The Amount of allready collected tokens for rewards (for airdrops) / | function RewardTokensBalance() public view returns (uint256) {
return _collectedTokens;
}
| function RewardTokensBalance() public view returns (uint256) {
return _collectedTokens;
}
| 41,839 |
1 | // When a withdrawal is initiated, we burn the withdrawer's token to prevent subsequent usage. | function _handleInitiateWithdrawal(
address, // _to,
uint _tokenId
)
internal
override
{
_burn(_tokenId);
}
| function _handleInitiateWithdrawal(
address, // _to,
uint _tokenId
)
internal
override
{
_burn(_tokenId);
}
| 42,091 |
0 | // Emitted when tokens have been drawn down for a beneficiary | event TokensClaimed(address indexed beneficiary, uint256 indexed version, uint256 amount);
| event TokensClaimed(address indexed beneficiary, uint256 indexed version, uint256 amount);
| 19,435 |
30 | // Modify the NestNode raising time | function changeNNLimitTime(uint256 num) public onlyOwner {
require(num > 0, "Parameter needs to be greater than 0");
_NNLimitTime = num;
}
| function changeNNLimitTime(uint256 num) public onlyOwner {
require(num > 0, "Parameter needs to be greater than 0");
_NNLimitTime = num;
}
| 24,767 |
4 | // implementation of a LUKSO's Universal Profile based on LSP3 Fabian Vogelsteller <fabian@lukso.network> Implementation of the ERC725Account + LSP1 universalReceiver / | contract UniversalProfile is LSP0ERC725Account {
/**
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
* @param _newOwner the owner of the contract
*/
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {
// set key SupportedStandard... | contract UniversalProfile is LSP0ERC725Account {
/**
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
* @param _newOwner the owner of the contract
*/
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {
// set key SupportedStandard... | 34,195 |
13 | // Get likers of a project | function getLikers(uint _projectId) public view returns (address[] memory) {
Project storage project = projects[_projectId];
return project.likers;
}
| function getLikers(uint _projectId) public view returns (address[] memory) {
Project storage project = projects[_projectId];
return project.likers;
}
| 23,277 |
27 | // insert the trove in the factory contract in the right spot of the list of troves with the same token _newNextTrove is the trove that we think will be the next one in the list. This might be off in case there were some other list changing transactions / | function insertTrove(address _newNextTrove) private {
// insertTrove is only called after updateCollateral has been invoked and the _debt variable has been updated
require(_collateralization() >= mcr(), "41670 TCR must be > MCR");
// only call insertTrove if there are more than one troves in the list
... | function insertTrove(address _newNextTrove) private {
// insertTrove is only called after updateCollateral has been invoked and the _debt variable has been updated
require(_collateralization() >= mcr(), "41670 TCR must be > MCR");
// only call insertTrove if there are more than one troves in the list
... | 22,067 |
31 | // FUNCTIONS // PRIVATE FUNCTIONS / | function _addTokenTo(address _to, uint256 _tokenId) internal {
require(cardIdToOwner[_tokenId] == address(0));
ownerToCardCount[_to] = ownerToCardCount[_to] + 1;
cardIdToOwner[_tokenId] = _to;
}
| function _addTokenTo(address _to, uint256 _tokenId) internal {
require(cardIdToOwner[_tokenId] == address(0));
ownerToCardCount[_to] = ownerToCardCount[_to] + 1;
cardIdToOwner[_tokenId] = _to;
}
| 34,000 |
33 | // Internal function to reward the player with a random power-up or defense NFT player The player's address / | function _rewardRandomPowerUpOrDefense(address player) internal {
uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, player))) % 2; // Generate a random number (0 or 1)
uint256 tokenId = randomNumber == 0 ? POWER_UP_ID : DEFENSE_ID;
_mint(player, tokenId, 1, "");
... | function _rewardRandomPowerUpOrDefense(address player) internal {
uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, player))) % 2; // Generate a random number (0 or 1)
uint256 tokenId = randomNumber == 0 ? POWER_UP_ID : DEFENSE_ID;
_mint(player, tokenId, 1, "");
... | 31,544 |
26 | // flash withdraw from strategy, providing strategy tokens, buying wSqueeth, burning and receiving ETH this function will execute a flash swap where it receives wSqueeth, burns, withdraws ETH and then repays the flash swap with ETH _crabAmount strategy token amount to burn _maxEthToPay maximum ETH to pay to buy back th... | function flashWithdraw(uint256 _crabAmount, uint256 _maxEthToPay) external nonReentrant {
uint256 exactWSqueethNeeded = _getDebtFromStrategyAmount(_crabAmount);
_exactOutFlashSwap(
weth,
wPowerPerp,
IUniswapV3Pool(ethWSqueethPool).fee(),
exactWSqueeth... | function flashWithdraw(uint256 _crabAmount, uint256 _maxEthToPay) external nonReentrant {
uint256 exactWSqueethNeeded = _getDebtFromStrategyAmount(_crabAmount);
_exactOutFlashSwap(
weth,
wPowerPerp,
IUniswapV3Pool(ethWSqueethPool).fee(),
exactWSqueeth... | 23,986 |
67 | // ============ Structs ============ //The base definition of a SetToken Positioncomponent Address of token in the Position moduleIf not in default state, the address of associated module unitEach unit is theof components per 10^18 of a SetToken positionState Position ENUM. Default is 0; External is 1 dataArbitrary dat... | struct Position {
address component;
address module;
int256 unit;
uint8 positionState;
bytes data;
}
| struct Position {
address component;
address module;
int256 unit;
uint8 positionState;
bytes data;
}
| 10,901 |
54 | // Transfer ownership of the contract from the current {`owner()`} to the {`pendingOwner()`}. Once this function is called:- the current {`owner()`} will loose access to the functions restricted to the {`owner()`} only.- the {`pendingOwner()`} will gain access to the functions restricted to the {`owner()`} only. @custo... | function acceptOwnership() public virtual override {
address previousOwner = owner();
_acceptOwnership();
| function acceptOwnership() public virtual override {
address previousOwner = owner();
_acceptOwnership();
| 22,893 |
253 | // Retrieves the EVM Recipient from a Transfer _transferAction The messagereturn The EVM Recipient / | function evmRecipient(bytes29 _transferAction)
internal
pure
typeAssert(_transferAction, Types.Transfer)
returns (address)
| function evmRecipient(bytes29 _transferAction)
internal
pure
typeAssert(_transferAction, Types.Transfer)
returns (address)
| 22,383 |
84 | // implement the eip-2612 | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(owner != address(0), "zero address");
require(block.timestamp <= deadline || deadline == 0, "permit is expired");
bytes32 digest = keccak256(
... | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(owner != address(0), "zero address");
require(block.timestamp <= deadline || deadline == 0, "permit is expired");
bytes32 digest = keccak256(
... | 14,566 |
9 | // Core ERC1155 creator implementation / | abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
uint256 constant public VERSION = 2;
using EnumerableSet for EnumerableSet.AddressSet;
string public name;
string public symbol;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes... | abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
uint256 constant public VERSION = 2;
using EnumerableSet for EnumerableSet.AddressSet;
string public name;
string public symbol;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes... | 14,031 |
112 | // sUSD is a special case and is never stale. | if (currencyKey == "sUSD") return false;
return lastRateUpdateTimes[currencyKey].add(rateStalePeriod) < now;
| if (currencyKey == "sUSD") return false;
return lastRateUpdateTimes[currencyKey].add(rateStalePeriod) < now;
| 52,517 |
171 | // The multiplication in the next line has the same exact purpose as the one above. | let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
| let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
| 35,421 |
17 | // 无效操作 | return CODE_ERR_INVALIDOPERATION;
| return CODE_ERR_INVALIDOPERATION;
| 11,110 |
22 | // Enumerate NFTs assigned to an owner/Throws if `_index` >= `balanceOf(_owner)` or if/`_owner` is the zero address, representing invalid NFTs./_owner An address where we are interested in NFTs owned by them/_index A counter less than `balanceOf(_owner)`/ return The token identifier for the `_index`th NFT assigned to `... | function tokenOfOwnerByIndex(address _owner , uint256 _index) external view returns (uint256) {
require (_index < max, "index out of range");
require (_owner != address(0), "address invalid");
require (ownership[_index] != address(0), "token not assigned");
return _index;
}
| function tokenOfOwnerByIndex(address _owner , uint256 _index) external view returns (uint256) {
require (_index < max, "index out of range");
require (_owner != address(0), "address invalid");
require (ownership[_index] != address(0), "token not assigned");
return _index;
}
| 56,213 |
666 | // Make sure input address is clean. (Solidity does not guarantee this) | input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
| input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
| 36,034 |
228 | // function to update base URI for NFT marketplaces __baseURI The new base URI/ | function updateBaseURI(string memory __baseURI) public onlyOwner {
_baseTokenURI = __baseURI;
}
| function updateBaseURI(string memory __baseURI) public onlyOwner {
_baseTokenURI = __baseURI;
}
| 75,145 |
24 | // path[0] = uniswapRouter.WETH(); | path[0] = add1;
path[1] = add2;
return path;
| path[0] = add1;
path[1] = add2;
return path;
| 448 |
154 | // Used to collect accumulated protocol fees. / | function collectProtocol(
uint256 amount0,
uint256 amount1,
address to
| function collectProtocol(
uint256 amount0,
uint256 amount1,
address to
| 54,970 |
1 | // Mutable Internal State // Immutable Private State // Mutable Private State // Constructor / | ) Ownable() {
// Prevent overflow, though 76 would create a safe but unusable contract
require(
stakingTokenDecimals < 77,
"StakedRewardsPool: staking token has far too many decimals"
);
_rewardsToken = rewardsToken;
_stakingToken = stakingToken;
_stakingTokenDecimals = stakingTokenDecimals;
_sta... | ) Ownable() {
// Prevent overflow, though 76 would create a safe but unusable contract
require(
stakingTokenDecimals < 77,
"StakedRewardsPool: staking token has far too many decimals"
);
_rewardsToken = rewardsToken;
_stakingToken = stakingToken;
_stakingTokenDecimals = stakingTokenDecimals;
_sta... | 31,245 |
16 | // Lock tokens | require (token.transferFrom(msg.sender, this, _price));
ordersOf[msg.sender].push(id);
OpenAskOrder(id);
| require (token.transferFrom(msg.sender, this, _price));
ordersOf[msg.sender].push(id);
OpenAskOrder(id);
| 4,752 |
3 | // We return the petId provided as a confirmation | return petId;
| return petId;
| 2,499 |
3 | // ============ External Setter Functions ============ |
function setToReturn(
address newAddress
)
external
|
function setToReturn(
address newAddress
)
external
| 40,629 |
304 | // amount needs to be subtracted from totalBalance because it has already been added to it from either IWETH.deposit and IERC20.safeTransferFrom | uint256 total = totalWithDepositedAmount.sub(amount);
uint256 shareSupply = totalSupply();
| uint256 total = totalWithDepositedAmount.sub(amount);
uint256 shareSupply = totalSupply();
| 9,390 |
23 | // Resume the issuance of new tokens.Once set to false, '_isIssuable' can never be set to 'true' again. / | function getMinWithdrawAmount() public returns (uint256 amount);
| function getMinWithdrawAmount() public returns (uint256 amount);
| 12,535 |
534 | // mapping from trait type (index) to its name | string[9] _traitTypes = [
"Body",
"Hat",
"Eye",
"Mouth",
"Clothes",
"Tail",
"Alpha"
];
| string[9] _traitTypes = [
"Body",
"Hat",
"Eye",
"Mouth",
"Clothes",
"Tail",
"Alpha"
];
| 12,806 |
4 | // If last selector slot is not full | if (selectorCount % 8 > 0) {
ds.selectorSlots[selectorCount / 8] = selectorSlot;
}
| if (selectorCount % 8 > 0) {
ds.selectorSlots[selectorCount / 8] = selectorSlot;
}
| 79,448 |
60 | // Calculates user dividends g Cache of stored globals stakeSharesParam Param from stake to calculate bonuses for beginDay First day to calculate bonuses for endDay Last day (non-inclusive) of range to calculate bonuses forreturn payout in Suns / | function _calcPayoutDividendsReward(
GlobalsCache memory g,
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
private
view
returns (uint256 payout)
| function _calcPayoutDividendsReward(
GlobalsCache memory g,
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
private
view
returns (uint256 payout)
| 5,983 |
79 | // Return a rate for which we can buy an amount of tokens/_srcAddr From token/_destAddr To token/_destAmount To amount/ return rate Rate | function getBuyRate(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) public override view returns (uint rate) {
uint256 srcRate = getSellRate(_destAddr, _srcAddr, _destAmount, _additionalData);
uint256 srcAmount = wmul(srcRate, _destAmount);
rate = getSel... | function getBuyRate(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) public override view returns (uint rate) {
uint256 srcRate = getSellRate(_destAddr, _srcAddr, _destAmount, _additionalData);
uint256 srcAmount = wmul(srcRate, _destAmount);
rate = getSel... | 39,755 |
11 | // Returns the address of the incentives controller contract / | function getIncentivesController() external view override returns (IAaveIncentivesController) {
return _getIncentivesController();
}
| function getIncentivesController() external view override returns (IAaveIncentivesController) {
return _getIncentivesController();
}
| 18,664 |
4 | // Allowance for future token management by user | mapping (address => mapping (address => uint)) public allowed;
| mapping (address => mapping (address => uint)) public allowed;
| 17,763 |
15 | // -- Collectors -- | mapping (address => uint) public collectors;
| mapping (address => uint) public collectors;
| 42,038 |
320 | // File @1inch/solidity-utils/contracts/libraries/ECDSA.sol@v2.1.1 |
pragma solidity ^0.8.0;
library ECDSA {
|
pragma solidity ^0.8.0;
library ECDSA {
| 12,082 |
33 | // solhint-disable no-unused-vars/ | * @dev See {IERC4626-withdraw}.
*/
function withdraw(
uint256 assets,
address receiver,
address owner,
uint256 minimumReceive
)
public
virtual
override
returns (uint256)
{
require(assets <= maxWithdraw(owner), "ERC4626: withdr... | * @dev See {IERC4626-withdraw}.
*/
function withdraw(
uint256 assets,
address receiver,
address owner,
uint256 minimumReceive
)
public
virtual
override
returns (uint256)
{
require(assets <= maxWithdraw(owner), "ERC4626: withdr... | 7,404 |
36 | // critical reserve ratio = 2 - time in second / 25 years | FixidityLib.Fraction memory timeSinceInitialization = FixidityLib.newFixed(now.sub(startTime));
FixidityLib.Fraction memory m = FixidityLib.newFixed(25 * 365 * 1 days);
FixidityLib.Fraction memory b = FixidityLib.newFixed(2);
FixidityLib.Fraction memory criticalRatio;
| FixidityLib.Fraction memory timeSinceInitialization = FixidityLib.newFixed(now.sub(startTime));
FixidityLib.Fraction memory m = FixidityLib.newFixed(25 * 365 * 1 days);
FixidityLib.Fraction memory b = FixidityLib.newFixed(2);
FixidityLib.Fraction memory criticalRatio;
| 37,281 |
6 | // only if the entered timestamp is within the allowed rangeThis helps to not list or bid for too short or too long period of time / | modifier onlyAllowedExpireTimestamp(uint256 expireTimestamp) {
require(
expireTimestamp.sub(block.timestamp) >= _actionTimeOutRangeMin,
"Please enter a longer period of time"
);
require(
expireTimestamp.sub(block.timestamp) <= _actionTimeOutRangeMax,
... | modifier onlyAllowedExpireTimestamp(uint256 expireTimestamp) {
require(
expireTimestamp.sub(block.timestamp) >= _actionTimeOutRangeMin,
"Please enter a longer period of time"
);
require(
expireTimestamp.sub(block.timestamp) <= _actionTimeOutRangeMax,
... | 22,349 |
15 | // Function to flip claim on or off | function toggleClaim() public onlyOwner {
claimIsActive = !claimIsActive;
}
| function toggleClaim() public onlyOwner {
claimIsActive = !claimIsActive;
}
| 32,070 |
95 | // Returns the total current supply of the contract.WARNING - Underlying variables do NOT get automatically updated on mintsso that we can save gas on transactions that mint multiple tokens./ | function totalSupply() public view virtual returns (uint256) {
return _totalMinted - _totalBurned;
}
| function totalSupply() public view virtual returns (uint256) {
return _totalMinted - _totalBurned;
}
| 34,471 |
44 | // Function to mint tokens to The address that will receive the minted tokens. value The amount of tokens to mint.return A boolean that indicates if the operation was successful. / | function mint( address to, uint256 value ) public onlyOwner returns (bool){
_mint(to, value);
return true;
}
| function mint( address to, uint256 value ) public onlyOwner returns (bool){
_mint(to, value);
return true;
}
| 6,956 |
16 | // Return true if disclosures latest agreement is fully signed. / | public view returns(bool) {
return isAgreementFullySigned(
latestMap[disclosureIndex].agreementHash
);
}
| public view returns(bool) {
return isAgreementFullySigned(
latestMap[disclosureIndex].agreementHash
);
}
| 33,234 |
169 | // Allows to stake an operator on the Polygon stakeManager./ This function calls Polygon transferFrom so the totalAmount(_amount + _heimdallFee)/ has to be approved first./_amount amount to stake./_heimdallFee heimdallFee to stake. | function stake(uint256 _amount, uint256 _heimdallFee) external;
| function stake(uint256 _amount, uint256 _heimdallFee) external;
| 28,212 |
259 | // Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) / | event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| 36,394 |
48 | // ICO start date seconds since epoch. | uint public startAt;
| uint public startAt;
| 40,520 |
9 | // Sets the contentURI of the current implementation _contentURI bytes representing the external URI for fetching new version's content / | function updateContentURI(bytes _contentURI) public onlyProxyOwner {
_setContentURI(_contentURI);
}
| function updateContentURI(bytes _contentURI) public onlyProxyOwner {
_setContentURI(_contentURI);
}
| 53,208 |
43 | // Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address. / | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, ... | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, ... | 208 |
9 | // Returns a number between 0 and 1e18 to indicate how much collateral each long and short token is entitledto per collateralPerPair. expiryPrice The price from the optimistic oracle for the LSP price identifier.return expiryPercentLong to indicate how much collateral should be sent between long and short tokens. / | function percentageLongCollateralAtExpiry(int256 expiryPrice)
public
view
override
nonReentrantView
returns (uint256)
| function percentageLongCollateralAtExpiry(int256 expiryPrice)
public
view
override
nonReentrantView
returns (uint256)
| 9,747 |
69 | // Liquidity / tokenA address of first token in pair tokenB address of second token in pairreturn LP balance / | function getLiquidity(address tokenA, address tokenB)
external
view
returns (uint256)
| function getLiquidity(address tokenA, address tokenB)
external
view
returns (uint256)
| 14,134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.