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 |
|---|---|---|---|---|
5 | // Change the base URI for returning metadata _baseTokenURI the respective base URI/ | function setBaseURI(string memory _baseTokenURI) external override onlyRole(DEFAULT_ADMIN_ROLE) {
baseTokenURI = _baseTokenURI;
}
| function setBaseURI(string memory _baseTokenURI) external override onlyRole(DEFAULT_ADMIN_ROLE) {
baseTokenURI = _baseTokenURI;
}
| 63,160 |
274 | // Unique identifier for DVM price feed ticker. | bytes32 public priceIdentifier;
| bytes32 public priceIdentifier;
| 8,060 |
151 | // Save/update amount value staked by the delegator | _snapshotDelegatorStake(_poolStakingAddress, _staker);
| _snapshotDelegatorStake(_poolStakingAddress, _staker);
| 7,259 |
419 | // round 27 | ark(i, q, 20162517328110570500010831422938033120419484532231241180224283481905744633719);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 20162517328110570500010831422938033120419484532231241180224283481905744633719);
sbox_partial(i, q);
mix(i, q);
| 48,706 |
88 | // change the minimum burn rate to acquire a slot | function setMinBurnRate(uint poolId, uint newMinBurnRate) external poolOwnerOnly(poolId) {
Pool storage pool = pools[poolId];
pool.minimumBurnRateWeiPerBlock = newMinBurnRate;
}
| function setMinBurnRate(uint poolId, uint newMinBurnRate) external poolOwnerOnly(poolId) {
Pool storage pool = pools[poolId];
pool.minimumBurnRateWeiPerBlock = newMinBurnRate;
}
| 62,881 |
766 | // Reads the bytes7 at `mPtr` in memory. | function readBytes7(MemoryPointer mPtr) internal pure returns (bytes7 value) {
assembly {
value := mload(mPtr)
}
}
| function readBytes7(MemoryPointer mPtr) internal pure returns (bytes7 value) {
assembly {
value := mload(mPtr)
}
}
| 40,440 |
29 | // _uriSuffix new suffix value to be used in tokenURI / | function setUriSuffix(string calldata _uriSuffix) public onlyOwner {
uriSuffix = _uriSuffix;
}
| function setUriSuffix(string calldata _uriSuffix) public onlyOwner {
uriSuffix = _uriSuffix;
}
| 32,448 |
148 | // but not on the total amount of tokens | return(totalTokens);
| return(totalTokens);
| 74,830 |
10 | // This function sets the maximum allowable deposit for the given ERC20 token/asset_source Contract address for given ERC20 token/maximum_amount Maximum deposit amount/nonce Vega-assigned single-use number that provides replay attack protection/signatures Vega-supplied signature bundle of a validator-signed order/See M... | function set_deposit_maximum(address asset_source, uint256 maximum_amount, uint256 nonce, bytes memory signatures) public override {
require(listed_tokens[asset_source], "asset not listed");
bytes memory message = abi.encode(asset_source, maximum_amount, nonce, 'set_deposit_maximum');
requir... | function set_deposit_maximum(address asset_source, uint256 maximum_amount, uint256 nonce, bytes memory signatures) public override {
require(listed_tokens[asset_source], "asset not listed");
bytes memory message = abi.encode(asset_source, maximum_amount, nonce, 'set_deposit_maximum');
requir... | 31,461 |
105 | // Transfer lighthouse fee to lighthouse worker directly | require(xrt.transferFrom(liability.promisor(),
tx.origin,
liability.lighthouseFee()));
| require(xrt.transferFrom(liability.promisor(),
tx.origin,
liability.lighthouseFee()));
| 5,474 |
21 | // Function to check balance of contract | function getContractBalance() public view returns (uint256)
| function getContractBalance() public view returns (uint256)
| 24,254 |
134 | // Landlord | else if(ownerType == 2){
getLandNFT().ownerOf(landId);
}
| else if(ownerType == 2){
getLandNFT().ownerOf(landId);
}
| 43,827 |
54 | // Reward token |
PlotXToken private rewardToken;
|
PlotXToken private rewardToken;
| 3,989 |
17 | // balanceOf : Displya token balance of given address / | function balanceOf(address tokenOwner) virtual override public view returns (uint balance) {
return balances[tokenOwner];
}
| function balanceOf(address tokenOwner) virtual override public view returns (uint balance) {
return balances[tokenOwner];
}
| 11,755 |
11 | // Gets the balance of the specified address. _owner The address to query the the balance of.return An uint256 representing the amount owned by the passed address. / | function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| 38,241 |
92 | // amount in real tokens/wei if ether | function withdrawDepositsByProfile(uint32 profile_id) external {
for(uint32 i=0; i < customers_deposits[msg.sender].length; i++){
if (depositIsExtractable(customers_deposits[msg.sender][i]) && profile_id == customers_deposits[msg.sender][i].deposit_profile_id){
withdrawDepositBy... | function withdrawDepositsByProfile(uint32 profile_id) external {
for(uint32 i=0; i < customers_deposits[msg.sender].length; i++){
if (depositIsExtractable(customers_deposits[msg.sender][i]) && profile_id == customers_deposits[msg.sender][i].deposit_profile_id){
withdrawDepositBy... | 33,025 |
90 | // Validate that address and bytes array lengths match. Validate address array is not emptyand contains no duplicate elements.A Array of addresses B Array of bytes / | function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure {
require(A.length == B.length, "Array length mismatch");
_validateLengthAndUniqueness(A);
}
| function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure {
require(A.length == B.length, "Array length mismatch");
_validateLengthAndUniqueness(A);
}
| 23,375 |
151 | // The buy slope of the bonding curve./ Does not affect the financial model, only the granularity of COT./This is the numerator component of the fractional value. | uint public buySlopeNum;
| uint public buySlopeNum;
| 77,933 |
409 | // An event for tracking the creation of a new Staker. | event FarmCreated(address indexed farmAddress, address indexed creator);
| event FarmCreated(address indexed farmAddress, address indexed creator);
| 41,451 |
7 | // Remove Leading Zeroes | while (fractionalPartTemp != 0 && fractionalPartTemp % 10 == 0) {
fractionalPartTemp /= 10;
if (powerRemaining > 0) {
powerRemaining--;
}
| while (fractionalPartTemp != 0 && fractionalPartTemp % 10 == 0) {
fractionalPartTemp /= 10;
if (powerRemaining > 0) {
powerRemaining--;
}
| 43,652 |
26 | // add pending rewards to remainder to be claimed by user later, if there is any existing stake | uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = tokens.add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= t... | uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = tokens.add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= t... | 58,675 |
24 | // Update reinvest minimum threshold before a deposit newValue min threshold in wei / | function updateMinTokensToReinvestBeforeDeposit(uint newValue) external onlyOwner {
emit UpdateMinTokensToReinvestBeforeDeposit(MIN_TOKENS_TO_REINVEST_BEFORE_DEPOSIT, newValue);
MIN_TOKENS_TO_REINVEST_BEFORE_DEPOSIT = newValue;
}
| function updateMinTokensToReinvestBeforeDeposit(uint newValue) external onlyOwner {
emit UpdateMinTokensToReinvestBeforeDeposit(MIN_TOKENS_TO_REINVEST_BEFORE_DEPOSIT, newValue);
MIN_TOKENS_TO_REINVEST_BEFORE_DEPOSIT = newValue;
}
| 40,586 |
9 | // enum which contains type of contract / | ContractType private _contractType;
| ContractType private _contractType;
| 24,504 |
43 | // Reset the counter | tokenReserved = 0;
| tokenReserved = 0;
| 40,574 |
15 | // ROUND DATA | mapping (uint256 => FFEIFDatasets.Round) public round_; // (rID => data) round data
mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id
| mapping (uint256 => FFEIFDatasets.Round) public round_; // (rID => data) round data
mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id
| 32,206 |
89 | // Get the true value of dai claimable by an account, factoring in the interest splitOverrides usual ERC20 balanceOf() to show true claimable balance across wallets and dAppsaccount Account to check | function balanceOf(address account) public view returns (uint256) {
return _dai(account, _simulateChi());
}
| function balanceOf(address account) public view returns (uint256) {
return _dai(account, _simulateChi());
}
| 35,591 |
56 | // use user limit | userPendingWithdrawals[msg.sender] = userPendingWithdrawals[msg.sender]+msg.value-prices[0];
pendingWithdrawalEvent(msg.sender,userPendingWithdrawals[msg.sender]+msg.value-prices[0]);
cities[cityId].purchases = cities[cityId].purchases+1;
userPendingWithdrawals[cities[c... | userPendingWithdrawals[msg.sender] = userPendingWithdrawals[msg.sender]+msg.value-prices[0];
pendingWithdrawalEvent(msg.sender,userPendingWithdrawals[msg.sender]+msg.value-prices[0]);
cities[cityId].purchases = cities[cityId].purchases+1;
userPendingWithdrawals[cities[c... | 80,375 |
55 | // adding defence for the city | function addDefence() payable withFee public {
// getting coordinates of the current player
uint32 coord = _requirePlayer(msg.sender);
// ensure these are coordinates of a real city
_requireCity(coord);
// the defence cannot exceed 8
uint8 defence = cities[coord].defe... | function addDefence() payable withFee public {
// getting coordinates of the current player
uint32 coord = _requirePlayer(msg.sender);
// ensure these are coordinates of a real city
_requireCity(coord);
// the defence cannot exceed 8
uint8 defence = cities[coord].defe... | 13,336 |
91 | // Tell us invest was success | Invested(receiver, weiAmount, tokenAmount);
| Invested(receiver, weiAmount, tokenAmount);
| 10,590 |
19 | // NOTE: storage layout must be the same as contract A | uint public num;
address public sender;
uint public value;
| uint public num;
address public sender;
uint public value;
| 6,462 |
60 | // Increments the total number of uncommitted storage slots. / | function incrementTotalUncommittedContractStorage()
override
public
authenticated
| function incrementTotalUncommittedContractStorage()
override
public
authenticated
| 56,468 |
74 | // The left child is taking the place of node, so we update it&39;s parent to be the original parent of the node. | Node storage newRoot = index.nodes[originalRoot.left];
newRoot.parent = originalRoot.parent;
| Node storage newRoot = index.nodes[originalRoot.left];
newRoot.parent = originalRoot.parent;
| 35,031 |
33 | // list NFTs | function listNft(
address _contractAddress,
uint256 _nftId,
uint256 _price
| function listNft(
address _contractAddress,
uint256 _nftId,
uint256 _price
| 11,146 |
12 | // total transferred amount | uint public totalOutboundAmount = 0;
| uint public totalOutboundAmount = 0;
| 4,973 |
69 | // fromToken Address of the source token toToken Address of the destination token fromAmount Amount of source tokens to be swapped toAmount Minimum destination token amount expected out of this swap expectedAmount Expected amount of destination tokens without slippage beneficiary Beneficiary address0 then 100% will be ... | struct SellData {
IERC20 fromToken;
IERC20 toToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
string referrer;
Utils.Path[] path;
}
| struct SellData {
IERC20 fromToken;
IERC20 toToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
string referrer;
Utils.Path[] path;
}
| 37,879 |
152 | // Sets new block on which presales first stage will end/This method should only be used in ongoing presale if something goes wrong/firstStageBlockEnd_ The block number on which presales first stage will end/ return default return True after everything is processed | function setFirstStageBlockEnd(uint firstStageBlockEnd_) public onlyRole(MODERATOR_ROLE) override returns (bool) {
uint oldValue = _firstStageBlockEnd;
require(oldValue != firstStageBlockEnd_, "Value is already set!");
_firstStageBlockEnd = firstStageBlockEnd_;
emit FirstStageBlockEn... | function setFirstStageBlockEnd(uint firstStageBlockEnd_) public onlyRole(MODERATOR_ROLE) override returns (bool) {
uint oldValue = _firstStageBlockEnd;
require(oldValue != firstStageBlockEnd_, "Value is already set!");
_firstStageBlockEnd = firstStageBlockEnd_;
emit FirstStageBlockEn... | 13,902 |
260 | // calculate amount of ETH we need | (uint256 requiredETH, uint256 amountWant)= getFlashLoanParams(want, amountDesired);
| (uint256 requiredETH, uint256 amountWant)= getFlashLoanParams(want, amountDesired);
| 40,438 |
464 | // Reads the bytes4 at `mPtr` in memory. | function readBytes4(
MemoryPointer mPtr
| function readBytes4(
MemoryPointer mPtr
| 19,810 |
67 | // Otherwise, revert with a generic error. | _revertInvalidCallToConduit(conduit);
| _revertInvalidCallToConduit(conduit);
| 17,064 |
99 | // Restore tax and liquidity fees | _taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){
restoreAllFee();
}
| _taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){
restoreAllFee();
}
| 35,235 |
14 | // bytesStorage / | function setStorage(BytesData storage self, bytes memory key, bytes memory innerKey, bytes memory value) internal {
self._storage[key][innerKey] = value;
}
| function setStorage(BytesData storage self, bytes memory key, bytes memory innerKey, bytes memory value) internal {
self._storage[key][innerKey] = value;
}
| 42,553 |
20 | // Safe token transfer function, just in case if rounding errorcauses pool to not have enough reward tokens _token The address of then token to transfer _to The address that will receive `_amount` `rewardToken` _amount The amount to send to `_to` / | function safeTokenTransfer(
ERC20 _token,
address _to,
uint256 _amount
| function safeTokenTransfer(
ERC20 _token,
address _to,
uint256 _amount
| 20,928 |
4 | // Emitted when attempting to buy hTokens with a zero amount of underlying. | error HifiPool__BuyHTokenUnderlyingZero();
| error HifiPool__BuyHTokenUnderlyingZero();
| 38,132 |
3 | // cant already be floating | require( !ships[_contract][_shipId].floating );
| require( !ships[_contract][_shipId].floating );
| 13,505 |
0 | // Events / | event Confirmation(address indexed sender, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transactionId);
event Submission(uint256 indexed transactionId);
event Execution(uint256 indexed transactionId);
event ExecutionFailure(uint256 indexed transactionId);
event Deposit(... | event Confirmation(address indexed sender, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transactionId);
event Submission(uint256 indexed transactionId);
event Execution(uint256 indexed transactionId);
event ExecutionFailure(uint256 indexed transactionId);
event Deposit(... | 45,949 |
35 | // Msg Value/ Owner Address should not be equal to zero | require(initiatedProduct[_productId]._ownerAddress != address(0x0),"Product does not exists");
| require(initiatedProduct[_productId]._ownerAddress != address(0x0),"Product does not exists");
| 44,146 |
8 | // return When the actual report was made if one was made / | function getReportTimestamp() public view returns (uint256) {
return reportTimestamp;
}
| function getReportTimestamp() public view returns (uint256) {
return reportTimestamp;
}
| 24,394 |
3 | // Liquidates a leveraged asset; meant to be called from an LToken contract asset Asset to swap from userShare User's ratio of received tokens liquidatorShare Liquidator's ratio of received tokens poolShare Pool's ration of received tokens numberOfAssetTokens Number of asset tokens to swap user Address of the user liqu... | function liquidateLeveragedAsset(address asset, uint userShare, uint liquidatorShare, uint poolShare, uint numberOfAssetTokens, address user, address liquidator) external returns (uint);
| function liquidateLeveragedAsset(address asset, uint userShare, uint liquidatorShare, uint poolShare, uint numberOfAssetTokens, address user, address liquidator) external returns (uint);
| 7,936 |
0 | // @TODO: Fill in the constructor parameters! | address payable wallet,
PupperCoin token,
uint cap,
uint rate,
uint goal,
uint open,
uint close
)
Crowdsale(rate, wallet, token)
| address payable wallet,
PupperCoin token,
uint cap,
uint rate,
uint goal,
uint open,
uint close
)
Crowdsale(rate, wallet, token)
| 10,595 |
4 | // send all Ether to owner Owner can receive Ether since the address of owner is payable | (bool success, ) = owner.call{value: amount}("");
| (bool success, ) = owner.call{value: amount}("");
| 26,220 |
58 | // gives square. batchplies x by x/ | function sq(uint256 x)
internal
pure
returns (uint256)
| function sq(uint256 x)
internal
pure
returns (uint256)
| 37,902 |
1 | // silence state mutability warning without generating bytecode - see https:github.com/ethereum/solidity/issues/2691 | return msg.data;
| return msg.data;
| 7,296 |
43 | // An event emitted when a new proposal is created | event ProposalCreated(uint indexed id, address indexed proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
| event ProposalCreated(uint indexed id, address indexed proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
| 83,133 |
48 | // Deleverage | uint256 flashLoanAmount = AaveLibPub.quoteReserveFromBase((1 ether * debt - ltv * collateral) / (1 ether - ltv), usdc, 6, priceOracle);
ILendingPool(lendingPool).flashLoanSimple(
address(this),
usdc,
flashLoanAmount,
abi.encode(flashLoanAmount + (flashLoanAmount * (ILendingP... | uint256 flashLoanAmount = AaveLibPub.quoteReserveFromBase((1 ether * debt - ltv * collateral) / (1 ether - ltv), usdc, 6, priceOracle);
ILendingPool(lendingPool).flashLoanSimple(
address(this),
usdc,
flashLoanAmount,
abi.encode(flashLoanAmount + (flashLoanAmount * (ILendingP... | 11,495 |
47 | // A user has passed KYC verification, store them on the blockchain in the order it happened.This will be cleared once the ICO completes, see closeIco(). ---- ICO-Platform Note ----The horizon-globex.com ICO platform's registered KYC provider submits their approvalfor this Contributor to particpate using the ICO-Platfo... | function kycApproved(address who) public onlyKycProvider {
require(!isIcoComplete, "The ICO phase has ended, you can no longer approve.");
require(who != 0x0, "Cannot approve a null address.");
kycValidated.push(who);
}
| function kycApproved(address who) public onlyKycProvider {
require(!isIcoComplete, "The ICO phase has ended, you can no longer approve.");
require(who != 0x0, "Cannot approve a null address.");
kycValidated.push(who);
}
| 11,543 |
32 | // Return the log in base 2, following the selected rounding direction, of a positive value.Returns 0 if given 0. / | function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
| function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
| 20,638 |
136 | // ========== HOOKS ========== // Override _beforeStake() hook to collect the deposit fee and update associated state / | function _beforeStake(
address _account,
uint256 _amount
| function _beforeStake(
address _account,
uint256 _amount
| 32,321 |
16 | // Current winning bid | uint256 public lastBid;
uint256 public lastBidTime;
address payable public winning;
event Bid(address who, uint256 amount);
event Won(address who, uint256 amount);
| uint256 public lastBid;
uint256 public lastBidTime;
address payable public winning;
event Bid(address who, uint256 amount);
event Won(address who, uint256 amount);
| 20,115 |
169 | // Check whether the endEarningsPool is initialised If it is not initialised set it's cumulative factors so that they can be used when a delegator next claims earnings as the start cumulative factors (see delegatorCumulativeStakeAndFees()) | Transcoder storage t = transcoders[del.delegateAddress];
EarningsPool.Data storage endEarningsPool = t.earningsPoolPerRound[_endRound];
if (endEarningsPool.cumulativeRewardFactor == 0) {
uint256 lastRewardRound = t.lastRewardRound;
if (lastRewardRound ... | Transcoder storage t = transcoders[del.delegateAddress];
EarningsPool.Data storage endEarningsPool = t.earningsPoolPerRound[_endRound];
if (endEarningsPool.cumulativeRewardFactor == 0) {
uint256 lastRewardRound = t.lastRewardRound;
if (lastRewardRound ... | 33,956 |
0 | // Maps users to tokens to spender addresses and information about the approval on the token/Indexed in the order of token owner address, token address, spender address/The stored word saves the allowed amount, expiration on the allowance, and nonce | mapping(address => mapping(address => mapping(address => PackedAllowance))) public allowance;
| mapping(address => mapping(address => mapping(address => PackedAllowance))) public allowance;
| 2,424 |
109 | // AaveDistributionManager Accounting contract to manage multiple staking distributions Aave / | contract AaveDistributionManager is IAaveDistributionManager {
using SafeMath for uint256;
struct AssetData {
uint128 emissionPerSecond;
uint128 lastUpdateTimestamp;
uint256 index;
mapping(address => uint256) users;
}
uint256 public immutable DISTRIBUTION_END;
address public immutable EMISS... | contract AaveDistributionManager is IAaveDistributionManager {
using SafeMath for uint256;
struct AssetData {
uint128 emissionPerSecond;
uint128 lastUpdateTimestamp;
uint256 index;
mapping(address => uint256) users;
}
uint256 public immutable DISTRIBUTION_END;
address public immutable EMISS... | 41,140 |
136 | // Initialises a newly created instance/_totalSupply Total amount of Color Coin tokens available./_founder Address of the founder wallet/_admin Address of the admin wallet/_pixelCoinSupply Amount of tokens dedicated for Pixel program/_pixelAccount Address of the account that keeps coins for the Pixel program | constructor(uint256 _totalSupply,
address payable _founder,
address _admin,
uint256 _pixelCoinSupply,
address _pixelAccount
) public ColorCoinWithPixel (_totalSupply, _founder, _admin, _pixelCoinSupply, _pixelAccount)
| constructor(uint256 _totalSupply,
address payable _founder,
address _admin,
uint256 _pixelCoinSupply,
address _pixelAccount
) public ColorCoinWithPixel (_totalSupply, _founder, _admin, _pixelCoinSupply, _pixelAccount)
| 37,959 |
233 | // Upgrade token functions | function freezeToken() onlyOwner public {
token.pause();
}
| function freezeToken() onlyOwner public {
token.pause();
}
| 86,320 |
11 | // Check if poolToken was initialized | modifier poolTokenSet() {
require(address(poolToken) != address(0x0), "poolToken not set");
_;
}
| modifier poolTokenSet() {
require(address(poolToken) != address(0x0), "poolToken not set");
_;
}
| 23,039 |
196 | // Update the free memory pointer to allocate. | mstore(0x40, m)
| mstore(0x40, m)
| 1,197 |
167 | // Authorize / Deauthorize / Authorize users for an address be permitted to make record modifications / | function addUser(
| function addUser(
| 62,733 |
27 | // this is deployed on mainnet at:0x38aEfE9e8E0Fc938475bfC6d7E52aE28D39FEBD8 | contract Fomo3d {
// create some data tracking vars for testing
bool public depositSuccessful_;
uint256 public successfulTransactions_;
uint256 public gasBefore_;
uint256 public gasAfter_;
// create forwarder instance
Forwarder Jekyll_Island_Inc;
// take addr for forwarder in c... | contract Fomo3d {
// create some data tracking vars for testing
bool public depositSuccessful_;
uint256 public successfulTransactions_;
uint256 public gasBefore_;
uint256 public gasAfter_;
// create forwarder instance
Forwarder Jekyll_Island_Inc;
// take addr for forwarder in c... | 51,845 |
124 | // Constructor Caveat emptor: this base contract is intended for inheritance by the Little Phil crowdsale only/ | constructor() public {
// setup the map of bonus-rates for each SaleState tier
createSalesTierConfigMap();
}
| constructor() public {
// setup the map of bonus-rates for each SaleState tier
createSalesTierConfigMap();
}
| 76,136 |
0 | // collateral Asset used as a loan collateral. For a definition see { MultiToken dependency lib }. / | struct LOAN {
uint8 status;
address borrower;
uint40 expiration;
address loanAssetAddress;
uint256 loanRepayAmount;
MultiToken.Asset collateral;
}
| struct LOAN {
uint8 status;
address borrower;
uint40 expiration;
address loanAssetAddress;
uint256 loanRepayAmount;
MultiToken.Asset collateral;
}
| 10,884 |
21 | // PokumiWar Sebastien Gazeau Manage Pokmi's Pokumi War game / | contract PokumiWar is ERC1155, AccessControl, ERC1155Receiver, ERC1155Burnable, ERC1155Pausable {
using Counters for Counters.Counter;
struct InitialDataGame {
string idPokumi;
uint warrior;
}
struct InitialSeason {
address player;
string idPokumi;
}
struct Season... | contract PokumiWar is ERC1155, AccessControl, ERC1155Receiver, ERC1155Burnable, ERC1155Pausable {
using Counters for Counters.Counter;
struct InitialDataGame {
string idPokumi;
uint warrior;
}
struct InitialSeason {
address player;
string idPokumi;
}
struct Season... | 348 |
124 | // Unlocks all avilable vAKRO for a holder holder Whose funds to unlockreturn total unlocked amount awailable for redeem / | function unlockAvailable(address holder) public returns (uint256) {
require(holders[holder].batches.length > 0, "VestedAkro: nothing to unlock");
claimAllFromBatches(holder);
return holders[holder].unlocked;
}
| function unlockAvailable(address holder) public returns (uint256) {
require(holders[holder].batches.length > 0, "VestedAkro: nothing to unlock");
claimAllFromBatches(holder);
return holders[holder].unlocked;
}
| 35,690 |
46 | // Changes weight to updatedWeight by reducing, pushes tokens and burns LP tokens. // function _moveWeightDown( | ) internal {
uint256 totalSupply_ = totalSupply;
require(
totalWeight.add(weight.sub(updatedWeight)) <= MAX_TOTAL_WEIGHT,
"ERR_MAX_TOTAL_WEIGHT"
);
uint256 absoluteWeightChange = weight.sub(updatedWeight);
uint256 absoluteBalanceChange = balance.mul(a... | ) internal {
uint256 totalSupply_ = totalSupply;
require(
totalWeight.add(weight.sub(updatedWeight)) <= MAX_TOTAL_WEIGHT,
"ERR_MAX_TOTAL_WEIGHT"
);
uint256 absoluteWeightChange = weight.sub(updatedWeight);
uint256 absoluteBalanceChange = balance.mul(a... | 40,091 |
9 | // If no restrictions were triggered return success | return SUCCESS_CODE;
| return SUCCESS_CODE;
| 50,443 |
367 | // Data | uint256 public cpi_last = 28012600000; // Dec 2021 CPI-U, 280.126 * 100000000
uint256 public cpi_target = 28193300000; // Jan 2022 CPI-U, 281.933 * 100000000
uint256 public peg_price_last = 1e18; // Use currPegPrice(). Will always be in Dec 2021 dollars
uint256 public peg_price_target = 1006450668627688... | uint256 public cpi_last = 28012600000; // Dec 2021 CPI-U, 280.126 * 100000000
uint256 public cpi_target = 28193300000; // Jan 2022 CPI-U, 281.933 * 100000000
uint256 public peg_price_last = 1e18; // Use currPegPrice(). Will always be in Dec 2021 dollars
uint256 public peg_price_target = 1006450668627688... | 12,175 |
46 | // pay outstanding interest to lender | _payInterest(
loanLocal.lender,
loanParamsLocal.loanToken
);
LoanInterest storage loanInterestLocal = loanInterest[loanLocal.id];
LenderInterest storage lenderInterestLocal = lenderInterest[loanLocal.lender][loanParamsLocal.loanToken];
uint256 owedPerDay... | _payInterest(
loanLocal.lender,
loanParamsLocal.loanToken
);
LoanInterest storage loanInterestLocal = loanInterest[loanLocal.id];
LenderInterest storage lenderInterestLocal = lenderInterest[loanLocal.lender][loanParamsLocal.loanToken];
uint256 owedPerDay... | 42,983 |
75 | // Update the balance proof data for the closing_participant | updateBalanceProofData(channel, closing_participant, nonce, balance_hash);
emit NonClosingBalanceProofUpdated(
channel_identifier,
closing_participant,
nonce,
balance_hash
);
| updateBalanceProofData(channel, closing_participant, nonce, balance_hash);
emit NonClosingBalanceProofUpdated(
channel_identifier,
closing_participant,
nonce,
balance_hash
);
| 7,442 |
222 | // Auction contract for collateral | address collateralAuction;
| address collateralAuction;
| 33,911 |
3 | // min cross transfer amount :token => min amount. | mapping(address => uint256) public minAmountLimit;
modifier onlyFMarketOrAdmin(address token) {
require(address(fluxMarkets[token]) == msg.sender || msg.sender == owner(), "ONLY_FOR_FLUXMARKET");
_;
}
| mapping(address => uint256) public minAmountLimit;
modifier onlyFMarketOrAdmin(address token) {
require(address(fluxMarkets[token]) == msg.sender || msg.sender == owner(), "ONLY_FOR_FLUXMARKET");
_;
}
| 35,967 |
226 | // calculates the fee of given value. _value the value of the transaction to calculate fees from _sender address sending._recipient address receiving.return the transactional fee for given value / | function getTxFees(
uint256 _value,
address _sender,
address _recipient
| function getTxFees(
uint256 _value,
address _sender,
address _recipient
| 49,509 |
83 | // View Methods Start // This function is used to get the minimum staking amount / | function getMinimumStakingAmount() external view returns (uint256) {
return _minimumStakingAmount;
}
| function getMinimumStakingAmount() external view returns (uint256) {
return _minimumStakingAmount;
}
| 44,988 |
5 | // We whitelist the pair to have no vesting on reception | governance = msg.sender; // bypass !gov checks
_PAIR_ADDRESS = uniswapPair;
setNoVestingWhitelist(uniswapPair, true);
setNoVestingWhitelist(BURNER, true);
setNoVestingWhitelist(rebasingLP, true);
setNoVestingWhitelist(UNISWAP_V2_ROUTER, true); // We set the router to no v... | governance = msg.sender; // bypass !gov checks
_PAIR_ADDRESS = uniswapPair;
setNoVestingWhitelist(uniswapPair, true);
setNoVestingWhitelist(BURNER, true);
setNoVestingWhitelist(rebasingLP, true);
setNoVestingWhitelist(UNISWAP_V2_ROUTER, true); // We set the router to no v... | 41,075 |
22 | // modifier to limit the minting to not exceed maximum supply limit | modifier canPoSMint() {
require(totalSupply < maxTotalSupply);
_;
}
| modifier canPoSMint() {
require(totalSupply < maxTotalSupply);
_;
}
| 25,441 |
129 | // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. | assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
| assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
| 5,157 |
41 | // new v.12.7 patient_address stored as bytes: | // function getAddressFromBytesToString(uint256 tokenId) public view returns (string memory) {
// Script storage rx = allScripts[tokenId];
// return string(abi.encodePacked(rx.patient_address));
// }
| // function getAddressFromBytesToString(uint256 tokenId) public view returns (string memory) {
// Script storage rx = allScripts[tokenId];
// return string(abi.encodePacked(rx.patient_address));
// }
| 14,627 |
84 | // mint HXY to address ( for use in external contracts within the eco-system) | function mintHXY(uint hearts, address receiver)
public
onlyMinters
returns(bool)
| function mintHXY(uint hearts, address receiver)
public
onlyMinters
returns(bool)
| 32,939 |
29 | // Destroy tokens from owners account / | function burnTokens(address _addr, uint256 _amount)public onlyOwner {
require (balances[msg.sender] < _amount); // Throw if you do not have enough balance
totalRemainSupply += _amount; // Deduct totalSupply
balances[_addr] -= _amount; ... | function burnTokens(address _addr, uint256 _amount)public onlyOwner {
require (balances[msg.sender] < _amount); // Throw if you do not have enough balance
totalRemainSupply += _amount; // Deduct totalSupply
balances[_addr] -= _amount; ... | 11,899 |
71 | // ============ R = 1 cases ============ |
function _ROneSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
|
function _ROneSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
| 19,396 |
158 | // Checks if a yield token is enabled.//yieldToken The address of the yield token. | function _checkYieldTokenEnabled(address yieldToken) internal view {
if (!_yieldTokens[yieldToken].enabled) {
revert TokenDisabled(yieldToken);
}
}
| function _checkYieldTokenEnabled(address yieldToken) internal view {
if (!_yieldTokens[yieldToken].enabled) {
revert TokenDisabled(yieldToken);
}
}
| 44,178 |
318 | // Rebuild the resolver caches in all MixinResolver contracts - batch 1; | MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20);
addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876);
addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0xAD95C918af576c82Df74... | MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20);
addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876);
addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0xAD95C918af576c82Df74... | 71,336 |
59 | // Claim N bought tokens to the investor as the msg sender | function claim() {
address investor = msg.sender;
if(balances[investor] == 0) {
// Not our investor
throw;
}
if(now < freezeEndsAt[investor]) {
throw; // Trying to claim early
}
uint amount = balances[investor];
balances[investor] = 0;
cl... | function claim() {
address investor = msg.sender;
if(balances[investor] == 0) {
// Not our investor
throw;
}
if(now < freezeEndsAt[investor]) {
throw; // Trying to claim early
}
uint amount = balances[investor];
balances[investor] = 0;
cl... | 41,461 |
53 | // Set a value in a tree./_key The key of the tree./_value The new value./_ID The ID of the value./ `O(log_k(n))` where/ `k` is the maximum number of children per node in the tree,/and `n` is the maximum number of nodes ever appended. | function _set(bytes32 _key, uint256 _value, bytes32 _ID) internal {
SortitionSumTree storage tree = sortitionSumTrees[_key];
uint256 treeIndex = tree.IDsToNodeIndexes[_ID];
if (treeIndex == 0) {
// No existing node.
if (_value != 0) {
// Non zero valu... | function _set(bytes32 _key, uint256 _value, bytes32 _ID) internal {
SortitionSumTree storage tree = sortitionSumTrees[_key];
uint256 treeIndex = tree.IDsToNodeIndexes[_ID];
if (treeIndex == 0) {
// No existing node.
if (_value != 0) {
// Non zero valu... | 21,015 |
76 | // Initiate a change of owner to `_owner` | function changeOwner(address _owner)
public
onlyOwner
returns (bool)
| function changeOwner(address _owner)
public
onlyOwner
returns (bool)
| 53,234 |
29 | // Returns true if this token is claimable, meaning it can have or actually have _maximumEditions[tokenId] > 1/ | function isClaimable(uint256 tokenId) external view returns (bool) {
require(_exists(tokenId), 'setTokenClaimStartPrice: Nonexisting token.');
if(_maximumEditions[tokenId] > 1)
{
return true;
}
else{
return false;
}
}
| function isClaimable(uint256 tokenId) external view returns (bool) {
require(_exists(tokenId), 'setTokenClaimStartPrice: Nonexisting token.');
if(_maximumEditions[tokenId] > 1)
{
return true;
}
else{
return false;
}
}
| 40,707 |
5 | // ============ Private Functions ============ / | function _getProposalInfo(uint256 _proposalId) internal view returns (address, uint256[3] memory) {
(, address proposer, , , uint256 endBlock, uint256 forVotes, uint256 againstVotes, , , ) =
governor.proposals(_proposalId);
return (proposer, [endBlock, forVotes.sub(againstVotes), uint256... | function _getProposalInfo(uint256 _proposalId) internal view returns (address, uint256[3] memory) {
(, address proposer, , , uint256 endBlock, uint256 forVotes, uint256 againstVotes, , , ) =
governor.proposals(_proposalId);
return (proposer, [endBlock, forVotes.sub(againstVotes), uint256... | 35,497 |
35 | // FPT-B = Staked FNX | function fnxUnStakeFPT_B(uint256 FPT_B_amount) public onlyByOwnerOrGovernance {
fnxMinePool.unstakeFPTB(FPT_B_amount);
}
| function fnxUnStakeFPT_B(uint256 FPT_B_amount) public onlyByOwnerOrGovernance {
fnxMinePool.unstakeFPTB(FPT_B_amount);
}
| 74,564 |
229 | // order irrelevant in other case | order = [uint256(0), 1, 2];
| order = [uint256(0), 1, 2];
| 72,032 |
39 | // Prevents a contract from calling itself, directly or indirectly. If you mark a function `nonReentrant`, you should also mark it `external`. Calling one `nonReentrant` function from another is not supported. Instead, you can implement a `private` function doing the actual work, and an `external` wrapper marked as `no... | modifier nonReentrant() {
require(reentrancyLock == REENTRANCY_GUARD_FREE, "nonReentrant");
reentrancyLock = REENTRANCY_GUARD_LOCKED;
_;
reentrancyLock = REENTRANCY_GUARD_FREE;
}
| modifier nonReentrant() {
require(reentrancyLock == REENTRANCY_GUARD_FREE, "nonReentrant");
reentrancyLock = REENTRANCY_GUARD_LOCKED;
_;
reentrancyLock = REENTRANCY_GUARD_FREE;
}
| 10,916 |
21 | // Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred / | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balance... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balance... | 26,720 |
4 | // Initializer variant that does not embed linearized calls to any parent initializers. Follows the multiple inheritance initializer rules defined [here](calling two of these init functions can potentially initialize the same contract twice. / | function __NORI_init_unchained() internal onlyInitializing {
// solhint-disable-previous-line no-empty-blocks, func-name-mixedcase
}
| function __NORI_init_unchained() internal onlyInitializing {
// solhint-disable-previous-line no-empty-blocks, func-name-mixedcase
}
| 56,135 |
197 | // manual antibot, play fair! | function _blacklistBot(address account) external onlyOwner() {
require(account != 0x10ED43C718714eb63d5aA57B78B54704E256024E, 'We cannot blacklist Pancakeswap');
require(!_isBot[account], "Account is already blacklisted");
_isBot[account] = true;
_confirmedBots.push(account);
}
| function _blacklistBot(address account) external onlyOwner() {
require(account != 0x10ED43C718714eb63d5aA57B78B54704E256024E, 'We cannot blacklist Pancakeswap');
require(!_isBot[account], "Account is already blacklisted");
_isBot[account] = true;
_confirmedBots.push(account);
}
| 27,521 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.