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 |
|---|---|---|---|---|
306 | // assume 18 decimal | function _getTokenPrice(address _asset)
internal
view
virtual
returns (int256)
| function _getTokenPrice(address _asset)
internal
view
virtual
returns (int256)
| 37,456 |
887 | // Creates a new proposal/_proposalDescHash Proposal description hash through IPFS having Short and long description of proposal/_categoryId This id tells under which the proposal is categorized i.e. Proposal's Objective | function createProposal(
string calldata _proposalTitle,
string calldata _proposalSD,
string calldata _proposalDescHash,
uint _categoryId
)
external;
| function createProposal(
string calldata _proposalTitle,
string calldata _proposalSD,
string calldata _proposalDescHash,
uint _categoryId
)
external;
| 2,277 |
87 | // Get the date format from the expiry timestamp. Convert a number of days into a human-readable date, courtesy of BokkyPooBah. Source: https:github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary/blob/master/contracts/BokkyPooBahsDateTimeLibrary.sol | string memory yearStr;
string memory monthStr;
string memory dayStr;
{
int256 __days = int256(expiry_ / 1 days);
int256 num1 = __days + 68569 + 2440588; // 2440588 = OFFSET19700101
int256 num2 = (4 * num1) / 146097;
num1 = num1 - (146097 *... | string memory yearStr;
string memory monthStr;
string memory dayStr;
{
int256 __days = int256(expiry_ / 1 days);
int256 num1 = __days + 68569 + 2440588; // 2440588 = OFFSET19700101
int256 num2 = (4 * num1) / 146097;
num1 = num1 - (146097 *... | 30,171 |
9 | // ---Category Management--- // Updates the prices on the oracle for all the tokens in a category. / | function updateCategoryPrices(uint256 categoryID) external {
address[] memory tokens = _categoryTokens[categoryID];
oracle.updatePrices(tokens);
}
| function updateCategoryPrices(uint256 categoryID) external {
address[] memory tokens = _categoryTokens[categoryID];
oracle.updatePrices(tokens);
}
| 26,942 |
85 | // Computes the unique id of a channel. Computes the unique id of a channel. fixedPart Part of the state that does not changereturn channelId / | function _getChannelId(FixedPart memory fixedPart) internal pure returns (bytes32 channelId) {
require(fixedPart.chainId == getChainID(), 'Incorrect chainId');
channelId = keccak256(
abi.encode(getChainID(), fixedPart.participants, fixedPart.channelNonce)
);
}
| function _getChannelId(FixedPart memory fixedPart) internal pure returns (bytes32 channelId) {
require(fixedPart.chainId == getChainID(), 'Incorrect chainId');
channelId = keccak256(
abi.encode(getChainID(), fixedPart.participants, fixedPart.channelNonce)
);
}
| 4,156 |
188 | // Underflow should never happen and is handled by SafeMath if it does. | usersEthBalance -= amount;
| usersEthBalance -= amount;
| 45,658 |
14 | // addresses of the staking contracts | address[] stakings,
| address[] stakings,
| 50,500 |
3 | // Transfers ERC20 and NFT to ownerOnly owner of contract can call this function / | function sweepTokensAndNFTs(
IERC20[] memory tokens,
NFT[] memory nfts,
address to
| function sweepTokensAndNFTs(
IERC20[] memory tokens,
NFT[] memory nfts,
address to
| 27,628 |
36 | // Convert values to a string | function toString(address value) external pure returns (string memory stringifiedValue);
function toString(bytes calldata value) external pure returns (string memory stringifiedValue);
function toString(bytes32 value) external pure returns (string memory stringifiedValue);
function toString(bool value) ... | function toString(address value) external pure returns (string memory stringifiedValue);
function toString(bytes calldata value) external pure returns (string memory stringifiedValue);
function toString(bytes32 value) external pure returns (string memory stringifiedValue);
function toString(bool value) ... | 13,949 |
21 | // a little number and a big number | uint public _MINIMUM_TARGET = 2**16;
uint public _MAXIMUM_TARGET = 2**234;
address public parentAddress; // for merge mining
uint public miningTarget;
bytes32 public challengeNumber; //generate a new one when a new reward is minted
uint public rewardEra;
uint public maxSupplyF... | uint public _MINIMUM_TARGET = 2**16;
uint public _MAXIMUM_TARGET = 2**234;
address public parentAddress; // for merge mining
uint public miningTarget;
bytes32 public challengeNumber; //generate a new one when a new reward is minted
uint public rewardEra;
uint public maxSupplyF... | 4,735 |
46 | // Remove the internal value, resetting the item on the quest | landItemOnQuest[tokenID] = 0;
| landItemOnQuest[tokenID] = 0;
| 22,998 |
158 | // Overrides STATICCALL. _gasLimit Amount of gas to be passed into this call. _address Address of the contract to call. _calldata Data to send along with the call.return _success Whether or not the call returned (rather than reverted).return _returndata Data returned by the call. / | function ovmSTATICCALL(
uint256 _gasLimit,
address _address,
bytes memory _calldata
)
override
public
fixedGasDiscount(80000)
returns (
bool _success,
| function ovmSTATICCALL(
uint256 _gasLimit,
address _address,
bytes memory _calldata
)
override
public
fixedGasDiscount(80000)
returns (
bool _success,
| 27,973 |
71 | // transfer amount | playersMap[msg.sender].balance = playersMap[msg.sender].balance.sub(
amount
);
dollar.transfer(msg.sender, amount);
| playersMap[msg.sender].balance = playersMap[msg.sender].balance.sub(
amount
);
dollar.transfer(msg.sender, amount);
| 32,169 |
55 | // We reduce the amount paid out to the seller (this effectively resets their payouts value to zero, since they're selling all of their tokens). This makes sure the seller isn't disadvantaged if they decide to buy back in. | payouts[msg.sender][colorid] -= payoutDiff;
| payouts[msg.sender][colorid] -= payoutDiff;
| 24,850 |
18 | // Keeps track whether the contract is paused. When that is true, most actions are blocked | bool public paused = false;
| bool public paused = false;
| 14,512 |
19 | // Helper that gets signed token0 delta/sqrtRatioAX96 A sqrt price/sqrtRatioBX96 Another sqrt price/liquidity The change in liquidity for which to compute the amount0 delta/ return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices | function getAmount0Delta(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
int128 liquidity
| function getAmount0Delta(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
int128 liquidity
| 17,773 |
8 | // the protocol thanks you for your donation | if (destination == address(0)) {
revert DestinationMissing();
}
| if (destination == address(0)) {
revert DestinationMissing();
}
| 5,208 |
703 | // Set the initial guess to the least power of two that is greater than or equal to sqrt(x). | uint256 xAux = uint256(x);
result = 1;
| uint256 xAux = uint256(x);
result = 1;
| 69,771 |
75 | // reset which owners have confirmed (none) - set our bitmap to 0. | pending.ownersDone = 0;
pending.index = m_multiOwnedPendingIndex.length++;
m_multiOwnedPendingIndex[pending.index] = _operation;
assertOperationIsConsistent(_operation);
| pending.ownersDone = 0;
pending.index = m_multiOwnedPendingIndex.length++;
m_multiOwnedPendingIndex[pending.index] = _operation;
assertOperationIsConsistent(_operation);
| 2,662 |
2 | // In the constructor make the address that deploys this contract the 1st retailer | constructor() public {
_addRetailer(msg.sender);
}
| constructor() public {
_addRetailer(msg.sender);
}
| 2,761 |
169 | // sell | setSellFees();
| setSellFees();
| 59,812 |
92 | // C2 = 25PRECISION - (F(PRECISION - G)2) / ((PRECISION - G)2 + LPRECISION) | uint256 private constant C2 = 20036905816356657810;
| uint256 private constant C2 = 20036905816356657810;
| 26,644 |
75 | // base price of zero indicates no sales, since base price of zero is not allowed when configuring an auction. | require(basePrice > 0, "Only latestPurchasePrice > 0");
| require(basePrice > 0, "Only latestPurchasePrice > 0");
| 37,784 |
24 | // 取得全體玩家陣列 | function getPlayers() public view returns (address payable[] memory) {
return players;
}
| function getPlayers() public view returns (address payable[] memory) {
return players;
}
| 21,901 |
18 | // prevent modify unstake token | uint256 lastStakeTime = tokenStorage[contractId][tokenId];
require(lastStakeTime > 0,"Staking: token not stake");
uint256 blocktime = block.timestamp;
uint256 totalRewards = (blocktime - lastStakeTime) * (vipList[contractAddr] ? VIP_RATE : NORMAL_RATE);
_mint(msg.sender, totalRew... | uint256 lastStakeTime = tokenStorage[contractId][tokenId];
require(lastStakeTime > 0,"Staking: token not stake");
uint256 blocktime = block.timestamp;
uint256 totalRewards = (blocktime - lastStakeTime) * (vipList[contractAddr] ? VIP_RATE : NORMAL_RATE);
_mint(msg.sender, totalRew... | 14,687 |
1,687 | // Starts a withdrawal request that allows the sponsor to withdraw `denominatedCollateralAmount`from their position denominated in the quote asset of the price identifier, following a DVM price resolution. The request will be pending for the duration of the DVM vote and can be cancelled at any time.Only one withdrawal ... | function requestWithdrawal(FixedPoint.Unsigned memory denominatedCollateralAmount)
public
isInitialized()
noPendingWithdrawal(msg.sender)
nonReentrant()
| function requestWithdrawal(FixedPoint.Unsigned memory denominatedCollateralAmount)
public
isInitialized()
noPendingWithdrawal(msg.sender)
nonReentrant()
| 21,994 |
178 | // sale holders | address[2] public fundRecipients = [
0xaDDfdc72494E29A131B1d4d6668184840f1Fc30C,
0xcD7BCAc7Ee5c18d8cC1374B62F09cf67e6432a08
];
uint256[] public receivePercentagePt = [7000]; //distribution in basis points
| address[2] public fundRecipients = [
0xaDDfdc72494E29A131B1d4d6668184840f1Fc30C,
0xcD7BCAc7Ee5c18d8cC1374B62F09cf67e6432a08
];
uint256[] public receivePercentagePt = [7000]; //distribution in basis points
| 53,379 |
16 | // A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends ofthe sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and | * FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
* the existing queue contents are left in storage.
*
* The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be
* used in storage, and not... | * FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
* the existing queue contents are left in storage.
*
* The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be
* used in storage, and not... | 50,597 |
4 | // tokenId is the id of the sbt return _signature associated to the sbt/ | function getSignature(uint256 tokenId) external view returns (string memory);
| function getSignature(uint256 tokenId) external view returns (string memory);
| 13,136 |
30 | // 512-bit multiply [prod1 prod0] = xy. Compute the product mod 2^256 and mod 2^256 - 1, then use use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 variables such that product = prod12^256 + prod0. | uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
| uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
| 36,134 |
119 | // withdraws tokens held by the anchor and sends them to an account can only be called by the owner_token ERC20 token contract address_toaccount to receive the new amount_amountamount to withdraw/ | function withdrawFromAnchor(IERC20Token _token, address _to, uint256 _amount) public ownerOnly {
anchor.withdrawTokens(_token, _to, _amount);
}
| function withdrawFromAnchor(IERC20Token _token, address _to, uint256 _amount) public ownerOnly {
anchor.withdrawTokens(_token, _to, _amount);
}
| 36,811 |
35 | // if have winners, all keys will gone. | if (jackpotWinners.length > 0 && jackpot > 0) {
unIssuedGoldKeys = 0; // clear un issued gold keys
| if (jackpotWinners.length > 0 && jackpot > 0) {
unIssuedGoldKeys = 0; // clear un issued gold keys
| 33,793 |
414 | // Ensure price is acceptable to buyer | if (maxPrice < price) revert NoLossCollateralAuction__takeCollateral_tooExpensive();
| if (maxPrice < price) revert NoLossCollateralAuction__takeCollateral_tooExpensive();
| 64,137 |
42 | // Transfer payment solium-disable-next-line security/no-tx-origin | transfer(safe, paymentToken, tx.origin, payment);
| transfer(safe, paymentToken, tx.origin, payment);
| 30,750 |
172 | // Returns the Vault information of the vault at `vaultId`, returns if non-existent. vaultId The id of the vault. / | function vaultInfo(uint256 vaultId) external returns (Vault memory);
| function vaultInfo(uint256 vaultId) external returns (Vault memory);
| 35,064 |
21 | // If token is mintable | bool public pauseMinting = false;
| bool public pauseMinting = false;
| 8,823 |
76 | // getAssetCount(): returns the number of assets held by this contract | function getAssetCount()
view
external
returns (uint256 count)
| function getAssetCount()
view
external
returns (uint256 count)
| 73,840 |
17 | // Team allocation percentages (F3D, P3D) + (Pot , Referrals, Community) Referrals / Community rewards are mathematically designed to come from the winner's share of the pot. | fees_[0] = F3Ddatasets.TeamFee(30,6); //50% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot
fees_[1] = F3Ddatasets.TeamFee(43,0); //43% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot
fees_[2] = F3Ddatasets.TeamFee(56,10); //20% to pot, 10% to aff, 2% to ... | fees_[0] = F3Ddatasets.TeamFee(30,6); //50% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot
fees_[1] = F3Ddatasets.TeamFee(43,0); //43% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot
fees_[2] = F3Ddatasets.TeamFee(56,10); //20% to pot, 10% to aff, 2% to ... | 3,437 |
4 | // ensures the player's turn | require(msg.sender == activePlayer, "It is not the player's turn");
| require(msg.sender == activePlayer, "It is not the player's turn");
| 35,714 |
51 | // Delegable enables users to delegate their account management to other users./ Delegable implements addDelegateBySignature, to add delegates using a signature instead of a separate transaction. | contract Delegable is IDelegable {
event Delegate(address indexed user, address indexed delegate, bool enabled);
// keccak256("Signature(address user,address delegate,uint256 nonce,uint256 deadline)");
bytes32 public immutable SIGNATURE_TYPEHASH = 0x0d077601844dd17f704bafff948229d27f33b57445915754dfe3d095f... | contract Delegable is IDelegable {
event Delegate(address indexed user, address indexed delegate, bool enabled);
// keccak256("Signature(address user,address delegate,uint256 nonce,uint256 deadline)");
bytes32 public immutable SIGNATURE_TYPEHASH = 0x0d077601844dd17f704bafff948229d27f33b57445915754dfe3d095f... | 45,451 |
81 | // Lets an account subscribe to a Tier_param SubscriotionAPIParam - the parameter that governs a subscription to be made.See struct `ISwylClub/SubscriptionAPIParam` for more details./ | function subsribe(SubscribeParam memory _param) external payable override nonReentrant onlyExistingClub(_param.clubId){
// check if _msgSender() has already subscribed
bool isSubscribed = checkIsSubsribed(_param.clubId, _msgSender());
require(!isSubscribed, "SUBSCRIBED");
// check i... | function subsribe(SubscribeParam memory _param) external payable override nonReentrant onlyExistingClub(_param.clubId){
// check if _msgSender() has already subscribed
bool isSubscribed = checkIsSubsribed(_param.clubId, _msgSender());
require(!isSubscribed, "SUBSCRIBED");
// check i... | 1,340 |
55 | // Pay LIQUIDATOR: TRV - dispute reward - sponsor reward If TRV > Collateral, then subtract rewards from collateral NOTE: `payToLiquidator` should never be below zero since we enforce that (sponsorDisputePct+disputerDisputePct) <= 1 in the constructor when these params are set. | rewards.payToLiquidator = tokenRedemptionValue
.sub(sponsorDisputeReward)
.sub(disputerDisputeReward);
| rewards.payToLiquidator = tokenRedemptionValue
.sub(sponsorDisputeReward)
.sub(disputerDisputeReward);
| 30,110 |
73 | // (proofPtr + 0x1a0) = noteData length (0x40 bytes) | mstore(add(proofPtr, 0x1a0), 0x40)
| mstore(add(proofPtr, 0x1a0), 0x40)
| 29,459 |
34 | // Transfer token for a specified address _to The address to transfer to. _value The amount to be transferred. / | 54,230 | ||
530 | // Similarly, the sum 'G' is used to calculate LQTY gains. During it's lifetime, each deposit d_t earns a LQTY gain of( d_t[G - G_t] )/P_t, where G_t is the depositor's snapshot of G taken at time t whenthe deposit was made.LQTY reward events occur are triggered by depositor operations (new deposit, topup, withdrawal),... | mapping (uint128 => mapping(uint128 => uint)) public epochToScaleToG;
| mapping (uint128 => mapping(uint128 => uint)) public epochToScaleToG;
| 68,814 |
10 | // SETTERS | function setNeverdieSignerAddress(address _to) public onlyOwner {
neverdieSigner = _to;
}
| function setNeverdieSignerAddress(address _to) public onlyOwner {
neverdieSigner = _to;
}
| 33,724 |
2 | // Get the total number of products in the contract | function getProductCount() external view returns(uint);
| function getProductCount() external view returns(uint);
| 42,517 |
95 | // Check whether the designated Lock exists or not.If exists, return true. / | function _isLockExists(uint256 id) private view returns (bool) {
return _locks[id].beneficiary != address(0);
}
| function _isLockExists(uint256 id) private view returns (bool) {
return _locks[id].beneficiary != address(0);
}
| 14,875 |
98 | // receive eth from uniswap swap | receive () external payable {}
function lockLiquidity(uint256 _lockableSupply) public {
// lockable supply is the token balance of this contract
require(_lockableSupply <= balanceOf(address(this)), "ERC20TransferLiquidityLock::lockLiquidity: lock amount higher than lockable balance");
r... | receive () external payable {}
function lockLiquidity(uint256 _lockableSupply) public {
// lockable supply is the token balance of this contract
require(_lockableSupply <= balanceOf(address(this)), "ERC20TransferLiquidityLock::lockLiquidity: lock amount higher than lockable balance");
r... | 10,121 |
96 | // start and end timestamps where investments are allowed (both inclusive) | uint256 public startTime;
uint256 public endTime;
| uint256 public startTime;
uint256 public endTime;
| 15,923 |
46 | // returns the larger of two values_val1 the first value _val2 the second value / | function max(uint256 _val1, uint256 _val2) internal pure returns (uint256) {
return _val1 > _val2 ? _val1 : _val2;
}
| function max(uint256 _val1, uint256 _val2) internal pure returns (uint256) {
return _val1 > _val2 ? _val1 : _val2;
}
| 85,018 |
324 | // called by flash loan | function _loanLogic(
bool deficit,
uint256 amount,
uint256 repayAmount
| function _loanLogic(
bool deficit,
uint256 amount,
uint256 repayAmount
| 9,966 |
119 | // Fetches the given transaction from the active fork and executes it on the current state | function transact(bytes32 txHash) external;
| function transact(bytes32 txHash) external;
| 12,944 |
5 | // If there is no base URI, return the token URI. | if (bytes(base).length == 0) {
return _tokenURI;
}
| if (bytes(base).length == 0) {
return _tokenURI;
}
| 2,126 |
6 | // Throws if called before the exercise window has expired/ | modifier canRefund() {
require( block.timestamp > expiryTime.add(windowSize), ERR_NOT_EXPIRED);
_;
}
| modifier canRefund() {
require( block.timestamp > expiryTime.add(windowSize), ERR_NOT_EXPIRED);
_;
}
| 45,390 |
231 | // Iterate over all assets in the Vault and allocate the the appropriate strategy | for (uint256 i = 0; i < allAssets.length; i++) {
IERC20 asset = IERC20(allAssets[i]);
uint256 assetBalance = asset.balanceOf(address(this));
| for (uint256 i = 0; i < allAssets.length; i++) {
IERC20 asset = IERC20(allAssets[i]);
uint256 assetBalance = asset.balanceOf(address(this));
| 23,712 |
83 | // Getter for the amount of `token` tokens already released to a payee. `token` should be the address of anIERC20 contract. / | function released(IERC20 token, address account) public view returns (uint256) {
return _erc20Released[token][account];
}
| function released(IERC20 token, address account) public view returns (uint256) {
return _erc20Released[token][account];
}
| 1,461 |
5 | // Max count of fees | uint256 maxFeesCount = 100;
| uint256 maxFeesCount = 100;
| 40,376 |
195 | // convert weth -> eth if needed | if (_exData.destAddr == KYBER_ETH_ADDRESS) {
TokenInterface(WETH_ADDRESS).withdraw(
TokenInterface(WETH_ADDRESS).balanceOf(address(this))
);
}
| if (_exData.destAddr == KYBER_ETH_ADDRESS) {
TokenInterface(WETH_ADDRESS).withdraw(
TokenInterface(WETH_ADDRESS).balanceOf(address(this))
);
}
| 18,024 |
210 | // Price per NFT | uint256 public price;
| uint256 public price;
| 10,438 |
39 | // require (_pid != 0, 'withdraw CAKE by unstaking'); | PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
uint treward = updatePool(_pid);
uint bal = IDefiERC20(address(pool.lpToken)).balanceOf(address(this));
uint256 pending = us... | PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
uint treward = updatePool(_pid);
uint bal = IDefiERC20(address(pool.lpToken)).balanceOf(address(this));
uint256 pending = us... | 8,198 |
2 | // fallback. Collect ether. | fallback () external payable {
}
| fallback () external payable {
}
| 29,381 |
7 | // Mint/Redeem Parameters Minimum amount that must be deposited to mint the RWA token Denoted in decimals of `collateral` | uint256 public minimumDepositAmount;
| uint256 public minimumDepositAmount;
| 32,374 |
174 | // The unit here is per half hour. Price decreases in a step function every half hour | uint256 public SALE_DURATION = 12;
uint256 public SALE_DURATION_SEC_PER_STEP = 1800; // 30 minutes
uint256 public DUTCH_AUCTION_START_FEE = 8 ether;
uint256 public DUTCH_AUCTION_END_FEE = 2 ether;
uint256 public EARLY_ACCESS_MINT_FEE = 0.5 ether;
uint256 public earlyAccessMinted;
uint256 ... | uint256 public SALE_DURATION = 12;
uint256 public SALE_DURATION_SEC_PER_STEP = 1800; // 30 minutes
uint256 public DUTCH_AUCTION_START_FEE = 8 ether;
uint256 public DUTCH_AUCTION_END_FEE = 2 ether;
uint256 public EARLY_ACCESS_MINT_FEE = 0.5 ether;
uint256 public earlyAccessMinted;
uint256 ... | 47,576 |
8 | // payment received by one of our channels | uint value = msg.value;
m_investmentsByPaymentChannel[paymentChannel] = m_investmentsByPaymentChannel[paymentChannel].add(value);
| uint value = msg.value;
m_investmentsByPaymentChannel[paymentChannel] = m_investmentsByPaymentChannel[paymentChannel].add(value);
| 13,773 |
102 | // Retrieves the stored address of the oracle contractreturn The address of the oracle contract / | function chainlinkOracleAddress()
internal
view
returns (address)
| function chainlinkOracleAddress()
internal
view
returns (address)
| 46,031 |
69 | // Sets the underlying implementation that fulfills the swap orders. Can only be called by the contract owner. implementation The new implementation. / | function setImplementation(IZapHandler implementation) external;
| function setImplementation(IZapHandler implementation) external;
| 49,194 |
7 | // Allows lenders to exercise their conversion right for given repayment period Can only be called by entitled lenders and during conversion grace period of given repayment period / | function exerciseConversion() external;
| function exerciseConversion() external;
| 38,483 |
141 | // Orders still active | if (!_makerOrder.active_)
return error('Maker order is inactive, Exchange.__ordersMatch_and_AreVaild__()');
if (!_takerOrder.active_)
return error('Taker order is inactive, Exchange.__ordersMatch_and_AreVaild__()');
| if (!_makerOrder.active_)
return error('Maker order is inactive, Exchange.__ordersMatch_and_AreVaild__()');
if (!_takerOrder.active_)
return error('Taker order is inactive, Exchange.__ordersMatch_and_AreVaild__()');
| 20,103 |
61 | // Distributes rewards among members / | function distributeRewards() internal {
LibFeeCalculator.Storage storage fcs = feeCalculatorStorage();
fcs.feesAccrued = fcs.feesAccrued.add(fcs.serviceFee);
}
| function distributeRewards() internal {
LibFeeCalculator.Storage storage fcs = feeCalculatorStorage();
fcs.feesAccrued = fcs.feesAccrued.add(fcs.serviceFee);
}
| 82,158 |
20 | // 初始化 | function construct() public {
maxPlayers = 2;
minMoney = 10000;
minPlayerToStart = 2;
timeoutBolcks = 100000;
singleBet = 5000;
}
| function construct() public {
maxPlayers = 2;
minMoney = 10000;
minPlayerToStart = 2;
timeoutBolcks = 100000;
singleBet = 5000;
}
| 13,624 |
26 | // Updates RGT distribution speeds for each pool given one `pool` and its `newBalance` (only accessible by the RariFundManager corresponding to `pool`). pool The pool whose balance should be refreshed. newBalance The new balance of the pool to be refreshed. / | function refreshDistributionSpeeds(RariPool pool, uint256 newBalance) external enabled {
require(msg.sender == address(rariFundManagers[uint8(pool)]), "Caller is not the fund manager corresponding to this pool.");
if (block.number >= distributionEndBlock) return;
storeRgtDistributedPerRft();... | function refreshDistributionSpeeds(RariPool pool, uint256 newBalance) external enabled {
require(msg.sender == address(rariFundManagers[uint8(pool)]), "Caller is not the fund manager corresponding to this pool.");
if (block.number >= distributionEndBlock) return;
storeRgtDistributedPerRft();... | 69,667 |
98 | // - Updates the variables of each pool in the array / | function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 54,162 |
123 | // Do the transfer | _send721Or20(tokenAddress, msg.sender, address(this), amounts[i]);
| _send721Or20(tokenAddress, msg.sender, address(this), amounts[i]);
| 63,577 |
248 | // Uses binarysearch to find the unclaimed lockups for a given account / | function _findFirstUnclaimed(uint64 _lastClaim, address _account)
internal
view
returns (uint256 first)
| function _findFirstUnclaimed(uint64 _lastClaim, address _account)
internal
view
returns (uint256 first)
| 23,322 |
20 | // If the allowance is max we do not reduce it Note - This means that max allowances will be more gas efficient by not requiring a sstore on 'transferFrom' | if (allowed != type(uint256).max) {
require(allowed >= amount, "ERC20: insufficient-allowance");
allowance[spender][msg.sender] = allowed - amount;
}
| if (allowed != type(uint256).max) {
require(allowed >= amount, "ERC20: insufficient-allowance");
allowance[spender][msg.sender] = allowed - amount;
}
| 16,180 |
9 | // Converts two uint256 representing a fraction to fixed point units,equivalent to multiplying dividend and divisor by 10^digits(). numerator numerator must be <= maxNewFixed() denominator denominator must be <= maxNewFixed() and denominator can't be 0Test newFixedFraction(1,0) failsTest newFixedFraction(0,1) returns 0... | function newFixedFraction(uint256 numerator, uint256 denominator)
internal
pure
returns (Fraction memory)
| function newFixedFraction(uint256 numerator, uint256 denominator)
internal
pure
returns (Fraction memory)
| 3,463 |
50 | // ETH to ETH exchange rate is fixed at 1 and has no rate oracle | rateOracle = AggregatorV2V3Interface(address(0));
rateDecimalPlaces = Constants.ETH_DECIMAL_PLACES;
| rateOracle = AggregatorV2V3Interface(address(0));
rateDecimalPlaces = Constants.ETH_DECIMAL_PLACES;
| 45,273 |
126 | // Fixed192x64Math library - Allows calculation of logarithmic and exponential functions/Alan Lu - <alan.lu@gnosis.pm>/Stefan George - <stefan@gnosis.pm> | library Fixed192x64Math {
enum EstimationMode { LowerBound, UpperBound, Midpoint }
/*
* Constants
*/
// This is equal to 1 in our calculations
uint public constant ONE = 0x10000000000000000;
uint public constant LN2 = 0xb17217f7d1cf79ac;
uint public constant LOG2_E = 0x171547652b82... | library Fixed192x64Math {
enum EstimationMode { LowerBound, UpperBound, Midpoint }
/*
* Constants
*/
// This is equal to 1 in our calculations
uint public constant ONE = 0x10000000000000000;
uint public constant LN2 = 0xb17217f7d1cf79ac;
uint public constant LOG2_E = 0x171547652b82... | 20,475 |
46 | // Manual sync enabled | bool public petSyncEnabled = true;
| bool public petSyncEnabled = true;
| 52,591 |
18 | // check conditions | require(msg.sender == address(blokkoToken), "Simple777Recipient: Invalid ERC777 token");
require(from == orders[_selectedOrderID].client, "Payment not made by client");
require(amount == _escrowAmount, "Escrow payment is not the same as the order amount");
require(orders[_selectedOrderID... | require(msg.sender == address(blokkoToken), "Simple777Recipient: Invalid ERC777 token");
require(from == orders[_selectedOrderID].client, "Payment not made by client");
require(amount == _escrowAmount, "Escrow payment is not the same as the order amount");
require(orders[_selectedOrderID... | 3,612 |
127 | // Making sure token owner is not sending to self | require(oldOwner != newOwner);
| require(oldOwner != newOwner);
| 6,460 |
5 | // Return existing oracle if present | address currentOracle = address(oracles[uniswapV3Factory][feeTier][baseToken]);
if (currentOracle != address(0)) return currentOracle;
| address currentOracle = address(oracles[uniswapV3Factory][feeTier][baseToken]);
if (currentOracle != address(0)) return currentOracle;
| 49,655 |
97 | // isCharityAddress[preferred] is required because the owner can freely remove a charity address without knowing if its a holder's preferred charity. | beneficiaries.charity = preferredCharityAddress[sender];
| beneficiaries.charity = preferredCharityAddress[sender];
| 30,806 |
2 | // ------------------------------------------------------------------------------------------------------------------/EVENTS | event AddedItem(uint indexed id, string name, uint price, uint quantity);
event RemovedItem(uint indexed id);
event ChangedPrice(uint indexed id, uint prevPrice, uint price);
event BoughtItem(uint indexed id, address indexed buyer, uint quantity);
event DeletedStore(address indexed addr, address ind... | event AddedItem(uint indexed id, string name, uint price, uint quantity);
event RemovedItem(uint indexed id);
event ChangedPrice(uint indexed id, uint prevPrice, uint price);
event BoughtItem(uint indexed id, address indexed buyer, uint quantity);
event DeletedStore(address indexed addr, address ind... | 48,939 |
72 | // Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. / | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_tot... | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_tot... | 3,776 |
155 | // return The current state of the escrow. / | function state() public view returns (State) {
return _state;
}
| function state() public view returns (State) {
return _state;
}
| 38,294 |
95 | // See {IERC721-transferFrom}. / | function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
| function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
| 954 |
51 | // ICO state. / | function InitialPriceEnable() onlyOwner() {
preTge = true;
}
| function InitialPriceEnable() onlyOwner() {
preTge = true;
}
| 20,144 |
44 | // Event emitted when comptroller is changed / | event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);
| event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);
| 13,551 |
12 | // See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
| function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
| 7,355 |
12 | // the date when purchased KP4R can be claimed //the date when KP4R can no longer be purchased from the contract //percentage bonus actived upon purchasing more than the trigger value. / Stats: | uint256 internal totalForSale;
uint256 internal totalSold;
uint256 internal totalSettled;
uint256 internal weiRaised;
mapping(address => uint256) internal balance;
event Purchase (address indexed buyer, uint256 amount, uint256 price);
| uint256 internal totalForSale;
uint256 internal totalSold;
uint256 internal totalSettled;
uint256 internal weiRaised;
mapping(address => uint256) internal balance;
event Purchase (address indexed buyer, uint256 amount, uint256 price);
| 32,137 |
95 | // Block number that interest was last accrued at / | uint256 public accrualBlockNumber;
| uint256 public accrualBlockNumber;
| 5,094 |
106 | // This account&39;s first time to summon, we do not need to clear summon numbers | accountsLastClearTime[msg.sender] = now;
| accountsLastClearTime[msg.sender] = now;
| 56,214 |
1 | // Functions for deployment and upgrade Contract is deployed via platform | constructor(address _newOwner) public {
tvm.accept();
_owner = _newOwner;
}
| constructor(address _newOwner) public {
tvm.accept();
_owner = _newOwner;
}
| 34,073 |
67 | // External interface of AccessControl declared to support ERC165 detection. / | interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
... | interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
... | 3,691 |
72 | // Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0/a The multiplicand/b The multiplier/denominator The divisor/ return result The 256-bit result/Credit to Remco Bloemen under MIT license https:xn--2-umb.com/21/muldiv | function mulDiv(
uint256 a,
uint256 b,
uint256 denominator
| function mulDiv(
uint256 a,
uint256 b,
uint256 denominator
| 22,934 |
7 | // Expansion has executed an ERC1155 reward action (alchemy) for specific token. / | event AlchemyItem(
address core,
address user,
address token,
uint256 id,
uint256 amount
| event AlchemyItem(
address core,
address user,
address token,
uint256 id,
uint256 amount
| 81,746 |
37 | // Returns total yield generated on vault in the underlying asset. / | function totalYield() public view virtual returns (uint256) {
return totalAssets() - totalSupply();
}
| function totalYield() public view virtual returns (uint256) {
return totalAssets() - totalSupply();
}
| 19,067 |
2 | // Required. User gets password after buying the book. | string password;
| string password;
| 36,713 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.