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 |
|---|---|---|---|---|
25 | // list of Vesting contracts, tokens for these contracts won't be slashed if unstaked by governance | mapping(address => bool) public vestingWhitelist;
| mapping(address => bool) public vestingWhitelist;
| 20,508 |
208 | // add contribution into the contributions array account Address being contributing weiAmount Amount of wei contributed tokenAmount Amount of token received / | function addBalance(address account, uint256 weiAmount, uint256 tokenAmount) public onlyOperator {
if (!_contributors[account].exists) {
_addresses.push(account);
_contributors[account].exists = true;
}
_contributors[account].weiAmount = _contributors[account].weiAmo... | function addBalance(address account, uint256 weiAmount, uint256 tokenAmount) public onlyOperator {
if (!_contributors[account].exists) {
_addresses.push(account);
_contributors[account].exists = true;
}
_contributors[account].weiAmount = _contributors[account].weiAmo... | 34,376 |
128 | // --- Observations --- | struct ConverterFeedObservation {
uint timestamp;
uint timeAdjustedPrice;
}
| struct ConverterFeedObservation {
uint timestamp;
uint timeAdjustedPrice;
}
| 37,583 |
7 | // Recreate Sheets on sister-chain exact as they exist on this chain | for(uint256 i = 0; i < numSheetFighters; i++) {
calls[i] = _buildData(sheetFighterIds[i]);
}
| for(uint256 i = 0; i < numSheetFighters; i++) {
calls[i] = _buildData(sheetFighterIds[i]);
}
| 33,809 |
69 | // Reverts to the previous address immediately/In case the new version has a fault, a quick way to fallback to the old contract/_id Id of contract | function revertToPreviousAddress(bytes4 _id) public onlyOwner {
if (!(entries[_id].exists)){
revert EntryNonExistentError(_id);
}
if (previousAddresses[_id] == address(0)){
revert EmptyPrevAddrError(_id);
}
address currentAddr = entries[_id].contractA... | function revertToPreviousAddress(bytes4 _id) public onlyOwner {
if (!(entries[_id].exists)){
revert EntryNonExistentError(_id);
}
if (previousAddresses[_id] == address(0)){
revert EmptyPrevAddrError(_id);
}
address currentAddr = entries[_id].contractA... | 40,323 |
167 | // To call to go to a new period. TRUSTED. / | function passPeriod() public {
require(now-lastPeriodChange >= timePerPeriod[uint8(period)]);
if (period == Period.Activation) {
rnBlock = block.number + 1;
rng.requestRN(rnBlock);
period = Period.Draw;
} else if (period == Period.Draw) {
rand... | function passPeriod() public {
require(now-lastPeriodChange >= timePerPeriod[uint8(period)]);
if (period == Period.Activation) {
rnBlock = block.number + 1;
rng.requestRN(rnBlock);
period = Period.Draw;
} else if (period == Period.Draw) {
rand... | 49,040 |
16 | // storing the token amount in the smart-contract | token.transferFrom(msg.sender, address(this), _amount);
| token.transferFrom(msg.sender, address(this), _amount);
| 477 |
55 | // repay allows user to return some of the debt of the specified token the repay does not collect any fees and is not validating the user's total collateral to debt position. | function repay(address _token, uint256 _amount) public nonReentrant returns (uint256) {
return _repay(_token, _amount);
}
| function repay(address _token, uint256 _amount) public nonReentrant returns (uint256) {
return _repay(_token, _amount);
}
| 3,881 |
161 | // Remove the player from the pending bets queue by setting the address to 0x0 | pendingBetsQueue[index] = address(0x0);
| pendingBetsQueue[index] = address(0x0);
| 57,864 |
0 | // Used to show data about the finished game, it shows the choice of winner-loser and the address of the winner | event Winner(
string loserAnnouncement,
string winnerAnnouncement,
address winner
);
| event Winner(
string loserAnnouncement,
string winnerAnnouncement,
address winner
);
| 39,450 |
36 | // A mapping keeping track of which ChainFaceIDs are currently contained within the contract./We cannot rely on depositedChainFacesArray as the source of truth as to which ChainFaces are/deposited in the contract. This is because burnTokensAndWithdrawChainFaces() allows a user to /withdraw a ChainFace "out of order" of... | mapping (uint256 => bool) private chainFaceIsDepositedInContract;
| mapping (uint256 => bool) private chainFaceIsDepositedInContract;
| 16,140 |
25 | // withdraw from stakedao and curvePool | IStakeDao sdecrv = IStakeDao(sdecrvAddress);
sdecrv.withdraw(sdecrvToWithdraw);
uint256 ecrvBalance = sdecrv.token().balanceOf(address(this));
uint256 ethReceived = curvePool.remove_liquidity_one_coin(ecrvBalance, 0, minEth);
| IStakeDao sdecrv = IStakeDao(sdecrvAddress);
sdecrv.withdraw(sdecrvToWithdraw);
uint256 ecrvBalance = sdecrv.token().balanceOf(address(this));
uint256 ethReceived = curvePool.remove_liquidity_one_coin(ecrvBalance, 0, minEth);
| 57,209 |
184 | // aura prefix | string[] private element = [
"Angelic",
"Dark",
"Demonic",
"Earth",
"Electric",
"Fire",
"Ice",
"Radiant",
| string[] private element = [
"Angelic",
"Dark",
"Demonic",
"Earth",
"Electric",
"Fire",
"Ice",
"Radiant",
| 38,504 |
127 | // VaultManagerParameters / | contract VaultManagerParameters is Auth {
// determines the minimum percentage of COL token part in collateral, 0 decimals
mapping(address => uint) public minColPercent;
// determines the maximum percentage of COL token part in collateral, 0 decimals
mapping(address => uint) public maxColPercent;
... | contract VaultManagerParameters is Auth {
// determines the minimum percentage of COL token part in collateral, 0 decimals
mapping(address => uint) public minColPercent;
// determines the maximum percentage of COL token part in collateral, 0 decimals
mapping(address => uint) public maxColPercent;
... | 44,902 |
308 | // Will | USDC.transfer(
0x31920DF2b31B5f7ecf65BDb2c497DE31d299d472,
yearlyToMonthlyUSD(84000, 1)
);
| USDC.transfer(
0x31920DF2b31B5f7ecf65BDb2c497DE31d299d472,
yearlyToMonthlyUSD(84000, 1)
);
| 36,812 |
7 | // Mapping for stroing interface ids of supported interfaces | mapping(bytes4 => bool) private _supportedInterfaces;
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
| mapping(bytes4 => bool) private _supportedInterfaces;
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
| 14,078 |
3 | // vaultId of vault to settle | uint256 vaultId;
| uint256 vaultId;
| 14,454 |
28 | // Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./ | function transfer(address recipient, uint256 amount) external returns(bool);
| function transfer(address recipient, uint256 amount) external returns(bool);
| 38,863 |
11 | // Check _fee, _adminFee and set fee parameters | require(_fee < SwapUtils.MAX_SWAP_FEE, "_fee exceeds maximum");
require(_adminFee < SwapUtils.MAX_ADMIN_FEE, "_adminFee exceeds maximum");
| require(_fee < SwapUtils.MAX_SWAP_FEE, "_fee exceeds maximum");
require(_adminFee < SwapUtils.MAX_ADMIN_FEE, "_adminFee exceeds maximum");
| 3,610 |
58 | // return return token sizes | function getTokenSizes(uint256 _tokenId) public exists(_tokenId) view returns (uint256, uint256) {
Token memory token = allMinedTokens[allTokensIndex[_tokenId]];
return (token.sizeA, token.sizeB);
}
| function getTokenSizes(uint256 _tokenId) public exists(_tokenId) view returns (uint256, uint256) {
Token memory token = allMinedTokens[allTokensIndex[_tokenId]];
return (token.sizeA, token.sizeB);
}
| 36,633 |
129 | // Checks & Calculations Determine the liquidation amount in collateral units (i.e. how much debt is liquidator going to repay) | uint256 _liquidationAmountInCollateralUnits = ((_totalBorrow.toAmount(_sharesToLiquidate, false) *
_exchangeRate) / EXCHANGE_PRECISION);
| uint256 _liquidationAmountInCollateralUnits = ((_totalBorrow.toAmount(_sharesToLiquidate, false) *
_exchangeRate) / EXCHANGE_PRECISION);
| 24,538 |
400 | // Return a validator's linked nodes.Requirements:- Validator ID must exist. / | function getValidatorNodeIndexes(uint validatorId) external view returns (uint[] memory) {
ValidatorService validatorService = ValidatorService(contractManager.getValidatorService());
require(validatorService.validatorExists(validatorId), "Validator ID does not exist");
return validatorToNod... | function getValidatorNodeIndexes(uint validatorId) external view returns (uint[] memory) {
ValidatorService validatorService = ValidatorService(contractManager.getValidatorService());
require(validatorService.validatorExists(validatorId), "Validator ID does not exist");
return validatorToNod... | 69,319 |
6 | // throw | require (msg.sender == owner);
_;
| require (msg.sender == owner);
_;
| 7,969 |
66 | // 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) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
| function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
| 21,793 |
246 | // Pending administrator for this contract/ | address public pendingAdmin;
| address public pendingAdmin;
| 10,764 |
71 | // bmul overflow | uint c1 = c0 + (b / 2);
require(c1 >= c0, "ERR_DIV_INTERNAL");
| uint c1 = c0 + (b / 2);
require(c1 >= c0, "ERR_DIV_INTERNAL");
| 34,512 |
22 | // Returns the address of the owner of the NFT. NFTs assigned to the zero address areconsidered invalid, and queries about them do throw. _tokenId The identifier for an NFT.return _owner Address of _tokenId owner. / | function ownerOf(uint256 _tokenId)
external
view
override
returns (address _owner)
| function ownerOf(uint256 _tokenId)
external
view
override
returns (address _owner)
| 18,989 |
7 | // Denominator for transaction fee calculation; 100 = 1% | uint256 txFeeDenominator = 100;
| uint256 txFeeDenominator = 100;
| 9,239 |
29 | // adds an ETH deposit, mints an ERC721 token, and transfersits ownership to another account account that will be the owner of this deposit (can withdraw) initialPenaltyPercent initial penalty percent for deposit commitPeriod period during which a withdrawal results in penalty and no bonusreturn ERC721 tokenId of this ... | function depositETHFor(
address account,
uint initialPenaltyPercent,
uint commitPeriod
) external payable
validCommitment(initialPenaltyPercent, commitPeriod)
returns (uint tokenId)
| function depositETHFor(
address account,
uint initialPenaltyPercent,
uint commitPeriod
) external payable
validCommitment(initialPenaltyPercent, commitPeriod)
returns (uint tokenId)
| 24,322 |
193 | // Encodes some bytes to the base64 representation | function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
ass... | function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
ass... | 76,367 |
0 | // bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; | * function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
| * function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
| 1,414 |
479 | // Calculate DSD cost | Decimal.D256 memory ethSpent =
Decimal.D256({
value: (startGas - gasleft() + 41000).mul(uint256(fastGasPrice)) // approximate used gas for tx
});
| Decimal.D256 memory ethSpent =
Decimal.D256({
value: (startGas - gasleft() + 41000).mul(uint256(fastGasPrice)) // approximate used gas for tx
});
| 30,801 |
400 | // to get the contract staked by a staker _stakerAddress is the address of the staker _stakerIndex is the index of stakerreturn the address of staked contract / | function getStakerStakedContractByIndex(
address _stakerAddress,
uint _stakerIndex
)
public
view
returns (address stakedContractAddress)
| function getStakerStakedContractByIndex(
address _stakerAddress,
uint _stakerIndex
)
public
view
returns (address stakedContractAddress)
| 54,632 |
45 | // Function that returns the (dynamic) price of selling a single token. | function sellPrice() public constant returns (uint) {
var eth = getEtherForTokens(1 finney);
var fee = div(eth, 10);
return eth - fee;
}
| function sellPrice() public constant returns (uint) {
var eth = getEtherForTokens(1 finney);
var fee = div(eth, 10);
return eth - fee;
}
| 33,629 |
30 | // Check that this grant doesn't exceed the total amount of tokens currently available for vesting. | require(totalVesting.add(_amount) <= greed.balanceOf(address(this)));
revocables[_beneficiary] = _revocable;
durations[_beneficiary] = _duration;
cliffs[_beneficiary] = _start.add(_cliff);
starts[_beneficiary] = _start;
amounts[_beneficiary] = _amount;
totalVesting = totalVesting.add(_amount);... | require(totalVesting.add(_amount) <= greed.balanceOf(address(this)));
revocables[_beneficiary] = _revocable;
durations[_beneficiary] = _duration;
cliffs[_beneficiary] = _start.add(_cliff);
starts[_beneficiary] = _start;
amounts[_beneficiary] = _amount;
totalVesting = totalVesting.add(_amount);... | 19,405 |
71 | // ๅฆๆๅฅๅฑ>0 ๅ้ๅฅๅฑ | if (_reward > 0) _safeTransfer(tokens[i], account, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
| if (_reward > 0) _safeTransfer(tokens[i], account, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
| 28,232 |
5 | // ๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ช ร4 | require(total <= 4, "only 4 tiles");
| require(total <= 4, "only 4 tiles");
| 4,383 |
182 | // Establish path from Dai to Ether. | (address[] memory path, uint256[] memory amounts) = _createPathAndAmounts(
address(_DAI), _WETH, false
);
| (address[] memory path, uint256[] memory amounts) = _createPathAndAmounts(
address(_DAI), _WETH, false
);
| 78,223 |
118 | // LooksRare marketplace transfer manager. | address public looksrare = 0xf42aa99F011A1fA7CDA90E5E98b277E306BcA83e;
| address public looksrare = 0xf42aa99F011A1fA7CDA90E5E98b277E306BcA83e;
| 6,566 |
5 | // when we have enough participants | if (player_count == required_number_players) {
bet_blocknumber=block.number;
}
| if (player_count == required_number_players) {
bet_blocknumber=block.number;
}
| 12,086 |
58 | // player vs player optimized seeds ante up slots | startingOptions[0]=0;
startingOptions[1]=0;
startingOptions[2]=0;
startingOptions[3]=precision*(random(2)); // between 0 and 1
startingOptions[4]=precision*(random(3)+1); // between 1 and 3
startingOptions[5]=precision*(random(2)+3); // between 3 and 4
startingOptions[6]=precision*(random(3)... | startingOptions[0]=0;
startingOptions[1]=0;
startingOptions[2]=0;
startingOptions[3]=precision*(random(2)); // between 0 and 1
startingOptions[4]=precision*(random(3)+1); // between 1 and 3
startingOptions[5]=precision*(random(2)+3); // between 3 and 4
startingOptions[6]=precision*(random(3)... | 51,953 |
34 | // Calculates the common logarithm of x.//First checks if x is an exact power of ten and it stops if yes. If it's not, calculates the common/ logarithm based on the insight that log10(x) = log2(x) / log2(10).// Requirements:/ - All from "log2".// Caveats:/ - All from "log2".//x The unsigned 60.18-decimal fixed-point nu... | function log10(uint256 x) internal pure returns (uint256 result) {
require(x >= SCALE);
// Note that the "mul" in this block is the assembly mul operation, not the "mul" function defined in this contract.
// prettier-ignore
assembly {
switch x
case 1 { result... | function log10(uint256 x) internal pure returns (uint256 result) {
require(x >= SCALE);
// Note that the "mul" in this block is the assembly mul operation, not the "mul" function defined in this contract.
// prettier-ignore
assembly {
switch x
case 1 { result... | 14,698 |
111 | // This internal minting function allows inheriting contracts/ to mint tokens in the way they wish./account the address which will receive the token./amount the amount of token which they will receive/This function is virtual so that it can be overridden, if you/are reviewing this contract for security you should ensur... | function _mint(address account, uint256 amount) internal virtual {
// Add tokens to the account
balanceOf[account] = balanceOf[account] + amount;
// Emit an event to track the minting
emit Transfer(address(0), account, amount);
}
| function _mint(address account, uint256 amount) internal virtual {
// Add tokens to the account
balanceOf[account] = balanceOf[account] + amount;
// Emit an event to track the minting
emit Transfer(address(0), account, amount);
}
| 25,590 |
37 | // Method for setting royalty/_tokenId TokenId/_royalty Royalty | function registerRoyalty(
address _nftAddress,
uint256 _tokenId,
uint8 _royalty
| function registerRoyalty(
address _nftAddress,
uint256 _tokenId,
uint8 _royalty
| 49,420 |
73 | // _resetTokenPrice// Internal function to set token price to 0 for a given contract. _originContract address of ERC721 contract. _tokenId uin256 id of the token. / | function _resetTokenPrice(address _originContract, uint256 _tokenId)
internal
| function _resetTokenPrice(address _originContract, uint256 _tokenId)
internal
| 2,504 |
120 | // Returns the count of all existing NFTokens. / | function totalSupply()
external
view
returns (uint256)
| function totalSupply()
external
view
returns (uint256)
| 22,049 |
103 | // return the current state of the escrow. / | function state() public view returns (State) {
return _state;
}
| function state() public view returns (State) {
return _state;
}
| 33,402 |
53 | // Claim all bought tokens. Available tokens will be sent to transaction sender address if unlocked / | function claim() public whenNotPaused {
claimFor(msg.sender);
}
| function claim() public whenNotPaused {
claimFor(msg.sender);
}
| 38,388 |
6 | // Execute a queued tx | if (isActionQueued(_vault, stack.signHash)){
require(relayer[_vault].queuedTransactions[stack.signHash] < block.timestamp, "KR: Time not expired");
(stack.success, stack.returnData) = address(this).call(_data);
require(stack.success, "KR: Internal call failed");
i... | if (isActionQueued(_vault, stack.signHash)){
require(relayer[_vault].queuedTransactions[stack.signHash] < block.timestamp, "KR: Time not expired");
(stack.success, stack.returnData) = address(this).call(_data);
require(stack.success, "KR: Internal call failed");
i... | 27,103 |
144 | // initializes bond parameters_vestingTermSeconds uint_vestingTerm uint_discount uint_maxPayout uint_fee uint_maxDebt uint_initialDebt uint_soldBondsLimitUsd uint_useWhitelist bool_useCircuitBreaker bool_prematureReturnRate uint_limitBondCount uint / | function initializeBondTerms(
uint _vestingTermSeconds,
uint _vestingTerm,
uint _discount,
uint _maxPayout,
uint _fee,
uint _maxDebt,
uint _initialDebt,
uint _soldBondsLimitUsd,
bool _useWhitelist,
| function initializeBondTerms(
uint _vestingTermSeconds,
uint _vestingTerm,
uint _discount,
uint _maxPayout,
uint _fee,
uint _maxDebt,
uint _initialDebt,
uint _soldBondsLimitUsd,
bool _useWhitelist,
| 15,208 |
31 | // Harvest proceeds for transaction sender to `to`./pid The index of the pool. See `poolInfo`./to Receiver of the rewards. | function harvest(uint256 pid, address to) external {
require(!nonReentrant, "genericFarmV2::nonReentrant - try again");
nonReentrant = true;
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][msg.sender];
int256 accumulatedRewardTokens = int256(use... | function harvest(uint256 pid, address to) external {
require(!nonReentrant, "genericFarmV2::nonReentrant - try again");
nonReentrant = true;
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][msg.sender];
int256 accumulatedRewardTokens = int256(use... | 27,581 |
110 | // Settles the lottery, the winners are calculated based onthe random number generated. The Admin fee is calculated andtransferred back to Admin `adminAddress`. | * Emits an {WinnersGenerated} event indicating that the winners for the lottery have been generated.
* Emits {LotterySettled} event indicating that the winnings have been transferred to the Admin and the Lottery is closed.
*
* Requirements:
*
* - The random number has been generated
*... | * Emits an {WinnersGenerated} event indicating that the winners for the lottery have been generated.
* Emits {LotterySettled} event indicating that the winnings have been transferred to the Admin and the Lottery is closed.
*
* Requirements:
*
* - The random number has been generated
*... | 37,034 |
72 | // Batch query of asset liabilities for a user user user address to query / | function getLiabilities(address user)
| function getLiabilities(address user)
| 62,834 |
58 | // log the bet being placed successfully | emit Placed(vrfInputHash, player, playerNonce, amount, packedBet.toUint(), humanReadable.toString());
| emit Placed(vrfInputHash, player, playerNonce, amount, packedBet.toUint(), humanReadable.toString());
| 17,884 |
21 | // Allows the trader to return the position/loan token to increase their escrowed balance/This should be used by the trader if they've withdraw an overcollateralized loan/If depositTokenAddress is not the correct token, it will be traded to the correct token using the oracle./loanOrderHash A unique hash representing th... | function depositPositionForBorrower(
bytes32 loanOrderHash,
address borrower,
address depositTokenAddress,
uint256 depositAmount)
external
nonReentrant
tracksGas
returns (bool)
| function depositPositionForBorrower(
bytes32 loanOrderHash,
address borrower,
address depositTokenAddress,
uint256 depositAmount)
external
nonReentrant
tracksGas
returns (bool)
| 12,312 |
122 | // Initialize the contract _stakedToken: staked token address _rewardToken: reward token address _rewardPerBlock: reward per block (in rewardToken) _startBlock: start block _endBlock: end block _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0) _depositFee: deposit fee _withdrawFee: withdraw fee _lo... | function initialize(
IERC20 _stakedToken,
IERC20 _rewardToken,
uint256 _rewardPerBlock,
uint256 _startBlock,
uint256 _endBlock,
uint256 _poolLimitPerUser,
uint16 _depositFee,
uint16 _withdrawFee,
uint256 _lockPeriod,
| function initialize(
IERC20 _stakedToken,
IERC20 _rewardToken,
uint256 _rewardPerBlock,
uint256 _startBlock,
uint256 _endBlock,
uint256 _poolLimitPerUser,
uint16 _depositFee,
uint16 _withdrawFee,
uint256 _lockPeriod,
| 77,489 |
81 | // adds `_amt` collateral to `vaultOwner` and returns the new balance of the vault vaultOwner the index of the vault amt the amount of collateral to add / | function _addCollateral(address payable vaultOwner, uint256 amt)
internal
notExpired
returns (uint256)
| function _addCollateral(address payable vaultOwner, uint256 amt)
internal
notExpired
returns (uint256)
| 46,381 |
7 | // list of all the treasuries deployed | address[] private treasuries;
| address[] private treasuries;
| 37,385 |
46 | // Sets/updates the converter for a given vault _vault The address of the vault _converter The address of the converter / | function setConverter(
address _vault,
address _converter
)
external
notHalted
onlyStrategist
| function setConverter(
address _vault,
address _converter
)
external
notHalted
onlyStrategist
| 52,519 |
26 | // Update the name of the token newName The new name for the token / | function _setName(string memory newName) internal {
_name = newName;
}
| function _setName(string memory newName) internal {
_name = newName;
}
| 4,647 |
39 | // Set L1 TransferRoot | _setTransferRoot(rootHash, totalAmount);
| _setTransferRoot(rootHash, totalAmount);
| 50,550 |
50 | // game over: display zero | if (now >= roundEndTime) {
return 0;
| if (now >= roundEndTime) {
return 0;
| 25,560 |
104 | // _controller:BvaultsBank _buyBackToken1Info[]: buyBackToken1, buyBackAddress1, buyBackToken1MidRouteAddress _buyBackToken2Info[]: buyBackToken2, buyBackAddress2, buyBackToken2MidRouteAddress | constructor(
address _controller,
bool _isCAKEStaking,
bool _isAutoComp,
address _farmContractAddress,
uint256 _pid,
address _wantAddress,
address _earnedAddress,
address _uniRouterAddress,
address[] memory _buyBackToken1Info,
| constructor(
address _controller,
bool _isCAKEStaking,
bool _isAutoComp,
address _farmContractAddress,
uint256 _pid,
address _wantAddress,
address _earnedAddress,
address _uniRouterAddress,
address[] memory _buyBackToken1Info,
| 11,082 |
7 | // Fixed at deployment time | struct DeploymentConfig {
// Name of the NFT contract.
string name;
// Symbol of the NFT contract.
string symbol;
// The contract owner address. If you wish to own the contract, then set it as your wallet address.
// This is also the wallet that can manage the contrac... | struct DeploymentConfig {
// Name of the NFT contract.
string name;
// Symbol of the NFT contract.
string symbol;
// The contract owner address. If you wish to own the contract, then set it as your wallet address.
// This is also the wallet that can manage the contrac... | 37,811 |
122 | // no ref purchase add the referral bonus back to the global dividends cake | _dividends = safeAdd(_dividends, _referralBonus);
_fee = _dividends * magnitude;
| _dividends = safeAdd(_dividends, _referralBonus);
_fee = _dividends * magnitude;
| 18,690 |
99 | // b = S_ + D / Ann | uint256 b = S_.add(_D.div(Ann));
uint256 prevY = 0;
uint256 y = _D;
| uint256 b = S_.add(_D.div(Ann));
uint256 prevY = 0;
uint256 y = _D;
| 53,080 |
139 | // Increment buffer length - 0x60 plus the original length | mstore(ptr, add(0x60, mload(ptr)))
| mstore(ptr, add(0x60, mload(ptr)))
| 28,205 |
1 | // Sale Information | bytes32 private _merkleRoot;
uint64 public cost;
uint8 public salePhase;
uint8 public lastSalePhase;
uint8 private constant _MAX_PER_TX = 10;
| bytes32 private _merkleRoot;
uint64 public cost;
uint8 public salePhase;
uint8 public lastSalePhase;
uint8 private constant _MAX_PER_TX = 10;
| 19,957 |
58 | // Set the length of the array the number that has been used. solium-disable-next-line security/no-inline-assembly | assembly {
mstore(results, i)
}
| assembly {
mstore(results, i)
}
| 24,771 |
76 | // manage public mint |
mintSupply=totalSupply();
require(!paused, "Contract is paused");
require(_mintAmount > 0, "mint amount cant be 0");
require(_mintAmount <= maxMintAmount, "Cant mint over the max mint amount");
require(mintSupply + _mintAmount <= maxSupply, "Mint amount is too high there may not be enough left t... |
mintSupply=totalSupply();
require(!paused, "Contract is paused");
require(_mintAmount > 0, "mint amount cant be 0");
require(_mintAmount <= maxMintAmount, "Cant mint over the max mint amount");
require(mintSupply + _mintAmount <= maxSupply, "Mint amount is too high there may not be enough left t... | 58,834 |
110 | // multiplier applied to rarity bounds when feeding horsey | uint8 public rarityMultiplier = 1;
| uint8 public rarityMultiplier = 1;
| 30,588 |
1 | // The DIN to buy a DIN. | uint256 public GENESIS_DIN = 1000000000;
string public version = "0.0.1";
| uint256 public GENESIS_DIN = 1000000000;
string public version = "0.0.1";
| 20,562 |
171 | // / | function revoke(address from, uint256 amount) public onlyRevoker returns (bool) {
return _revoke(from, amount);
}
| function revoke(address from, uint256 amount) public onlyRevoker returns (bool) {
return _revoke(from, amount);
}
| 4,354 |
66 | // Passing ERC20 token details to the constructor | ERC20("Reviewfy", "R5") {
// Adding total supply in multiplication with desired decimal places <Total supply * (10 ** decimals)>
uint totalSupply = 100000000 * (10**18);
// Mint the supply to the address provided
setInitialRewardAmount(10**18);
_mint(m... | ERC20("Reviewfy", "R5") {
// Adding total supply in multiplication with desired decimal places <Total supply * (10 ** decimals)>
uint totalSupply = 100000000 * (10**18);
// Mint the supply to the address provided
setInitialRewardAmount(10**18);
_mint(m... | 29,567 |
101 | // Calculates the claimable amounts for token and lp stake from normal and super rewards _account user addressreturn token - claimable reward amount for token stakereturn lp - claimable reward amount for lp stake / | function claimable(address _account) external view returns (uint256 token, uint256 lp) {
token = _earned(_account, false) + _earnedSuper(_account, false) - tokenStake[_account].rewards;
lp = _earned(_account, true) + _earnedSuper(_account, true) - liquidityStake[_account].rewards;
}
| function claimable(address _account) external view returns (uint256 token, uint256 lp) {
token = _earned(_account, false) + _earnedSuper(_account, false) - tokenStake[_account].rewards;
lp = _earned(_account, true) + _earnedSuper(_account, true) - liquidityStake[_account].rewards;
}
| 49,766 |
12 | // Initialises the Module by setting publisher addresses, and reading all available system module information / | constructor(address _nexus) internal {
require(_nexus != address(0), "Nexus is zero address");
nexus = INexus(_nexus);
}
| constructor(address _nexus) internal {
require(_nexus != address(0), "Nexus is zero address");
nexus = INexus(_nexus);
}
| 13,570 |
86 | // Original amount for the pool | uint256 remamountToPoolOrg = feeamount.sub(feeamountToPool);
| uint256 remamountToPoolOrg = feeamount.sub(feeamountToPool);
| 19,395 |
13 | // Changes the `_rng` storage variable._rng The new value for the `RNGenerator` storage variable._rngLookahead The new value for the `rngLookahead` storage variable. / | function changeRandomNumberGenerator(RNG _rng, uint256 _rngLookahead) external onlyByGovernor {
rng = _rng;
rngLookahead = _rngLookahead;
if (phase == Phase.generating) {
rngRequestedBlock = block.number + rngLookahead;
rng.requestRandomness(rngRequestedBlock);
... | function changeRandomNumberGenerator(RNG _rng, uint256 _rngLookahead) external onlyByGovernor {
rng = _rng;
rngLookahead = _rngLookahead;
if (phase == Phase.generating) {
rngRequestedBlock = block.number + rngLookahead;
rng.requestRandomness(rngRequestedBlock);
... | 22,510 |
24 | // Sets the borrow cap of the reserve self The reserve configuration borrowCap The borrow cap / | {
require(borrowCap <= MAX_VALID_BORROW_CAP, Errors.RC_INVALID_BORROW_CAP);
self.data = (self.data & BORROW_CAP_MASK) | (borrowCap << BORROW_CAP_START_BIT_POSITION);
}
| {
require(borrowCap <= MAX_VALID_BORROW_CAP, Errors.RC_INVALID_BORROW_CAP);
self.data = (self.data & BORROW_CAP_MASK) | (borrowCap << BORROW_CAP_START_BIT_POSITION);
}
| 9,897 |
108 | // return the total number of deposits this _staker has made / | function getNumberOfDeposits(address _staker)
external view returns (uint256)
| function getNumberOfDeposits(address _staker)
external view returns (uint256)
| 79,349 |
16 | // position ID is the ERC 1155 token ID | positionIds,
amounts,
""
);
emit PositionSplit(msg.sender, collateralToken, parentCollectionId, conditionId, partition, amount);
| positionIds,
amounts,
""
);
emit PositionSplit(msg.sender, collateralToken, parentCollectionId, conditionId, partition, amount);
| 23,773 |
71 | // we save the stake amount of a donor at the end of each claim,so rewardPeriods[_index - 1].donorStakeAmounts[_donorAddress] is the amount staked by the donor at his last claim | _lastDonorStakeAmount = rewardPeriods[_index - 1].donorStakeAmounts[_donorAddress];
while (_index <= _lastPeriodNumber) {
if (_currentRewardPeriod.startBlock > 0) {
| _lastDonorStakeAmount = rewardPeriods[_index - 1].donorStakeAmounts[_donorAddress];
while (_index <= _lastPeriodNumber) {
if (_currentRewardPeriod.startBlock > 0) {
| 20,350 |
107 | // ๅฆๆ็ดฏ่ฎกๅบๅก > ๆๅคงๅบๅก | if (accumulatedDebt > maxDebt) {
| if (accumulatedDebt > maxDebt) {
| 42,980 |
37 | // Retrieves the identifier from action _action The actionreturn The action type / | function actionType(bytes29 _action) internal pure returns (uint8) {
return uint8(_action.indexUint(0, 1));
}
| function actionType(bytes29 _action) internal pure returns (uint8) {
return uint8(_action.indexUint(0, 1));
}
| 33,519 |
8 | // Places `addr` in the first empty position if it isn't in the queue / | function enqueue(address _addr) external {
for(uint8 i = 0; i<free; i++) {
if(_addr == queue[i])
return;
}
if(free < size) {
queue[free] = _addr;
pushTime[_addr] = now;
free++;
}
}
| function enqueue(address _addr) external {
for(uint8 i = 0; i<free; i++) {
if(_addr == queue[i])
return;
}
if(free < size) {
queue[free] = _addr;
pushTime[_addr] = now;
free++;
}
}
| 33,383 |
3 | // the address of the Vault that the strategy belongs to | function vault() external view returns (address);
| function vault() external view returns (address);
| 33,833 |
176 | // Only smart contracts will be affected by this modifier | modifier defense() {
require(
(msg.sender == tx.origin) || // If it is a normal user and not smart contract,
// then the requirement will pass
!IController(controller()).greyList(msg.sender), // If it is a smart contract, then
"Vault: This smart contract has not been grey li... | modifier defense() {
require(
(msg.sender == tx.origin) || // If it is a normal user and not smart contract,
// then the requirement will pass
!IController(controller()).greyList(msg.sender), // If it is a smart contract, then
"Vault: This smart contract has not been grey li... | 10,234 |
61 | // _Available since v3.1._ / | interface IERC1155Receiver is IERC165 {
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
To accept the transfer, this must return
`bytes4(keccak256("onERC1155Received(address,a... | interface IERC1155Receiver is IERC165 {
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
To accept the transfer, this must return
`bytes4(keccak256("onERC1155Received(address,a... | 12,485 |
33 | // to update the owner parameterscode is the associated codeval is value to be set / | function updateAddressParameters(bytes8 code, address payable val) public {
require(ms.checkIsAuthToGoverned(msg.sender));
if (code == "PUMPAD") {
_changePumpAddress(val);
}
}
| function updateAddressParameters(bytes8 code, address payable val) public {
require(ms.checkIsAuthToGoverned(msg.sender));
if (code == "PUMPAD") {
_changePumpAddress(val);
}
}
| 51,029 |
13 | // lib/tinlake-math/src/math.sol Copyright (C) 2018 Rain <rainbreak@riseup.net>/ pragma solidity >=0.5.15; / | contract Math {
uint256 constant ONE = 10 ** 27;
function safeAdd(uint x, uint y) public pure returns (uint z) {
require((z = x + y) >= x, "safe-add-failed");
}
function safeSub(uint x, uint y) public pure returns (uint z) {
require((z = x - y) <= x, "safe-sub-failed");
}
func... | contract Math {
uint256 constant ONE = 10 ** 27;
function safeAdd(uint x, uint y) public pure returns (uint z) {
require((z = x + y) >= x, "safe-add-failed");
}
function safeSub(uint x, uint y) public pure returns (uint z) {
require((z = x - y) <= x, "safe-sub-failed");
}
func... | 10,321 |
124 | // The amount of time to vote on a proposal | function votingPeriod() external view returns (uint256) {
return settings.votingPeriod;
}
| function votingPeriod() external view returns (uint256) {
return settings.votingPeriod;
}
| 17,989 |
190 | // Allows users to access the token's symbol/ | function symbol() external pure returns (string memory) {
return "TRB";
}
| function symbol() external pure returns (string memory) {
return "TRB";
}
| 26,086 |
15 | // Events // Modifiers / | modifier onlylockdropContractCreator() {
require(msg.sender == lockdropContractCreator, "Sender must be lockdrop contract creator");
_;
}
| modifier onlylockdropContractCreator() {
require(msg.sender == lockdropContractCreator, "Sender must be lockdrop contract creator");
_;
}
| 20,891 |
272 | // DM Gargamel in Discord that you're standing right behind him. / | function setRevealTimestamp(uint256 revealTimeStamp) public onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
| function setRevealTimestamp(uint256 revealTimeStamp) public onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
| 30,212 |
40 | // Various utilities useful for uint256. / | library UInt256Lib {
uint256 private constant MAX_INT256 = ~(uint256(1) << 255);
/**
* @dev Safely converts a uint256 to an int256.
*/
function toInt256Safe(uint256 a) internal pure returns (int256) {
require(a <= MAX_INT256);
return int256(a);
}
}
| library UInt256Lib {
uint256 private constant MAX_INT256 = ~(uint256(1) << 255);
/**
* @dev Safely converts a uint256 to an int256.
*/
function toInt256Safe(uint256 a) internal pure returns (int256) {
require(a <= MAX_INT256);
return int256(a);
}
}
| 9,431 |
39 | // gas optimizationcredit squeebo_nft / | abstract contract ERC721EnumerableLite is ERC721B, IERC721Batch, IERC721Enumerable {
mapping(address => uint) internal _balances;
function isOwnerOf( address account, uint[] calldata tokenIds ) external view virtual override returns( bool ){
for(uint i; i < tokenIds.length; ++i ){
if( _owne... | abstract contract ERC721EnumerableLite is ERC721B, IERC721Batch, IERC721Enumerable {
mapping(address => uint) internal _balances;
function isOwnerOf( address account, uint[] calldata tokenIds ) external view virtual override returns( bool ){
for(uint i; i < tokenIds.length; ++i ){
if( _owne... | 75,167 |
329 | // No overflow check are needed for the amount since it's never casted to `int` and Solidity 0.8.0 automatically handles overflows | col.token.safeTransferFrom(msg.sender, address(poolManager), amount);
| col.token.safeTransferFrom(msg.sender, address(poolManager), amount);
| 44,290 |
54 | // It is important to place this if because the recipient can call this function again as part of the receiving call before `transfer` returns . | if (transportDeposit[_id] - selectedProduct.lowestBid >= 0 && !selectedProduct.ended) {
selectedProduct.lowestBidder.transfer(selectedProduct.lowestBid + selectedProduct.lowestBid);
uint tax = chargeTax(selectedProduct.lowestBid, selectedProduct.beneficiary);
uint sub = selec... | if (transportDeposit[_id] - selectedProduct.lowestBid >= 0 && !selectedProduct.ended) {
selectedProduct.lowestBidder.transfer(selectedProduct.lowestBid + selectedProduct.lowestBid);
uint tax = chargeTax(selectedProduct.lowestBid, selectedProduct.beneficiary);
uint sub = selec... | 40,952 |
69 | // If we overflow on multiplication it should not revert tx, we will get lower fees | protocolShare = accruedInterest * protocolShareFee / SolvencyV2._PRECISION_DECIMALS;
newProtocolFees = protocolFeesCached + protocolShare;
if (newProtocolFees < protocolFeesCached) {
protocolShare = type(uint256).max - protocolFeesCached;
newProtocolF... | protocolShare = accruedInterest * protocolShareFee / SolvencyV2._PRECISION_DECIMALS;
newProtocolFees = protocolFeesCached + protocolShare;
if (newProtocolFees < protocolFeesCached) {
protocolShare = type(uint256).max - protocolFeesCached;
newProtocolF... | 8,547 |
2 | // Register a name, or change the owner of an existing registration. subnode The hash of the label to register. owner The address of the new owner. / | function register(bytes32 subnode, address owner) public only_owner(subnode) {
engns.setSubnodeOwner(rootNode, subnode, owner);
}
| function register(bytes32 subnode, address owner) public only_owner(subnode) {
engns.setSubnodeOwner(rootNode, subnode, owner);
}
| 20,243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.