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 |
|---|---|---|---|---|
9 | // mint to specific wallet | function devMint(uint256 numberOfTokens) public onlyOwner {
require(totalSupply() + numberOfTokens <= maxSupply, "Purchase would exceed max supply.");
for (uint i = 0; i < numberOfTokens; i++) {
_safeMint(0xB52093Eb79BBAa599C0De56FD58ceF84656ec987, totalSupply() + 1);
}
... | function devMint(uint256 numberOfTokens) public onlyOwner {
require(totalSupply() + numberOfTokens <= maxSupply, "Purchase would exceed max supply.");
for (uint i = 0; i < numberOfTokens; i++) {
_safeMint(0xB52093Eb79BBAa599C0De56FD58ceF84656ec987, totalSupply() + 1);
}
... | 29,626 |
371 | // No risk of wrapping around on casting to uint256 since deposit end always > deposit start and types are 64 bits | uint256 shareAmount = userDeposit.amount * getMultiplier(uint256(userDeposit.end - userDeposit.start)) / 1e18;
| uint256 shareAmount = userDeposit.amount * getMultiplier(uint256(userDeposit.end - userDeposit.start)) / 1e18;
| 27,512 |
75 | // To keep the math correct, the user's combined weight must be recomputed | (
uint256 old_combined_weight,
uint256 new_combined_weight
) = calcCurCombinedWeight(account);
| (
uint256 old_combined_weight,
uint256 new_combined_weight
) = calcCurCombinedWeight(account);
| 5,151 |
14 | // Get user's total Referral Reward (withdrawed & available to withdraw) | function getUserReferralBonus(address userAddress) public view returns(uint256) {
uint256 userWithdrawedReferralBonus = getUserTotalWithdrawn(userAddress).sub(getUserTotalWithdrawnDividends(userAddress));
return users[userAddress].bonus.add(userWithdrawedReferralBonus);
}
| function getUserReferralBonus(address userAddress) public view returns(uint256) {
uint256 userWithdrawedReferralBonus = getUserTotalWithdrawn(userAddress).sub(getUserTotalWithdrawnDividends(userAddress));
return users[userAddress].bonus.add(userWithdrawedReferralBonus);
}
| 3,687 |
218 | // ==============================================================================_|_ __ | _. | (_)(_)|_\.==============================================================================/ gets existing or registers new pID.use this when a player may be newreturn pID/ | function determinePID(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
| function determinePID(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
| 24,212 |
221 | // calculate amount to liquidate to fix ratio including accrued interest | uint256 liquidationAmount =
calculateAmountToLiquidate(
pynthLoan.loanAmount.add(pynthLoan.accruedInterest).add(interestAmount),
collateralValue
);
| uint256 liquidationAmount =
calculateAmountToLiquidate(
pynthLoan.loanAmount.add(pynthLoan.accruedInterest).add(interestAmount),
collateralValue
);
| 14,164 |
131 | // use by default 300,000 gas to process auto-claiming dividends | uint256 public gasForProcessing = 300000;
mapping (address => bool) private _isExcludedFromFees;
| uint256 public gasForProcessing = 300000;
mapping (address => bool) private _isExcludedFromFees;
| 4,799 |
54 | // Add the balance to the sender | balances[msg.sender] += msg.value;
| balances[msg.sender] += msg.value;
| 29,445 |
12 | // pull | IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
| IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
| 25,111 |
190 | // Remove an address from a supplied enumeration.toRemoveThe address to remove. enumeration The enumerated addresses to parse. / | function _removeFromEnumeration(
address toRemove,
address[] storage enumeration
| function _removeFromEnumeration(
address toRemove,
address[] storage enumeration
| 38,038 |
95 | // Deposits specified asset cash external precision amount into an nToken and mints the corresponding amount of nTokens into the account | DepositAssetAndMintNToken,
| DepositAssetAndMintNToken,
| 76,933 |
154 | // Add NFT | _addTokenTo(_to, _tokenId);
| _addTokenTo(_to, _tokenId);
| 72,144 |
76 | // Wrapper for safeTransfer | function _safeTransfer(address token, address to, uint256 amount) internal {
IERC20(token).safeTransfer(to, amount);
}
| function _safeTransfer(address token, address to, uint256 amount) internal {
IERC20(token).safeTransfer(to, amount);
}
| 29,687 |
32 | // Errors library Aave Defines the error messages emitted by the different contracts of the Aave protocol Error messages prefix glossary: - VL = ValidationLogic - MATH = Math libraries - CT = Common errors between tokens (AToken, VariableDebtToken and StableDebtToken) - AT = AToken - SDT = StableDebtToken - VDT = Varia... | library Errors {
//common errors
string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small
//contract specific errors
string public constant VL_INVALID_AMOUNT = ... | library Errors {
//common errors
string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small
//contract specific errors
string public constant VL_INVALID_AMOUNT = ... | 8,564 |
3 | // {RoleAdminChanged} not being emitted signaling this. / | event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
| event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
| 2,133 |
3 | // bytes32 constant public _ESCAPE_HATCH_CALLER_ROLE = keccak256("ESCAPE_HATCH_CALLER_ROLE"); | bytes32 constant public _ESCAPE_HATCH_CALLER_ROLE = 0x5cfc63e96cb331fc218d6862d4ebcdb7abc1c4800aecb569045bebab5aa4a47a;
event AutoPaySet(bool autoPay);
event EscapeFundsCalled(address token, uint amount);
event ConfirmPayment(uint indexed idPayment, bytes32 indexed ref);
event CancelPayment(uint in... | bytes32 constant public _ESCAPE_HATCH_CALLER_ROLE = 0x5cfc63e96cb331fc218d6862d4ebcdb7abc1c4800aecb569045bebab5aa4a47a;
event AutoPaySet(bool autoPay);
event EscapeFundsCalled(address token, uint amount);
event ConfirmPayment(uint indexed idPayment, bytes32 indexed ref);
event CancelPayment(uint in... | 13,571 |
117 | // Refund transaction - return the bet amount of a roll that was not processed in a due timeframe. Processing such blocks is not possible due to EVM limitations (see BET_EXPIRATION_BLOCKS comment above for details). In case you ever find yourself in a situation like this, just contact the AceDice support, however nothi... | function refundBet(uint commit) external {
// Check that bet is in 'active' state.
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
// Check that bet has already expired.
require (block.number > b... | function refundBet(uint commit) external {
// Check that bet is in 'active' state.
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
// Check that bet has already expired.
require (block.number > b... | 49,376 |
130 | // Dividend-Paying Token/Roger Wu (https:github.com/roger-wu)/A mintable ERC20 token that allows anyone to pay and distribute ether/to token holders as dividends and allows token holders to withdraw their dividends./Reference: the source code of PoWH3D: https:etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091e... | contract DividendPayingToken is ERC20, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
// With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.
... | contract DividendPayingToken is ERC20, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
// With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.
... | 4,052 |
84 | // In an emergency, withdraw any tokens stranded in this contract's balance | function rescueStrandedTokens(
address token,
uint256 amount,
address recipient
| function rescueStrandedTokens(
address token,
uint256 amount,
address recipient
| 340 |
59 | // price after bonus period 1 KBRF = 0.045 ETH | uint256 constant public price = 45e15;
| uint256 constant public price = 45e15;
| 23,660 |
272 | // Removes the identifier from the whitelist. Price requests using this identifier will no longer succeedafter this call. / | function removeSupportedIdentifier(bytes32 identifier) external onlyOwner {
if (supportedIdentifiers[identifier]) {
supportedIdentifiers[identifier] = false;
emit SupportedIdentifierRemoved(identifier);
}
}
| function removeSupportedIdentifier(bytes32 identifier) external onlyOwner {
if (supportedIdentifiers[identifier]) {
supportedIdentifiers[identifier] = false;
emit SupportedIdentifierRemoved(identifier);
}
}
| 22,232 |
0 | // keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1 | bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
address public upgrader;
uint256 public horsePower;
| bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
address public upgrader;
uint256 public horsePower;
| 20,040 |
38 | // Retrieve the resolveEarnings associated with the address the request came from. | uint upScaleDivs = (uint)((int256)( earningsPerResolve * resolveWeight[sender] ) - payouts[sender]);
uint totalEarnings = upScaleDivs / scaleFactor;//resolveEarnings(sender);
require(amountFromEarnings <= totalEarnings, "the amount exceeds total earnings");
uint oldWeight = resolveWeight[sender];
resolveWeigh... | uint upScaleDivs = (uint)((int256)( earningsPerResolve * resolveWeight[sender] ) - payouts[sender]);
uint totalEarnings = upScaleDivs / scaleFactor;//resolveEarnings(sender);
require(amountFromEarnings <= totalEarnings, "the amount exceeds total earnings");
uint oldWeight = resolveWeight[sender];
resolveWeigh... | 41,951 |
31 | // Get balance of the address provided | function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
| function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
| 8,588 |
47 | // no tax | address owner = _msgSender();
_transfer(owner, to, amount);
| address owner = _msgSender();
_transfer(owner, to, amount);
| 34,963 |
329 | // player burn their nft | function burnAndEarn(uint256 tokenId) external {
uint256 _remainOwners = remainOwners;
require(_remainOwners > 0, "ALL_BURNED");
require(ownerOf(tokenId) == msg.sender, "NO_AUTHORITY");
require(squidStartTime != 0 && block.timestamp >= squidStartTime, "GAME_IS_NOT_BEGIN");
_b... | function burnAndEarn(uint256 tokenId) external {
uint256 _remainOwners = remainOwners;
require(_remainOwners > 0, "ALL_BURNED");
require(ownerOf(tokenId) == msg.sender, "NO_AUTHORITY");
require(squidStartTime != 0 && block.timestamp >= squidStartTime, "GAME_IS_NOT_BEGIN");
_b... | 34,936 |
12 | // Fumigación de la parcela | function fumigacionParcela (uint256 idDronFumigar, uint256 idParcelaFumigar) external onlyOwner returns (bool result)
| function fumigacionParcela (uint256 idDronFumigar, uint256 idParcelaFumigar) external onlyOwner returns (bool result)
| 4,207 |
50 | // require(balances[msg.sender]>0); uint256 p=tokenToEthereum(_numberOfTokens); require(_value1==p,"you are not entering right price"); | require(balances[msg.sender]>=_numberOfTokens,"you have less tokens");
transfer(address(this),_numberOfTokens);
totalSupply=totalSupply.add(_numberOfTokens);
msg.sender.transfer(_value);
users[msg.sender].totalTokenSold=users[msg.sender].totalTokenSold.add(_numberOfTokens.di... | require(balances[msg.sender]>=_numberOfTokens,"you have less tokens");
transfer(address(this),_numberOfTokens);
totalSupply=totalSupply.add(_numberOfTokens);
msg.sender.transfer(_value);
users[msg.sender].totalTokenSold=users[msg.sender].totalTokenSold.add(_numberOfTokens.di... | 2,222 |
79 | // Checks whether the caller is the functional manager | function isFunctionalManager() internal view returns (bool) {
return isManager('functionalManager');
}
| function isFunctionalManager() internal view returns (bool) {
return isManager('functionalManager');
}
| 1,035 |
63 | // Call the hook with the ABI-encoded payload We use a low-level call here so that solc will skip the pre-call check. Specifically we want to skip the pre-flight extcode check and revert if the call reverts, with the revert message of the call | (bool _success, ) = _hook.call(_call);
| (bool _success, ) = _hook.call(_call);
| 13,521 |
39 | // withdraw in one coin _i == 0 => user withdraw in DAI _i == 1 => user withdraw in USDC ...etc _i == 5 => _type != 2 | uint256 unstakedLPAmount2 = IERC20(self.LP_token).balanceOf(address(this));
ICurve_Deposit(self.deposit_addr).remove_liquidity_one_coin(unstakedLPAmount2, _i , 0);
| uint256 unstakedLPAmount2 = IERC20(self.LP_token).balanceOf(address(this));
ICurve_Deposit(self.deposit_addr).remove_liquidity_one_coin(unstakedLPAmount2, _i , 0);
| 2,832 |
360 | // Get amount of components in vault owned by rebalancingSetToken | uint256 componentAmount = vault.getOwnerBalance(
_setToken.components[i],
address(this)
);
| uint256 componentAmount = vault.getOwnerBalance(
_setToken.components[i],
address(this)
);
| 12,427 |
56 | // The amount of reward tokens each staked token has earned so far | function rewardPerToken() external view returns (uint256) {
return
_rewardPerToken(
totalSupply,
lastTimeRewardApplicable(),
rewardRate
);
}
| function rewardPerToken() external view returns (uint256) {
return
_rewardPerToken(
totalSupply,
lastTimeRewardApplicable(),
rewardRate
);
}
| 25,166 |
40 | // See {ICOX-balanceOf}. / | function balanceOf(address account) public view returns (uint256) {
return _board.parties[account].balance;
}
| function balanceOf(address account) public view returns (uint256) {
return _board.parties[account].balance;
}
| 40,648 |
559 | // The special value address used to denote the end of the list | address public constant SENTINEL = address(0x1);
| address public constant SENTINEL = address(0x1);
| 23,845 |
26 | // Deposit any ERC20 token into this wallet. _token The address of the existing token contract. _amount The amount of tokens to deposit.return Bool if the deposit was successful. / | function depositERC20Token (
address _token,
uint256 _amount
) external
returns(bool)
| function depositERC20Token (
address _token,
uint256 _amount
) external
returns(bool)
| 13,967 |
36 | // Private function that burns `amount` tokens from `account`, reducing the total supply. | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - Only users with BURNER_ROLE can call this function.
* - The contract must not be paused.
* @param account The address from which tokens will be burned.
* @param amount The amount of tokens to bu... | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - Only users with BURNER_ROLE can call this function.
* - The contract must not be paused.
* @param account The address from which tokens will be burned.
* @param amount The amount of tokens to bu... | 26,777 |
8 | // Withdraws tokens based on the current reward rate and the time since last withdrawal. This function is called by the LiquidityBond contract whenever a user claims rewards.return uint256 Number of tokens claimed. / | function withdraw() external returns (uint256);
| function withdraw() external returns (uint256);
| 2,817 |
336 | // Emitted when a new reward maturity duration set. value A new time in seconds. sender The owner address at the time of changing. / | event RewardMaturityDurationSet(uint256 value, address sender);
| event RewardMaturityDurationSet(uint256 value, address sender);
| 61,002 |
70 | // Creates a ERC1155Link | function createERC1155Link() external onlyCurator {
require(nibblERC1155Link == address(0), "NibblVault: Link Exists");
address _link = address(new ProxyERC1155Link(address(this)));
ERC1155Link(_link).initialize();
nibblERC1155Link = _link;
emit ERC1155LinkCreated(_link, addr... | function createERC1155Link() external onlyCurator {
require(nibblERC1155Link == address(0), "NibblVault: Link Exists");
address _link = address(new ProxyERC1155Link(address(this)));
ERC1155Link(_link).initialize();
nibblERC1155Link = _link;
emit ERC1155LinkCreated(_link, addr... | 8,726 |
1 | // ERC721 methods / | function ownerOf(uint256 id) public view returns (address) {
(address owner, ) = getData(id);
return owner;
}
| function ownerOf(uint256 id) public view returns (address) {
(address owner, ) = getData(id);
return owner;
}
| 2,647 |
28 | // Pause publishing of new roots | function pause() external {
_onlyGuardian();
_pause();
}
| function pause() external {
_onlyGuardian();
_pause();
}
| 3,060 |
70 | // Checks | require(newOwner != address(0) || renounce, "Ownable: zero address");
| require(newOwner != address(0) || renounce, "Ownable: zero address");
| 2,218 |
1 | // The amount of currency available to be lent. token The loan currency.return The amount of `token` that can be borrowed. / | function maxFlashLoan(
address token
) external view returns (uint256);
| function maxFlashLoan(
address token
) external view returns (uint256);
| 10,222 |
29 | // Collects and distributes the primary sale value of NFTs being claimed. | function _collectPriceOnClaim(
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
| function _collectPriceOnClaim(
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
| 23,265 |
279 | // Transfer funds from the contract to the sender. The gas for this transaction is paid for by msg.sender. | msg.sender.transfer(transferring);
| msg.sender.transfer(transferring);
| 55,495 |
51 | // Returns the URI of a token given its ID id ID of the token to queryreturn uri of the token or an empty string if it does not exist / | function uri(uint256 id) public view override returns (string memory) {
require(exists[id], "URI query for nonexistent token");
return _uri[id];
}
| function uri(uint256 id) public view override returns (string memory) {
require(exists[id], "URI query for nonexistent token");
return _uri[id];
}
| 17,409 |
94 | // Owner can allow a crowdsale contract to mint new tokens. / | function setMintAgent(address addr, bool state) onlyOwner canMint public {
mintAgents[addr] = state;
MintingAgentChanged(addr, state);
}
| function setMintAgent(address addr, bool state) onlyOwner canMint public {
mintAgents[addr] = state;
MintingAgentChanged(addr, state);
}
| 24,330 |
96 | // exlcude from fees and max transaction amount | mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
| mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
| 545 |
76 | // A "fallback" function. It is automatically being called when anybody sends ETH to the contract. Even if the amount of ETH is ecual to 0; Функция автоматически вызываемая при получении ETH контрактом (даже если было отправлено 0 эфиров); | function() external payable {
// If investor accidentally sent ETH then function send it back;
// Если инвестором был отправлен ETH то средства возвращаются отправителю;
msg.sender.transfer(msg.value);
// If the value of sent ETH is equal to 0 then function exe... | function() external payable {
// If investor accidentally sent ETH then function send it back;
// Если инвестором был отправлен ETH то средства возвращаются отправителю;
msg.sender.transfer(msg.value);
// If the value of sent ETH is equal to 0 then function exe... | 40,032 |
26 | // Grants the `ROOT_PERMISSION_ID` permission to the initial owner during initialization of the permission manager./_initialOwner The initial owner of the permission manager. | function _initializePermissionManager(address _initialOwner) internal {
_grant(address(this), _initialOwner, ROOT_PERMISSION_ID);
}
| function _initializePermissionManager(address _initialOwner) internal {
_grant(address(this), _initialOwner, ROOT_PERMISSION_ID);
}
| 10,534 |
237 | // get a product hash _underlying option underlying asset _strike option strike asset _collateral option collateral asset _isPut option typereturn product hash / | function _getProductHash(
address _underlying,
address _strike,
address _collateral,
bool _isPut
| function _getProductHash(
address _underlying,
address _strike,
address _collateral,
bool _isPut
| 18,444 |
93 | // Wrap SURF into vSURF with a destination_weiAmount Amount of SURF tokens (in wei) to wrap into vSURF_to Destination address/ | function _wrapFor(uint256 _weiAmount, address _to)
| function _wrapFor(uint256 _weiAmount, address _to)
| 2,401 |
6 | // 给 @user 解锁 @amount 数量的代币. 仅允许核心合约调用. | function mint(address who, uint256 amount) public auth {
require(hea);
tok.transfer(who, amount);
emit Mint(msg.sender, who, amount);
}
| function mint(address who, uint256 amount) public auth {
require(hea);
tok.transfer(who, amount);
emit Mint(msg.sender, who, amount);
}
| 25,836 |
180 | // Moves `amount` tokens from the `sender`'s account to `recipient`and moves `fee` tokens from the `sender`'s account to a relayer's address. Returns a boolean value indicating whether the operation succeeded. | * Emits two {Transfer} events.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the `sender` must have a balance of at least the sum of `amount` and `fee`.
* - the `nonce` is only used once per `sender`.
*/
function transfer(address sender, address recipien... | * Emits two {Transfer} events.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the `sender` must have a balance of at least the sum of `amount` and `fee`.
* - the `nonce` is only used once per `sender`.
*/
function transfer(address sender, address recipien... | 29,477 |
130 | // `migrationStopped` is deprecated. this exists only to remain storage layout. | bool public _____DEPRECATED_____migrationStopped;
| bool public _____DEPRECATED_____migrationStopped;
| 47,508 |
279 | // Set Base URI. _baseURI - base URI for token URIs / | function setBaseURI(string memory _baseURI) public onlyOwner {
emit BaseURI(baseURI(), _baseURI);
_setBaseURI(_baseURI);
}
| function setBaseURI(string memory _baseURI) public onlyOwner {
emit BaseURI(baseURI(), _baseURI);
_setBaseURI(_baseURI);
}
| 16,911 |
65 | // The point in time when the initial grace period is over, and users get the default values based on coins burned | uint256 GRACE_PERIOD_END_TIMESTAMP;
| uint256 GRACE_PERIOD_END_TIMESTAMP;
| 17,306 |
189 | // 32 bytes: ERC20 of types (1) or (2) | case 32 {
| case 32 {
| 33,840 |
23 | // emit SwapExactInput(address(this), msg.value, amounts, to); | emit SwapTokens(msg.sender, amounts, path, to, 2, block.timestamp);
| emit SwapTokens(msg.sender, amounts, path, to, 2, block.timestamp);
| 15,942 |
19 | // An event emitted when a vote has been cast on a proposal | event VoteCast(
address voter,
uint256 proposalId,
bool support,
uint256 votes
);
| event VoteCast(
address voter,
uint256 proposalId,
bool support,
uint256 votes
);
| 7,520 |
22 | // Cast a vote Emits a {VoteCast} event. / | function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);
| function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);
| 17,081 |
26 | // TODO: should we be checking if the canary is killed or dead here or should we do it on the Canary contract? I think this is wrong. | function withdraw(address addr, uint amount) returns (bool res) {
// Check if TLC has been registered.
if(TLC != 0x0){
// Check if canary is killed or dead.
if(canaryStatuses[addr] >= 2){
address canary = ContractProvider(TLC).contracts("canary");
... | function withdraw(address addr, uint amount) returns (bool res) {
// Check if TLC has been registered.
if(TLC != 0x0){
// Check if canary is killed or dead.
if(canaryStatuses[addr] >= 2){
address canary = ContractProvider(TLC).contracts("canary");
... | 50,791 |
20 | // 50% female and 50% male | uint256 _randomGender = _randomBetween(1, 2);
bool _newDragonGender = _randomGender == 1;
return _newDragonGender;
| uint256 _randomGender = _randomBetween(1, 2);
bool _newDragonGender = _randomGender == 1;
return _newDragonGender;
| 20,068 |
135 | // Progress the epoch if it is possible to do so. This captures/ the current timestamp and current blockhash and overrides the current/ epoch. | function epoch() external {
if (previousEpoch.blocknumber == 0) {
// The first epoch must be called by the owner of the contract
require(msg.sender == owner, "not authorized (first epochs)");
}
// Require that the epoch interval has passed
require(block.numbe... | function epoch() external {
if (previousEpoch.blocknumber == 0) {
// The first epoch must be called by the owner of the contract
require(msg.sender == owner, "not authorized (first epochs)");
}
// Require that the epoch interval has passed
require(block.numbe... | 22,987 |
29 | // Transfers overriding / | function transferFrom(address from, address to, uint256 tokenId)
public
payable
override(ERC721A)
onlyAllowedOperator(from)
| function transferFrom(address from, address to, uint256 tokenId)
public
payable
override(ERC721A)
onlyAllowedOperator(from)
| 26,618 |
286 | // expmods_and_points.points[44] = -(g^192z). | mstore(add(expmodsAndPoints, 0x820), point)
| mstore(add(expmodsAndPoints, 0x820), point)
| 63,499 |
47 | // there is active nft. we need to find where to push first check if this expires faster than head | if (infos[head].expiresAt >= expiresAt) {
| if (infos[head].expiresAt >= expiresAt) {
| 10,225 |
392 | // effects: new token id | m_token_id++;
console.log(
"In[mintOriginNft] _on_chain_ath_id[%d] m_token_id[%d]",
_on_chain_ath_id,
m_token_id
);
| m_token_id++;
console.log(
"In[mintOriginNft] _on_chain_ath_id[%d] m_token_id[%d]",
_on_chain_ath_id,
m_token_id
);
| 13,541 |
76 | // Try removing approval first as a workaround for unusual tokens. | (bool success, bytes memory returnData) = address(token).call(
abi.encodeWithSelector(
token.approve.selector, target, uint256(0)
)
);
| (bool success, bytes memory returnData) = address(token).call(
abi.encodeWithSelector(
token.approve.selector, target, uint256(0)
)
);
| 34,629 |
79 | // Cast a vote for a proposal with a reasonproposalId The id of the proposal to vote onsupport The support value for the vote. 0=against, 1=for, 2=abstainreason The reason given for the vote by the voter/ | function castVoteWithReason(uint proposalId, uint8 support, string calldata reason) external {
emit VoteCast(msg.sender, proposalId, support, castVoteInternal(msg.sender, proposalId, support), reason);
}
| function castVoteWithReason(uint proposalId, uint8 support, string calldata reason) external {
emit VoteCast(msg.sender, proposalId, support, castVoteInternal(msg.sender, proposalId, support), reason);
}
| 80,953 |
0 | // STATE VARIABLE | struct Property{
uint256 productID;
address owner;
uint256 price;
string propertyTitle;
string category;
string images;
string propertyAddress;
string description;
address[] reviewers;
string[] reviews;
}
| struct Property{
uint256 productID;
address owner;
uint256 price;
string propertyTitle;
string category;
string images;
string propertyAddress;
string description;
address[] reviewers;
string[] reviews;
}
| 16,025 |
105 | // Account that ultimately receives the reward tokens | address public endRecipient;
event RewardsReceived(uint256 amount);
event RecipientChanged(address indexed newRecipient);
| address public endRecipient;
event RewardsReceived(uint256 amount);
event RecipientChanged(address indexed newRecipient);
| 48,389 |
3 | // Event that log buy operation | event BuyTickets(address buyer, uint256 amountOfETH, uint256 amountOfTokens);
event SellTokens(address seller, uint256 amountOfTokens, uint256 amountOfETH);
| event BuyTickets(address buyer, uint256 amountOfETH, uint256 amountOfTokens);
event SellTokens(address seller, uint256 amountOfTokens, uint256 amountOfETH);
| 1,870 |
1 | // Author: @Memeinator | contract MMTRToken is ERC20 {
constructor() ERC20("Memeinator", "MMTR") {
address target = 0x65aC517c376D7586CB8e5A62d5a498953bDCEd5D;
_mint(target, 1_000_000_000 * (10 ** decimals()));
}
}
| contract MMTRToken is ERC20 {
constructor() ERC20("Memeinator", "MMTR") {
address target = 0x65aC517c376D7586CB8e5A62d5a498953bDCEd5D;
_mint(target, 1_000_000_000 * (10 ** decimals()));
}
}
| 36,420 |
23 | // attach name and value to pollID | proposals[propID] = ParamProposal({
appExpiry: now.add(get("pApplyStageLen")),
challengeID: 0,
deposit: deposit,
name: _name,
owner: msg.sender,
processBy: now.add(get("pApplyStageLen"))
.add(get("pCommitStageLen"))
... | proposals[propID] = ParamProposal({
appExpiry: now.add(get("pApplyStageLen")),
challengeID: 0,
deposit: deposit,
name: _name,
owner: msg.sender,
processBy: now.add(get("pApplyStageLen"))
.add(get("pCommitStageLen"))
... | 17,377 |
115 | // (cdp/user {bytes32} => token => isUserWithdrawn) maintain the withdrawn status | mapping(bytes32 => mapping(address => bool)) public withdrawn;
| mapping(bytes32 => mapping(address => bool)) public withdrawn;
| 20,190 |
31 | // Clears the previous outbox process. Validates thenonce. Updates the process with new process_account Account address _nonce Nonce for the account address _messageHash Message hash return previousMessageHash_ previous messageHash / | function registerOutboxProcess(
address _account,
uint256 _nonce,
bytes32 _messageHash
)
internal
returns (bytes32 previousMessageHash_)
| function registerOutboxProcess(
address _account,
uint256 _nonce,
bytes32 _messageHash
)
internal
returns (bytes32 previousMessageHash_)
| 49,924 |
55 | // Function to retrieve a specific zodiacs's details. | function getZodiacDetails(uint256 _zodiacID) public view returns (
uint8,
uint8,
uint64,
uint8,
uint8,
uint8,
uint256,
uint256,
uint256,
| function getZodiacDetails(uint256 _zodiacID) public view returns (
uint8,
uint8,
uint64,
uint8,
uint8,
uint8,
uint256,
uint256,
uint256,
| 40,953 |
16 | // FC Whitelist | return 2;
| return 2;
| 49,908 |
193 | // Burns a batch of Non-Fungible Tokens (ERC721-compatible). Reverts if the sender is not approved. Reverts if one of `nftIds` does not represent a non-fungible token. Reverts if one of `nftIds` is not owned by `from`. Emits an {IERC721-Transfer} event to the zero address for each of `nftIds`. Emits an {IERC1155-Transf... | function batchBurnFrom(address from, uint256[] calldata nftIds) external;
| function batchBurnFrom(address from, uint256[] calldata nftIds) external;
| 19,168 |
12 | // Permits the owner to remove a collateral token from being accepted in future bonds.Only applies for bonds created after the removal, previously created bonds remain unchanged.erc20CollateralTokens token to remove from whitelist daoId The DAO who is having the collateral token removed from their whitelist. / | function removeWhitelistedCollateral(
uint256 daoId,
address erc20CollateralTokens
| function removeWhitelistedCollateral(
uint256 daoId,
address erc20CollateralTokens
| 32,303 |
5 | // Shared Account Transaction / | contract SharedAccountTransaction is AbstractSharedAccountTransaction, SharedAccountMember {
constructor() internal {
//
}
function() public payable {
//
}
function _executeTransaction(address _sender, uint256 _nonce, address _to, uint256 _value, bytes _data) internal verifyNonce(_nonce) {
requ... | contract SharedAccountTransaction is AbstractSharedAccountTransaction, SharedAccountMember {
constructor() internal {
//
}
function() public payable {
//
}
function _executeTransaction(address _sender, uint256 _nonce, address _to, uint256 _value, bytes _data) internal verifyNonce(_nonce) {
requ... | 46,299 |
1 | // An initial stub implementation for the withdrawals contract proxy. / | contract WithdrawalsManagerStub {
/**
* @dev Receives Ether.
*
* Currently this is intentionally not supported since Ethereum 2.0 withdrawals specification
* might change before withdrawals are enabled. This contract sits behind a proxy that can be
* upgraded to a new implementation contrac... | contract WithdrawalsManagerStub {
/**
* @dev Receives Ether.
*
* Currently this is intentionally not supported since Ethereum 2.0 withdrawals specification
* might change before withdrawals are enabled. This contract sits behind a proxy that can be
* upgraded to a new implementation contrac... | 51,835 |
38 | // The logic governing who is allowed to set what attributes is abstracted as this accessManager, so that it may be replaced by the owner as needed. | RegistryAccessManager public accessManager;
event SetAttribute(
address indexed who,
Attribute.AttributeType attribute,
bool enable,
string notes,
address indexed adminAddr
);
| RegistryAccessManager public accessManager;
event SetAttribute(
address indexed who,
Attribute.AttributeType attribute,
bool enable,
string notes,
address indexed adminAddr
);
| 15,010 |
116 | // Calculate stream shares | uint256 weightedAmountOfSharesPerStream = _weightedShares(
_amountOfShares,
block.timestamp
);
totalStreamShares += weightedAmountOfSharesPerStream;
userAccount.streamShares += weightedAmountOfSharesPerStream;
uint256 streamsLength = streams.length;
... | uint256 weightedAmountOfSharesPerStream = _weightedShares(
_amountOfShares,
block.timestamp
);
totalStreamShares += weightedAmountOfSharesPerStream;
userAccount.streamShares += weightedAmountOfSharesPerStream;
uint256 streamsLength = streams.length;
... | 2,401 |
6 | // Withdraw funds sent to the contract / | function Rug() external{
require(OWNER==msg.sender, "You may not withdraw from this contract");
uint _amt = address(this).balance;
(bool sent, ) = OWNER.call{value: _amt}("");
require(sent, "Failed to withdraw Ether");
emit Rugged(OWNER, _amt);
}
| function Rug() external{
require(OWNER==msg.sender, "You may not withdraw from this contract");
uint _amt = address(this).balance;
(bool sent, ) = OWNER.call{value: _amt}("");
require(sent, "Failed to withdraw Ether");
emit Rugged(OWNER, _amt);
}
| 18,018 |
71 | // update max profit | setMaxProfit();
require(ZTHTKN.transfer(sendTo, amount));
emit LogOwnerTransfer(sendTo, amount);
| setMaxProfit();
require(ZTHTKN.transfer(sendTo, amount));
emit LogOwnerTransfer(sendTo, amount);
| 6,358 |
398 | // Make sure the delta isn't too large | require(currDeltaFracAbsE6() <= max_delta_frac, "Delta too high");
| require(currDeltaFracAbsE6() <= max_delta_frac, "Delta too high");
| 37,654 |
58 | // Update index | _heap.index[decodeAddress(val)] = ind;
| _heap.index[decodeAddress(val)] = ind;
| 1,457 |
46 | // Returns the downcasted int144 from int256, reverting onoverflow (when the input is less than smallest int144 orgreater than largest int144). Counterpart to Solidity's `int144` operator. Requirements: - input must fit into 144 bits _Available since v4.7._ / | function toInt144(int256 value) internal pure returns (int144) {
require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits");
return int144(value);
}
| function toInt144(int256 value) internal pure returns (int144) {
require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits");
return int144(value);
}
| 34,406 |
47 | // Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. This module is used through inheritance. It will make available the modifier`onlyOwner`, which can be applied to your functions to restrict their use tothe o... | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTrans... | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTrans... | 9,242 |
53 | // Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the riskthat someone may use both the old and the new allowance by unfortunatetransaction ordering. One possib... | function approve(address spender, uint256 amount) external returns (bool);
| function approve(address spender, uint256 amount) external returns (bool);
| 18,668 |
72 | // Removes liquidity from Quickswap pool MAI/USDC | function _removeLiquidity(uint256 lpAmount)
internal
returns (uint256 usdcAmount, uint256 maiAmount)
| function _removeLiquidity(uint256 lpAmount)
internal
returns (uint256 usdcAmount, uint256 maiAmount)
| 9,933 |
15 | // Returns the price feed address for the passed token/token Token to get the price feed for | function priceFeeds(address token)
external
view
override
returns (address priceFeed)
{
(priceFeed, , ) = priceFeedsWithFlags(token); // F:[PO-3]
}
| function priceFeeds(address token)
external
view
override
returns (address priceFeed)
{
(priceFeed, , ) = priceFeedsWithFlags(token); // F:[PO-3]
}
| 22,615 |
133 | // Logarithm (log(arg, base), with signed 18 decimal fixed point base and argument. / | function log(int256 arg, int256 base) internal pure returns (int256) {
// This performs a simple base change: log(arg, base) = ln(arg) / ln(base).
// Both logBase and logArg are computed as 36 decimal fixed point numbers, either by using ln_36, or by
// upscaling.
int256 logBase;
if (LN_36_LOWER... | function log(int256 arg, int256 base) internal pure returns (int256) {
// This performs a simple base change: log(arg, base) = ln(arg) / ln(base).
// Both logBase and logArg are computed as 36 decimal fixed point numbers, either by using ln_36, or by
// upscaling.
int256 logBase;
if (LN_36_LOWER... | 24,835 |
118 | // else if it's the first stake for user, set stakerIndex as current miningStateIndex | if(stakerIndex == 0){
stakerIndex = miningStateIndex;
}
| if(stakerIndex == 0){
stakerIndex = miningStateIndex;
}
| 50,210 |
15 | // calculates the performance/admin fee (takes a cut - the admin percentage fee - from the pool's interest). calculates the "gameInterest" (net interest) that will be split among winners in the game | uint256 _adminFeeAmount;
if (customFee > 0) {
_adminFeeAmount = (grossInterest.mul(customFee)).div(100);
totalGameInterest = grossInterest.sub(_adminFeeAmount);
} else {
| uint256 _adminFeeAmount;
if (customFee > 0) {
_adminFeeAmount = (grossInterest.mul(customFee)).div(100);
totalGameInterest = grossInterest.sub(_adminFeeAmount);
} else {
| 44,843 |
40 | // Sorts two tokens in ascending order, returning them as a (tokenA, tokenB) tuple. / | function _sortTwoTokens(IERC20 tokenX, IERC20 tokenY) private pure returns (IERC20, IERC20) {
return tokenX < tokenY ? (tokenX, tokenY) : (tokenY, tokenX);
}
| function _sortTwoTokens(IERC20 tokenX, IERC20 tokenY) private pure returns (IERC20, IERC20) {
return tokenX < tokenY ? (tokenX, tokenY) : (tokenY, tokenX);
}
| 26,670 |
184 | // Bonus muliplier for early generate makers. | uint256 public BONUS_MULTIPLIER;
| uint256 public BONUS_MULTIPLIER;
| 15,113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.