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 |
|---|---|---|---|---|
38 | // Block / Unlock address handling tokens | function OWN_freezeAddress(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| function OWN_freezeAddress(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| 51,323 |
19 | // Collects SUSHI tokens | ISushiChef(masterChef).deposit(poolId, 0);
uint256 _sushi = IERC20(sushi).balanceOf(address(this));
if (_sushi > 0) {
| ISushiChef(masterChef).deposit(poolId, 0);
uint256 _sushi = IERC20(sushi).balanceOf(address(this));
if (_sushi > 0) {
| 13,517 |
142 | // Safe FRT transfer function, just in case if rounding error causes pool to not have enough Tokens. | function safeFRTTransfer(address _to, uint256 _amount) internal {
uint256 testBal = frt.balanceOf(address(this));
if (_amount > testBal) {
frt.safeTransfer(address(_to), testBal);
} else {
frt.safeTransfer(address(_to), _amount);
}
}
| function safeFRTTransfer(address _to, uint256 _amount) internal {
uint256 testBal = frt.balanceOf(address(this));
if (_amount > testBal) {
frt.safeTransfer(address(_to), testBal);
} else {
frt.safeTransfer(address(_to), _amount);
}
}
| 879 |
293 | // get position notional and unrealized Pnl without fee expense and funding payment _amm IAmm address _trader trader address _pnlCalcOption enum PnlCalcOption, SPOT_PRICE for spot price and TWAP for twap pricereturn positionNotional position notionalreturn unrealizedPnl unrealized Pnl / | function getPositionNotionalAndUnrealizedPnl(
IAmm _amm,
address _trader,
PnlCalcOption _pnlCalcOption
| function getPositionNotionalAndUnrealizedPnl(
IAmm _amm,
address _trader,
PnlCalcOption _pnlCalcOption
| 8,079 |
129 | // =================================================================================================================Constructors ================================================================================================================= |
function SirinCrowdsale(uint256 _startTime,
uint256 _endTime,
address _wallet,
address _walletTeam,
address _walletOEM,
address _walletBounties,
address _walletReserve,
SirinSmartToken _sirinSmartToken,
RefundVault _refundVault)
|
function SirinCrowdsale(uint256 _startTime,
uint256 _endTime,
address _wallet,
address _walletTeam,
address _walletOEM,
address _walletBounties,
address _walletReserve,
SirinSmartToken _sirinSmartToken,
RefundVault _refundVault)
| 44,419 |
4 | // Get Information | function getWalletBalance()
public
view
onlyOwner(msg.sender)
returns (uint256)
| function getWalletBalance()
public
view
onlyOwner(msg.sender)
returns (uint256)
| 29,063 |
17 | // Converts all incoming Ethereum to tokens for the caller, and passes down the referral address (if any) / | function buy(address _referredBy)
public
payable
returns(uint256)
| function buy(address _referredBy)
public
payable
returns(uint256)
| 19,756 |
77 | // if (curblk > (blk+2proposalExpiration)) { uint jump = (curblk-blk)/(2proposalExpirationnodeCount); if ((curblk-blk) > (2proposalExpirationnodeCountjump + proposalExpiration)) { blk = blk + (jump + 1)(2proposalExpirationnodeCount); } else { blk = blk + jump(2proposalExpirationnodeCount); } } | return blk;
| return blk;
| 1,568 |
0 | // ---------------------------------------------------------------------------------------------------------------------------EVENTS----------------------------------------------------------------------------------------------------------------------------- |
event EligibilityConfirmed(uint32 whitelistVersion, bytes32 hash, address user);
event EligibilityRemoved(uint32 whitelistVersion, address user);
event whitelistVersionIncreased(uint32 currentDeclaration);
|
event EligibilityConfirmed(uint32 whitelistVersion, bytes32 hash, address user);
event EligibilityRemoved(uint32 whitelistVersion, address user);
event whitelistVersionIncreased(uint32 currentDeclaration);
| 22,766 |
33 | // Returns global wallet limit. This is the max number of tokens can be minted by one wallet. / | function getGlobalWalletLimit() external view override returns (uint256) {
return _globalWalletLimit;
}
| function getGlobalWalletLimit() external view override returns (uint256) {
return _globalWalletLimit;
}
| 17,933 |
7 | // If not purchased, return true. If purchased demand, bought and timeover demand is true. | function _isBurnable(uint256 demand_id) private view returns(bool){
return _isPurchesed(demand_id) ? _isOwnBoughtDemand(demand_id)&&_isTimeOver(demand_id) : true;
}
| function _isBurnable(uint256 demand_id) private view returns(bool){
return _isPurchesed(demand_id) ? _isOwnBoughtDemand(demand_id)&&_isTimeOver(demand_id) : true;
}
| 53,342 |
77 | // Muldiv operation overflow. / | error MathOverflowedMulDiv();
| error MathOverflowedMulDiv();
| 38,498 |
1 | // Divides two numbers but checks for 0 in the divisor first./ Does not throw./a First number/b Second number/ return err False normally, or true if `b` is 0/ return res The quotient of a and b, or 0 if `b` is 0 | function dividedBy(uint256 a, uint256 b) public pure returns (bool err,uint256 i) {
uint256 res;
assembly{
switch iszero(b)
case 0 {
res := div(a,b)
let loc := mload(0x40)
mstore(add(loc,0x20),res)
i := mload(add(loc,0x20))
}
default {
err := 1
... | function dividedBy(uint256 a, uint256 b) public pure returns (bool err,uint256 i) {
uint256 res;
assembly{
switch iszero(b)
case 0 {
res := div(a,b)
let loc := mload(0x40)
mstore(add(loc,0x20),res)
i := mload(add(loc,0x20))
}
default {
err := 1
... | 73,673 |
37 | // @inheritdoc IUniswapV3PoolActions/not locked because it initializes unlocked | function initialize(uint160 sqrtPriceX96) external override {
require(slot0.sqrtPriceX96 == 0, 'AI');
int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96);
(uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp());
slot0 = Slot0({
sqrt... | function initialize(uint160 sqrtPriceX96) external override {
require(slot0.sqrtPriceX96 == 0, 'AI');
int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96);
(uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp());
slot0 = Slot0({
sqrt... | 3,377 |
75 | // Revert if flasher is not a valid flasher at {Chief}.flasher address to check / | function _checkValidFlasher(address flasher) internal view {
if (!chief.allowedFlasher(flasher)) {
revert BaseRouter__checkValidFlasher_notAllowedFlasher();
}
| function _checkValidFlasher(address flasher) internal view {
if (!chief.allowedFlasher(flasher)) {
revert BaseRouter__checkValidFlasher_notAllowedFlasher();
}
| 40,972 |
1 | // -------------------// MAPPINGS//-------------------//-------------------//EVENTS //-------------------//-------------------//CONSTRUCTOR//-------------------/ | {
Role[0x1A0a3E3AE390a0710f8A6d00587082273eA8F6C9] = true; // BRT Minter #1
Role[0x4d8013b0c264034CBf22De9DF33e22f58D52F207] = true; // BRT Minter #2
Role[0x4D9A8CF2fE52b8D49C7F7EAA87b2886c2bCB4160] = true; // BRT Minter #3
Role[0x124fd966A0D83aA020D3C54AE2c9f4800b46F460] = true; //... | {
Role[0x1A0a3E3AE390a0710f8A6d00587082273eA8F6C9] = true; // BRT Minter #1
Role[0x4d8013b0c264034CBf22De9DF33e22f58D52F207] = true; // BRT Minter #2
Role[0x4D9A8CF2fE52b8D49C7F7EAA87b2886c2bCB4160] = true; // BRT Minter #3
Role[0x124fd966A0D83aA020D3C54AE2c9f4800b46F460] = true; //... | 21,314 |
33 | // See {IExpansion-preparePackAndSale} / | function preparePackAndSale(
Pack memory pack,
IStorefront.Sale memory sale,
address storefront
) external override onlyRole(MINTER_ROLE) {
sale.packId = _preparePack(pack);
IStorefront(storefront).createSale(sale);
}
| function preparePackAndSale(
Pack memory pack,
IStorefront.Sale memory sale,
address storefront
) external override onlyRole(MINTER_ROLE) {
sale.packId = _preparePack(pack);
IStorefront(storefront).createSale(sale);
}
| 35,958 |
4 | // ROUTER Interface | interface iROUTER {
function depositWithExpiry(address, address, uint, string calldata, uint) external;
}
| interface iROUTER {
function depositWithExpiry(address, address, uint, string calldata, uint) external;
}
| 26,774 |
127 | // [USDT, BUNNY] or [BUNNY, USDT] | path = new address[](3);
path[0] = _from;
path[1] = WAVAX;
path[2] = _to;
| path = new address[](3);
path[0] = _from;
path[1] = WAVAX;
path[2] = _to;
| 17,053 |
106 | // The HUOGUO TOKEN! | HuoguoToken public huoguo;
| HuoguoToken public huoguo;
| 61,462 |
29 | // now exchange my pUSD to pBTC | (, IVirtualPynth vPynth) =
periFinance.exchangeWithVirtual("pUSD", pUSD.balanceOf(address(this)), "pBTC", bytes32(0));
| (, IVirtualPynth vPynth) =
periFinance.exchangeWithVirtual("pUSD", pUSD.balanceOf(address(this)), "pBTC", bytes32(0));
| 15,516 |
4 | // ADD AIRDROPS Function | function airdrop(address[] memory accounts) public nonReentrant whenNotPaused onlyOwner {
require(
tokenCount + accounts.length <= nftsAvailable,
"No NFTs available for minting"
);
tokenCount += 1;
for (uint256 i = tokenCount; i < tokenCount + accounts.length... | function airdrop(address[] memory accounts) public nonReentrant whenNotPaused onlyOwner {
require(
tokenCount + accounts.length <= nftsAvailable,
"No NFTs available for minting"
);
tokenCount += 1;
for (uint256 i = tokenCount; i < tokenCount + accounts.length... | 21,415 |
181 | // The shampooToken TOKEN! | shampooToken public shampoo;
| shampooToken public shampoo;
| 17,126 |
96 | // make a Stu_Course instance, name as sci. | Stu_Course storage sci = students[_StudentID].stu_courses[i];
Course storage ci = courses[sci.CourseID];
(Terms[j],Compulsorys[j],Credits[j],Marks[j]) = (ci.Term,ci.Compulsory,ci.Credit,sci.CourseGrade);
j++;
| Stu_Course storage sci = students[_StudentID].stu_courses[i];
Course storage ci = courses[sci.CourseID];
(Terms[j],Compulsorys[j],Credits[j],Marks[j]) = (ci.Term,ci.Compulsory,ci.Credit,sci.CourseGrade);
j++;
| 51,885 |
5 | // Returns the interface hash for an `interfaceName`, as defined in thecorresponding / | function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
| function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
| 4,814 |
39 | // Burns `tokenId`. See {ERC721-_burn}. | function burn(uint256 tokenId) external virtual {
| function burn(uint256 tokenId) external virtual {
| 10,138 |
207 | // adjustments[5] = point^degreeAdjustment(composition_degree_bound, 2(trace_length - 1), 0, 1). |
mstore(0x4e60,
expmod(point, degreeAdjustment(/*composition_degree_bound*/ mload(0x3f40), mul(2, sub(/*trace_length*/ mload(0x80), 1)), 0, 1), PRIME))
|
mstore(0x4e60,
expmod(point, degreeAdjustment(/*composition_degree_bound*/ mload(0x3f40), mul(2, sub(/*trace_length*/ mload(0x80), 1)), 0, 1), PRIME))
| 3,651 |
38 | // if the lending pools directly mint/transfer tokens to this address, process it like a user deposit only callable by the pool which issues the tokens _user the user address _amount the minted amount / | function onTokensDeposited(address _user, uint256 _amount) external {
//the msg.sender is the pool token. if the msg.sender is not a valid pool token, _deposit will revert
_deposit(msg.sender, _amount, _user, true);
}
| function onTokensDeposited(address _user, uint256 _amount) external {
//the msg.sender is the pool token. if the msg.sender is not a valid pool token, _deposit will revert
_deposit(msg.sender, _amount, _user, true);
}
| 3,285 |
20 | // Returns a slices from a byte array./b The byte array to take a slice from./from The starting index for the slice (inclusive)./to The final index for the slice (exclusive)./ return result The slice containing bytes at indices [from, to) | function slice(
bytes memory b,
uint256 from,
uint256 to
)
internal
pure
returns (bytes memory result)
| function slice(
bytes memory b,
uint256 from,
uint256 to
)
internal
pure
returns (bytes memory result)
| 11,974 |
0 | // bytes4 constant private ORACLE_REQUEST_SELECTOR = 0x40429946; | uint256 constant private SELECTOR_LENGTH = 4;
uint256 constant private EXPECTED_REQUEST_WORDS = 2;
uint256 constant private MINIMUM_REQUEST_LENGTH = SELECTOR_LENGTH + (32 * EXPECTED_REQUEST_WORDS);
function onTokenTransfer(
address _sender,
uint256 _amount,
bytes memory _data
... | uint256 constant private SELECTOR_LENGTH = 4;
uint256 constant private EXPECTED_REQUEST_WORDS = 2;
uint256 constant private MINIMUM_REQUEST_LENGTH = SELECTOR_LENGTH + (32 * EXPECTED_REQUEST_WORDS);
function onTokenTransfer(
address _sender,
uint256 _amount,
bytes memory _data
... | 29,719 |
141 | // Pull directly from this contract the token amount in relation to the share if strategy not used | if(share < tokenTotal){
uint256 _balance = getNormalizedTotalBalance(address(this));
uint256 _myBalance = _balance.mul(share).div(tokenTotal);
withdrawPerBalance(_msgSender(), _myBalance, false); // This will withdraw based on token balanace
wi... | if(share < tokenTotal){
uint256 _balance = getNormalizedTotalBalance(address(this));
uint256 _myBalance = _balance.mul(share).div(tokenTotal);
withdrawPerBalance(_msgSender(), _myBalance, false); // This will withdraw based on token balanace
wi... | 4,409 |
290 | // minimum 1 day | require(_maturationUnix > 24 * 60 * 60);
maturationPeriod = _maturationUnix;
| require(_maturationUnix > 24 * 60 * 60);
maturationPeriod = _maturationUnix;
| 58,614 |
124 | // Only manager is able to call this function Sets the liquidation discount asset The address of the main collateral token newValue The liquidation discount (3 decimals) / | function setLiquidationDiscount(address asset, uint newValue) public onlyManager {
require(newValue < 1e5, "Unit Protocol: INCORRECT_DISCOUNT_VALUE");
liquidationDiscount[asset] = newValue;
}
| function setLiquidationDiscount(address asset, uint newValue) public onlyManager {
require(newValue < 1e5, "Unit Protocol: INCORRECT_DISCOUNT_VALUE");
liquidationDiscount[asset] = newValue;
}
| 23,014 |
63 | // Gets the token ID at a given index of the tokens list of the requested owner.owner address owning the tokens list to be accessedindex uint256 representing the index to be accessed of the requested tokens list return uint256 token ID at the given index of the tokens list owned by the requested address/ | function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
| function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
| 39,643 |
18 | // Modifier that allows only a subgraph operator to be the caller / | modifier onlySubgraphAuth(uint256 _subgraphID) {
require(ownerOf(_subgraphID) == msg.sender, "GNS: Must be authorized");
_;
}
| modifier onlySubgraphAuth(uint256 _subgraphID) {
require(ownerOf(_subgraphID) == msg.sender, "GNS: Must be authorized");
_;
}
| 20,031 |
166 | // FRAX portion is FraxCR | uint256 frax_portion_with_cr = (allocations[2] * FRAX.global_collateral_ratio()) / PRICE_PRECISION;
| uint256 frax_portion_with_cr = (allocations[2] * FRAX.global_collateral_ratio()) / PRICE_PRECISION;
| 40,038 |
2 | // Uniswap router | IUniswapV2Router02 uniswapRouter;
| IUniswapV2Router02 uniswapRouter;
| 42,543 |
20 | // solhint-enable max-line-length |
return (totalElements, lastSequencerTimestamp);
|
return (totalElements, lastSequencerTimestamp);
| 9,843 |
222 | // id => creators | mapping (uint256 => address) public creators;
| mapping (uint256 => address) public creators;
| 31,196 |
9 | // doge consumes asteroiddoge address can only be set once / | function setAstroDogeAddress(address _astrodogeAddress) external onlyOwner {
require(address(astrodogeAddress) == address(0), "astrodoge address already set");
astrodogeAddress = _astrodogeAddress;
}
| function setAstroDogeAddress(address _astrodogeAddress) external onlyOwner {
require(address(astrodogeAddress) == address(0), "astrodoge address already set");
astrodogeAddress = _astrodogeAddress;
}
| 22,470 |
48 | // Mint additional supply of SRC20 tokens based on SWN token stake.Can be used for initial supply and subsequent minting of new SRC20 tokens.When used, Manager will update SWM/SRC20 values in this call and use itfor token owner's incStake/decStake calls, minting/burning SRC20 based oncurrent SWM/SRC20 ratio.Only owner ... | function mintSupply(address src20, address swmAccount, uint256 swmValue, uint256 src20Value)
onlyMinter(src20)
external
returns (bool)
| function mintSupply(address src20, address swmAccount, uint256 swmValue, uint256 src20Value)
onlyMinter(src20)
external
returns (bool)
| 4,264 |
10 | // Calculate auction price / | function getAuctionPrice() public view returns (uint256) {
if (block.timestamp < auctionSaleStartTime) {
return AUCTION_START_PRICE;
}
if (block.timestamp - auctionSaleStartTime >= AUCTION_PRICE_CURVE_LENGTH) {
return AUCTION_END_PRICE;
} else {
... | function getAuctionPrice() public view returns (uint256) {
if (block.timestamp < auctionSaleStartTime) {
return AUCTION_START_PRICE;
}
if (block.timestamp - auctionSaleStartTime >= AUCTION_PRICE_CURVE_LENGTH) {
return AUCTION_END_PRICE;
} else {
... | 46,045 |
36 | // Block number that interest was last accrued at / | uint256 public accrualBlockNumber;
| uint256 public accrualBlockNumber;
| 3,709 |
143 | // Storage of map keys and values | MapEntry[] _entries;
| MapEntry[] _entries;
| 49,666 |
45 | // Claiming collected service fee amount / | function claimServiceFee()
external
nonReentrant
onlyRole(DEFAULT_ADMIN_ROLE)
| function claimServiceFee()
external
nonReentrant
onlyRole(DEFAULT_ADMIN_ROLE)
| 36,169 |
39 | // solhint-disable no-empty-blocks, avoid-low-level-calls | contract EthDistribute is Ownable {
using SafeMath for uint256;
address payable private _marketingWallet;
address payable private _devWallet;
address payable private _treasuryWallet;
uint256 private _marketingShare = 40;
uint256 private _devShare = 10;
uint256 private _treasuryShare = 50;
... | contract EthDistribute is Ownable {
using SafeMath for uint256;
address payable private _marketingWallet;
address payable private _devWallet;
address payable private _treasuryWallet;
uint256 private _marketingShare = 40;
uint256 private _devShare = 10;
uint256 private _treasuryShare = 50;
... | 39,702 |
225 | // IPOR Index Value/value represented in 18 decimals | uint256 indexValue;
| uint256 indexValue;
| 36,657 |
40 | // Check if any GRT tokens are deposited for a SubgraphDeployment. _subgraphDeploymentID SubgraphDeployment to check if curatedreturn True if curated, false otherwise / | function isCurated(bytes32 _subgraphDeploymentID) public view override returns (bool) {
return pools[_subgraphDeploymentID].tokens != 0;
}
| function isCurated(bytes32 _subgraphDeploymentID) public view override returns (bool) {
return pools[_subgraphDeploymentID].tokens != 0;
}
| 17,091 |
0 | // ========== CONSTANTS ============= // ========== STATE VARIABLES ========== // ========== MODIFIERS ========== / | modifier onlyMinter() {
require(
isMinter(msg.sender) == true,
"NoavaMinterV2: caller is not the minter"
);
_;
}
| modifier onlyMinter() {
require(
isMinter(msg.sender) == true,
"NoavaMinterV2: caller is not the minter"
);
_;
}
| 12,428 |
10 | // Returns `user`'s Internal Balance for a set of tokens. / | function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);
| function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);
| 21,971 |
160 | // delete the liquidity mining position after the withdraw | if (remainingLiquidity == 0) {
_positions[positionId] = _positions[0x0];
} else {
| if (remainingLiquidity == 0) {
_positions[positionId] = _positions[0x0];
} else {
| 55,121 |
32 | // IMPORTANT: inorder to saving gas we removed approve / | function approve(address /* spender */, uint256 /* amount */) public virtual override returns (bool ret) {
ret = false;
require(false, "err approve");
}
| function approve(address /* spender */, uint256 /* amount */) public virtual override returns (bool ret) {
ret = false;
require(false, "err approve");
}
| 36,141 |
2 | // User pool tokens | mapping (address => uint) public override balance;
mapping (address => mapping (uint => uint)) public override balanceOf;
uint public override totalSupply;
| mapping (address => uint) public override balance;
mapping (address => mapping (uint => uint)) public override balanceOf;
uint public override totalSupply;
| 25,823 |
75 | // Pick a random type of land. | if(percentChance(__noundles + offset, (percentLowLand + percentMidLand + percentHighLand), percentHighLand)){
_type = 4;
}else if(percentChance(__noundles + offset, (percentLowLand + percentMidLand + percentHighLand), percentMidLand)){
| if(percentChance(__noundles + offset, (percentLowLand + percentMidLand + percentHighLand), percentHighLand)){
_type = 4;
}else if(percentChance(__noundles + offset, (percentLowLand + percentMidLand + percentHighLand), percentMidLand)){
| 11,307 |
56 | // Investment cap ICO phase two | uint32 public investmentCapIcoPhaseTwoPounds = 4000000000;
| uint32 public investmentCapIcoPhaseTwoPounds = 4000000000;
| 49,895 |
43 | // ERC20Mintable ERC20 minting logic / | contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
*
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
*
* @return A boolean that indicates if the operation was successful.
*/
function mint... | contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
*
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
*
* @return A boolean that indicates if the operation was successful.
*/
function mint... | 28,227 |
3 | // Constructor. marketId The identifier of the market / | constructor(string memory marketId) {
_setMarketId(marketId);
| constructor(string memory marketId) {
_setMarketId(marketId);
| 7,502 |
8 | // `Proposal({...})` 创建一个临时 Proposal 对象, `proposals.push(...)` 将其添加到 `proposals` 的末尾 | proposals.push(Proposal({
name:proposalNames[i],
voteCount:0
}));
| proposals.push(Proposal({
name:proposalNames[i],
voteCount:0
}));
| 17,633 |
75 | // Update trail PCT | Decimal.decimal memory tpct = isLong ?
Decimal.one().addD(trailingOrders[order_id].trailPct) :
Decimal.one().subD(trailingOrders[order_id].trailPct);
| Decimal.decimal memory tpct = isLong ?
Decimal.one().addD(trailingOrders[order_id].trailPct) :
Decimal.one().subD(trailingOrders[order_id].trailPct);
| 8,917 |
127 | // calculate round prize here | uint256 roundPrize = cycleProgressivePot.mul(roundPotRate).div(100);
uint256 adminShare = cycleProgressivePot.mul(4).div(100);
foundationBalance += adminShare;
roundPrizePot[roundCount] = roundPrize;
cycleProgressivePot = roundPrize;
narrowRoundPrize(roundCount);
salt++;
emit roundPrizeA... | uint256 roundPrize = cycleProgressivePot.mul(roundPotRate).div(100);
uint256 adminShare = cycleProgressivePot.mul(4).div(100);
foundationBalance += adminShare;
roundPrizePot[roundCount] = roundPrize;
cycleProgressivePot = roundPrize;
narrowRoundPrize(roundCount);
salt++;
emit roundPrizeA... | 14,940 |
39 | // Checks if the vote unready threshold was reached for a given subject/a subject is voted-unready if either it reaches the threshold in the general committee or a certified subject reaches the threshold in the certified committee/committee is a list of the current committee members/weights is a list of the current com... | function isCommitteeVoteUnreadyThresholdReached(address[] memory committee, uint256[] memory weights, bool[] memory certification, address subject) private returns (bool) {
Settings memory _settings = settings;
uint256 totalCommitteeStake = 0;
uint256 totalVoteUnreadyStake = 0;
uint256 totalCertifiedStake = 0... | function isCommitteeVoteUnreadyThresholdReached(address[] memory committee, uint256[] memory weights, bool[] memory certification, address subject) private returns (bool) {
Settings memory _settings = settings;
uint256 totalCommitteeStake = 0;
uint256 totalVoteUnreadyStake = 0;
uint256 totalCertifiedStake = 0... | 37,987 |
144 | // Store it in the vault. | tokenId = tokenIds[i];
_tokenIds.push(tokenId);
_indices[tokenId] = ++_length;
| tokenId = tokenIds[i];
_tokenIds.push(tokenId);
_indices[tokenId] = ++_length;
| 79,172 |
29 | // isExecutable / | function isExecutable(uint256 _transactionId) public virtual view returns (bool) {
return !transactions[_transactionId].locked && (
!transactions[_transactionId].cancelled) && (
!transactions[_transactionId].executed) && (
!isExpired(_transactionId)) && (
transactions[_transactionId].conf... | function isExecutable(uint256 _transactionId) public virtual view returns (bool) {
return !transactions[_transactionId].locked && (
!transactions[_transactionId].cancelled) && (
!transactions[_transactionId].executed) && (
!isExpired(_transactionId)) && (
transactions[_transactionId].conf... | 43,797 |
170 | // Generates init data for Farm Factory _rewards Rewards token address _rewardsPerBlock - Rewards per block for the whole farm _startBlock - Starting block _divaddr Any donations if set are sent here _accessControls Gives right to access/ | function getInitData(
address _rewards,
uint256 _rewardsPerBlock,
uint256 _startBlock,
address _divaddr,
address _accessControls
)
external
pure
returns (bytes memory _data)
| function getInitData(
address _rewards,
uint256 _rewardsPerBlock,
uint256 _startBlock,
address _divaddr,
address _accessControls
)
external
pure
returns (bytes memory _data)
| 27,092 |
57 | // Dependencies / |
using SafeMath for uint256;
using SafeMathInt for int256;
|
using SafeMath for uint256;
using SafeMathInt for int256;
| 22,284 |
132 | // Emitted when the pause is triggered by `account`. / | event Paused(address account);
| event Paused(address account);
| 21,989 |
8 | // The address sending in USDC for capitalization. | address toAddress;
| address toAddress;
| 41,829 |
37 | // TokenSold(_tokenId, sellingPrice, pizzaIndexToPrice[_tokenId], oldOwner, newOwner, pizzas[_tokenId].name); |
msg.sender.transfer(purchaseExcess);
|
msg.sender.transfer(purchaseExcess);
| 15,831 |
2 | // map user addresses over their info / | mapping(address => UserInfo) public userInfo;
| mapping(address => UserInfo) public userInfo;
| 1,423 |
27 | // EIP-20 token decimals for this token | uint8 public constant decimals = 18;
| uint8 public constant decimals = 18;
| 46,847 |
1 | // Sends a message to the l2BridgeAddress from layer-1 _calldata The data that l2BridgeAddress will be called with / | function sendCrossDomainMessage(bytes memory _calldata) public override onlyL1Bridge {
l1MessengerAddress.sendMessage(
l2BridgeAddress,
_calldata,
uint32(defaultGasLimit)
);
}
| function sendCrossDomainMessage(bytes memory _calldata) public override onlyL1Bridge {
l1MessengerAddress.sendMessage(
l2BridgeAddress,
_calldata,
uint32(defaultGasLimit)
);
}
| 16,707 |
96 | // enable cooldown between sells | function changeCooldownSettings(bool newStatus, uint256 newInterval) external onlyOwner {
require(newInterval <= 24 hours, "Exceeds the limit");
cooldownEnabled = newStatus;
cooldownTimerInterval = newInterval;
}
| function changeCooldownSettings(bool newStatus, uint256 newInterval) external onlyOwner {
require(newInterval <= 24 hours, "Exceeds the limit");
cooldownEnabled = newStatus;
cooldownTimerInterval = newInterval;
}
| 80,236 |
33 | // Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship betweenEther and Wei. NOTE: This information is only used for _dis... | * {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
| * {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
| 8,156 |
3 | // Triggered when a beneficiary has been copiedmanager Address of the manager that triggered the event beneficiary Address of the beneficiary that has been added / | event BeneficiaryCopied(address indexed manager, address indexed beneficiary);
| event BeneficiaryCopied(address indexed manager, address indexed beneficiary);
| 23,438 |
10 | // WETH address | address public immutable WETH;
| address public immutable WETH;
| 45,227 |
102 | // Increase the offset to amounts by 32. | mstore(
BatchTransfer1155Params_amounts_head_ptr,
add(
OneWord,
mload(BatchTransfer1155Params_amounts_head_ptr)
)
)
| mstore(
BatchTransfer1155Params_amounts_head_ptr,
add(
OneWord,
mload(BatchTransfer1155Params_amounts_head_ptr)
)
)
| 14,508 |
7 | // Open or close a given channel. Only callable by the controller.channel The channel to open or close. isOpenThe status of the channel (either open or closed). / | function updateChannel(address channel, bool isOpen) external;
| function updateChannel(address channel, bool isOpen) external;
| 8,926 |
359 | // get the control lever | ControlLever storage lever =
controlTokenMapping[controlTokenId].levers[leverIds[i]];
| ControlLever storage lever =
controlTokenMapping[controlTokenId].levers[leverIds[i]];
| 15,377 |
14 | // Create "StakedRotyBroi". | StakedRotyBroi memory stakedRotyBroi = StakedRotyBroi(msg.sender, _rotybroiId);
| StakedRotyBroi memory stakedRotyBroi = StakedRotyBroi(msg.sender, _rotybroiId);
| 1,457 |
5 | // Events |
event WithdrawalStarted(address to, uint256 amount, uint256 eta);
event WithdrawalCancelled(address to, uint256 amount, uint256 eta);
event WithdrawalPerformed(address to, uint256 amount);
|
event WithdrawalStarted(address to, uint256 amount, uint256 eta);
event WithdrawalCancelled(address to, uint256 amount, uint256 eta);
event WithdrawalPerformed(address to, uint256 amount);
| 34,016 |
4 | // Approve the LendingPool contract allowance to pull the owed amount | for (uint256 i = 0; i < assets.length; i++) {
uint256 amountOwing = amounts[i].add(premiums[i]);
IERC20(assets[i]).approve(address(LENDING_POOL), amountOwing);
}
| for (uint256 i = 0; i < assets.length; i++) {
uint256 amountOwing = amounts[i].add(premiums[i]);
IERC20(assets[i]).approve(address(LENDING_POOL), amountOwing);
}
| 19,812 |
109 | // Calculate total value of asset under management (in real-time) Report total value in collateral token / | function totalValueCurrent() external virtual override returns (uint256) {
return totalValue();
}
| function totalValueCurrent() external virtual override returns (uint256) {
return totalValue();
}
| 22,903 |
67 | // Internal function to invoke `onERC721Received` on a target address.The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data bytes optional... | function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
| function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
| 24,635 |
8 | // if not challenged, only user can exit | require(balance.account == msg.sender, "exit: wrong sender");
| require(balance.account == msg.sender, "exit: wrong sender");
| 5,292 |
0 | // The token that is deposited into this vault | address public constant DEPOSIT_TOKEN = 0xf43211935C781D5ca1a41d2041F397B8A7366C7A;
| address public constant DEPOSIT_TOKEN = 0xf43211935C781D5ca1a41d2041F397B8A7366C7A;
| 961 |
9 | // returns the previous trove by collaterization ratio / | function prevTrove(address _token, address _trove) public view override returns (address) {
return _troves[_token].list._values[_trove].prev;
}
| function prevTrove(address _token, address _trove) public view override returns (address) {
return _troves[_token].list._values[_trove].prev;
}
| 30,907 |
44 | // Burns a specific amount of tokens._value The amount of token to be burned./ | function burn(
uint256 _value
)
public
whenNotPaused
| function burn(
uint256 _value
)
public
whenNotPaused
| 43,712 |
0 | // Implementation of the {IERC777} interface.that a supply mechanism has to be added in a derived contract using {_mint}.Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on tokenAdditionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there This isn't ever read from - it's only used ... | address[] private _defaultOperatorsArray;
| address[] private _defaultOperatorsArray;
| 11,562 |
18 | // Asset value of debt | uint256 assetsDebt = _borrowToAsset(borrowPrice, debtToken.balanceOf(address(this)));
return balanceOfAsset() + assetsEth + aToken.balanceOf(address(this)) + sushiLpValue - assetsDebt;
| uint256 assetsDebt = _borrowToAsset(borrowPrice, debtToken.balanceOf(address(this)));
return balanceOfAsset() + assetsEth + aToken.balanceOf(address(this)) + sushiLpValue - assetsDebt;
| 18,356 |
423 | // Decodes and returns a 5 bit unsigned integer shifted by an offset from a 256 bit word. / | function decodeUint5(bytes32 word, uint256 offset) internal pure returns (uint256) {
return uint256(word >> offset) & _MASK_5;
}
| function decodeUint5(bytes32 word, uint256 offset) internal pure returns (uint256) {
return uint256(word >> offset) & _MASK_5;
}
| 13,513 |
132 | // Includes an account from receiving reward. | * Emits a {IncludeAccountInReward} event.
*
* Requirements:
*
* - `account` is excluded in receiving reward.
*/
function includeAccountInReward(address account) public onlyOwner {
require(_isExcludedFromReward[account], "Account is already included.");
for (uint2... | * Emits a {IncludeAccountInReward} event.
*
* Requirements:
*
* - `account` is excluded in receiving reward.
*/
function includeAccountInReward(address account) public onlyOwner {
require(_isExcludedFromReward[account], "Account is already included.");
for (uint2... | 55,895 |
132 | // Check if the Ring 2 validation has sustained throughout this period | (,uint256 ring2IssueBlock,) = _CA.getStatus(target);
require(ring2IssueBlock != 0, "CerticolDAO: target has no ring 2 status");
require(
block.number.sub(ring2IssueBlock) >= _posatRewardRequirement,
"CerticolDAO: ring 2 status has not sustained long enough for reward"
... | (,uint256 ring2IssueBlock,) = _CA.getStatus(target);
require(ring2IssueBlock != 0, "CerticolDAO: target has no ring 2 status");
require(
block.number.sub(ring2IssueBlock) >= _posatRewardRequirement,
"CerticolDAO: ring 2 status has not sustained long enough for reward"
... | 51,487 |
136 | // Check Quarterly Reward | (uint256 quarterlyRewards, uint256 lastQuarterlyWithdrawTime) =
getQuarterlyReward(_msgSender());
if (quarterlyRewards > 0) {
_withdrawQuarterlyReward();
}
| (uint256 quarterlyRewards, uint256 lastQuarterlyWithdrawTime) =
getQuarterlyReward(_msgSender());
if (quarterlyRewards > 0) {
_withdrawQuarterlyReward();
}
| 2,858 |
145 | // split the liquify amount into halves | uint256 half = liquifyAmount.div(2);
uint256 otherHalf = liquifyAmount.sub(half);
| uint256 half = liquifyAmount.div(2);
uint256 otherHalf = liquifyAmount.sub(half);
| 7,883 |
13 | // Deploys a new proxy instance/_constructData The constructor data with which to call `init()` on the deployed proxy/ return proxy_ The proxy address | function deployProxy(bytes memory _constructData) public override returns (address proxy_) {
proxy_ = address(new BeaconProxy(_constructData, address(this)));
emit ProxyDeployed(msg.sender, proxy_, _constructData);
return proxy_;
}
| function deployProxy(bytes memory _constructData) public override returns (address proxy_) {
proxy_ = address(new BeaconProxy(_constructData, address(this)));
emit ProxyDeployed(msg.sender, proxy_, _constructData);
return proxy_;
}
| 57,319 |
6 | // Allows the current owner to transfer control of the contract to a newOwner.newOwner the address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
setOwner(newOwner);
}
| function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
setOwner(newOwner);
}
| 11,072 |
43 | // MasterChef is the master of Cake. He can make Cake and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once CAKE is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it'... | contract MasterChef is AdminRole, ReentrancyGuard, Pausable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
u... | contract MasterChef is AdminRole, ReentrancyGuard, Pausable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
u... | 29,576 |
63 | // REGISTER DIRECT MINT CONTRACT// Register Contract. / | contract RegisterDirectMint {
using SafeMath for uint256;
// Account with the right to adjust the set of minters.
address public _owner;
// Address of the Kong ERC20 account.
address public _kongERC20Address;
// Sum of Kong amounts marked as mintable for registered devices.
uint256 public _totalMintabl... | contract RegisterDirectMint {
using SafeMath for uint256;
// Account with the right to adjust the set of minters.
address public _owner;
// Address of the Kong ERC20 account.
address public _kongERC20Address;
// Sum of Kong amounts marked as mintable for registered devices.
uint256 public _totalMintabl... | 38,859 |
404 | // Whitelist of users being able to convert tokens.user_ address is candidate to be whitelisted (if whitelist is enabled)allowed_ bool set if user should be allowed (uf true), or denied using system/ | function setKyc(address user_, bool allowed_) public auth {
require(user_ != address(0), "asm-kyc-user-can-not-be-zero");
kyc[user_] = allowed_;
}
| function setKyc(address user_, bool allowed_) public auth {
require(user_ != address(0), "asm-kyc-user-can-not-be-zero");
kyc[user_] = allowed_;
}
| 26,914 |
33 | // Function to get global item via the Association Struct (IceGlobal library) self is the GlobalRecord Struct (IceGlobal library) which contains the indexes used for storing an item _globalItems is the entire array of global itemsreturn association is the Association Struct which contains properties of the specific ite... | function getGlobalItemViaRecord(
GlobalRecord storage self,
mapping (uint => mapping(uint => Association)) storage _globalItems
)
internal view
| function getGlobalItemViaRecord(
GlobalRecord storage self,
mapping (uint => mapping(uint => Association)) storage _globalItems
)
internal view
| 24,482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.