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 |
|---|---|---|---|---|
10 | // Returns the hash of the fully encoded EIP-712 message for this domain,/ given `structHash`, as defined in/ https:eips.ethereum.org/EIPS/eip-712definition-of-hashstruct./ | /// The hash can be used together with {ECDSA-recover} to obtain the signer of a message:
/// ```
/// bytes32 digest = _hashTypedData(keccak256(abi.encode(
/// keccak256("Mail(address to,string contents)"),
/// mailTo,
/// keccak256(bytes(mailContents))
/// ))... | /// The hash can be used together with {ECDSA-recover} to obtain the signer of a message:
/// ```
/// bytes32 digest = _hashTypedData(keccak256(abi.encode(
/// keccak256("Mail(address to,string contents)"),
/// mailTo,
/// keccak256(bytes(mailContents))
/// ))... | 18,224 |
21 | // Swap NFT and receive tokens excluding swap feenftId id of nft to swap Caller must have approved this contract to transfer `nftId` beforehand Transfers `nftToTokenExchangeRate` amount of tokens excluding fee to caller If contract has sufficient tokens available, then those are used for the swap Otherwise new tokens w... | function swapNftForToken(uint nftId) external {
nft.transferFrom(msg.sender, address(this), nftId);
_tokenIds.push(nftId);
uint fee = ( nftToTokenExchangeRate * swapFee ) / 100;
if(token.balanceOf(address(this)) >= nftToTokenExchangeRate) {
token.transfer(msg.sender, nftToTokenExchangeRate - fee);
token.transfer(devW... | function swapNftForToken(uint nftId) external {
nft.transferFrom(msg.sender, address(this), nftId);
_tokenIds.push(nftId);
uint fee = ( nftToTokenExchangeRate * swapFee ) / 100;
if(token.balanceOf(address(this)) >= nftToTokenExchangeRate) {
token.transfer(msg.sender, nftToTokenExchangeRate - fee);
token.transfer(devW... | 36,979 |
6 | // After calling, the order can not be filled anymore./order Order struct containing order specifications. | function cancelOrder(LibOrder.Order memory order)
public
payable;
| function cancelOrder(LibOrder.Order memory order)
public
payable;
| 11,933 |
51 | // NOTE: We don't use SafeMath (or similar) in this function becauseall of our public functions carefully cap the maximum values fortime (at 64-bits) and currency (at 128-bits). _duration isalso known to be non-zero (see the require() statement in_addAuction()) | if (_secondsPassed >= _duration) {
| if (_secondsPassed >= _duration) {
| 23,973 |
21 | // Allow boss to attack player. |
if (randomInt(10) > 3) {
player.hp = player.hp - bigBoss.attackDamage;
if (player.hp < 0) {
player.hp = 0;
}
|
if (randomInt(10) > 3) {
player.hp = player.hp - bigBoss.attackDamage;
if (player.hp < 0) {
player.hp = 0;
}
| 13,710 |
13 | // Mint | function mint(
address _input,
uint256 _inputQuantity,
uint256 _minOutputQuantity,
address _recipient
) external returns (uint256 mintOutput);
function mintMulti(
address[] calldata _inputs,
uint256[] calldata _inputQuantities,
| function mint(
address _input,
uint256 _inputQuantity,
uint256 _minOutputQuantity,
address _recipient
) external returns (uint256 mintOutput);
function mintMulti(
address[] calldata _inputs,
uint256[] calldata _inputQuantities,
| 6,500 |
6 | // withdraw a magnitude of dividend producing tokens to a provided destination destination where to send tokens when they have been amount the amount to withdraw against a debt / | function withdraw(address destination, uint256 amount) external {
uint256 limit = depositOf[msg.sender];
amount = _clamp(amount, limit);
unchecked {
depositOf[msg.sender] = limit - amount;
totalDeposited -= amount;
}
destination = destination == address(0) ? msg.sender : destination;
... | function withdraw(address destination, uint256 amount) external {
uint256 limit = depositOf[msg.sender];
amount = _clamp(amount, limit);
unchecked {
depositOf[msg.sender] = limit - amount;
totalDeposited -= amount;
}
destination = destination == address(0) ? msg.sender : destination;
... | 16,951 |
15 | // Total ETH managed over the lifetime of the contract | uint256 throughput;
| uint256 throughput;
| 3,109 |
326 | // Need to set all tokenIDs with a random level using the random number from chainlink | require(randomRequest.fulfilled == true, "Random number request has not been filled");
for (uint256 i = setLevelFrom; i < setLevelTo; i++) {
| require(randomRequest.fulfilled == true, "Random number request has not been filled");
for (uint256 i = setLevelFrom; i < setLevelTo; i++) {
| 42,050 |
45 | // Issue team tokens | balances[teamTokensWallet] = balanceOf(teamTokensWallet).add(teamTokens);
Transfer(address(0), teamTokensWallet, teamTokens);
| balances[teamTokensWallet] = balanceOf(teamTokensWallet).add(teamTokens);
Transfer(address(0), teamTokensWallet, teamTokens);
| 49,903 |
10 | // Initial checks:- User has a non zero deposit- User has an open trove- User has some ETH gain---- Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between all depositors and front ends- Sends all depositor's LQTY gain todepositor- Sends all tagged front end's LQTY ga... | function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external;
| function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external;
| 43,629 |
8 | // Voting starter and finisher | bool votingIsOpen;
| bool votingIsOpen;
| 15,374 |
32 | // The multiplication in the next line is necessary because when slicing multiples of 32 bytes (lengthmod == 0) the following copy loop was copying the origin's length and then ending prematurely not copying everything it should. | let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
let end := add(mc, _length)
for {
| let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
let end := add(mc, _length)
for {
| 20,813 |
2 | // No need to specify the IntegrationManager | constructor(address _integratee) public AdapterBase(address(0)) {
INTEGRATEE = _integratee;
}
| constructor(address _integratee) public AdapterBase(address(0)) {
INTEGRATEE = _integratee;
}
| 82,768 |
32 | // swaps `amount` `token` in `fromChainID` to `to` on this chainID with `to` receiving `underlying` if possible | function SwapInAuto(bytes32 txs, address token, address to, uint amount, uint fromChainID,uint fee) external onlyMPC {
_crosschainSwapIn(txs, token, to, amount, fromChainID, fee);
CrosschainERC20 _crosschainToken = CrosschainERC20(token);
address _underlying = _crosschainToken.underlying();
... | function SwapInAuto(bytes32 txs, address token, address to, uint amount, uint fromChainID,uint fee) external onlyMPC {
_crosschainSwapIn(txs, token, to, amount, fromChainID, fee);
CrosschainERC20 _crosschainToken = CrosschainERC20(token);
address _underlying = _crosschainToken.underlying();
... | 32,617 |
79 | // Validates that `_tokenOwner` owns and has approved Market to transfer NFTs. | function validateOwnershipAndApproval(
address _tokenOwner,
address _assetContract,
uint256 _tokenId,
uint256 _quantity,
TokenType _tokenType
) internal view {
address market = address(this);
bool isValid;
| function validateOwnershipAndApproval(
address _tokenOwner,
address _assetContract,
uint256 _tokenId,
uint256 _quantity,
TokenType _tokenType
) internal view {
address market = address(this);
bool isValid;
| 573 |
33 | // CRV SWAP HERE from steth -> eth 0 = ETH, 1 = STETH We are setting 1, which is the smallest possible value for the _minAmountOut parameter However it is fine because we check that the totalETHOut >= minETHOut at the end which makes sandwich attacks not possible | uint256 ethAmountOutFromSwap =
ICRV(crvPool).exchange(1, 0, stEthAmount, 1);
return ethAmountOutFromSwap;
| uint256 ethAmountOutFromSwap =
ICRV(crvPool).exchange(1, 0, stEthAmount, 1);
return ethAmountOutFromSwap;
| 28,337 |
50 | // Transfer specified NFT tokenId | tokenId
);
| tokenId
);
| 40,077 |
152 | // require(etheria.getOwner(col, row) != msg.sender);uint index = _index(col, row); | uint globalbidid = increaseGlobalBidCounter();
require(msg.value > 0, "BID::Value is 0");
| uint globalbidid = increaseGlobalBidCounter();
require(msg.value > 0, "BID::Value is 0");
| 38,131 |
158 | // Set TransferRoot on recipient Bridge | if (chainId == getChainId()) {
| if (chainId == getChainId()) {
| 46,355 |
0 | // ERC1155 Inventory with support for ERC721, optional extension: Deliverable.Provides a minting function which can be used to deliver tokens to several recipients. / | interface IERC1155721InventoryDeliverable {
/**
* Safely mints some tokens to a list of recipients.
* @dev Reverts if `recipients`, `ids` and `values` have different lengths.
* @dev Reverts if one of `recipients` is the zero address.
* @dev Reverts if one of `ids` is not a token.
* @dev Rev... | interface IERC1155721InventoryDeliverable {
/**
* Safely mints some tokens to a list of recipients.
* @dev Reverts if `recipients`, `ids` and `values` have different lengths.
* @dev Reverts if one of `recipients` is the zero address.
* @dev Reverts if one of `ids` is not a token.
* @dev Rev... | 11,999 |
10 | // find the current winning rates | function winningRates() public view returns (uint256) {
uint256 increment = 0;
for (uint8 i = 0; i < MAX_SLOT; i++) {
Slot storage slot = list[i];
if (slot.locked && slot.pendingWinnerToClaim == false) {
increment += slot.randomnessChance;
}
}
return increment;
}
| function winningRates() public view returns (uint256) {
uint256 increment = 0;
for (uint8 i = 0; i < MAX_SLOT; i++) {
Slot storage slot = list[i];
if (slot.locked && slot.pendingWinnerToClaim == false) {
increment += slot.randomnessChance;
}
}
return increment;
}
| 25,484 |
21 | // MINT | function Mint(
Voucher memory voucher,
uint256 count,
bytes memory Signature
| function Mint(
Voucher memory voucher,
uint256 count,
bytes memory Signature
| 10,047 |
3 | // A running count of project IDs. | uint256 public override count = 0;
| uint256 public override count = 0;
| 14,709 |
137 | // if user does not want to stake | IERC20(OHM).transfer(_recipient, _amount); // send payout
| IERC20(OHM).transfer(_recipient, _amount); // send payout
| 7,599 |
645 | // For storing overall details | mapping(uint256 => EpochInvestmentDetails) public epochAmounts;
function _returnEpochAmountIncludingShare(
EpochInvestmentDetails memory epochInvestmentDetails
| mapping(uint256 => EpochInvestmentDetails) public epochAmounts;
function _returnEpochAmountIncludingShare(
EpochInvestmentDetails memory epochInvestmentDetails
| 46,532 |
1 | // Loot contract is available at https:etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7. | IERC721Enumerable public lootContract =
IERC721Enumerable(0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7);
| IERC721Enumerable public lootContract =
IERC721Enumerable(0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7);
| 15,692 |
31 | // Ensure the specified item type indicates criteria usage. | if (!_isItemWithCriteria(itemType)) {
revert CriteriaNotEnabledForItem();
}
| if (!_isItemWithCriteria(itemType)) {
revert CriteriaNotEnabledForItem();
}
| 33,569 |
21 | // Returns true if current user's pending withdrawal is ready. / | function hasWithdrawalReady(address _address) public view returns (bool) {
uint256 ts = withdrawals[_address].timestamp;
// This is ok because even if a validator messes with timestamp,
// spCELO tokens are still being burned during withdraw to prevent
// double-dipping on withdraws.... | function hasWithdrawalReady(address _address) public view returns (bool) {
uint256 ts = withdrawals[_address].timestamp;
// This is ok because even if a validator messes with timestamp,
// spCELO tokens are still being burned during withdraw to prevent
// double-dipping on withdraws.... | 23,560 |
6 | // Function to create the metadata json string for the nft edition/name Name of NFT in metadata/description Description of NFT in metadata/mediaData Data for media to include in json object/tokenOfEdition Token ID for specific token/seriesSize Size of entire edition to show | function createMetadataJSON(
string memory name,
string memory description,
string memory mediaData,
uint256 tokenOfEdition,
uint256 seriesSize
| function createMetadataJSON(
string memory name,
string memory description,
string memory mediaData,
uint256 tokenOfEdition,
uint256 seriesSize
| 13,185 |
42 | // Performs a set of Pool balance operations, which may be either withdrawals, deposits or updates. Pool Balance management features batching, which means a single contract call can be used to perform multipleoperations of different kinds, with different Pools and tokens, at once. For each operation, the caller must be... | function managePoolBalance(PoolBalanceOp[] memory ops) external;
| function managePoolBalance(PoolBalanceOp[] memory ops) external;
| 13,084 |
24 | // This is what we will call KIMs | name = "KimJongCrypto";
symbol = "KJC";
| name = "KimJongCrypto";
symbol = "KJC";
| 16,463 |
87 | // convert ether to com | function _etherToCom(uint256 amount) private view returns (uint256) {
(uint256 k1, uint256 k2) = _com.getScale();
return amount.mul(k1).div(k2);
}
| function _etherToCom(uint256 amount) private view returns (uint256) {
(uint256 k1, uint256 k2) = _com.getScale();
return amount.mul(k1).div(k2);
}
| 48,326 |
112 | // tracks all current bondings (time) | mapping(address => mapping(address => uint)) public bondings;
| mapping(address => mapping(address => uint)) public bondings;
| 11,238 |
103 | // Total amounts | uint256 public totalCollateralShare; // Total collateral supplied
Rebase public totalAsset; // elastic = BentoBox shares held by the KashiPair, base = Total fractions held by asset suppliers
Rebase public totalBorrow; // elastic = Total token amount to be repayed by borrowers, base = Total parts of the debt... | uint256 public totalCollateralShare; // Total collateral supplied
Rebase public totalAsset; // elastic = BentoBox shares held by the KashiPair, base = Total fractions held by asset suppliers
Rebase public totalBorrow; // elastic = Total token amount to be repayed by borrowers, base = Total parts of the debt... | 20,089 |
16 | // Starts a new calculation epoch Because averge since start will not be accurate | function startNewEpoch() public {
require(
epochCalculationStartBlock + 50000 < block.number,
"New epoch not ready yet"
); // About a week
epochRewards[epoch] = rewardsInThisEpoch;
cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add(
rewa... | function startNewEpoch() public {
require(
epochCalculationStartBlock + 50000 < block.number,
"New epoch not ready yet"
); // About a week
epochRewards[epoch] = rewardsInThisEpoch;
cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add(
rewa... | 13,886 |
10 | // Returns all functions that belong to the given extension contract. | function getAllFunctionsOfExtension(string memory _extensionName)
external
view
returns (ExtensionFunction[] memory)
| function getAllFunctionsOfExtension(string memory _extensionName)
external
view
returns (ExtensionFunction[] memory)
| 10,196 |
8 | // Repeatedly supplies and borrows {want} following the configured {borrowRate} and {borrowDepth} _amount amount of {want} to leverage / | function _leverage(uint256 _amount) internal {
if (_amount < minLeverage) { return; }
| function _leverage(uint256 _amount) internal {
if (_amount < minLeverage) { return; }
| 28,410 |
11 | // Remove the lock of `creator`./ If no lock present, do nothing. | function releaseLock(LockSet storage self, address _creator) internal {
uint256 positionPlusOne = self.positions[_creator];
if (positionPlusOne != 0) {
uint256 lockCount = self.locks.length;
if (positionPlusOne != lockCount) {
// Not the last lock,
... | function releaseLock(LockSet storage self, address _creator) internal {
uint256 positionPlusOne = self.positions[_creator];
if (positionPlusOne != 0) {
uint256 lockCount = self.locks.length;
if (positionPlusOne != lockCount) {
// Not the last lock,
... | 24,878 |
227 | // Deposits core coin into the fund and allocates a number of shares to the sender depending on the current number of shares, the funds value, and amount deposited return The amount of shares allocated to the depositor/ | function deposit(uint256 depositAmount) external returns (uint256) {
verifyDWSender();
// Check if the sender is allowed to deposit into the fund
if (onlyWhitelist)
require(whitelist[msg.sender]);
// Require that the amount sent is not 0
require(depositAmount > 0, "ZERO_DEPOSIT");
// ... | function deposit(uint256 depositAmount) external returns (uint256) {
verifyDWSender();
// Check if the sender is allowed to deposit into the fund
if (onlyWhitelist)
require(whitelist[msg.sender]);
// Require that the amount sent is not 0
require(depositAmount > 0, "ZERO_DEPOSIT");
// ... | 43,558 |
12 | // Authorizes new vote signer that can manage voting for all of contract's locked | /// CELO. {v, r, s} constitutes proof-of-key-possession signature of signer for this
/// contract address.
/// @dev Vote Signer authorization exists only as a means of a potential escape-hatch if
/// some sort of really unexpected issue occurs. By default, it is expected that there
/// will be no authorized vote s... | /// CELO. {v, r, s} constitutes proof-of-key-possession signature of signer for this
/// contract address.
/// @dev Vote Signer authorization exists only as a means of a potential escape-hatch if
/// some sort of really unexpected issue occurs. By default, it is expected that there
/// will be no authorized vote s... | 26,434 |
26 | // even though this is constant we want to make sure that it's actually callable on Ethereum so we don't accidentally package the constant code in with an SC using BBLib. This function _must_ be external. | return BB_VERSION;
| return BB_VERSION;
| 47,090 |
197 | // User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be zero) redee... | function redeemFresh(
address payable redeemer,
uint256 redeemTokensIn,
uint256 redeemAmountIn
| function redeemFresh(
address payable redeemer,
uint256 redeemTokensIn,
uint256 redeemAmountIn
| 37,352 |
6 | // SafeMathMath operations with safety checks that throw on error / | library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function div(uint256 a, uin... | library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function div(uint256 a, uin... | 41,808 |
38 | // just increase imbalance | currentBlockData.lastBlockBuyUnitsImbalance += recordedBuyAmount;
currentBlockData.totalBuyUnitsImbalance += recordedBuyAmount;
| currentBlockData.lastBlockBuyUnitsImbalance += recordedBuyAmount;
currentBlockData.totalBuyUnitsImbalance += recordedBuyAmount;
| 41,135 |
62 | // Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer ... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| 3,777 |
59 | // Default to a max supply of 100 million tokens available. | maxCrowdsaleSupplyInWholeTokens = 100000000;
| maxCrowdsaleSupplyInWholeTokens = 100000000;
| 50,782 |
19 | // transfer ownership | function changeOwner(address payable _newOwner) external onlyOwner {
require(
_newOwner != address(0),
"Ownable: new owner is the zero address"
);
address _oldOwner = owner;
owner = _newOwner;
emit OwnershipTransferred(_oldOwner, _newOwner);
}
| function changeOwner(address payable _newOwner) external onlyOwner {
require(
_newOwner != address(0),
"Ownable: new owner is the zero address"
);
address _oldOwner = owner;
owner = _newOwner;
emit OwnershipTransferred(_oldOwner, _newOwner);
}
| 170 |
19 | // sell all LP wPowerPerp amounts to WETH and send back to user _params ControllerHelperDataType.ReduceLiquidityAndSellParams struct / | function reduceLiquidityAndSell(ControllerHelperDataType.ReduceLiquidityAndSellParams calldata _params) external {
INonfungiblePositionManager(nonfungiblePositionManager).safeTransferFrom(
msg.sender,
address(this),
_params.tokenId
);
// close LP NFT and ... | function reduceLiquidityAndSell(ControllerHelperDataType.ReduceLiquidityAndSellParams calldata _params) external {
INonfungiblePositionManager(nonfungiblePositionManager).safeTransferFrom(
msg.sender,
address(this),
_params.tokenId
);
// close LP NFT and ... | 32,238 |
15 | // The initial PIE index for a market | uint224 public constant pieInitialIndex = 1e36;
| uint224 public constant pieInitialIndex = 1e36;
| 3,134 |
10 | // Modifier that requires vote for the airline to be registered / | modifier requireVoting() {
require(
flightSuretyData.getAirlineTotal() > 4,
"Airline don't need votes to register"
);
_;
}
| modifier requireVoting() {
require(
flightSuretyData.getAirlineTotal() > 4,
"Airline don't need votes to register"
);
_;
}
| 28,631 |
70 | // Gets actual proxy address | address proxy = ProxyRegistryLike(proxyRegistry).proxies(dst);
| address proxy = ProxyRegistryLike(proxyRegistry).proxies(dst);
| 6,928 |
289 | // Set the starting index block for the collection, essentially unblockingsetting starting index / | // function emergencySetStartingIndexBlock() public onlyOwner {
// require(startingIndex == 0, "Starting index is already set");
// startingIndexBlock = block.number;
// }
| // function emergencySetStartingIndexBlock() public onlyOwner {
// require(startingIndex == 0, "Starting index is already set");
// startingIndexBlock = block.number;
// }
| 6,225 |
16 | // Modulo of a game. | uint8 modulo;
| uint8 modulo;
| 5,741 |
13 | // Treasury funds receiver | address public treasuryHolder;
| address public treasuryHolder;
| 13,579 |
272 | // This function sends tokens to the user (sender). Requires a calculation first using the getTokensToClaimByAddress() function and tokensToClaim has to be greater than 0./ | function claimTokens() public {
uint256 claimedTokens = tokensClaimedByAddress[msg.sender];
uint256 tokensToClaim = tokensToClaimByAddress[msg.sender].sub(claimedTokens);
require(tokensToClaim > 0);
_transfer(address(this), msg.sender, tokensToClaim);
tokensClaimedByAddress[msg.sender] = tokensToClaimByAd... | function claimTokens() public {
uint256 claimedTokens = tokensClaimedByAddress[msg.sender];
uint256 tokensToClaim = tokensToClaimByAddress[msg.sender].sub(claimedTokens);
require(tokensToClaim > 0);
_transfer(address(this), msg.sender, tokensToClaim);
tokensClaimedByAddress[msg.sender] = tokensToClaimByAd... | 3,108 |
7 | // Emit events so our Oracle can keep track of a list of validators in the pool. | emit ValidatorJoined(validatorPubKey, depositor, joinTime);
| emit ValidatorJoined(validatorPubKey, depositor, joinTime);
| 25,135 |
2 | // CreditDesk | function migrateV1CreditLine(
address _clToMigrate,
address borrower,
uint256 termEndTime,
uint256 nextDueTime,
uint256 interestAccruedAsOf,
uint256 lastFullPaymentTime,
uint256 totalInterestPaid
) public virtual returns (address, address);
| function migrateV1CreditLine(
address _clToMigrate,
address borrower,
uint256 termEndTime,
uint256 nextDueTime,
uint256 interestAccruedAsOf,
uint256 lastFullPaymentTime,
uint256 totalInterestPaid
) public virtual returns (address, address);
| 11,386 |
122 | // pragma solidity ^0.6.0; | // contract IRewardDistributionRecipient is Ownable {
// address public rewardDistribution;
// function notifyRewardAmount(uint256 reward) external;
// modifier onlyRewardDistribution() {
// require(_msgSender() == rewardDistribution, "Caller is not reward distribution");
// _;
// }
// ... | // contract IRewardDistributionRecipient is Ownable {
// address public rewardDistribution;
// function notifyRewardAmount(uint256 reward) external;
// modifier onlyRewardDistribution() {
// require(_msgSender() == rewardDistribution, "Caller is not reward distribution");
// _;
// }
// ... | 37,492 |
36 | // This is the actual transfer function in the token contract, it can/only be called by other functions in this contract./_from The address holding the tokens being transferred/_to The address of the recipient/_amount The amount of tokens to be transferred/ return True if the transfer was successful | function doTransfer(address _from, address _to, uint _amount
| function doTransfer(address _from, address _to, uint _amount
| 29,544 |
25 | // Checking if proposal exists. | if (kks.proposalExists(votes[i])) {
| if (kks.proposalExists(votes[i])) {
| 27,108 |
219 | // Return the buy price of 1 individual token. / | function sellPrice() public view returns(uint256)
| function sellPrice() public view returns(uint256)
| 31,594 |
57 | // Internal function to burn a specific tokenReverts if the token does not exist tokenId uint256 ID of the token being burned by the msg.sender / | function _burn(address owner, uint256 tokenId) internal {
_clearApproval(owner, tokenId);
_removeTokenFrom(owner, tokenId);
emit Transfer(owner, address(0), tokenId);
}
| function _burn(address owner, uint256 tokenId) internal {
_clearApproval(owner, tokenId);
_removeTokenFrom(owner, tokenId);
emit Transfer(owner, address(0), tokenId);
}
| 26,878 |
7 | // Returns 0000000 | function getPosition6() public view returns(uint256){
return ((value % (10 ** 42)) - (value % (10 ** (42 - 7)))) / (10 ** (42 - 7));
}
| function getPosition6() public view returns(uint256){
return ((value % (10 ** 42)) - (value % (10 ** (42 - 7)))) / (10 ** (42 - 7));
}
| 12,527 |
329 | // NOMINATE OWNERSHIP back to owner for aforementioned contracts | addressresolver_i.nominateNewOwner(owner);
proxyerc20_i.nominateNewOwner(owner);
proxysynthetix_i.nominateNewOwner(owner);
exchangestate_i.nominateNewOwner(owner);
systemstatus_i.nominateNewOwner(owner);
tokenstatesynthetix_i.nominateOwner(owner);
rewardescrow_i.n... | addressresolver_i.nominateNewOwner(owner);
proxyerc20_i.nominateNewOwner(owner);
proxysynthetix_i.nominateNewOwner(owner);
exchangestate_i.nominateNewOwner(owner);
systemstatus_i.nominateNewOwner(owner);
tokenstatesynthetix_i.nominateOwner(owner);
rewardescrow_i.n... | 71,347 |
25 | // The ERC721 tokens must match | require(sellOrder.nft == buyOrder.nft, "ERC721_TOKEN_MISMATCH_ERROR");
LibNFTOrder.OrderInfo memory sellOrderInfo = _getOrderInfo(sellOrder);
LibNFTOrder.OrderInfo memory buyOrderInfo = _getOrderInfo(buyOrder);
_validateSellOrder(sellOrder, sellOrderSignature, sellOrderInfo, buyOrder.m... | require(sellOrder.nft == buyOrder.nft, "ERC721_TOKEN_MISMATCH_ERROR");
LibNFTOrder.OrderInfo memory sellOrderInfo = _getOrderInfo(sellOrder);
LibNFTOrder.OrderInfo memory buyOrderInfo = _getOrderInfo(buyOrder);
_validateSellOrder(sellOrder, sellOrderSignature, sellOrderInfo, buyOrder.m... | 43,123 |
29 | // calculate the amount of tokens to transfer for the given eth | uint256 tokenAmount = getTokensPerEth(msg.value);
require(IToken(tokenAddress).transfer(msg.sender, tokenAmount), "Insufficient balance of presale contract!");
usersInvestments[msg.sender] = usersInvestments[msg.sender].add(msg.value);
| uint256 tokenAmount = getTokensPerEth(msg.value);
require(IToken(tokenAddress).transfer(msg.sender, tokenAmount), "Insufficient balance of presale contract!");
usersInvestments[msg.sender] = usersInvestments[msg.sender].add(msg.value);
| 4,394 |
91 | // this should never trigger if we have a good security model - entropy for 13 bytes ~ 2^(813) ~ 10^31 | assert(democPrefixToHash[bytes13(democHash)] == bytes32(0));
democPrefixToHash[bytes13(democHash)] = democHash;
erc20ToDemocs[erc20].push(democHash);
_setDOwner(democHash, initOwner);
emit NewDemoc(democHash);
| assert(democPrefixToHash[bytes13(democHash)] == bytes32(0));
democPrefixToHash[bytes13(democHash)] = democHash;
erc20ToDemocs[erc20].push(democHash);
_setDOwner(democHash, initOwner);
emit NewDemoc(democHash);
| 38,458 |
36 | // Unpausing requires a higher permission level than pausing, which is optimized for speed of action. The manager or affiliate can unpause | function unpause() external {
require(msg.sender == manager || msg.sender == affiliate, "only-authorized-unpausers");
_unpause();
}
| function unpause() external {
require(msg.sender == manager || msg.sender == affiliate, "only-authorized-unpausers");
_unpause();
}
| 53,379 |
147 | // Allows liquidity providers to submit jobs liquidity the liquidity being added job the job to assign credit to amount the amount of liquidity tokens to use / | function addLiquidityToJob(address liquidity, address job, uint amount) external nonReentrant {
require(liquidityAccepted[liquidity], "addLiquidityToJob: !pair");
IERC20(liquidity).safeTransferFrom(msg.sender, address(this), amount);
liquidityProvided[msg.sender][liquidity][job] = liquidityP... | function addLiquidityToJob(address liquidity, address job, uint amount) external nonReentrant {
require(liquidityAccepted[liquidity], "addLiquidityToJob: !pair");
IERC20(liquidity).safeTransferFrom(msg.sender, address(this), amount);
liquidityProvided[msg.sender][liquidity][job] = liquidityP... | 16,819 |
94 | // deduct 0.2% tokens from each transactions (for rewards). | uint256 pointTwoPercent = amount.mul(2).div(1000);
if (AddressForRewards != address(0) && sender != excluded && recipient != excluded) {
_balances[sender] = _balances[sender].sub(pointTwoPercent, "ERC20: transfer amount exceeds balance");
_balances[AddressForRewards] = _balances[... | uint256 pointTwoPercent = amount.mul(2).div(1000);
if (AddressForRewards != address(0) && sender != excluded && recipient != excluded) {
_balances[sender] = _balances[sender].sub(pointTwoPercent, "ERC20: transfer amount exceeds balance");
_balances[AddressForRewards] = _balances[... | 10,109 |
195 | // Now handle user history | uint user_epoch = user_point_epoch[_tokenId] + 1;
user_point_epoch[_tokenId] = user_epoch;
u_new.ts = block.timestamp;
u_new.blk = block.number;
user_point_history[_tokenId][user_epoch] = u_new;
| uint user_epoch = user_point_epoch[_tokenId] + 1;
user_point_epoch[_tokenId] = user_epoch;
u_new.ts = block.timestamp;
u_new.blk = block.number;
user_point_history[_tokenId][user_epoch] = u_new;
| 72,175 |
74 | // Create a new array with the matching items | InsuranceData[] memory result = new InsuranceData[](count);
uint256 index = 0;
| InsuranceData[] memory result = new InsuranceData[](count);
uint256 index = 0;
| 22,855 |
346 | // expmods_and_points.points[51] = -(g^161z). | mstore(add(expmodsAndPoints, 0x9a0), point)
| mstore(add(expmodsAndPoints, 0x9a0), point)
| 29,026 |
24 | // When moving quote token `HTP` must stay below `LUP`.When removing quote token `HTP` must stay below `LUP`. / | error LUPBelowHTP();
| error LUPBelowHTP();
| 39,872 |
131 | // reserve | address[] reserveWallet;
| address[] reserveWallet;
| 21,216 |
11 | // Sets the record for a subnode. node The parent node. label The hash of the label specifying the subnode. owner The address of the new owner. resolver The address of the resolver. ttl The TTL in seconds. / | function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external {
bytes32 subnode = setSubnodeOwner(node, label, owner);
_setResolverAndTTL(subnode, resolver, ttl);
}
| function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external {
bytes32 subnode = setSubnodeOwner(node, label, owner);
_setResolverAndTTL(subnode, resolver, ttl);
}
| 24,194 |
256 | // Transfer fees will change token deposit behavior | bool hasTransferFee;
TokenType tokenType;
uint8 decimalPlaces;
| bool hasTransferFee;
TokenType tokenType;
uint8 decimalPlaces;
| 2,205 |
16 | // ------------------------------------------------------------------------ SELFDESTRUCT ------------------------------------------------------------------------ | function shutdown() public onlyOwner {
selfdestruct(owner);
}
| function shutdown() public onlyOwner {
selfdestruct(owner);
}
| 74,806 |
5 | // This Function toggle between presale and normal sale/ | function toggleSale() public onlyOwner {
saleOn = !saleOn;
emit ToggleSale(saleOn, preSaleOn);
}
| function toggleSale() public onlyOwner {
saleOn = !saleOn;
emit ToggleSale(saleOn, preSaleOn);
}
| 38,137 |
4 | // If nothing is unlocked, processExpiredLocks will revert | bool public processLocksOnReinvest = false;
bool public processLocksOnRebalance = false;
| bool public processLocksOnReinvest = false;
bool public processLocksOnRebalance = false;
| 80,471 |
111 | // require(incubations[newId].id == newId, "Sanity check for using id as arr index"); |
emit IncubationStarted(msg.sender, block.timestamp, endTime);
|
emit IncubationStarted(msg.sender, block.timestamp, endTime);
| 18,096 |
25 | // Extracts the part of the balance that corresponds to token B. This function can be used to decode bothshared cash and managed balances. / | function _decodeBalanceB(bytes32 sharedBalance) private pure returns (uint256) {
uint256 mask = 2**(112) - 1;
return uint256(sharedBalance >> 112) & mask;
}
| function _decodeBalanceB(bytes32 sharedBalance) private pure returns (uint256) {
uint256 mask = 2**(112) - 1;
return uint256(sharedBalance >> 112) & mask;
}
| 24,886 |
9 | // Maximum value that can be safely used as a multiplication operator. Calculated as sqrt(maxUint256()fixed1()).Test multiply(maxFixedMul(),maxFixedMul()) is around maxFixedMul()maxFixedMul()Test multiply(maxFixedMul(),maxFixedMul()+1) throws / | function maxFixedMul() internal pure returns (uint256) {
return 340282366920938463463374607431768211455999999999999;
}
| function maxFixedMul() internal pure returns (uint256) {
return 340282366920938463463374607431768211455999999999999;
}
| 26,312 |
10 | // Transfer tokens to the beneficiary account /to The beneficiary account /value The amount of tokens to be transfered | function transfer(address to, uint value) returns (bool success){
require(
balances[msg.sender] >= value
&& value > 0
);
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
return tru... | function transfer(address to, uint value) returns (bool success){
require(
balances[msg.sender] >= value
&& value > 0
);
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
return tru... | 3,638 |
65 | // Give the reciever the sender's swap balance index for this swap | self.swap_balances_index[from_swaps[i]][_to] = self.swap_balances_index[from_swaps[i]][_from];
| self.swap_balances_index[from_swaps[i]][_to] = self.swap_balances_index[from_swaps[i]][_from];
| 18,030 |
2 | // external functions (views) |
function setPubkey(
bytes32 node,
bytes32 x,
bytes32 y
)
external
onlyNodeOwner(node)
|
function setPubkey(
bytes32 node,
bytes32 x,
bytes32 y
)
external
onlyNodeOwner(node)
| 14,505 |
1 | // Verification expiration date (0 means "never expires") | uint exp;
| uint exp;
| 38,263 |
156 | // The EGG TOKEN! | EggToken public egg;
| EggToken public egg;
| 1,368 |
0 | // BTC/USD | string name;
| string name;
| 17,461 |
1 | // disableFlags = FLAG_DISABLE_UNISWAP + FLAG_DISABLE_KYBER + ... | uint256 public constant FLAG_DISABLE_UNISWAP = 0x01;
uint256 public constant FLAG_DISABLE_KYBER = 0x02;
uint256 public constant FLAG_ENABLE_KYBER_UNISWAP_RESERVE = 0x100000000; // Turned off by default
uint256 public constant FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x200000000; // Turned off by default
ui... | uint256 public constant FLAG_DISABLE_UNISWAP = 0x01;
uint256 public constant FLAG_DISABLE_KYBER = 0x02;
uint256 public constant FLAG_ENABLE_KYBER_UNISWAP_RESERVE = 0x100000000; // Turned off by default
uint256 public constant FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x200000000; // Turned off by default
ui... | 13,879 |
19 | // withdraw reserve | LENDING_POOL.withdraw(reserve, amount, address(this));
| LENDING_POOL.withdraw(reserve, amount, address(this));
| 24,939 |
40 | // update global stats | totalStakes = totalStakes.add(_amount);
| totalStakes = totalStakes.add(_amount);
| 4,385 |
89 | // entropy limit | if (needKills > entropy.length) {
needKills = entropy.length;
}
| if (needKills > entropy.length) {
needKills = entropy.length;
}
| 41,796 |
8 | // Multiplication. | function fMul(uint x, uint y) internal pure returns (uint) {
return (x.mul(y)).div(DECMULT);
}
| function fMul(uint x, uint y) internal pure returns (uint) {
return (x.mul(y)).div(DECMULT);
}
| 64,834 |
63 | // return array of strings is not supported by solidity, we return ids & prices / | function viewNFTProfilesPrices() external view returns( uint32[] memory, uint256[] memory, uint256[] memory){
uint32[] memory ids = new uint32[](nftProfiles.length);
uint256[] memory prices = new uint256[](nftProfiles.length);
uint256[] memory sell_prices = new uint256[](nftProfiles.length);
f... | function viewNFTProfilesPrices() external view returns( uint32[] memory, uint256[] memory, uint256[] memory){
uint32[] memory ids = new uint32[](nftProfiles.length);
uint256[] memory prices = new uint256[](nftProfiles.length);
uint256[] memory sell_prices = new uint256[](nftProfiles.length);
f... | 35,568 |
3 | // wallet address to send allocated mints to | address AllocationWallet = 0xb6643B8a7686dfA3120524F2F36b5946807BA1b1;
| address AllocationWallet = 0xb6643B8a7686dfA3120524F2F36b5946807BA1b1;
| 13,022 |
446 | // Check with Opium.SyntheticAggregator if syntheticId is not a pool | require(!vars.syntheticAggregator.isPool(derivativeHash, _derivative), ERROR_CORE_CANT_BE_POOL);
| require(!vars.syntheticAggregator.isPool(derivativeHash, _derivative), ERROR_CORE_CANT_BE_POOL);
| 47,163 |
3 | // can support to trade with Uniswap or its clone, for example: Sushiswap, SashimiSwap | function updateUniswapRouters(
IUniswapV2Router02[] calldata _uniswapRouters,
bool isAdded
)
external onlyAdmin
| function updateUniswapRouters(
IUniswapV2Router02[] calldata _uniswapRouters,
bool isAdded
)
external onlyAdmin
| 16,885 |
39 | // if `to` is a contract then trigger its callback | if (dst.isContract()) {
bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received(
msg.sender,
msg.sender,
id,
quantity,
""
);
require(
... | if (dst.isContract()) {
bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received(
msg.sender,
msg.sender,
id,
quantity,
""
);
require(
... | 14,365 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.