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 |
|---|---|---|---|---|
342 | // apply the high fee only if the ratio between the effective weight and the external (target) weight is below the high fee upper bound | uint32 feeFactor;
if (uint256(_targetWeight).mul(PPM_RESOLUTION) < uint256(_targetExternalWeight).mul(HIGH_FEE_UPPER_BOUND)) {
feeFactor = highFeeFactor;
}
| uint32 feeFactor;
if (uint256(_targetWeight).mul(PPM_RESOLUTION) < uint256(_targetExternalWeight).mul(HIGH_FEE_UPPER_BOUND)) {
feeFactor = highFeeFactor;
}
| 10,159 |
38 | // ===Interactions=== make sure msg value >= amountReceive | uint256 amountReturn = msg.value.sub(amountReceive);
| uint256 amountReturn = msg.value.sub(amountReceive);
| 34,328 |
123 | // Typically there wouldn't be any amount here however, it is possible because of the emergencyExit | if(amount > underlying.balanceOf(address(this))){
| if(amount > underlying.balanceOf(address(this))){
| 46,883 |
95 | // Max harvest interval: 14 days | uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days;
| uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days;
| 14,496 |
155 | // Construct a new Compound reward token name ERC-20 name of this token symbol ERC-20 symbol of this token _cToken The address of cToken contract delegate The address of reward owner / | constructor(
string memory name,
string memory symbol,
ICToken _cToken,
address delegate
| constructor(
string memory name,
string memory symbol,
ICToken _cToken,
address delegate
| 83,249 |
141 | // the Metadata extension, but not including the Enumerable extension, which is available separately as | * {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => addr... | * {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => addr... | 2,229 |
173 | // Struct storing variables used in calculation in addLiquidity function to avoid stack too deep error | struct AddLiquidityInfo {
uint256 d0;
uint256 d1;
uint256 d2;
uint256 preciseA;
}
| struct AddLiquidityInfo {
uint256 d0;
uint256 d1;
uint256 d2;
uint256 preciseA;
}
| 19,597 |
45 | // Mutative | function addListing(
IERC721 _tokenAddress,
uint256 _id,
uint256 _price,
address _targetBuyer
)
public
| function addListing(
IERC721 _tokenAddress,
uint256 _id,
uint256 _price,
address _targetBuyer
)
public
| 30,649 |
45 | // Function to get the current stage number.return A uint256 specifing the current stage number. / | function getCurrentStage() public view returns(uint256) {
for(uint256 i=0; i < stages.length; i++) {
if(stages[i].closed == 0) {
return i;
}
}
revert();
}
| function getCurrentStage() public view returns(uint256) {
for(uint256 i=0; i < stages.length; i++) {
if(stages[i].closed == 0) {
return i;
}
}
revert();
}
| 49,721 |
27 | // 0x11: The script contains too many calls. | ScriptTooManyCalls,
| ScriptTooManyCalls,
| 23,234 |
3 | // 所有投票人 | mapping(address => Voter) public voters;
| mapping(address => Voter) public voters;
| 17,629 |
90 | // Liquidity/Liquidation Calculations // Local vars for avoiding stack-depth limits in calculating account liquidity. Note that `cTokenBalance` is the number of cTokens the account owns in the market, whereas `borrowBalance` is the amount of underlying that the account has borrowed. / | struct AccountLiquidityLocalVars {
uint sumCollateral;
uint sumBorrowPlusEffects;
uint cTokenBalance;
uint borrowBalance;
uint exchangeRateMantissa;
uint oraclePriceMantissa;
Exp collateralFactor;
Exp exchangeRate;
Exp oraclePrice;
Exp ... | struct AccountLiquidityLocalVars {
uint sumCollateral;
uint sumBorrowPlusEffects;
uint cTokenBalance;
uint borrowBalance;
uint exchangeRateMantissa;
uint oraclePriceMantissa;
Exp collateralFactor;
Exp exchangeRate;
Exp oraclePrice;
Exp ... | 9,099 |
176 | // Calculates all unclaimed reward data, finding both immediately unlocked rewards and those that have passed their time lock._account User address return amount Total units of unclaimed rewards return first Index of the first userReward that has unlocked return last Index of the last userReward that has unlocked | function unclaimedRewards(address _account)
external
view
returns (
uint256 amount,
uint256 first,
uint256 last
);
| function unclaimedRewards(address _account)
external
view
returns (
uint256 amount,
uint256 first,
uint256 last
);
| 18,639 |
2 | // / | function deposit(uint256 amount) public {
par.safeTransferFrom(msg.sender, address(this), amount);
_increaseStake(msg.sender, amount);
}
| function deposit(uint256 amount) public {
par.safeTransferFrom(msg.sender, address(this), amount);
_increaseStake(msg.sender, amount);
}
| 33,408 |
192 | // Nonces for permit / meta-transactions owner Token owner's addressreturn Next nonce / | function nonces(address owner) external view returns (uint256) {
return _nonces[owner];
}
| function nonces(address owner) external view returns (uint256) {
return _nonces[owner];
}
| 8,893 |
14 | // frames | [250, 150, 300, 200, 40, 10, 80, 70, 400, 100, 8400, maxChanceValue],
| [250, 150, 300, 200, 40, 10, 80, 70, 400, 100, 8400, maxChanceValue],
| 12,616 |
18 | // E18 for dollars, not E6 Assumes $1 FRAX and $1 USDC | return (mintedBalance()).mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION);
| return (mintedBalance()).mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION);
| 74,553 |
245 | // Network analytics contract address | address public immutable networkAnalyticsAddress;
| address public immutable networkAnalyticsAddress;
| 69,520 |
211 | // Calculates free collateral and will revert if it falls below zero. If the account context/ must be updated due to changes in debt settings, will update. Cannot check free collateral if assets/ need to be settled first./Cannot be called directly by users, used during various actions that require an FC check. Must be/... | function checkFreeCollateralAndRevert(address account) external {
AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
require(!accountContext.mustSettleAssets(), "Assets not settled");
(int256 ethDenominatedFC, bool updateContext) =
FreeColla... | function checkFreeCollateralAndRevert(address account) external {
AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
require(!accountContext.mustSettleAssets(), "Assets not settled");
(int256 ethDenominatedFC, bool updateContext) =
FreeColla... | 3,493 |
115 | // _name Name these shares/_symbol Symbol of shares/_decimal Amount of decimals sharePrice is denominated in, defined to be equal as deciamls in REFERENCE_ASSET contract/_creationTime Timestamp of share creation | function Shares(bytes32 _name, bytes8 _symbol, uint _decimal, uint _creationTime) {
name = _name;
symbol = _symbol;
decimal = _decimal;
creationTime = _creationTime;
}
| function Shares(bytes32 _name, bytes8 _symbol, uint _decimal, uint _creationTime) {
name = _name;
symbol = _symbol;
decimal = _decimal;
creationTime = _creationTime;
}
| 25,004 |
209 | // unrealized pnl after open position | SignedDecimal.signedDecimal unrealizedPnlAfter;
| SignedDecimal.signedDecimal unrealizedPnlAfter;
| 30,811 |
10 | // Sets a Chainlink price feed. It is not an error to set a feed twice. | * @dev Emits a {SetFeed} event.
*
* Requirements:
*
* - The caller must be the admin.
* - The number of decimals of the feed must be 8.
*
* @param asset The address of the Erc20 contract for which to get the price.
* @param feed The address of the Chainlink price feed contra... | * @dev Emits a {SetFeed} event.
*
* Requirements:
*
* - The caller must be the admin.
* - The number of decimals of the feed must be 8.
*
* @param asset The address of the Erc20 contract for which to get the price.
* @param feed The address of the Chainlink price feed contra... | 21,883 |
6 | // register first airline when contract is deployed | _registerAirline(deployingAccount);
| _registerAirline(deployingAccount);
| 48,551 |
34 | // Withdraw dividends | withdraw();
| withdraw();
| 78,060 |
134 | // Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._ / | function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
| function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
| 2,322 |
2 | // Processes a comment action referencing a given publication. This can only be called by the hub.profileId The token ID of the profile associated with the publication being published. profileIdPointed The profile ID of the profile associated the publication being referenced. pubIdPointed The publication ID of the publ... | function processComment(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed
| function processComment(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed
| 52,045 |
15 | // Reduce the max supply of tokens _newMaxSupply The new maximum supply of tokens available to mint / | function reduceMaxSupply(uint256 _newMaxSupply) external onlyOwner {
require(_newMaxSupply < MAX_SUPPLY, "NEW_MAX_SUPPLY_TOO_HIGH");
require(
_newMaxSupply >= totalSupply(),
"SUPPLY_LOWER_THAN_MINTED_TOKENS"
);
MAX_SUPPLY = _newMaxSupply;
}
| function reduceMaxSupply(uint256 _newMaxSupply) external onlyOwner {
require(_newMaxSupply < MAX_SUPPLY, "NEW_MAX_SUPPLY_TOO_HIGH");
require(
_newMaxSupply >= totalSupply(),
"SUPPLY_LOWER_THAN_MINTED_TOKENS"
);
MAX_SUPPLY = _newMaxSupply;
}
| 20,477 |
0 | // Pairs to market NFT _id => price / | struct Pair {
uint256 pair_id;
uint256 amount;
address collection;
uint256 token_id;
address creator;
address owner;
uint256 price;
bool bValid;
}
| struct Pair {
uint256 pair_id;
uint256 amount;
address collection;
uint256 token_id;
address creator;
address owner;
uint256 price;
bool bValid;
}
| 22,212 |
96 | // The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value | set._indexes[value] = set._values.length;
return true;
| set._indexes[value] = set._values.length;
return true;
| 25,406 |
17 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IBEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `_spender` cannot be the zero address. / | function increaseAllowance(address _spender, uint256 _addVal) external returns (bool) {
require(_spender != address(0), "approve to 0");
_approve(_msgSender(), _spender, _allowances[_msgSender()][_spender].add(_addVal));
return true;
}
| function increaseAllowance(address _spender, uint256 _addVal) external returns (bool) {
require(_spender != address(0), "approve to 0");
_approve(_msgSender(), _spender, _allowances[_msgSender()][_spender].add(_addVal));
return true;
}
| 48,297 |
57 | // This emits when the equipment&39;s attributes changed | event ChangeFashion(address indexed owner, uint256 tokenId, uint16 changeType);
| event ChangeFashion(address indexed owner, uint256 tokenId, uint16 changeType);
| 30,419 |
32 | // 目前正在二級市場交易的票數加 1。 | tradings++;
| tradings++;
| 30,252 |
48 | // Set the referrer, if no referrer has been set yet, and the player/ and referrer are not the same address. | referrerOf[newReferral] = referrer;
| referrerOf[newReferral] = referrer;
| 18,544 |
12 | // Updates royalties for the collection.receiver New address of the royalties receiver. feeNumerator Royalties amount %. / | function updateRoyalties(address receiver, uint96 feeNumerator) external;
| function updateRoyalties(address receiver, uint96 feeNumerator) external;
| 24,857 |
271 | // Locate Vault by hashing metadata about the product | mapping(uint256 => Vault) private Vaults;
| mapping(uint256 => Vault) private Vaults;
| 66,979 |
1 | // instantiate ERC20 & ERC721 contracts | qt = QuestCoinLoom(ERC20contract);
ql = QuestLootLoom(ERC721contract);
| qt = QuestCoinLoom(ERC20contract);
ql = QuestLootLoom(ERC721contract);
| 30,059 |
0 | // Set elixor contract address | elixor elixorContract=elixor(0x898bF39cd67658bd63577fB00A2A3571dAecbC53);
| elixor elixorContract=elixor(0x898bF39cd67658bd63577fB00A2A3571dAecbC53);
| 41,529 |
5 | // compute end of script / next location | location = startOffset + calldataLength;
require(location <= _script.length, ERROR_INVALID_LENGTH);
bool success;
assembly {
success := call(
sub(gas, 5000), // forward gas left - 5000
contractAddress, //... | location = startOffset + calldataLength;
require(location <= _script.length, ERROR_INVALID_LENGTH);
bool success;
assembly {
success := call(
sub(gas, 5000), // forward gas left - 5000
contractAddress, //... | 32,797 |
26 | // This will assign ownership, and also emit the Transfer event as per ERC721 draft | _transfer(0, _owner, newFishId);
return newFishId;
| _transfer(0, _owner, newFishId);
return newFishId;
| 35,047 |
4 | // Trade logic called when items are purchased by a user/_itemId id of the item to fetch/_numberOfItems number of the items purchased/the function will trade amount from buyer to seller , also any left over amount will be transfered to buyer itself | modifier trade (string memory _itemId, uint _numberOfItems) {
_;
uint totalAmount = _numberOfItems.mul(items[_itemId].price);
require(msg.value >= totalAmount, 'Amount less than required');
uint amountToRefund = msg.value.sub(items[_itemId].price);
if(amountToRefund>0){
msg.sender.transfer... | modifier trade (string memory _itemId, uint _numberOfItems) {
_;
uint totalAmount = _numberOfItems.mul(items[_itemId].price);
require(msg.value >= totalAmount, 'Amount less than required');
uint amountToRefund = msg.value.sub(items[_itemId].price);
if(amountToRefund>0){
msg.sender.transfer... | 5,274 |
86 | // Vesting users token by default parameters account address of the useramount the amount to be vested / | function setDefaultVestingToken(address account, uint256 amount) external onlyOwner returns(bool){
vestingContractAddress.setDefaultVesting(account, amount);
_transfer(msg.sender,address(vestingContractAddress), amount);
return true;
}
| function setDefaultVestingToken(address account, uint256 amount) external onlyOwner returns(bool){
vestingContractAddress.setDefaultVesting(account, amount);
_transfer(msg.sender,address(vestingContractAddress), amount);
return true;
}
| 30,719 |
218 | // It allows owner to set the fee (1000 == 10% of gained interest)_fee : fee amount where 100000 is 100%, max settable is 10% / | function setFee(uint256 _fee)
| function setFee(uint256 _fee)
| 39,726 |
13 | // Propose a new owner for a subscription.Only callable by the Subscription's ownersubscriptionId - ID of the subscriptionnewOwner - proposed new owner of the subscription | function proposeSubscriptionOwnerTransfer(uint64 subscriptionId, address newOwner) external;
| function proposeSubscriptionOwnerTransfer(uint64 subscriptionId, address newOwner) external;
| 15,894 |
437 | // Returns a slice of the original array, with the BPT token address removed. This mutates the original array, which should not be used anymore after calling this function.It's recommended to call this function such that the calling function either immediately returns or overwritesthe original array variable so it cann... | function dropBptFromTokens(IERC20[] memory registeredTokens) internal pure returns (IERC20[] memory tokens) {
assembly {
// An array's memory representation is a 32 byte word for the length followed by 32 byte words for
// each element, with the stack variable pointing to the length.... | function dropBptFromTokens(IERC20[] memory registeredTokens) internal pure returns (IERC20[] memory tokens) {
assembly {
// An array's memory representation is a 32 byte word for the length followed by 32 byte words for
// each element, with the stack variable pointing to the length.... | 29,333 |
146 | // calculate interest due for new bond_value uint return uint / | function payoutFor(uint256 _value) public view returns (uint256) {
return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e14);
}
| function payoutFor(uint256 _value) public view returns (uint256) {
return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e14);
}
| 17,742 |
6 | // Deposits an `amount` of asset as collateral to borrow other asset. _asset The asset address for collateral _asset = 0x0000000000000000000000000000000000000000 means to use ETH as collateral _amount The deposit amount / | function depositCollateral(address _asset, uint256 _amount) external payable virtual {
_deposit(_asset, _amount, msg.sender);
}
| function depositCollateral(address _asset, uint256 _amount) external payable virtual {
_deposit(_asset, _amount, msg.sender);
}
| 20,463 |
355 | // Get basic information about a particular market. marketIdThe market to queryreturn A Storage.Market struct with the current state of the market / | function getMarket(
uint256 marketId
)
public
view
returns (Storage.Market memory)
| function getMarket(
uint256 marketId
)
public
view
returns (Storage.Market memory)
| 35,731 |
0 | // ========== STATE VARIABLES ========== //Basis points or bps, set to 10 000 (equal to 1/10000). Used to express relative values (fees) | uint256 public constant BPS_DENOMINATOR = 10000;
| uint256 public constant BPS_DENOMINATOR = 10000;
| 71,778 |
394 | // Emitted when BRID+ rate is changed | event NewBirdPlusRate(uint oldBirdRate, uint newBirdRate);
| event NewBirdPlusRate(uint oldBirdRate, uint newBirdRate);
| 46,872 |
9 | // check to see if the events have fired async and havent been written yet | uint256 enabledCount = 0;
if(!t.enabled) {
for(uint256 x = 0; x < t.requiredEvents.length; x++) {
enabledCount += trustEventLog.firedEvents(t.requiredEvents[x]) ? 1 : 0;
}
| uint256 enabledCount = 0;
if(!t.enabled) {
for(uint256 x = 0; x < t.requiredEvents.length; x++) {
enabledCount += trustEventLog.firedEvents(t.requiredEvents[x]) ? 1 : 0;
}
| 13,869 |
47 | // restricts the permission to update the contract-registry_onlyOwnerCanUpdateRegistryindicates whether or not permission is restricted to owner only/ | function restrictRegistryUpdate(bool _onlyOwnerCanUpdateRegistry) public ownerOnly {
// change the permission to update the contract-registry
onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
}
| function restrictRegistryUpdate(bool _onlyOwnerCanUpdateRegistry) public ownerOnly {
// change the permission to update the contract-registry
onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
}
| 5,358 |
65 | // Returns hash to be signed by owners. data Data payload. / | function getTransactionHash(
bytes calldata data,
uint256 nonce
| function getTransactionHash(
bytes calldata data,
uint256 nonce
| 46,671 |
25 | // deposite 20% of minting price to contract for bonus. 10% for startup, 10% for the continue adding. | currentBonus += msg.value / 10;
payable(walletAddr).transfer(msg.value * 4 / 5);
for (uint256 i; i < quantity; i++) {
_safeMint(msg.sender, supply + i);
_generateInfo(supply + i, 1);
}
| currentBonus += msg.value / 10;
payable(walletAddr).transfer(msg.value * 4 / 5);
for (uint256 i; i < quantity; i++) {
_safeMint(msg.sender, supply + i);
_generateInfo(supply + i, 1);
}
| 9,119 |
22 | // Modern and gas efficient ERC20 + EIP-2612 implementation./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)/Modified from Uniswap (https:github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)/Do not manually set balances without updating totalSupply, as the sum of a... | abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed o... | abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed o... | 15,108 |
10 | // verifies that each storage slot is included in the storage trieusing the provided proofs. Accepts both existence and nonexistenceproofs. Reverts if a proof is invalid. Assumes the storageRootcomes from a valid Ethereum account. proofNodes concatenation of all nodes used in the trie proofs slots the list of slots bei... | function verifyMultiStorageSlot(
bytes calldata proofNodes,
bytes32[] calldata slots,
bytes calldata slotProofs,
bytes32 storageRoot
| function verifyMultiStorageSlot(
bytes calldata proofNodes,
bytes32[] calldata slots,
bytes calldata slotProofs,
bytes32 storageRoot
| 12,858 |
26 | // approve spender | function approve(uint256 amount) external {
require(msg.sender == caller, "Only from the caller");
IERC20(targetToken).approve(spender, amount);
}
| function approve(uint256 amount) external {
require(msg.sender == caller, "Only from the caller");
IERC20(targetToken).approve(spender, amount);
}
| 19,944 |
9 | // Revokes the SENTRY_ROLE from the specified address. / | function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {
_revokeRole(SENTRY_ROLE, _sentry);
}
| function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {
_revokeRole(SENTRY_ROLE, _sentry);
}
| 19,972 |
208 | // _baseURI | function _baseURI() internal view override returns (string memory) {
return m_BaseURI;
}
| function _baseURI() internal view override returns (string memory) {
return m_BaseURI;
}
| 50,247 |
102 | // Mapping of order filled amounts. filled[orderHash] = filledAmount | mapping(bytes32 => uint256) filled;
| mapping(bytes32 => uint256) filled;
| 37,720 |
54 | // Load the offer array pointer. | let offerArrPtr := mload(add(paramsPtr, OrderParameters_offer_head_offset))
| let offerArrPtr := mload(add(paramsPtr, OrderParameters_offer_head_offset))
| 16,593 |
31 | // Adds a list of trusted organizations. / | function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {
for (uint256 _i; _i < _list.length; _i++) {
_addTrustedOrganization(_list[_i]);
}
emit TrustedOrganizationsAdded(_list);
}
| function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {
for (uint256 _i; _i < _list.length; _i++) {
_addTrustedOrganization(_list[_i]);
}
emit TrustedOrganizationsAdded(_list);
}
| 23,994 |
41 | // Increase the amount of tokens that an owner allowed to a spender.approve should be called when allowed_[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.solEmits an Approval event. spender The address which ... | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
... | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
... | 34,823 |
104 | // do public presale | purchasePresale(buyer, value);
| purchasePresale(buyer, value);
| 32,057 |
5 | // Actually delete team member from a storage | storageDeleteTeamMember(teamId, uint(memberIndex));
| storageDeleteTeamMember(teamId, uint(memberIndex));
| 45,905 |
1 | // Withdraw funds. Solidity integer division may leave up to 1 wei in the contract afterwards. / | function withdraw() external noReentrant {
uint payout1 = address(this).balance * shares1 / 1000;
uint payout2 = address(this).balance * shares2 / 1000;
(bool success1,) = dev1.call{value: payout1}("");
| function withdraw() external noReentrant {
uint payout1 = address(this).balance * shares1 / 1000;
uint payout2 = address(this).balance * shares2 / 1000;
(bool success1,) = dev1.call{value: payout1}("");
| 7,222 |
163 | // setup all pricing model varlues/ _highRiskRiskyAssetThresholdPercentage URRp Utilization ration for pricing model when the assets is considered risky, %/ _lowRiskRiskyAssetThresholdPercentage URRp Utilization ration for pricing model when the assets is not considered risky, %/ _highRiskMinimumCostPercentage MC minim... | function setupPricingModel(
uint256 _highRiskRiskyAssetThresholdPercentage,
uint256 _lowRiskRiskyAssetThresholdPercentage,
uint256 _highRiskMinimumCostPercentage,
uint256 _lowRiskMinimumCostPercentage,
uint256 _minimumInsuranceCost,
uint256 _lowRiskMaxPercentPremiumCo... | function setupPricingModel(
uint256 _highRiskRiskyAssetThresholdPercentage,
uint256 _lowRiskRiskyAssetThresholdPercentage,
uint256 _highRiskMinimumCostPercentage,
uint256 _lowRiskMinimumCostPercentage,
uint256 _minimumInsuranceCost,
uint256 _lowRiskMaxPercentPremiumCo... | 24,368 |
124 | // Initialize the auction details, including null values. | auctions[tokenId] = Auction({
duration: duration,
reservePrice: reservePrice,
curatorFeePercent: curatorFeePercent,
curator: curator,
fundsRecipient: fundsRecipient,
amount: 0,
firstBidTime: 0,
bidder: address(0)
... | auctions[tokenId] = Auction({
duration: duration,
reservePrice: reservePrice,
curatorFeePercent: curatorFeePercent,
curator: curator,
fundsRecipient: fundsRecipient,
amount: 0,
firstBidTime: 0,
bidder: address(0)
... | 25,363 |
35 | // Swaps assetIn to assetOut using the stored stable swap or internal swap pool Will not swap if the asset passed in is the adopted asset _key - The hash of the canonical id and domain _assetIn - The address of the from asset _assetOut - The address of the to asset _amountOut - The amount of the _assetOut to swap _maxI... | function _swapAssetOut(
bytes32 _key,
address _assetIn,
address _assetOut,
uint256 _amountOut,
uint256 _maxIn
)
internal
returns (
bool,
| function _swapAssetOut(
bytes32 _key,
address _assetIn,
address _assetOut,
uint256 _amountOut,
uint256 _maxIn
)
internal
returns (
bool,
| 13,069 |
8 | // ========== CONSTRUCTOR========== //Constructor that initializes the most important configurations. | function initialize(
uint8 _excessConfirmations,
IWETH _weth
| function initialize(
uint8 _excessConfirmations,
IWETH _weth
| 49,758 |
112 | // Validation of an executed purchase. Observe state and use revert statements to undo rollback when validconditions are not met. beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase / | function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// solhint-disable-previous-line no-empty-blocks
}
| function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// solhint-disable-previous-line no-empty-blocks
}
| 8,118 |
4 | // riskScore_from[_requestId] = response; | riskScore = response;
| riskScore = response;
| 36,939 |
114 | // Take into account the fee so we can calculate the newPricePerShare | currentBalance = currentBalance.sub(totalVaultFee);
{
newPricePerShare = ShareMath.pricePerShare(
params.currentShareSupply,
currentBalance,
pendingAmount,
params.decimals
);
| currentBalance = currentBalance.sub(totalVaultFee);
{
newPricePerShare = ShareMath.pricePerShare(
params.currentShareSupply,
currentBalance,
pendingAmount,
params.decimals
);
| 59,262 |
0 | // Initial amount of reward within lock period. | uint16 public INITIAL_REWARD;
| uint16 public INITIAL_REWARD;
| 37,687 |
14 | // 销毁我(创建交易者)账户中指定个代币 -非ERC20标准 / | function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); ... | function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); ... | 43,652 |
6 | // called by our factory to create the needed initial query for a new MarketContract/marketContractAddress - address of the newly created MarketContract/oracleDataSource a data-source such as "URL", "WolframAlpha", "IPFS"/ see http:docs.oraclize.it/ethereum-quick-start-simple-query/oracleQuery see http:docs.oraclize.it... | function requestQuery(
address marketContractAddress,
string oracleDataSource,
string oracleQuery,
uint expiration
) external onlyFactory
| function requestQuery(
address marketContractAddress,
string oracleDataSource,
string oracleQuery,
uint expiration
) external onlyFactory
| 28,510 |
228 | // See {IERC165-supportsInterface} / | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| 22,608 |
164 | // 1.1 If txFee then short circuit - there is no cache | else if (_personal.hasTxFee) {
IPlatformIntegration(_personal.integrator).withdraw(
_recipient,
_personal.addr,
_quantity,
_quantity,
true
);
}
| else if (_personal.hasTxFee) {
IPlatformIntegration(_personal.integrator).withdraw(
_recipient,
_personal.addr,
_quantity,
_quantity,
true
);
}
| 15,796 |
49 | // ETH orders | mapping(bytes32 => uint256) public ethDeposits;
| mapping(bytes32 => uint256) public ethDeposits;
| 25,157 |
52 | // set the next withdrawal date/time & totals | nextWithdrawal = now + WITHDRAW_INTERVAL;
totalWithdrawn += amount;
| nextWithdrawal = now + WITHDRAW_INTERVAL;
totalWithdrawn += amount;
| 18,859 |
37 | // Allows DRP holders to vote on the poposed transfer of ownership. Weight is calculated directly, this is no problem because tokens cannot be transferred yet_approve indicates if the sender supports the proposal / | function vote(bool _approve) onlyShareholders beforeDeadline atStage(Stages.Proposed) {
// One vote per proposal
if (transferProposal.voted[msg.sender] >= transferProposal.deadline - transferProposalEnd) {
throw;
}
transferProposal.voted[msg.sender] = now;
uint2... | function vote(bool _approve) onlyShareholders beforeDeadline atStage(Stages.Proposed) {
// One vote per proposal
if (transferProposal.voted[msg.sender] >= transferProposal.deadline - transferProposalEnd) {
throw;
}
transferProposal.voted[msg.sender] = now;
uint2... | 26,890 |
74 | // Child contract can override to provide the condition in which the upgrade can begin. / | function canUpgrade() public view returns(bool) {
return true;
}
| function canUpgrade() public view returns(bool) {
return true;
}
| 18,601 |
438 | // Get the test NFT info | (
IBasePositionManager.Position memory pos_test,
IBasePositionManager.PoolInfo memory info_test
) = kyber_positions_mgr.positions(test_nft_id);
| (
IBasePositionManager.Position memory pos_test,
IBasePositionManager.PoolInfo memory info_test
) = kyber_positions_mgr.positions(test_nft_id);
| 30,553 |
11 | // Gets the total airdrop allocation of the specified address.account The address to query the balance of. return An uint256 representing the total allocation for this account (claimed or not)/ | function allocationOf(address account) public view returns (uint256) {
return _airdropData[account].allocation;
}
| function allocationOf(address account) public view returns (uint256) {
return _airdropData[account].allocation;
}
| 5,279 |
37 | // TODO: add _token to compatible backwards with ring and eth | function _buyProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer, uint _claimBounty)
internal
canBeStoredWith128Bits(_priceInToken)
| function _buyProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer, uint _claimBounty)
internal
canBeStoredWith128Bits(_priceInToken)
| 17,151 |
163 | // Revert with an ABI encoded Solidity error with a message/ that fits into 32-bytes.// An ABI encoded Solidity error has the following memory layout:// ------------+----------------------------------/byte range | value/ ------------+----------------------------------/0x00..0x04 |selector("Error(string)")/0x04..0x24 |s... | function revertWithMessage(length, message) {
mstore(0x00, "\x08\xc3\x79\xa0")
mstore(0x04, 0x20)
mstore(0x24, length)
mstore(0x44, message)
revert(0x00, 0x64)
}
| function revertWithMessage(length, message) {
mstore(0x00, "\x08\xc3\x79\xa0")
mstore(0x04, 0x20)
mstore(0x24, length)
mstore(0x44, message)
revert(0x00, 0x64)
}
| 35,603 |
57 | // The list of available bonuses. Filled by the constructor on contract initialization | AmountBonus[] public amountBonuses;
| AmountBonus[] public amountBonuses;
| 25,058 |
32 | // Divides value a by value b (result is rounded down). / | function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISE_UNIT).div(b);
}
| function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISE_UNIT).div(b);
}
| 16,593 |
13 | // mark the hash so that it can't be used multiple times | conversionHashes[hash] = true;
| conversionHashes[hash] = true;
| 23,330 |
16 | // For each passed path, fetches the synthetic time-weighted average tick as of secondsAgo,/ as well as the current tick. Then, synthetic ticks from all paths are subjected to a weighted/ average, where the weights are the fraction of the total input amount allocated to each path./ Returned synthetic ticks always repre... | function getSyntheticTicks(
bytes[] memory paths,
uint128[] memory amounts,
uint32 secondsAgo
| function getSyntheticTicks(
bytes[] memory paths,
uint128[] memory amounts,
uint32 secondsAgo
| 24,796 |
12 | // 2. Effects | closed = true;
emit channelClosed(owners[0], state.values[owners[0]], owners[1], state.values[owners[1]], state.id);
| closed = true;
emit channelClosed(owners[0], state.values[owners[0]], owners[1], state.values[owners[1]], state.id);
| 3,562 |
151 | // Creates a duplicate of the NVM_ProxyEOA located at 0x42....09. Uses the following "magic" prefix to deploy an exact copy of the code: PUSH1 0x0Dsize of this prefix in bytes CODESIZE SUB subtract prefix size from codesize DUP1 PUSH1 0x0D PUSH1 0x00 CODECOPYcopy everything after prefix into memory at pos 0 PUSH1 0x00 ... | address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(
hex"600D380380600D6000396000f3",
ovmEXTCODECOPY(
Lib_PredeployAddresses.PROXY_EOA,
0,
ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)
)
));
| address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(
hex"600D380380600D6000396000f3",
ovmEXTCODECOPY(
Lib_PredeployAddresses.PROXY_EOA,
0,
ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)
)
));
| 27,968 |
35 | // Sell profits to dai | if(getTokenBalance(BAS) > 0) {
swapTokenfortoken(BAS,DAI);
}
| if(getTokenBalance(BAS) > 0) {
swapTokenfortoken(BAS,DAI);
}
| 9,046 |
133 | // Adds Distribution. This function doesn't limit max gas consumption,/ so adding too many investors can cause it to reach the out-of-gas error./_beneficiary The address of distribution./_tokensAllotment The amounts of the tokens that belong to each investor. | function _addDistribution(
address _beneficiary,
DistributionType _distributionType,
uint256 _tokensAllotment
| function _addDistribution(
address _beneficiary,
DistributionType _distributionType,
uint256 _tokensAllotment
| 8,255 |
325 | // Close the current accrual period of the given currencies/currencies The concerned currencies | function closeAccrualPeriod(MonetaryTypesLib.Currency[] currencies)
public
onlyOperator
| function closeAccrualPeriod(MonetaryTypesLib.Currency[] currencies)
public
onlyOperator
| 16,753 |
193 | // Returns the shares unredeemed by the user given their DepositReceipt depositReceipt is the user's deposit receipt currentRound is the `round` stored on the vault assetPerShare is the price in asset per share decimals is the number of decimals the asset/shares usereturn unredeemedShares is the user's virtual balance ... | function getSharesFromReceipt(
Vault.DepositReceipt memory depositReceipt,
uint256 currentRound,
uint256 assetPerShare,
uint256 decimals
| function getSharesFromReceipt(
Vault.DepositReceipt memory depositReceipt,
uint256 currentRound,
uint256 assetPerShare,
uint256 decimals
| 17,321 |
88 | // jfi.mint(address(this),reward); | lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(reward);
| lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(reward);
| 21,064 |
110 | // clean out any eth leftover | TokenUtils.ETH_ADDR.withdrawTokens(_to, type(uint256).max);
_srcAddr.withdrawTokens(_to, type(uint256).max);
_destAddr.withdrawTokens(_to, type(uint256).max);
| TokenUtils.ETH_ADDR.withdrawTokens(_to, type(uint256).max);
_srcAddr.withdrawTokens(_to, type(uint256).max);
_destAddr.withdrawTokens(_to, type(uint256).max);
| 20,190 |
12 | // Returns the internal balance for a token i.e. the balance of the contract for that token/ | function internalBalance(Token memory token) internal view returns(uint256){
return token.token.balanceOf(address(this));
}
| function internalBalance(Token memory token) internal view returns(uint256){
return token.token.balanceOf(address(this));
}
| 731 |
35 | // Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burningOperator MUST be msg.senderWhen minting/creating tokens, the `_from` field MUST be set to `0x0`When burning/destroying tokens, the `_to` field MUST be set to `0x0`The total amoun... | event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
| event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
| 7,749 |
15 | // Looks up the local address corresponding to a domain/id pair. If the token is local, it will return the local address.If the token is non-local and no local representation exists, thiswill return `address(0)`. _domain the domain of the canonical version. _id the identifier of the canonical version in its domain.retu... | function getLocalAddress(uint32 _domain, address _id)
external
view
returns (address _token)
| function getLocalAddress(uint32 _domain, address _id)
external
view
returns (address _token)
| 14,647 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.