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 |
|---|---|---|---|---|
62 | // WADTOKEN STARTS HERE / | contract WADCoin is Owned, TokenERC20 {
using SafeMath for uint256;
uint256 public sellPrice;
uint256 public buyPrice;
address public migrationAgent;
uint256 public totalMigrated;
address public migrationMaster;
mapping(address => bytes32[]) public lockReason;
mapping(address => mapping(bytes3... | contract WADCoin is Owned, TokenERC20 {
using SafeMath for uint256;
uint256 public sellPrice;
uint256 public buyPrice;
address public migrationAgent;
uint256 public totalMigrated;
address public migrationMaster;
mapping(address => bytes32[]) public lockReason;
mapping(address => mapping(bytes3... | 15,948 |
32 | // adding the collected taxes to the Tax Pool | AddTaxToPool(tax / 2);
| AddTaxToPool(tax / 2);
| 28,547 |
17 | // Error codes | uint constant ERR_INVALID_HEADER = 10050;
uint constant ERR_COINBASE_INDEX = 10060; // coinbase tx index within Litecoin merkle isn't 0
uint constant ERR_NOT_MERGE_MINED = 10070; // trying to check AuxPoW on a block that wasn't merge mined
uint constant ERR_FOUND_TWICE = 10080; // 0xfabe6d6d found twice... | uint constant ERR_INVALID_HEADER = 10050;
uint constant ERR_COINBASE_INDEX = 10060; // coinbase tx index within Litecoin merkle isn't 0
uint constant ERR_NOT_MERGE_MINED = 10070; // trying to check AuxPoW on a block that wasn't merge mined
uint constant ERR_FOUND_TWICE = 10080; // 0xfabe6d6d found twice... | 2,978 |
87 | // accrue and returns accrued stored of msg.sender / | function accrue() external returns (uint) {
accrueInternal();
(, uint instantAccountAccruedAmount) = accruedStoredInternal(msg.sender, globalAccruedIndex);
return instantAccountAccruedAmount;
}
| function accrue() external returns (uint) {
accrueInternal();
(, uint instantAccountAccruedAmount) = accruedStoredInternal(msg.sender, globalAccruedIndex);
return instantAccountAccruedAmount;
}
| 18,862 |
26 | // Namespace for the structs used in {SablierV2LockupLinear}./Struct encapsulating the parameters for the {SablierV2LockupLinear.createWithDurations} function./sender The address streaming the assets, with the ability to cancel the stream. It doesn't have to be the/ same as `msg.sender`./recipient The address receiving... | struct CreateWithDurations {
address sender;
address recipient;
uint128 totalAmount;
IERC20 asset;
bool cancelable;
Durations durations;
Broker broker;
}
| struct CreateWithDurations {
address sender;
address recipient;
uint128 totalAmount;
IERC20 asset;
bool cancelable;
Durations durations;
Broker broker;
}
| 31,348 |
21 | // Returns last time pool was paid | function getLastPaid(address asset) external view returns (uint256) {
return lastPaid[asset];
}
| function getLastPaid(address asset) external view returns (uint256) {
return lastPaid[asset];
}
| 6,964 |
94 | // Emits an {Approval} event. Requirements: - `user` cannot be the zero address.- `spender` cannot be the zero address. / | function _approve(
address user,
address spender,
uint256 amount
) internal virtual {
require(user != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[user][spender] = amount;
... | function _approve(
address user,
address spender,
uint256 amount
) internal virtual {
require(user != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[user][spender] = amount;
... | 35,869 |
4 | // Variables to manage the business logic of this contract | address private _creators;
address private _marketing;
uint256 private _poolForActors;
uint256 private _poolForHolders;
using EnumerableSet for EnumerableSet.AddressSet;
address[] private _actors;
EnumerableSet.AddressSet private _holders;
| address private _creators;
address private _marketing;
uint256 private _poolForActors;
uint256 private _poolForHolders;
using EnumerableSet for EnumerableSet.AddressSet;
address[] private _actors;
EnumerableSet.AddressSet private _holders;
| 13,382 |
186 | // Using safemath multiplication prevents overflows | result = previousResult.mul(a);
| result = previousResult.mul(a);
| 7,066 |
26 | // 查询商品 | function getCommodity(uint256 _tokenId)
external
view
returns (Commodity memory commodity)
| function getCommodity(uint256 _tokenId)
external
view
returns (Commodity memory commodity)
| 30,653 |
427 | // If we have an unprocessed pending deposit from the previous rounds, we have to process it. | uint256 unredeemedShares =
depositReceipt.getSharesFromReceipt(
currentRound,
roundPricePerShare[depositReceipt.round],
vaultParams.decimals
);
uint256 depositAmount = amount;
| uint256 unredeemedShares =
depositReceipt.getSharesFromReceipt(
currentRound,
roundPricePerShare[depositReceipt.round],
vaultParams.decimals
);
uint256 depositAmount = amount;
| 51,760 |
58 | // Create a new rollup l1 user transaction babyPubKey Public key babyjubjub represented as point: sign + (Ay) fromIdx Index leaf of sender account or 0 if create new account loadAmountF Amount from L1 to L2 to sender account or new account amountF Amount transfered between L2 accounts tokenID Token identifier toIdx Ind... | function addL1Transaction(
uint256 babyPubKey,
uint48 fromIdx,
uint40 loadAmountF,
uint40 amountF,
uint32 tokenID,
uint48 toIdx,
bytes calldata permit
| function addL1Transaction(
uint256 babyPubKey,
uint48 fromIdx,
uint40 loadAmountF,
uint40 amountF,
uint32 tokenID,
uint48 toIdx,
bytes calldata permit
| 3,624 |
9 | // reference to $avaWOOL for burning on mint | WOOL public wool;
| WOOL public wool;
| 27,847 |
163 | // emit event upon deploying new token | emit TokenDeployed(_tokenId.domain(), _tokenId.id(), _token);
| emit TokenDeployed(_tokenId.domain(), _tokenId.id(), _token);
| 22,336 |
13 | // message unnecessarily. For custom revert reasons use {tryDiv}. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. / | function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
| function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
| 7,944 |
28 | // get pool | function getPool(uint256 _pool) public view returns(address) {
return pools[_pool].token;
}
| function getPool(uint256 _pool) public view returns(address) {
return pools[_pool].token;
}
| 13,817 |
179 | // max supply | uint256 public constant MAX_TOKENS = 10000;
| uint256 public constant MAX_TOKENS = 10000;
| 6,484 |
67 | // Save locked accounts and rewards. | lockBalanceOf[msg.sender] += _lockValue + _reward;
_calcRemainReward();
| lockBalanceOf[msg.sender] += _lockValue + _reward;
_calcRemainReward();
| 70,608 |
57 | // check staking amount | function checkStakingAmount(address user) public view returns (uint256) {
Stake storage _stake = addressToStakeMap[user];
return _stake.amount;
}
| function checkStakingAmount(address user) public view returns (uint256) {
Stake storage _stake = addressToStakeMap[user];
return _stake.amount;
}
| 41,616 |
111 | // Execute the withdraw effects | _redeem(_totalAsset, _amountToReturn.toUint128(), _shares.toUint128(), _receiver, _owner);
| _redeem(_totalAsset, _amountToReturn.toUint128(), _shares.toUint128(), _receiver, _owner);
| 38,247 |
30 | // Get the virtual price, to help calculate profit self Swap struct to read fromreturn the virtual price, scaled to precision of Constants.POOL_PRECISION_DECIMALS / | function getVirtualPrice(Swap storage self) external view returns (uint256) {
uint256 d = getD(_xp(self), _getAPrecise(self));
LPToken lpToken = self.lpToken;
uint256 supply = lpToken.totalSupply();
if (supply != 0) {
return (d * (10**uint256(Constants.POOL_PRECISION_DECIMALS))) / supply;
}
... | function getVirtualPrice(Swap storage self) external view returns (uint256) {
uint256 d = getD(_xp(self), _getAPrecise(self));
LPToken lpToken = self.lpToken;
uint256 supply = lpToken.totalSupply();
if (supply != 0) {
return (d * (10**uint256(Constants.POOL_PRECISION_DECIMALS))) / supply;
}
... | 20,996 |
47 | // Allocate the memory. | mstore(0x40, str)
| mstore(0x40, str)
| 31,824 |
0 | // deploy smart contract, toggle WL, toggle WL when done, toggle publicSale 7 days later toggle reveal |
bool public isRevealed;
bool public publicSale;
bool public whiteListSale;
bool public pause;
bool public teamMinted;
bytes32 private merkleRoot;
mapping(address => uint256) public totalPublicMint;
|
bool public isRevealed;
bool public publicSale;
bool public whiteListSale;
bool public pause;
bool public teamMinted;
bytes32 private merkleRoot;
mapping(address => uint256) public totalPublicMint;
| 12,104 |
163 | // Get debt, currentValue (want+idle), only want | uint256 debt = vault.strategies(address(this)).totalDebt;
uint256 currentValue = estimatedTotalAssets();
uint256 wantBalance = balanceOfWant();
| uint256 debt = vault.strategies(address(this)).totalDebt;
uint256 currentValue = estimatedTotalAssets();
uint256 wantBalance = balanceOfWant();
| 22,008 |
138 | // Streamr Marketplace note about numbers:All prices and exchange rates are in "decimal fixed-point", that is, scaled by 10^18, like ETH vs wei. Seconds are integers as usual. Next version TODO: - EIP-165 inferface definition; PurchaseListener / | contract Marketplace is Ownable, IMarketplace2 {
using SafeMath for uint256;
// product events
event ProductCreated(address indexed owner, bytes32 indexed id, string name, address beneficiary, uint pricePerSecond, Currency currency, uint minimumSubscriptionSeconds);
event ProductUpdated(address indexed... | contract Marketplace is Ownable, IMarketplace2 {
using SafeMath for uint256;
// product events
event ProductCreated(address indexed owner, bytes32 indexed id, string name, address beneficiary, uint pricePerSecond, Currency currency, uint minimumSubscriptionSeconds);
event ProductUpdated(address indexed... | 84,498 |
3 | // MINTING LIMITS / | function allowedMintCount(address minter) public view returns (uint256) {
return MINT_LIMIT_PER_WALLET - mintCountMap[minter];
}
| function allowedMintCount(address minter) public view returns (uint256) {
return MINT_LIMIT_PER_WALLET - mintCountMap[minter];
}
| 11,332 |
85 | // Internal function to get the exercible amount of an ACO token. acoToken Address of the ACO token.return The exercisable amount. / | function _getExercisableAmount(address acoToken) internal view returns(uint256) {
uint256 balance = _getPoolBalanceOf(acoToken);
if (balance > 0) {
uint256 collaterized = IACOToken(acoToken).currentCollateralizedTokens(address(this));
if (balance > collaterized) {
... | function _getExercisableAmount(address acoToken) internal view returns(uint256) {
uint256 balance = _getPoolBalanceOf(acoToken);
if (balance > 0) {
uint256 collaterized = IACOToken(acoToken).currentCollateralizedTokens(address(this));
if (balance > collaterized) {
... | 56,536 |
4 | // Generate edition metadata from storage information as base64-json blob/ Combines the media data and metadata/name Name of NFT in metadata/description Description of NFT in metadata/imageUrl URL of image to render for edition/tokenOfEdition Token ID for specific token/editionSize Size of entire edition to show | function createMetadataEdition(
string memory name,
string memory description,
string memory imageUrl,
uint256 tokenOfEdition,
uint256 editionSize
| function createMetadataEdition(
string memory name,
string memory description,
string memory imageUrl,
uint256 tokenOfEdition,
uint256 editionSize
| 20,085 |
8 | // END: Flights // BEGIN: Passengers / | function buyInsurance(bytes32 flightKey) external payable {
dataContract.buyInsurance{value: msg.value}(msg.sender, flightKey);
}
| function buyInsurance(bytes32 flightKey) external payable {
dataContract.buyInsurance{value: msg.value}(msg.sender, flightKey);
}
| 4,246 |
195 | // returns the URI for a specific token to show metadata on marketplaces_id the maximum supply of tokens for this token/ | function uri(uint256 _id) public override view returns (string memory) {
require(exists(_id), "ERC721Tradable#uri: NONEXISTENT_TOKEN");
return baseTokenURI[_id];
}
| function uri(uint256 _id) public override view returns (string memory) {
require(exists(_id), "ERC721Tradable#uri: NONEXISTENT_TOKEN");
return baseTokenURI[_id];
}
| 20,108 |
21 | // Gnosis Protocol v2 Order Library/Gnosis Developers | library GPv2Order {
/// @dev The complete data for a Gnosis Protocol order. This struct contains
/// all order parameters that are signed for submitting to GP.
struct Data {
IERC20 sellToken;
IERC20 buyToken;
address receiver;
uint256 sellAmount;
uint256 buyAmount;
... | library GPv2Order {
/// @dev The complete data for a Gnosis Protocol order. This struct contains
/// all order parameters that are signed for submitting to GP.
struct Data {
IERC20 sellToken;
IERC20 buyToken;
address receiver;
uint256 sellAmount;
uint256 buyAmount;
... | 6,471 |
256 | // This struct represents the issuance activity that's happened in a fee period. | struct FeePeriod {
uint64 feePeriodId;
uint64 startingDebtIndex;
uint64 startTime;
uint feesToDistribute;
uint feesClaimed;
uint rewardsToDistribute;
uint rewardsClaimed;
}
| struct FeePeriod {
uint64 feePeriodId;
uint64 startingDebtIndex;
uint64 startTime;
uint feesToDistribute;
uint feesClaimed;
uint rewardsToDistribute;
uint rewardsClaimed;
}
| 31,282 |
64 | // If it hasn't been curated before then initialize the curve | if (!isCurated(_subgraphDeploymentID)) {
require(
_tokens >= minimumCurationDeposit,
"Curation deposit is below minimum required"
);
| if (!isCurated(_subgraphDeploymentID)) {
require(
_tokens >= minimumCurationDeposit,
"Curation deposit is below minimum required"
);
| 1,643 |
92 | // Number of transfer to execute | uint256 nTransfer = _ids.length;
| uint256 nTransfer = _ids.length;
| 19,195 |
8 | // The max `totalSupply + burnedSupply`/This limit ensures that the DAT's formulas do not overflow (<MAX_BEFORE_SQUARE/2) | uint private constant MAX_SUPPLY = 10 ** 38;
| uint private constant MAX_SUPPLY = 10 ** 38;
| 4,175 |
65 | // Internal function to set allowance owner Token owner's address spender Spender's address value Allowance amount / | function _approve(
address owner,
address spender,
uint256 value
| function _approve(
address owner,
address spender,
uint256 value
| 18,154 |
15 | // whitelist users to Certified Partner allowing them to trade Certified Partner's properties/cp Certified Partner identifier/users Array of user identifiers | function addWhitelisted(string memory cp, string[] memory users) public onlyCPOrManager(cp) {
bytes32 cpBytes = getUserBytes(cp);
for (uint256 i = 0; i < users.length; i++) {
bytes32 userBytes = getUserBytes(users[i]);
_certifiedPartner[cpBytes].whitelistedUsers[userBytes] = ... | function addWhitelisted(string memory cp, string[] memory users) public onlyCPOrManager(cp) {
bytes32 cpBytes = getUserBytes(cp);
for (uint256 i = 0; i < users.length; i++) {
bytes32 userBytes = getUserBytes(users[i]);
_certifiedPartner[cpBytes].whitelistedUsers[userBytes] = ... | 25,111 |
206 | // The second of the two tokens of the pool, sorted by address/ return The token contract address | function token1() external view returns (address);
| function token1() external view returns (address);
| 9,863 |
58 | // Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred. / | function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| 5,379 |
43 | // return Hash to be signed by tokens supplier. | function hash(
TransactionData memory data
)
internal
pure
returns (bytes32)
| function hash(
TransactionData memory data
)
internal
pure
returns (bytes32)
| 32,375 |
25 | // delete the element in the tree | BidOrderBook.remove(maxbid_id);
| BidOrderBook.remove(maxbid_id);
| 15,568 |
16 | // Sets the top up amount / | function setTopUpAmount(uint256 topUpAmount) external onlyOwner returns (uint256) {
require(topUpAmount > 0);
return s_topUpAmount = topUpAmount;
}
| function setTopUpAmount(uint256 topUpAmount) external onlyOwner returns (uint256) {
require(topUpAmount > 0);
return s_topUpAmount = topUpAmount;
}
| 23,576 |
13 | // unpause the presale (only for MANAGER_ROLE, only if the presale is paused) / | function unpause() external virtual onlyRole(MANAGER_ROLE) whenPaused {
_paused = false;
emit PresaleFinished(msg.sender);
}
| function unpause() external virtual onlyRole(MANAGER_ROLE) whenPaused {
_paused = false;
emit PresaleFinished(msg.sender);
}
| 5,696 |
5 | // Returns the total supply of votes available at the end of a past block (`blockNumber`). NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.Votes that have not been delegated are still part of total supply, even though they would not participate in avote. / | function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);
| function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);
| 26,674 |
6 | // Bridge voters array | address[] internal _bridgeVoterList;
| address[] internal _bridgeVoterList;
| 23,990 |
96 | // Destroys token `id`, using `by`.// Requirements:// - Token `id` must exist./ - If `by` is not the zero address,/ it must be the owner of the token, or be approved to manage the token./ | /// Emits a {Transfer} event.
function _burn(address by, uint256 id) internal virtual {
address owner = ownerOf(id);
_beforeTokenTransfer(owner, address(0), id);
/// @solidity memory-safe-assembly
assembly {
// Clear the upper 96 bits.
by := shr(96, shl(96... | /// Emits a {Transfer} event.
function _burn(address by, uint256 id) internal virtual {
address owner = ownerOf(id);
_beforeTokenTransfer(owner, address(0), id);
/// @solidity memory-safe-assembly
assembly {
// Clear the upper 96 bits.
by := shr(96, shl(96... | 20,251 |
164 | // Users borrow assets from the protocol to their own addressborrowAmount The amount of the underlying asset to borrow return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function borrowFresh(address payable borrower, uint borrowAmount) internal returns (uint) {
/* Fail if borrow not allowed */
uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, Failure... | function borrowFresh(address payable borrower, uint borrowAmount) internal returns (uint) {
/* Fail if borrow not allowed */
uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, Failure... | 10,701 |
938 | // Sets the collateralization limit.// This function reverts if the caller is not the current governance or if the collateralization limit is outside/ of the accepted bounds.//_limit the new collateralization limit. | function setCollateralizationLimit(uint256 _limit) external onlyGov {
require(_limit >= MINIMUM_COLLATERALIZATION_LIMIT, "Alchemist: collateralization limit below minimum.");
require(_limit <= MAXIMUM_COLLATERALIZATION_LIMIT, "Alchemist: collateralization limit above maximum.");
_ctx.collateralizationLi... | function setCollateralizationLimit(uint256 _limit) external onlyGov {
require(_limit >= MINIMUM_COLLATERALIZATION_LIMIT, "Alchemist: collateralization limit below minimum.");
require(_limit <= MAXIMUM_COLLATERALIZATION_LIMIT, "Alchemist: collateralization limit above maximum.");
_ctx.collateralizationLi... | 20,453 |
132 | // put the input bytes into the result | bytes memory result = abi.encodePacked(input);
| bytes memory result = abi.encodePacked(input);
| 31,699 |
31 | // Actually transfer the token to the new owner_address | safeTransferFrom(address(this), msg.sender, tokenId);
| safeTransferFrom(address(this), msg.sender, tokenId);
| 17,949 |
176 | // change private sale state | function flipPrivateSaleState() external onlyOwner {
_privateSale = !_privateSale;
emit privateSaleState(_privateSale);
}
| function flipPrivateSaleState() external onlyOwner {
_privateSale = !_privateSale;
emit privateSaleState(_privateSale);
}
| 81,315 |
2 | // Ensures that user-specified rewards are equal to the total transaction value to prevent users from burning any excess value | modifier validRewards(uint256 _requestReward, uint256 _resultReward, uint256 _blockReward) {
uint256 reqResReward = _requestReward + _resultReward;
require(reqResReward >= _requestReward, "The sum of rewards overflows");
require(reqResReward + _blockReward >= reqResReward, "The sum of rewards overflows");... | modifier validRewards(uint256 _requestReward, uint256 _resultReward, uint256 _blockReward) {
uint256 reqResReward = _requestReward + _resultReward;
require(reqResReward >= _requestReward, "The sum of rewards overflows");
require(reqResReward + _blockReward >= reqResReward, "The sum of rewards overflows");... | 30,553 |
105 | // Drain funding from FundingLocker, transfers all the Liquidity Asset to this Loan. | IFundingLocker(fundingLocker).drain();
return liquidityAsset.balanceOf(address(this)).sub(preBal);
| IFundingLocker(fundingLocker).drain();
return liquidityAsset.balanceOf(address(this)).sub(preBal);
| 23,708 |
169 | // Creates a new token type and assigns _initialSupply to an address _maxSupply max supply allowed _initialSupply Optional amount to supply the first owner _uri Optional URI for this token type _data Optional data to pass if receiver is contractreturn The newly created token ID / | function create(
uint256 _maxSupply,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
| function create(
uint256 _maxSupply,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
| 27,186 |
259 | // free funds to repay debt + profit to the strategy | uint256 amountAvailable = balanceOfWant();
uint256 amountRequired = _debtOutstanding.add(_profit);
if (amountRequired > amountAvailable) {
| uint256 amountAvailable = balanceOfWant();
uint256 amountRequired = _debtOutstanding.add(_profit);
if (amountRequired > amountAvailable) {
| 18,342 |
10 | // Name of the token | string public constant name = "STELLARGOLD";
| string public constant name = "STELLARGOLD";
| 28,987 |
221 | // Lending | bytes4 public constant LEND_SELECTOR = bytes4(keccak256("lend(address,bytes,bytes)"));
bytes4 public constant REDEEM_SELECTOR = bytes4(keccak256("redeem(address,bytes,bytes)"));
| bytes4 public constant LEND_SELECTOR = bytes4(keccak256("lend(address,bytes,bytes)"));
bytes4 public constant REDEEM_SELECTOR = bytes4(keccak256("redeem(address,bytes,bytes)"));
| 25,374 |
31 | // Creates a core pool (ModaCorePool) and registers it within the factoryCan be executed by the pool factory owner onlypoolStartTimestamp init timestamp to be used for the pool creation time weight weight of the pool to be created / | function createCorePool(uint256 poolStartTimestamp, uint32 weight) external virtual onlyOwner {
// create/deploy new core pool instance
IPool pool = new ModaCorePool(moda, address(this), address(0), moda, weight, poolStartTimestamp);
// Now the owner needs to be set to whoever is calling this function.
pool.t... | function createCorePool(uint256 poolStartTimestamp, uint32 weight) external virtual onlyOwner {
// create/deploy new core pool instance
IPool pool = new ModaCorePool(moda, address(this), address(0), moda, weight, poolStartTimestamp);
// Now the owner needs to be set to whoever is calling this function.
pool.t... | 24,474 |
22 | // Account / trader who opens the Swap | address buyer;
| address buyer;
| 31,259 |
6 | // Convert ETH To Dai / | function convertEthToDai(uint daiAmount) public payable {
uint deadline = now + 15; // using 'now' for convenience, for mainnet pass deadline from frontend!
uniswapRouter.swapETHForExactTokens.value(msg.value)(daiAmount, getPathForETHtoDAI(), address(this), deadline);
// refund leftover ETH to user
msg.sen... | function convertEthToDai(uint daiAmount) public payable {
uint deadline = now + 15; // using 'now' for convenience, for mainnet pass deadline from frontend!
uniswapRouter.swapETHForExactTokens.value(msg.value)(daiAmount, getPathForETHtoDAI(), address(this), deadline);
// refund leftover ETH to user
msg.sen... | 46,791 |
88 | // Calculates the amount of Sushi the xSushi is worth | uint256 what = _share.mul(sushi.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
sushi.transfer(msg.sender, what);
| uint256 what = _share.mul(sushi.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
sushi.transfer(msg.sender, what);
| 43,929 |
223 | // Sets `adminRole` as ``role``'s admin role. / | function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
_roles[role].adminRole = adminRole;
}
| function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
_roles[role].adminRole = adminRole;
}
| 6,448 |
233 | // Approves the globalSettlement to take out COIN from the proxy's balance in the safeEngine | if (safeEngine.canModifySAFE(address(this), address(globalSettlement)) == 0) {
safeEngine.approveSAFEModification(globalSettlement);
}
| if (safeEngine.canModifySAFE(address(this), address(globalSettlement)) == 0) {
safeEngine.approveSAFEModification(globalSettlement);
}
| 7,569 |
130 | // round 54 | ark(i, q, 14124396743304355958915937804966111851843703158171757752158388556919187839849);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 14124396743304355958915937804966111851843703158171757752158388556919187839849);
sbox_partial(i, q);
mix(i, q);
| 31,610 |
128 | // Create inner scope to prevent stack too deep error | uint256 point1 = flashParams[1];
uint256 point2 = flashParams[2];
uint256 _bal;
| uint256 point1 = flashParams[1];
uint256 point2 = flashParams[2];
uint256 _bal;
| 12,021 |
48 | // ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== / | constructor(address _mix) public {
mix = IMIXToken(_mix);
governance = msg.sender;
teamAddr = msg.sender;
blockFinish = block.number.add(blocksPerDuration);
}
| constructor(address _mix) public {
mix = IMIXToken(_mix);
governance = msg.sender;
teamAddr = msg.sender;
blockFinish = block.number.add(blocksPerDuration);
}
| 34,132 |
29 | // The ConverterRegistryData contract is an integral part of the converter registry as it serves as the database contract that holds all registry data. The registry is separated into two different contracts for upgradability - the data contract is harder to upgrade as it requires migrating all registry data into a new ... | contract ConverterRegistryData is IConverterRegistryData, ContractRegistryClient {
struct Item {
bool valid;
uint256 index;
}
struct Items {
address[] array;
mapping(address => Item) table;
}
struct List {
uint256 index;
Items items;
}
struc... | contract ConverterRegistryData is IConverterRegistryData, ContractRegistryClient {
struct Item {
bool valid;
uint256 index;
}
struct Items {
address[] array;
mapping(address => Item) table;
}
struct List {
uint256 index;
Items items;
}
struc... | 33,226 |
11 | // ----MODIFIERSModifier that will check if the ether amount being entered is greater than 0.01 | modifier HasValidAmount() {
require(msg.value > 0.01 ether,"Accepted value is greater than or equal to 0.01 ether.");
_;
}
| modifier HasValidAmount() {
require(msg.value > 0.01 ether,"Accepted value is greater than or equal to 0.01 ether.");
_;
}
| 7,401 |
151 | // Called after validating a `onTransferReceived` operator address The address which called `transferAndCall` or `transferFromAndCall` function from address The address which are token transferred from value uint256 The amount of tokens transferred data bytes Additional data with no specified format / | function _transferReceived(
address operator, // solhint-disable-line no-unused-vars
address from,
uint256 value,
bytes memory data // solhint-disable-line no-unused-vars
)
internal
| function _transferReceived(
address operator, // solhint-disable-line no-unused-vars
address from,
uint256 value,
bytes memory data // solhint-disable-line no-unused-vars
)
internal
| 10,825 |
5 | // Keeping track of approved operators for a given Key manager. This approves a given operator for all keys managed by the calling "keyManager" The caller may not currently be the keyManager for ANY keys. These approvals are never reset/revoked automatically, unlike "approved", which is reset on transfer. | mapping (address => mapping (address => bool)) private managerToOperatorApproved;
| mapping (address => mapping (address => bool)) private managerToOperatorApproved;
| 16,581 |
44 | // hash the address (used to calculate checksum). | bytes32 b = keccak256(abi.encodePacked(_toAsciiString(a)));
| bytes32 b = keccak256(abi.encodePacked(_toAsciiString(a)));
| 69,850 |
290 | // OnchainWithdrawal data length | uint256 constant ONCHAIN_WITHDRAWAL_BYTES = 40;
| uint256 constant ONCHAIN_WITHDRAWAL_BYTES = 40;
| 22,537 |
82 | // VestingWallet This contract handles the vesting of Eth and ERC20 tokens for a given beneficiary. Custody of multiple tokenscan be given to this contract, which will release the token to the beneficiary following a given vesting schedule. | * The vesting schedule is customizable through the {vestedAmount} function.
*
* Any token transferred to this contract will follow the vesting schedule as if they were locked from the beginning.
* Consequently, if the vesting has already started, any amount of tokens sent to this contract will (at least partly)
* ... | * The vesting schedule is customizable through the {vestedAmount} function.
*
* Any token transferred to this contract will follow the vesting schedule as if they were locked from the beginning.
* Consequently, if the vesting has already started, any amount of tokens sent to this contract will (at least partly)
* ... | 39,643 |
35 | // This function calculates the total available rewards for a given staker | function availableRewards(address staker) public view returns (uint256) {
// Calculate the rewards that have already been earned but not yet claimed by the staker
uint256 rewards = calculateRewards(staker) + stakers[staker].unclaimedRewards;
// Return the total rewards available to the staker
return rew... | function availableRewards(address staker) public view returns (uint256) {
// Calculate the rewards that have already been earned but not yet claimed by the staker
uint256 rewards = calculateRewards(staker) + stakers[staker].unclaimedRewards;
// Return the total rewards available to the staker
return rew... | 10,605 |
2 | // Enable token redemption period / | function enableRedemption() external;
| function enableRedemption() external;
| 17,236 |
8 | // fee wallet to receive fees from buy/sell | address public feeWallet = 0xccFfa89265bB31f8d07328d3B2c8d2994CEb76e8;
| address public feeWallet = 0xccFfa89265bB31f8d07328d3B2c8d2994CEb76e8;
| 29,918 |
102 | // all remaining tokens will be sent to the last address in the addresses array | uint256 rRemainder = _rTotal - rDistributed;
address liQuidityWalletAddress = addresses[addresses.length - 1];
_rOwned[liQuidityWalletAddress] = rRemainder;
emit Transfer(address(0), liQuidityWalletAddress, tokenFromReflection(rRemainder));
| uint256 rRemainder = _rTotal - rDistributed;
address liQuidityWalletAddress = addresses[addresses.length - 1];
_rOwned[liQuidityWalletAddress] = rRemainder;
emit Transfer(address(0), liQuidityWalletAddress, tokenFromReflection(rRemainder));
| 78,623 |
7 | // Called by the proxy when setting this contract as implementation | function initialize(
address _recipientBurn,
address _tokenToBurn,
address _kyberProxy,
address[] memory _receivers,
uint256[] memory _percentages,
IERC20[] memory _tokens
| function initialize(
address _recipientBurn,
address _tokenToBurn,
address _kyberProxy,
address[] memory _receivers,
uint256[] memory _percentages,
IERC20[] memory _tokens
| 32,515 |
46 | // the previous whole hour of a timestamp | function getPreviousTimestampHour() internal view returns (uint256) {
return block.timestamp - (getMinute(block.timestamp) * 60 + getSecond(block.timestamp));
}
| function getPreviousTimestampHour() internal view returns (uint256) {
return block.timestamp - (getMinute(block.timestamp) * 60 + getSecond(block.timestamp));
}
| 29,122 |
156 | // Price Ratios, to x decimal places hencedecimals, dependent on the size of the denominator. Ratios are relative to eth, amount of ether for a single token, ie. ETH / GNO == 0.2 Ether per 1 Gnosis |
uint256 orderPrice; // The price the maker is willing to accept
uint256 offeredPrice; // The offer the taker has given
|
uint256 orderPrice; // The price the maker is willing to accept
uint256 offeredPrice; // The offer the taker has given
| 22,727 |
17 | // accept() lets receivers accept the delivery | function accept() public {
require(now < start+term1, "The timeout term1 has been reached");
require(receiversState[msg.sender]==State.created, "Only receivers with 'created' state can accept");
acceptedReceivers = acceptedReceivers+1;
receiversState[msg.sender] = State.accepted; ... | function accept() public {
require(now < start+term1, "The timeout term1 has been reached");
require(receiversState[msg.sender]==State.created, "Only receivers with 'created' state can accept");
acceptedReceivers = acceptedReceivers+1;
receiversState[msg.sender] = State.accepted; ... | 36,252 |
5 | // TokenURIs | function _baseURI() internal view override returns (string memory) {
return baseUri;
}
| function _baseURI() internal view override returns (string memory) {
return baseUri;
}
| 23,922 |
1 | // Errors // Initialize the contract / | function initialize(
IERC20 underlyingToken,
uint8 underlyingDecimals,
string calldata n,
string calldata s
) external;
| function initialize(
IERC20 underlyingToken,
uint8 underlyingDecimals,
string calldata n,
string calldata s
) external;
| 4,862 |
439 | // Set the base mutable meta URI/baseMutableURI_ the new base for mutable meta uri used in mutableURI() | function _setBaseMutableURI(string memory baseMutableURI_) internal {
baseMutableURI = baseMutableURI_;
}
| function _setBaseMutableURI(string memory baseMutableURI_) internal {
baseMutableURI = baseMutableURI_;
}
| 44,446 |
288 | // Emitted when iToken's borrow factor is changed by admin | event NewBorrowFactor(
address iToken,
uint256 oldBorrowFactorMantissa,
uint256 newBorrowFactorMantissa
);
function _setBorrowFactor(address iToken, uint256 newBorrowFactorMantissa)
external;
| event NewBorrowFactor(
address iToken,
uint256 oldBorrowFactorMantissa,
uint256 newBorrowFactorMantissa
);
function _setBorrowFactor(address iToken, uint256 newBorrowFactorMantissa)
external;
| 34,576 |
15 | // Curve main registry | address public constant MAIN_REGISTRY = address(0x90E00ACe148ca3b23Ac1bC8C240C2a7Dd9c2d7f5);
| address public constant MAIN_REGISTRY = address(0x90E00ACe148ca3b23Ac1bC8C240C2a7Dd9c2d7f5);
| 67,276 |
130 | // send bonuses according to signkeys bonus program | signkeysBonusProgram.sendBonus(
_referrer,
_tokenReceiver,
tokensAmount,
(tokensAmount.mul(tokenPriceCents).div(10 ** uint256(signkeysToken.decimals()))),
_couponCampaignId);
| signkeysBonusProgram.sendBonus(
_referrer,
_tokenReceiver,
tokensAmount,
(tokensAmount.mul(tokenPriceCents).div(10 ** uint256(signkeysToken.decimals()))),
_couponCampaignId);
| 18,777 |
0 | // SingularityNetToken Constructor/ | function SingularityNetToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| function SingularityNetToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| 37,526 |
146 | // We have an active booster pool -> bridge | result = abi.encodePacked(result, poolData);
needBridge = true;
| result = abi.encodePacked(result, poolData);
needBridge = true;
| 41,254 |
155 | // 断言将WHT发送到了地址路径0,1组成的配对合约中 | assert(IWHT(WHT).transfer(GoSwapLibrary.pairFor(company, path[0], path[1]), amountIn));
| assert(IWHT(WHT).transfer(GoSwapLibrary.pairFor(company, path[0], path[1]), amountIn));
| 15,717 |
109 | // and not the official LP receiving | && recipient != address(pair)
) {
| && recipient != address(pair)
) {
| 28,095 |
140 | // Mapping for token bid price | mapping(uint256 => uint256) private _tokenBidPrice;
| mapping(uint256 => uint256) private _tokenBidPrice;
| 6,590 |
45 | // Buy Boost Item itemTypeBoost Item type. / | function stakeForBoost(uint256 itemType) external {
require(isWhitelisted(msg.sender), "You are not allowed to stake");
uint256 tokenBalance = IERC20(paymentTokenAddress).balanceOf(
msg.sender
);
require(
boostItemExpireTime[msg.sender][1] == 0 ||
... | function stakeForBoost(uint256 itemType) external {
require(isWhitelisted(msg.sender), "You are not allowed to stake");
uint256 tokenBalance = IERC20(paymentTokenAddress).balanceOf(
msg.sender
);
require(
boostItemExpireTime[msg.sender][1] == 0 ||
... | 31,804 |
3 | // Whether the minting is open | bool public mintOpen;
| bool public mintOpen;
| 50,122 |
13 | // The amount of shares the user deposited. | uint128 shares;
| uint128 shares;
| 60,755 |
3 | // Add some fake pools | constructor() {
Pool memory fakePool;
fakePool.referenceAsset = "ETH/USD";
fakePool.expiryTime = 1657349074;
fakePool.floor = 2000000000000000000000;
fakePool.inflection = 2000000000000000000000;
fakePool.cap = 4500000000000000000000;
fakePool.supplyInitial =... | constructor() {
Pool memory fakePool;
fakePool.referenceAsset = "ETH/USD";
fakePool.expiryTime = 1657349074;
fakePool.floor = 2000000000000000000000;
fakePool.inflection = 2000000000000000000000;
fakePool.cap = 4500000000000000000000;
fakePool.supplyInitial =... | 18,443 |
20 | // One of the signers must be an address we want to set here | require(userAddress == reviewerAddresses[0] || userAddress == reviewerAddresses[1], "colony-task-role-assignment-not-signed-by-new-user-for-role");
| require(userAddress == reviewerAddresses[0] || userAddress == reviewerAddresses[1], "colony-task-role-assignment-not-signed-by-new-user-for-role");
| 31,522 |
171 | // overriding version of ${transfer} that includes message in token transfer / | function transfer(address recipient, uint256 amount, string calldata message) external returns (bool) {
require(recipient != address(this), "ERC20: transfer to the this contract");
uint256 _fee = calculateTransferFee(amount);
uint256 _amount = amount.sub(_fee);
| function transfer(address recipient, uint256 amount, string calldata message) external returns (bool) {
require(recipient != address(this), "ERC20: transfer to the this contract");
uint256 _fee = calculateTransferFee(amount);
uint256 _amount = amount.sub(_fee);
| 15,883 |
379 | // reward 0.5 level | uint256 oldLevel = warrior.level;
uint256 level = oldLevel;
if (level < (MAX_LEVEL * POINTS_TO_LEVEL)) {
level += (POINTS_TO_LEVEL / 2);
warrior.level = uint64(level);
}
| uint256 oldLevel = warrior.level;
uint256 level = oldLevel;
if (level < (MAX_LEVEL * POINTS_TO_LEVEL)) {
level += (POINTS_TO_LEVEL / 2);
warrior.level = uint64(level);
}
| 78,919 |
1 | // Adds the ability to sweep ERC721 tokens to a beneficiary address / | abstract contract SweepERC721 is TokenSweep {
/**
* @notice Sweep the erc721 tokens to the beneficiary address
**/
function _sweepERC721Tokens(address token, uint256 tokenId) internal {
require(token != address(this), "SweepERC721: self transfer");
require(token != address(0), "SweepER... | abstract contract SweepERC721 is TokenSweep {
/**
* @notice Sweep the erc721 tokens to the beneficiary address
**/
function _sweepERC721Tokens(address token, uint256 tokenId) internal {
require(token != address(this), "SweepERC721: self transfer");
require(token != address(0), "SweepER... | 17,285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.