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 |
|---|---|---|---|---|
41 | // Redeem base token with fToken and given incentive./state The current state./_fTokenIn The amount of fToken supplied./_incentiveRatio The extra incentive given, multiplied by 1e18./ return _baseOut The amount of base token expected./ return _fDeltaNav The change for nav of fToken. | function liquidateWithIncentive(
SwapState memory state,
uint256 _fTokenIn,
uint256 _incentiveRatio
| function liquidateWithIncentive(
SwapState memory state,
uint256 _fTokenIn,
uint256 _incentiveRatio
| 41,210 |
47 | // setter for the address that is responsible for creating deposits / | function setDepositCreator(address _depositCreator) public onlyOwner {
require(_depositCreator != address(0));
depositCreator = _depositCreator;
}
| function setDepositCreator(address _depositCreator) public onlyOwner {
require(_depositCreator != address(0));
depositCreator = _depositCreator;
}
| 26,297 |
23 | // Throws if called by any account other than the admin. / | modifier onlyAdmin() {
require(msg.sender == admin, "Function reserved to admin");
_;
}
| modifier onlyAdmin() {
require(msg.sender == admin, "Function reserved to admin");
_;
}
| 5,136 |
10 | // This emits when signer is modified | event SignerChanged(address newSigner);
| event SignerChanged(address newSigner);
| 10,656 |
64 | // send the ether to the MultiSig Wallet | multiSig.transfer(this.balance); // better in case any other ether ends up here
SendedEtherToMultiSig(multiSig,amount);
| multiSig.transfer(this.balance); // better in case any other ether ends up here
SendedEtherToMultiSig(multiSig,amount);
| 34,412 |
248 | // pay validator fee to the issuing validator's address if applicable | if (validatorFee > 0) {
| if (validatorFee > 0) {
| 42,469 |
19 | // The contract MUST allow multiple operators per owner. Enables or disables approval for a third party ("operator") to manage all of`msg.sender`'s assets. It also emits the ApprovalForAll event. _operator Address to add to the set of authorized operators. _approved True if the operators is approved, false to revoke ap... | function setApprovalForAll(
| function setApprovalForAll(
| 38,202 |
134 | // Minter | address private constant MINTER = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
| address private constant MINTER = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
| 21,414 |
131 | // set oracle deviation (1e27) can only be called by owner _deviation deviation value / | function setOracleDeviation(uint256 _deviation) external onlyOwner {
oracleDeviation = _deviation;
emit OracleDeviationUpdated(_deviation);
}
| function setOracleDeviation(uint256 _deviation) external onlyOwner {
oracleDeviation = _deviation;
emit OracleDeviationUpdated(_deviation);
}
| 18,360 |
158 | // An event whenever artist secondary sale percentage is updated | event ArtistSecondSalePercentUpdated (
uint256 artistSecondPercentage
);
| event ArtistSecondSalePercentUpdated (
uint256 artistSecondPercentage
);
| 28,353 |
4 | // Both keyAgreement1 (KA1) and keyAgreement2 (KA2) create a shared key. -> Diffie-Hellman algorithm./id - autogenerated./The keyExchangeConsumerValidator and keyExchangeValidatorConsumer create a shared key between the consumer and validator. -> Diffie-Hellman algorithm./The keyExchangeConsumerClient and keyExchangeCl... | struct Request {
uint256 id;
address requester;
address client;
bytes8 attributeMap;
bytes32 keyExchangeConsumerValidator;
bytes32 keyExchangeValidatorConsumer;
bytes32 hashedDataWithSharedSecret;
bool clientAgreed;
| struct Request {
uint256 id;
address requester;
address client;
bytes8 attributeMap;
bytes32 keyExchangeConsumerValidator;
bytes32 keyExchangeValidatorConsumer;
bytes32 hashedDataWithSharedSecret;
bool clientAgreed;
| 21,377 |
55 | // Actually perform the safeTransferFrom | function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) internal isValidToken(_tokenId) canTransfer(_tokenId){
address owner = cardIdToOwner[_tokenId];
require(owner != address(0));
require(_to != address(0));
require(owner == _from);
_tr... | function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) internal isValidToken(_tokenId) canTransfer(_tokenId){
address owner = cardIdToOwner[_tokenId];
require(owner != address(0));
require(_to != address(0));
require(owner == _from);
_tr... | 27,446 |
162 | // Returns the value associated with `key`.O(1). Requirements: - `key` must be in the map. / | function _get(Map storage map, bytes32 key) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
return map._entries[keyIndex - 1]._value; // All indexes are 1-base... | function _get(Map storage map, bytes32 key) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
return map._entries[keyIndex - 1]._value; // All indexes are 1-base... | 23,012 |
36 | // Modifier to make a function callable only when the contract is paused. / | modifier whenPaused() {
require(paused);
_;
}
| modifier whenPaused() {
require(paused);
_;
}
| 3,911 |
28 | // Contructor that gives the sender all tokens/ | function TKRPToken() {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;
}
| function TKRPToken() {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;
}
| 45,229 |
13 | // Permissioned/This contract defines a permission policy and provides the functions to grant/revoke permissions to certain users/contracts. A Permissioned contract should be a contract with the purpouse to be accessed only by authorized entities | contract Permissioned is Ownable {
// The policies defined for this contract
struct PermissionPolicy {
bool granted;
uint periodStart;
}
// For each address we have a PermissionPolicy defined
mapping(address => PermissionPolicy) public permissionMap;
uint constant inte... | contract Permissioned is Ownable {
// The policies defined for this contract
struct PermissionPolicy {
bool granted;
uint periodStart;
}
// For each address we have a PermissionPolicy defined
mapping(address => PermissionPolicy) public permissionMap;
uint constant inte... | 49,447 |
9 | // for testing change weeks for hours... | uint public preICOEnds = now + 1 weeks;
uint public bonus1Ends = now + 3 weeks;
uint public bonus2Ends = now + 6 weeks;
uint public endDate = now + 11 weeks;
bool private _pause = false;
| uint public preICOEnds = now + 1 weeks;
uint public bonus1Ends = now + 3 weeks;
uint public bonus2Ends = now + 6 weeks;
uint public endDate = now + 11 weeks;
bool private _pause = false;
| 12,969 |
567 | // Internal function to flush buffered tokens to the active vault.// This function reverts if an emergency exit is active. This is in place to prevent the potential loss of/ additional funds.// return the amount of tokens flushed to the active vault. | function flushActiveVault() internal returns (uint256) {
VaultV2.Data storage _activeVault = _vaults.last();
uint256 _depositedAmount = _activeVault.depositAll();
emit FundsFlushed(_depositedAmount);
return _depositedAmount;
}
| function flushActiveVault() internal returns (uint256) {
VaultV2.Data storage _activeVault = _vaults.last();
uint256 _depositedAmount = _activeVault.depositAll();
emit FundsFlushed(_depositedAmount);
return _depositedAmount;
}
| 8,577 |
13 | // Get deputy owner at given index index Index at which deputy owner is fetched from list of deputy ownersreturn returns deputy owner at provided index / | function getDeputyOwners(uint index) public view returns (address) {
return deputyOwners[index];
}
| function getDeputyOwners(uint index) public view returns (address) {
return deputyOwners[index];
}
| 5,095 |
235 | // If _prime is a probable prime... | require(numberdataToNumberType(numberdata) == NumberType.PROBABLE_PRIME, "disproveProbablePrime error: that prime is not a probable prime");
| require(numberdataToNumberType(numberdata) == NumberType.PROBABLE_PRIME, "disproveProbablePrime error: that prime is not a probable prime");
| 38,718 |
12 | // Emitted when the value for optimisticTimeout is set timeout The new value for optimistic timeout / | event SetOptimisticTimeout(uint256 timeout);
| event SetOptimisticTimeout(uint256 timeout);
| 38,259 |
4 | // Allow owner to set pool address to avoid unnecessary upgrades/_pool_address address of the pool/ return address of new pool | function setPoolAddress(address _pool_address) external returns (address);
| function setPoolAddress(address _pool_address) external returns (address);
| 34,128 |
26 | // We will not allowed to sell after 5 minutes (300 seconds) before game start | require(gameTime - 300 > block.timestamp);
| require(gameTime - 300 > block.timestamp);
| 79,504 |
18 | // signAudit allows people to attach a signatures to an NFT token They have to be either whitelisted (if the token works with a whitelist) or everyone can sign if it's not a token using a whitelist | function signAudit(
string memory _ipfsHash,
string memory _name,
address _signer,
bytes memory _signature
| function signAudit(
string memory _ipfsHash,
string memory _name,
address _signer,
bytes memory _signature
| 44,986 |
13 | // Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all... | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
| function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
| 20,453 |
58 | // Simplified ERC1319 Registry for Brownie testing, based on ethpm/solidity-registry/original version written by Nick Gheorghita <nickg@ethereum.org>/DO NOT USE THIS IN PRODUCTION | contract PackageRegistry {
struct Package {
bool exists;
uint createdAt;
uint updatedAt;
uint releaseCount;
string name;
}
struct Release {
bool exists;
uint createdAt;
bytes32 packageId;
string version;
string manifestURI;
... | contract PackageRegistry {
struct Package {
bool exists;
uint createdAt;
uint updatedAt;
uint releaseCount;
string name;
}
struct Release {
bool exists;
uint createdAt;
bytes32 packageId;
string version;
string manifestURI;
... | 1,474 |
1 | // Adds a new pop address./addr Address of pop contract to add. | function addPopAddress(address addr)
external
override
onlyAuthorized
| function addPopAddress(address addr)
external
override
onlyAuthorized
| 27,541 |
134 | // Mapping from country code to asset introducer type to token IDs | mapping(bytes3 => mapping(uint8 => uint[])) countryCodeToAssetIntroducerTypeToTokenIdsMap;
| mapping(bytes3 => mapping(uint8 => uint[])) countryCodeToAssetIntroducerTypeToTokenIdsMap;
| 2,417 |
187 | // Time after which waifus are randomized and allotted | uint256 public constant REVEAL_TIMESTAMP = SALE_START_TIMESTAMP + (86400 * 14);
uint256 public constant NAME_CHANGE_PRICE = 1830 * (10 ** 18);
uint256 public constant MAX_NFT_SUPPLY = 16384;
uint256 public startingIndexBlock;
uint256 public startingIndex;
| uint256 public constant REVEAL_TIMESTAMP = SALE_START_TIMESTAMP + (86400 * 14);
uint256 public constant NAME_CHANGE_PRICE = 1830 * (10 ** 18);
uint256 public constant MAX_NFT_SUPPLY = 16384;
uint256 public startingIndexBlock;
uint256 public startingIndex;
| 14,978 |
25 | // 85% of exact liquidation as buffer NOTE: _position.leverage == 10 means 1x Ex. price start == 100, leverage == 15 (1.5x) (priceStart / (15 / 10))(8.5 / 10) (priceStart10 / 15)(8.5 / 10) (priceStart / 15)8.5 (priceStart8.5) / 15 | return
(positions[_tokenId].indexPriceStart * 85) /
10 /
positions[_tokenId].leverage;
| return
(positions[_tokenId].indexPriceStart * 85) /
10 /
positions[_tokenId].leverage;
| 36,458 |
20 | // days until expiry | uint256 t = expiryTimestamp.sub(block.timestamp).div(1 days);
uint256 d1;
uint256 d2;
| uint256 t = expiryTimestamp.sub(block.timestamp).div(1 days);
uint256 d1;
uint256 d2;
| 63,119 |
218 | // Migrate existing strategy to new strategy. Migrating strategy aka old and new strategy should be of same type. _old Address of strategy being migrated _new Address of new strategy / | function migrateStrategy(address _old, address _new) external onlyGovernor {
require(
IStrategy(_new).pool() == address(this) && IStrategy(_old).pool() == address(this),
Errors.INVALID_STRATEGY
);
IPoolAccountant(poolAccountant).migrateStrategy(_old, _new);
IS... | function migrateStrategy(address _old, address _new) external onlyGovernor {
require(
IStrategy(_new).pool() == address(this) && IStrategy(_old).pool() == address(this),
Errors.INVALID_STRATEGY
);
IPoolAccountant(poolAccountant).migrateStrategy(_old, _new);
IS... | 68,375 |
6 | // Get the hash of a given attribute approval from the jurisdiction. account address The account specified by the attribute approval. operator address An optional account permitted to submit approval. attributeTypeID uint256 The ID of the attribute type in question. value uint256 The value of the attribute in the appro... | function getAttributeApprovalHash(
| function getAttributeApprovalHash(
| 7,315 |
353 | // if there is nothing to do, just quit | if (totalWithdrawal == 0) {
return 0;
}
| if (totalWithdrawal == 0) {
return 0;
}
| 23,736 |
56 | // Disables sending funds to this contract. | function() external {}
/// @dev A modifier to check if the given value can fit in 64-bits.
modifier canBeStoredWith64Bits(uint256 _value) {
require(_value <= (2**64 - 1));
_;
}
| function() external {}
/// @dev A modifier to check if the given value can fit in 64-bits.
modifier canBeStoredWith64Bits(uint256 _value) {
require(_value <= (2**64 - 1));
_;
}
| 3,355 |
6 | // Output stateOutput buffer | bytes output;
| bytes output;
| 38,159 |
17 | // Spreads out getting to the target price | uint256 public rebaseLag;
| uint256 public rebaseLag;
| 10,182 |
330 | // Returns an array of token IDs owned by `owner`. This function scans the ownership mapping and is O(totalSupply) in complexity.It is meant to be called off-chain. | * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K pfp collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory) {
uncheck... | * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K pfp collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory) {
uncheck... | 36,582 |
31 | // Add offset to find physical address of page table entry | uint64vars[PTE_ADDR] += vpn << uint64(intvars[PTE_SIZE_LOG2]);
| uint64vars[PTE_ADDR] += vpn << uint64(intvars[PTE_SIZE_LOG2]);
| 38,323 |
13 | // Batched event for GAS savings | emit ChildrenCreated(tokenIds);
| emit ChildrenCreated(tokenIds);
| 24,847 |
415 | // Emergency exit PYTs into the underlying asset. Only callable when emergency exit has/ been activated for the vault./vault The vault to exit PYT for/xPYT The xPYT contract to use for burning PYT. Set to 0 to burn raw PYT instead./amount The amount of PYT to exit/recipient The recipient of the underlying asset/ return... | function emergencyExitPerpetualYieldToken(
address vault,
IxPYT xPYT,
uint256 amount,
address recipient
| function emergencyExitPerpetualYieldToken(
address vault,
IxPYT xPYT,
uint256 amount,
address recipient
| 46,028 |
10 | // UTILITY FUNCTIONS// Get operating status of contract return A bool that is the current operating status / | function isOperational() public view returns (bool) {
return operational;
}
| function isOperational() public view returns (bool) {
return operational;
}
| 20,512 |
7 | // save some gas with storage variable | PendingWithdrawals storage _pendingWithdrawals = pendingWithdraws[msgSender];
uint256 i = _pendingWithdrawals.fromId;
uint256 toId = _pendingWithdrawals.toId;
| PendingWithdrawals storage _pendingWithdrawals = pendingWithdraws[msgSender];
uint256 i = _pendingWithdrawals.fromId;
uint256 toId = _pendingWithdrawals.toId;
| 29,762 |
14 | // claim Shogun allocation based on invested amounts | function claimShogun() public onlyEOA {
require(canClaim, "Cannot claim now");
require(invested[msg.sender] > 0, "no claim avalaible");
require(dailyClaimed[msg.sender] < block.timestamp, "cannot claimed now");
if (dailyClaimed[msg.sender] == 0) {
dailyClaimed[msg.sender]... | function claimShogun() public onlyEOA {
require(canClaim, "Cannot claim now");
require(invested[msg.sender] > 0, "no claim avalaible");
require(dailyClaimed[msg.sender] < block.timestamp, "cannot claimed now");
if (dailyClaimed[msg.sender] == 0) {
dailyClaimed[msg.sender]... | 2,974 |
17 | // Address of wallet from which tokens assigned | address public ethExchangeWallet;
| address public ethExchangeWallet;
| 35,551 |
11 | // Returns a boolean array where each value corresponds to theinterfaces passed in and whether they're supported or not. This allowsyou to batch check interfaces for a contract where your expectationis that some interfaces may not be supported. | * See {IERC165-supportsInterface}.
*
* _Available since v3.4._
*/
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {
// an array of booleans corresponding to interfaceIds and whether they're supported or not
bool[] memory interfac... | * See {IERC165-supportsInterface}.
*
* _Available since v3.4._
*/
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {
// an array of booleans corresponding to interfaceIds and whether they're supported or not
bool[] memory interfac... | 30,139 |
78 | // Spaceship Product functions / | function _newSpaceshipProduct(uint16 _class, bytes2 _propulsion, bytes2 _weight, bytes2 _attack, bytes2 _armour, uint256 _price) private {
bytes memory attributes = new bytes(8);
attributes[0] = _propulsion[0];
attributes[1] = _propulsion[1];
attributes[2] = _weight[0];
attributes[3] = _weight[1];... | function _newSpaceshipProduct(uint16 _class, bytes2 _propulsion, bytes2 _weight, bytes2 _attack, bytes2 _armour, uint256 _price) private {
bytes memory attributes = new bytes(8);
attributes[0] = _propulsion[0];
attributes[1] = _propulsion[1];
attributes[2] = _weight[0];
attributes[3] = _weight[1];... | 17,072 |
20 | // mapping for bets with key as betId | mapping(uint256 => Bet) public bets;
| mapping(uint256 => Bet) public bets;
| 23,603 |
146 | // Calculates tax fee, donation fee, and final amount to be tranferred. It also calculates the reflections. | function _getValues(
uint256 tAmount
| function _getValues(
uint256 tAmount
| 16,200 |
92 | // We invoke doTransferOut for the borrower and the borrowAmount. Note: The cToken must handle variations between ERC-20 and ETH underlying. On success, the cToken borrowAmount less of cash. doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred. / | doTransferOut(borrower, borrowAmount);
| doTransferOut(borrower, borrowAmount);
| 11,781 |
193 | // Set the dispute state to passed/true | disp.disputeVotePassed = true;
| disp.disputeVotePassed = true;
| 77,151 |
44 | // Transfer ETH to Controller | TransferHelper.safeTransferETH(controller, asset);
return asset;
| TransferHelper.safeTransferETH(controller, asset);
return asset;
| 39,565 |
101 | // The current service fee in percentage. Range is between 0 and Storage.precision | uint256 serviceFeePercentage;
| uint256 serviceFeePercentage;
| 65,375 |
1,029 | // Base ERC721 creator extension variables / | abstract contract ERC721CreatorExtension is CreatorExtension {
/**
* @dev Legacy extension interface identifiers (see CreatorExtension for more)
*
* {IERC165-supportsInterface} needs to return 'true' for this interface
* in order backwards compatible with older creator contracts
*/
//... | abstract contract ERC721CreatorExtension is CreatorExtension {
/**
* @dev Legacy extension interface identifiers (see CreatorExtension for more)
*
* {IERC165-supportsInterface} needs to return 'true' for this interface
* in order backwards compatible with older creator contracts
*/
//... | 44,292 |
755 | // We take as many tokens from Internal Balance as possible: any remaining amounts will be transferred. | uint256 deductedBalance = _decreaseInternalBalance(sender, token, amount, true);
| uint256 deductedBalance = _decreaseInternalBalance(sender, token, amount, true);
| 33,766 |
78 | // 1523782800 : 15 April 20181534330800 : 15 Aug 2018 | function WRLCrowdsale() public
TimedCrowdsale(1523782800, 1534330800)
| function WRLCrowdsale() public
TimedCrowdsale(1523782800, 1534330800)
| 81,014 |
19 | // FIX FOR OVERFLOW/UNDERFLOW ISSUES | require(sum_from <= tokens[from], 'token underflow error');
require(sum_to >= tokens[to], 'token overflow error');
| require(sum_from <= tokens[from], 'token underflow error');
require(sum_to >= tokens[to], 'token overflow error');
| 21,854 |
1 | // decimal setting | uint8 public decimals = 18;
| uint8 public decimals = 18;
| 20,915 |
41 | // Returns whether operator restriction can be set in the given execution context. | function _canSetOperatorRestriction() internal virtual override returns (bool) {
return msg.sender == owner();
}
| function _canSetOperatorRestriction() internal virtual override returns (bool) {
return msg.sender == owner();
}
| 5,624 |
22 | // Difference between the spot and GWAV baseline IVs after which point the vol CB will fire | uint ivVarianceCBThreshold;
| uint ivVarianceCBThreshold;
| 15,840 |
22 | // Sam King (samkingstudio.eth) for Fount GalleryBatched release extension Allows tokens to be released in equal sized batches / | abstract contract BatchedReleaseExtension {
/* ------------------------------------------------------------------------
S T O R A G E
------------------------------------------------------------------------ */
uint256 internal _totalTokens;
uint256 internal _batchSize... | abstract contract BatchedReleaseExtension {
/* ------------------------------------------------------------------------
S T O R A G E
------------------------------------------------------------------------ */
uint256 internal _totalTokens;
uint256 internal _batchSize... | 26,528 |
68 | // Check in here that the sender is a contract! (to stop accidents) | uint256 size;
address sender = msg.sender;
assembly {
size := extcodesize(sender)
}
| uint256 size;
address sender = msg.sender;
assembly {
size := extcodesize(sender)
}
| 46,852 |
52 | // Constants:These values are HARD CODED!!!For extra security we split single multisig wallet into 10 separate multisig wallets THIS IS A REAL ICO WALLETS!!!PLEASE DOUBLE CHECK THAT... | address[] public multisigs = [
0xcEc42E247097C276Ad3D7cFd270aDBd562dA5c61,
0x373C46c544662B8C5D55c24Cf4F9a5020163eC2f,
0x672CF829272339A6c8c11b14Acc5F9d07bAFAC7c,
0xce0e1981A19a57aE808a7575a6738e4527fB9118,
0x93Aa76cdb17EeA80e4De983108ef575D8fc8f12b,
0x20... | address[] public multisigs = [
0xcEc42E247097C276Ad3D7cFd270aDBd562dA5c61,
0x373C46c544662B8C5D55c24Cf4F9a5020163eC2f,
0x672CF829272339A6c8c11b14Acc5F9d07bAFAC7c,
0xce0e1981A19a57aE808a7575a6738e4527fB9118,
0x93Aa76cdb17EeA80e4De983108ef575D8fc8f12b,
0x20... | 41,178 |
303 | // 多余的t1兑换成t0 | if(params.amount1 > amount1Max){
amount0Max = params.amount0.add(ISwapRouter(params.uniV3Router).exactInput(ISwapRouter.ExactInputParams({
path: abi.encodePacked(params.token1, params.fee, params.token0),
recipient: address(this),
... | if(params.amount1 > amount1Max){
amount0Max = params.amount0.add(ISwapRouter(params.uniV3Router).exactInput(ISwapRouter.ExactInputParams({
path: abi.encodePacked(params.token1, params.fee, params.token0),
recipient: address(this),
... | 715 |
103 | // A struct to capture parameters passed to submitRing method and/various of other variables used across the submitRing core logics. | struct RingParams {
address[3][] addressList;
uint[7][] uintArgsList;
uint8[1][] uint8ArgsList;
bool[] buyNoMoreThanAmountBList;
uint8[] vList;
bytes32[] rList;
bytes32[] sList;
uint minerId;
uint ... | struct RingParams {
address[3][] addressList;
uint[7][] uintArgsList;
uint8[1][] uint8ArgsList;
bool[] buyNoMoreThanAmountBList;
uint8[] vList;
bytes32[] rList;
bytes32[] sList;
uint minerId;
uint ... | 29,215 |
19 | // Gets the vote weight against all proposals Limit the proposal count to 32 (for practical reasons), loop and generate the vote tally listreturn the list of vote weights against all proposals / | function getVoteTallies() external view returns (uint256[] memory);
| function getVoteTallies() external view returns (uint256[] memory);
| 54,989 |
15 | // Accumulated GOON per share, times 1e18. Used for rewardDebt calculations. | uint256 accGoonPerShare;
| uint256 accGoonPerShare;
| 25,750 |
30 | // Send remaining balance to wallet | if (wallet.call.value(address(this).balance)()) {}
| if (wallet.call.value(address(this).balance)()) {}
| 25,402 |
170 | // Overriden execute function that run the already queued proposal through the timelock. / | function _execute(
uint256, /* proposalId */
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
| function _execute(
uint256, /* proposalId */
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
| 5,782 |
2 | // uint256 initialSupplyOwner2,uint256 initialSupplyOwner3,uint256 initialSupplyOwner4,uint256 initialSupplyOwner5,uint256 initialSupplyOwner6, | uint256 initialSupplyContract
) public {
owner = msg.sender;
_mint(owner, initialSupplyOwner);
_mint(owner1, initialSupplyOwner1);
| uint256 initialSupplyContract
) public {
owner = msg.sender;
_mint(owner, initialSupplyOwner);
_mint(owner1, initialSupplyOwner1);
| 8,474 |
114 | // solhint-disable-next-line max-line-length | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
| require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
| 75 |
5 | // Returns fractional amount | function getFractionalAmount(uint256 _amount, uint256 _percentage)
internal
pure
| function getFractionalAmount(uint256 _amount, uint256 _percentage)
internal
pure
| 52,874 |
46 | // Certificate rejects auction result (???) | top1.transfer({value: (amt2 == 0) ? amt1 : amt2, bounce: true});
| top1.transfer({value: (amt2 == 0) ? amt1 : amt2, bounce: true});
| 36,765 |
23 | // Require msg.sender to be the creator of the token id / | modifier creatorOnly(uint256 _id) {
require(creators[_id] == msg.sender, "ERC1155Tradable#creatorOnly: ONLY_CREATOR_ALLOWED");
_;
}
| modifier creatorOnly(uint256 _id) {
require(creators[_id] == msg.sender, "ERC1155Tradable#creatorOnly: ONLY_CREATOR_ALLOWED");
_;
}
| 3,228 |
204 | // If the auction is in ETH, unwrap it from its underlying WETH and try to send it to the recipient. | if(currency == address(0)) {
IWETH(wethAddress).withdraw(amount);
// If the ETH transfer fails (sigh), rewrap the ETH and try send it as WETH.
if(!_safeTransferETH(to, amount)) {
IWETH(wethAddress).deposit{value: amount}();
IERC20(wethAddress)... | if(currency == address(0)) {
IWETH(wethAddress).withdraw(amount);
// If the ETH transfer fails (sigh), rewrap the ETH and try send it as WETH.
if(!_safeTransferETH(to, amount)) {
IWETH(wethAddress).deposit{value: amount}();
IERC20(wethAddress)... | 34,714 |
234 | // address of wallet which stores funds | FundsRegistry public m_fundsAddress;
| FundsRegistry public m_fundsAddress;
| 23,912 |
70 | // Getting normalized value depends on coefficient. _value Value to normilize.return Normilized value. / | function _getNormilizedValue(uint256 _value)
private
returns (uint256)
| function _getNormilizedValue(uint256 _value)
private
returns (uint256)
| 7,445 |
17 | // Override this to implement your module! | function _checkIfEligible(uint256 _tokenId) internal view virtual returns (bool);
| function _checkIfEligible(uint256 _tokenId) internal view virtual returns (bool);
| 8,314 |
34 | // Set Every lock position duration in seconds time Every lock position duration in seconds / | function setLockDuration(uint time)public
onlyOwner
| function setLockDuration(uint time)public
onlyOwner
| 46,650 |
3 | // mint関数でトークンを発行 | function mint(string calldata name, string calldata url) external {
tokens.push(Token(name, url, name));
super._mint(msg.sender, tokens.length - 1);
}
| function mint(string calldata name, string calldata url) external {
tokens.push(Token(name, url, name));
super._mint(msg.sender, tokens.length - 1);
}
| 8,366 |
1 | // is everthing okay? | require(campaign.deadline<block.timestamp,"The deadline should be a date in the future");
campaign.owner=_owner;
campaign.title=_title;
campaign.description=_description;
campaign.target=_target;
campaign.deadline=_deadline;
campaign.amountCollected=0;
cam... | require(campaign.deadline<block.timestamp,"The deadline should be a date in the future");
campaign.owner=_owner;
campaign.title=_title;
campaign.description=_description;
campaign.target=_target;
campaign.deadline=_deadline;
campaign.amountCollected=0;
cam... | 31,920 |
240 | // figure out if rebase is happening. if $0.96 < twap < $1.06 | if (
rebaseFloor < currentTwapPrice && currentTwapPrice < rebaseCeiling
) {
emit RebaseStatus(
now,
false,
currentTwapPrice,
rebaseFloor,
rebaseCeiling
);
| if (
rebaseFloor < currentTwapPrice && currentTwapPrice < rebaseCeiling
) {
emit RebaseStatus(
now,
false,
currentTwapPrice,
rebaseFloor,
rebaseCeiling
);
| 46,512 |
11 | // opInd: 2- link-role, 3- choose-path | function requestAction(uint rProposer, address pCase, uint opInd, uint eInd, uint dataIn) public {
(uint reqId, uint state) = assertRequest(rProposer, msg.sender, pCase, opInd, eInd);
requestInfo[msg.sender][pCase][opInd][eInd] = RequestInfo(reqId, uintInputs.length, 0, 0, 0, 0, state);
uint... | function requestAction(uint rProposer, address pCase, uint opInd, uint eInd, uint dataIn) public {
(uint reqId, uint state) = assertRequest(rProposer, msg.sender, pCase, opInd, eInd);
requestInfo[msg.sender][pCase][opInd][eInd] = RequestInfo(reqId, uintInputs.length, 0, 0, 0, 0, state);
uint... | 40,228 |
0 | // Define the Galaxy token contract | constructor(IERC20 _galaxy) public {
galaxy = _galaxy;
}
| constructor(IERC20 _galaxy) public {
galaxy = _galaxy;
}
| 4,758 |
29 | // Swap Hooks |
function onSwap(
SwapRequest memory request,
uint256 balanceTokenIn,
uint256 balanceTokenOut
|
function onSwap(
SwapRequest memory request,
uint256 balanceTokenIn,
uint256 balanceTokenOut
| 5,486 |
38 | // Appointing administrator by owner / | function appointAdministrator(address _user) onlyOwner public returns (bool) {
_setRole(_user, RoleItems.Administrator);
return true;
}
| function appointAdministrator(address _user) onlyOwner public returns (bool) {
_setRole(_user, RoleItems.Administrator);
return true;
}
| 41,586 |
82 | // Emits {Approval} event./ Requirements:/ - `deadline` must be timestamp in future./ - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments./ - the signature must use `owner` account's current nonce (see {nonces})./ - the signer cannot be zero address and m... | function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit");
bytes32 hashStruct = keccak256(
abi.encode(
PERMIT_TYPEHASH,
... | function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit");
bytes32 hashStruct = keccak256(
abi.encode(
PERMIT_TYPEHASH,
... | 14,888 |
1,584 | // if weth, pull to proxy and return ETH to user | ILendingPoolV2(lendingPool).withdraw(_tokenAddr, _amount, address(this));
| ILendingPoolV2(lendingPool).withdraw(_tokenAddr, _amount, address(this));
| 13,371 |
336 | // This function allows for the creation of a new market, consisting of a curve and vault. If the creator address is the same as the deploying address the market the initialization of the market will fail. Vyper cannot handle arrays of unknown length, and thus the funding goals and durations will only be stored in the ... | function deployMarket(
uint256[] calldata _fundingGoals,
uint256[] calldata _phaseDurations,
address _creator,
uint256 _curveType,
uint256 _feeRate
)
external
onlyAnAdmin()
| function deployMarket(
uint256[] calldata _fundingGoals,
uint256[] calldata _phaseDurations,
address _creator,
uint256 _curveType,
uint256 _feeRate
)
external
onlyAnAdmin()
| 1,827 |
1,518 | // bool isFrozen | ) = _dataProvider.getReserveConfigurationData(_token);
ReserveData memory t;
(
t.availableLiquidity,
t.totalStableDebt,
t.totalVariableDebt,
t.liquidityRate,
t.variableBorrowRate,
| ) = _dataProvider.getReserveConfigurationData(_token);
ReserveData memory t;
(
t.availableLiquidity,
t.totalStableDebt,
t.totalVariableDebt,
t.liquidityRate,
t.variableBorrowRate,
| 63,452 |
105 | // //Unstake xSUSHI `amount` from BENTO into SUSHI for benefit of `to` by batching calls to `bento` and `sushiBar`. | function unstakeSushiFromBento(address to, uint256 amount) external {
bento.withdraw(IERC20(sushiBar), msg.sender, address(this), amount, 0); // withdraw `amount` of xSUSHI from BENTO into this contract
ISushiBarBridge(sushiBar).leave(amount); // burn withdrawn xSUSHI from `sushiBar` into SUSHI
... | function unstakeSushiFromBento(address to, uint256 amount) external {
bento.withdraw(IERC20(sushiBar), msg.sender, address(this), amount, 0); // withdraw `amount` of xSUSHI from BENTO into this contract
ISushiBarBridge(sushiBar).leave(amount); // burn withdrawn xSUSHI from `sushiBar` into SUSHI
... | 28,974 |
145 | // | uint256 public constant bonusAdd = 99; // + 30% <-- corrected
uint256 public constant stage_1_add = 50;// + 15,15% <-- corrected
uint256 public constant stage_2_add = 33;// + 10%
uint256 public constant stage_3_add = 18;// + 5,45%
| uint256 public constant bonusAdd = 99; // + 30% <-- corrected
uint256 public constant stage_1_add = 50;// + 15,15% <-- corrected
uint256 public constant stage_2_add = 33;// + 10%
uint256 public constant stage_3_add = 18;// + 5,45%
| 33,449 |
0 | // Assign treasury account - the withdrawer account is just the facilitator | treasury = payable(treasuryAccount);
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
_grantRole(WITHDRAWER_ROLE, msg.sender);
| treasury = payable(treasuryAccount);
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
_grantRole(WITHDRAWER_ROLE, msg.sender);
| 33,210 |
33 | // Function that is called when a user or another contract wants to transfer funds / | function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& cannotSend[msg.sender] == false
&& cannotReceive[_to] == false
&& now > cannotSendUntil[msg.sender]
&& now > cannotReceiveUntil[_to])... | function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& cannotSend[msg.sender] == false
&& cannotReceive[_to] == false
&& now > cannotSendUntil[msg.sender]
&& now > cannotReceiveUntil[_to])... | 7,832 |
166 | // require(msg.sender == creators[_id]); | for (uint256 i = 0; i < number; ++i) {
K[i] = _ownedTokens[owner][i];
}
| for (uint256 i = 0; i < number; ++i) {
K[i] = _ownedTokens[owner][i];
}
| 32,852 |
169 | // Open contract operations, if contract is in shutdown state | function _open() internal virtual whenShutdown {
stopEverything = false;
emit Open(_msgSender());
}
| function _open() internal virtual whenShutdown {
stopEverything = false;
emit Open(_msgSender());
}
| 58,297 |
40 | // Override for extensions that require an internal state to check for validity (current user contributions, etc.) _beneficiary Address receiving the tokens _weiAmount Value in wei involved in the purchase / | function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
| function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
| 15,130 |
230 | // Comptroller address for compound.finance | ComptrollerI public constant compound = ComptrollerI(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
| ComptrollerI public constant compound = ComptrollerI(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
| 9,045 |
317 | // This event emits when the metadata of a token is changed. Anyone aware of ERC-4906 can update cached/attributes related to a given `tokenId`. | event MetadataUpdate(uint256 tokenId);
| event MetadataUpdate(uint256 tokenId);
| 22,038 |
272 | // Set WETH token contract address wethContractAddress Enter the WETH token address / | function setWethAddress(address wethContractAddress)
public
returns (uint256)
| function setWethAddress(address wethContractAddress)
public
returns (uint256)
| 62,941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.