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 |
|---|---|---|---|---|
7 | // Delegates the current call to the address returned by `_implementation()`. This function does not return to its internall call site, it will return directly to the external caller. / | function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
| function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
| 1,994 |
25 | // Close all streams before changing rate | uint256[] memory streams = _streamsByRecipient[recipient];
for (uint256 index = 0; index < streams.length; index++) {
uint256 streamId = streams[index];
_close(streamId);
}
| uint256[] memory streams = _streamsByRecipient[recipient];
for (uint256 index = 0; index < streams.length; index++) {
uint256 streamId = streams[index];
_close(streamId);
}
| 26,300 |
198 | // {BurnEnded} uint timestamp, uint block number. / | function cleanUpAndEndTheBurn() internal {
require(Bools.autoBuyBackAndBurnEnabled, "burn not enabled");
moveTokens(Addr[Key.BURN], Addr[Key.TREASURY], 0);
moveTokens(Addr[Key.LIQUIDITY], Addr[Key.TREASURY], 0);
moveTokens(Addr[Key.PROXY], Addr[Key.TREASURY], 0);
setTax(Key.B... | function cleanUpAndEndTheBurn() internal {
require(Bools.autoBuyBackAndBurnEnabled, "burn not enabled");
moveTokens(Addr[Key.BURN], Addr[Key.TREASURY], 0);
moveTokens(Addr[Key.LIQUIDITY], Addr[Key.TREASURY], 0);
moveTokens(Addr[Key.PROXY], Addr[Key.TREASURY], 0);
setTax(Key.B... | 18,625 |
510 | // transferPoint(): transfer _point to _target, clearing all permissions data and keys if _reset is trueNote: the _reset flag is useful when transferring the point toa recipient who doesn't trust the previous owner.Requirements:- :msg.sender must be either _point's current owner, authorizedto transfer _point, or author... | function transferPoint(uint32 _point, address _target, bool _reset)
public
| function transferPoint(uint32 _point, address _target, bool _reset)
public
| 51,352 |
14 | // Redeem! | _balances[recipient] += amount;
_totalSupply += amount;
Transfer(0, recipient, amount);
| _balances[recipient] += amount;
_totalSupply += amount;
Transfer(0, recipient, amount);
| 35,977 |
6 | // Setup and admin functions | function DSTokenController( DSTokenFrontend frontend, DSBalanceDB baldb, DSApprovalDB apprdb ) {
_frontend = frontend;
_balances = baldb;
_approvals = apprdb;
}
| function DSTokenController( DSTokenFrontend frontend, DSBalanceDB baldb, DSApprovalDB apprdb ) {
_frontend = frontend;
_balances = baldb;
_approvals = apprdb;
}
| 16,900 |
154 | // calculating number of unacheived targets | for(uint256 _i = 1; _i <= 12; _i++) {
if(_pet.monthlyDepositAmount[_i] < _pet.monthlyCommitmentAmount) {
_unachieveTargetCount++;
}
| for(uint256 _i = 1; _i <= 12; _i++) {
if(_pet.monthlyDepositAmount[_i] < _pet.monthlyCommitmentAmount) {
_unachieveTargetCount++;
}
| 27,749 |
195 | // upgrades the converter to the latest version can only be called by the owner note that the owner needs to call acceptOwnership on the new converter after the upgrade/ | function upgrade() public ownerOnly {
IConverterUpgrader converterUpgrader = IConverterUpgrader(addressOf(CONVERTER_UPGRADER));
// trigger de-activation event
emit Activation(converterType(), anchor, false);
transferOwnership(converterUpgrader);
converterUpgrader.upgrade(ve... | function upgrade() public ownerOnly {
IConverterUpgrader converterUpgrader = IConverterUpgrader(addressOf(CONVERTER_UPGRADER));
// trigger de-activation event
emit Activation(converterType(), anchor, false);
transferOwnership(converterUpgrader);
converterUpgrader.upgrade(ve... | 10,060 |
290 | // Get current borrow balance of a token _token token address This is an estimation. Add a new checkpoint first, if you want to derive the exact balance. / | function getBorrowBalanceCurrent(
address _token,
address _accountAddr
| function getBorrowBalanceCurrent(
address _token,
address _accountAddr
| 15,116 |
7 | // Send tokens to an address without that address claiming them | function sendTokens(address dst, uint256 tokenAmount) virtual external;
| function sendTokens(address dst, uint256 tokenAmount) virtual external;
| 66,161 |
129 | // Change the random generator The calls to functions are used to verify the new generator implements them properly.It is necessary to wait for the VRF response before starting a round.Callable only by the contract owner _randomGeneratorAddress: address of the random generator / | function changeRandomGenerator(address _randomGeneratorAddress) external onlyOwner {
require(_lotteries[currentLotteryId].status == Status.Claimable, "Lottery not in claimable");
// Request a random number from the generator based on a seed
IRandomNumberGenerator(_randomGeneratorAddress).ge... | function changeRandomGenerator(address _randomGeneratorAddress) external onlyOwner {
require(_lotteries[currentLotteryId].status == Status.Claimable, "Lottery not in claimable");
// Request a random number from the generator based on a seed
IRandomNumberGenerator(_randomGeneratorAddress).ge... | 53,503 |
76 | // PRIVATE: Transfers tokens from one account to another This will apply any transaction fees and updating balances (including reflection) | function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
... | function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
... | 36,050 |
5 | // Maximum fraction of interest that can be set aside for reserves / | uint256 internal constant RESERVE_FACTOR_MAX_MANTISSA = 1e18;
| uint256 internal constant RESERVE_FACTOR_MAX_MANTISSA = 1e18;
| 27,288 |
34 | // calls all the internal functions above, to transfer a token from one user to another | function _clearApprovalAndTransfer(address _from, address _to, uint _tokenId) internal
| function _clearApprovalAndTransfer(address _from, address _to, uint _tokenId) internal
| 20,483 |
80 | // Add liquidity to the ETRNL/AVAX pair | emit AutomaticLiquidityProvision(amountETRNL, contractBalance, amountAVAX);
eternal.approve(address(joeRouter), amountETRNL);
| emit AutomaticLiquidityProvision(amountETRNL, contractBalance, amountAVAX);
eternal.approve(address(joeRouter), amountETRNL);
| 32,072 |
10 | // Address of the current leader | address public leader;
| address public leader;
| 4,283 |
1 | // Returns staking rewards fee rate/ | function getFee() external view returns (uint16 feeBasisPoints);
| function getFee() external view returns (uint16 feeBasisPoints);
| 5,451 |
5 | // Deposit function | function() external payable {
//require(AllowedAddressesToSendFunds[msg.sender],"You are not allowed!");
require(CheckIfAllowed(msg.sender),"You are not allowed!");
emit Deposit(msg.sender,msg.value);
}
| function() external payable {
//require(AllowedAddressesToSendFunds[msg.sender],"You are not allowed!");
require(CheckIfAllowed(msg.sender),"You are not allowed!");
emit Deposit(msg.sender,msg.value);
}
| 40,173 |
84 | // Only Escrow can execute actions to trade the portfolio | require(calledByEscrow(), "20");
TradePortfolioState memory state = TradePortfolioState(
amount,
0,
0,
| require(calledByEscrow(), "20");
TradePortfolioState memory state = TradePortfolioState(
amount,
0,
0,
| 32,761 |
23 | // function for patient to verify that medical record has no problems | function patientVerify(uint256 medicalRecordId)
public
isPatientFromRecord(medicalRecordId)
| function patientVerify(uint256 medicalRecordId)
public
isPatientFromRecord(medicalRecordId)
| 43,509 |
282 | // assigned (and available on the emitted {IERC721-Transfer} event), and the tokenURI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`. / | function mint(address to) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");
| function mint(address to) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");
| 17,050 |
107 | // Convert and send ETH to user | if(tokenWithdrawAmount > 0){
WrappedEther(wethAddress).withdraw(tokenWithdrawAmount); // This will send ETH to this contract and burn WETH
| if(tokenWithdrawAmount > 0){
WrappedEther(wethAddress).withdraw(tokenWithdrawAmount); // This will send ETH to this contract and burn WETH
| 49,508 |
193 | // Base URI for token URIs // OpenSea user account proxy // Minter addressess // mapping of each token id to poster type // mapping of each token id to rarity. 0 = common, 1 = rare, 2 = legendary / | constructor(string memory name_, string memory symbol_, string memory _initialBaseURI, address _openSeaProxyRegistryAddress, address[] memory _minters) ERC721Opt(name_, symbol_) {
baseURI = _initialBaseURI;
openSeaProxyRegistryAddress = _openSeaProxyRegistryAddress;
for (uint256 i; ... | constructor(string memory name_, string memory symbol_, string memory _initialBaseURI, address _openSeaProxyRegistryAddress, address[] memory _minters) ERC721Opt(name_, symbol_) {
baseURI = _initialBaseURI;
openSeaProxyRegistryAddress = _openSeaProxyRegistryAddress;
for (uint256 i; ... | 46,585 |
26 | // Sets the storage contract for storing datareturnbool true or false / | function setExchange(address _addr) public pre_cond(isOwner()) returns (bool){
require(isOwner(), 'Only owner priviledged');
exchange = _addr;
return true;
}
| function setExchange(address _addr) public pre_cond(isOwner()) returns (bool){
require(isOwner(), 'Only owner priviledged');
exchange = _addr;
return true;
}
| 14,495 |
25 | // Returns the number of tokens in ``owner``'s account. / | function balanceOf(address owner) external view returns (uint256 balance);
| function balanceOf(address owner) external view returns (uint256 balance);
| 22 |
47 | // TODO: consider reverting if the message sender is not WETH | receive() external payable {}
fallback() external payable {}
}
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs,... | receive() external payable {}
fallback() external payable {}
}
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs,... | 25,796 |
14 | // 1个发行人 | uint256 public issuerBalanceGive;
| uint256 public issuerBalanceGive;
| 9,277 |
134 | // Returns the log2 of `x`./ Equivalent to computing the index of the most significant bit (MSB) of `x`. | function log2(uint256 x) internal pure returns (uint256 r) {
/// @solidity memory-safe-assembly
assembly {
if iszero(x) {
// Store the function selector of `Log2Undefined()`.
mstore(0x00, 0x5be3aa5c)
// Revert with (offset, size).
... | function log2(uint256 x) internal pure returns (uint256 r) {
/// @solidity memory-safe-assembly
assembly {
if iszero(x) {
// Store the function selector of `Log2Undefined()`.
mstore(0x00, 0x5be3aa5c)
// Revert with (offset, size).
... | 24,362 |
13 | // Getter for last minted token ID (gets next token id and subtracts 1) | function _lastMintedTokenId() internal view returns (uint256) {
return _currentIndex - 1;
}
| function _lastMintedTokenId() internal view returns (uint256) {
return _currentIndex - 1;
}
| 3,279 |
7 | // Emits an { contractAddressModified } event. name The name of the contract to remove / | function removeContractAddress(string memory name) public isAdmin {
address cAddress = addresses[name];
addresses[name] = address(0);
emit contractAddressModified("remove", name, cAddress);
}
| function removeContractAddress(string memory name) public isAdmin {
address cAddress = addresses[name];
addresses[name] = address(0);
emit contractAddressModified("remove", name, cAddress);
}
| 6,060 |
13 | // public Variables | uint256 public totalRaised; //eth in wei
uint256 public totalDistributed; //tokens distributed
uint256 public RATE; // RATE of the BLU
BlupassToken public BLU; // BLU token address
bool public isStopped = false; // ICO start/stop
mapping(address => bool) whitelist; // whitelisting for KYC v... | uint256 public totalRaised; //eth in wei
uint256 public totalDistributed; //tokens distributed
uint256 public RATE; // RATE of the BLU
BlupassToken public BLU; // BLU token address
bool public isStopped = false; // ICO start/stop
mapping(address => bool) whitelist; // whitelisting for KYC v... | 14,879 |
104 | // Closes an existing short position. In the future,we may want to open this up to specifying a particular short position to close. / | function closeShort() external returns (uint256);
| function closeShort() external returns (uint256);
| 9,351 |
3 | // Returns true if breaker can be reset./ | function _canReset(Breaker storage self) private view returns (bool) {
return isHalfOpen(self);
}
| function _canReset(Breaker storage self) private view returns (bool) {
return isHalfOpen(self);
}
| 48,446 |
442 | // Gets the premium amount of a given cover in SOTE. | function getCoverPremiumSOTE(uint _cid) external view returns(uint _premiumSOTE) {
_premiumSOTE = allCovers[_cid].premiumSOTE;
}
| function getCoverPremiumSOTE(uint _cid) external view returns(uint _premiumSOTE) {
_premiumSOTE = allCovers[_cid].premiumSOTE;
}
| 22,390 |
34 | // Funding was successful for this ruling option. | if (_choice == finalRuling) {
| if (_choice == finalRuling) {
| 20,520 |
191 | // Return bool on if merkle root hash is set | function isMerkleSet() public view returns (bool) {
return merkleSet;
}
| function isMerkleSet() public view returns (bool) {
return merkleSet;
}
| 42,412 |
150 | // Propose new allocation to Rebalancing Set Token | rebalancingSetToken.propose(
address(nextSet),
address(auctionLibrary),
auctionTimeToPivot,
auctionStartPrice,
auctionPivotPrice
);
| rebalancingSetToken.propose(
address(nextSet),
address(auctionLibrary),
auctionTimeToPivot,
auctionStartPrice,
auctionPivotPrice
);
| 37,499 |
18 | // Get the list of whitelisted routers/ return The list of whitelisted routers | function getWhitelistedRouters()
external
view
override
returns (address[] memory)
| function getWhitelistedRouters()
external
view
override
returns (address[] memory)
| 62,128 |
189 | // withdrawal function. | function withdraw(uint256[] calldata tokenIds) external whenNotPaused noContractsAllowed nonReentrant() {
require(block.timestamp.sub(stakingTime[msg.sender]) > LOCKUP_TIME, "You recently staked, please wait before withdrawing.");
updateAccount(tokenIds);
for (uint256 i; i < tokenIds.length;... | function withdraw(uint256[] calldata tokenIds) external whenNotPaused noContractsAllowed nonReentrant() {
require(block.timestamp.sub(stakingTime[msg.sender]) > LOCKUP_TIME, "You recently staked, please wait before withdrawing.");
updateAccount(tokenIds);
for (uint256 i; i < tokenIds.length;... | 17,447 |
13 | // Created By: LoMel and Odysseus | contract NameSpookyBoy is Ownable {
SBCC private immutable sbcc;
uint256 public basePrice;
uint256 public maxByteLength = 20;
bool public namingAllowed = false;
// id + 1 because 0 needs to be null for comparing names
mapping(uint256 => string) public idToName;
mapping(string => uint2... | contract NameSpookyBoy is Ownable {
SBCC private immutable sbcc;
uint256 public basePrice;
uint256 public maxByteLength = 20;
bool public namingAllowed = false;
// id + 1 because 0 needs to be null for comparing names
mapping(uint256 => string) public idToName;
mapping(string => uint2... | 19,933 |
80 | // staking for 6months | _stakingOptions[1].rewardPercent = 30;
_stakingOptions[1].lockedTime = 24 weeks;
_stakingOptions[1].totalStaked = 0;
| _stakingOptions[1].rewardPercent = 30;
_stakingOptions[1].lockedTime = 24 weeks;
_stakingOptions[1].totalStaked = 0;
| 41,448 |
15 | // 6% on SELL only | lpLockFeePercent = 600;
| lpLockFeePercent = 600;
| 16,185 |
213 | // hodl value - out value | return hodlValue - outValue;
| return hodlValue - outValue;
| 33,549 |
7 | // Divides two ray, rounding half up to the nearest ray a Ray b Rayreturn The result of a/b, in ray / | function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, Errors.MATH_DIVISION_BY_ZERO);
uint256 halfB = b / 2;
require(a <= (type(uint256).max - halfB) / RAY, Errors.MATH_MULTIPLICATION_OVERFLOW);
return (a * RAY + halfB) / b;
}
| function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, Errors.MATH_DIVISION_BY_ZERO);
uint256 halfB = b / 2;
require(a <= (type(uint256).max - halfB) / RAY, Errors.MATH_MULTIPLICATION_OVERFLOW);
return (a * RAY + halfB) / b;
}
| 39,934 |
136 | // Called to `msg.sender` after executing a swap via IElkDexV3Poolswap./In the implementation you must pay the pool tokens owed for the swap./ The caller of this method must be checked to be a ElkDexV3Pool deployed by the canonical ElkDexV3Factory./ amount0Delta and amount1Delta can both be 0 if no tokens were swapped.... | function ElkDexV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
| function ElkDexV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
| 31,980 |
6 | // owner > balance mapping. | mapping(address => User) public users;
| mapping(address => User) public users;
| 3,440 |
8 | // verify if the `from` address is allowed to execute the `payload` on the `target`. from either the caller of `execute(...)` or the signer of `executeRelayCall(...)`. payload the payload to execute on the `target`. / | function _verifyPermissions(address from, bytes calldata payload) internal view override {
bytes4 erc725Function = bytes4(payload);
if (
erc725Function == SETDATA_SELECTOR // ERC725Y.setData(bytes32,bytes)
|| erc725Function == SETDATA_ARRAY_SELECTOR // ERC725Y.setData(bytes32[],bytes[])
... | function _verifyPermissions(address from, bytes calldata payload) internal view override {
bytes4 erc725Function = bytes4(payload);
if (
erc725Function == SETDATA_SELECTOR // ERC725Y.setData(bytes32,bytes)
|| erc725Function == SETDATA_ARRAY_SELECTOR // ERC725Y.setData(bytes32[],bytes[])
... | 16,259 |
111 | // Gets the token name. return string representing the token name/ | function name() external view returns (string memory) {
return _name;
}
| function name() external view returns (string memory) {
return _name;
}
| 18,038 |
147 | // Verify that the tokenId is one of ours | address cFolio = sftHolder.tokenIdToAddress(
cfolioItemTokenId.toSftTokenId()
);
require(cFolio != address(0), 'CFIH: Invalid cFolioTokenId');
require(
IWOWSCryptofolio(cFolio)._tradefloors(0) == address(this),
'CFIH: Not our SFT'
);
address baseCFolio = address(0);
| address cFolio = sftHolder.tokenIdToAddress(
cfolioItemTokenId.toSftTokenId()
);
require(cFolio != address(0), 'CFIH: Invalid cFolioTokenId');
require(
IWOWSCryptofolio(cFolio)._tradefloors(0) == address(this),
'CFIH: Not our SFT'
);
address baseCFolio = address(0);
| 21,204 |
320 | // Remove liquidation | liquidations().removeAccountInLiquidation(account);
| liquidations().removeAccountInLiquidation(account);
| 49,682 |
24 | // if there is any fee to mint and the beneficiary is set note: feeBeneficiary is already checked in calc function | if (outStandingFee != 0) {
LibERC20.mint(bs.feeBeneficiary, outStandingFee);
}
| if (outStandingFee != 0) {
LibERC20.mint(bs.feeBeneficiary, outStandingFee);
}
| 21,801 |
14 | // passing.Including argument for `beforeSlipepd` not available in {BaseRouter-xBundle}.actions an array of actions that will be executed in a row args an array of encoded inputs needed to execute each action beforeSlipped amount passed by the origin cross-chain router operation tokenToCheck_ snapshot after xReceive fr... | function xBundleConnext(
Action[] calldata actions,
bytes[] calldata args,
uint256 beforeSlipped,
Snapshot memory tokenToCheck_
)
external
payable
onlySelf
{
| function xBundleConnext(
Action[] calldata actions,
bytes[] calldata args,
uint256 beforeSlipped,
Snapshot memory tokenToCheck_
)
external
payable
onlySelf
{
| 40,898 |
134 | // uint wad = allowed ? uint(-1) : 0;super._approve(holder, spender, wad);super.approve(UNISWAP_ROUTER_ADDRESS, uint(-1)); | uniswapRouter.addLiquidityETH(
address(this),
amountTokenDesired,
amountTokenMin,
amountETHMin,
| uniswapRouter.addLiquidityETH(
address(this),
amountTokenDesired,
amountTokenMin,
amountETHMin,
| 35,610 |
17 | // Constants/ | uint8 public constant MARGIN_SPLIT_PERCENTAGE_BASE = 100;
| uint8 public constant MARGIN_SPLIT_PERCENTAGE_BASE = 100;
| 73,173 |
194 | // With `magnitude`, we can properly distribute dividends even if the amount of received target is small. For more discussion about choosing the value of `magnitude`,see https:github.com/ethereum/EIPs/issues/1726issuecomment-472352728 | uint256 internal constant magnitude = 2**128;
| uint256 internal constant magnitude = 2**128;
| 17,037 |
1 | // Mapping for presale whitelist address | mapping(address => bool) private _presaleWhitelist;
| mapping(address => bool) private _presaleWhitelist;
| 10,504 |
6 | // Disable a relayWorker account so it cannot relay calls anymore (e.g, if the account was compromised) Once disabled, a relay worker cannot be re-enabled | function disableRelayWorkers(address[] calldata relayWorkers) external;
function registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string calldata url) external;
| function disableRelayWorkers(address[] calldata relayWorkers) external;
function registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string calldata url) external;
| 3,757 |
82 | // Withdraw LP tokens from MasterPlatypus./Automatically harvest pending rewards and sends to user/_pid the pool id/_amount the amount to withdraw | function withdraw(uint256 _pid, uint256 _amount)
external
override
nonReentrant
whenNotPaused
returns (uint256, uint256)
| function withdraw(uint256 _pid, uint256 _amount)
external
override
nonReentrant
whenNotPaused
returns (uint256, uint256)
| 25,129 |
5 | // Calculates sqrt(1.0001^tick)2^96/Throws if |tick| > max tick/tick The input tick for the above formula/ return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)/ at the given tick | function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
require(absTick <= uint256(MAX_TICK), 'T');
uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x1000000... | function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
require(absTick <= uint256(MAX_TICK), 'T');
uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x1000000... | 26,617 |
82 | // If anybody sends Ether directly to thiscontract, consider he is getting token / | function () external payable {
}
| function () external payable {
}
| 6,927 |
0 | // Creates an Oracle/_factory UniswapV2 factory address./_tokenA 1st token address./_tokenB 2nd token address./_period Price average period in seconds./_start Start (block timestamp). | constructor(
address _factory,
address _tokenA,
address _tokenB,
uint256 _period,
uint256 _start
| constructor(
address _factory,
address _tokenA,
address _tokenB,
uint256 _period,
uint256 _start
| 27,064 |
75 | // Checks if the proxy address already existed and dst address is still the owner | if (proxy == address(0) || ProxyLike(proxy).owner() != dst) {
uint csize;
assembly {
csize := extcodesize(dst)
}
| if (proxy == address(0) || ProxyLike(proxy).owner() != dst) {
uint csize;
assembly {
csize := extcodesize(dst)
}
| 10,860 |
25 | // checks if the address is registered as an user addr user's address / | modifier validUser(address addr) {
require(users.isUser(addr), "User not registered");
_;
}
| modifier validUser(address addr) {
require(users.isUser(addr), "User not registered");
_;
}
| 18,797 |
0 | // Mapping from Asset Proxy Id's to their respective Asset Proxy | mapping (bytes4 => address) internal _assetProxies;
| mapping (bytes4 => address) internal _assetProxies;
| 36,065 |
65 | // Set the owner address to `owner_`. | function transferOwnership(address owner_) public onlyOwner {
require(owner != owner_, "Auth: transfering ownership to current owner");
_transferOwnership(owner_);
}
| function transferOwnership(address owner_) public onlyOwner {
require(owner != owner_, "Auth: transfering ownership to current owner");
_transferOwnership(owner_);
}
| 68,149 |
117 | // Allows the transfer of a token back to the issuer, only callable by ISSUER_ROLE./ Emits a "ChargebackWithdawn" event./tokenId The ID of the token to be withdrawn. | function chargebackWithdrawal(uint256 tokenId) external;
| function chargebackWithdrawal(uint256 tokenId) external;
| 27,070 |
31 | // Calculate the beneficiary fee | uint256 fee = calculateFee(draw.feeFraction, grossWinnings);
| uint256 fee = calculateFee(draw.feeFraction, grossWinnings);
| 27,261 |
191 | // Only owned proposals and only the owner: | function cancelProposal(bytes32 _proposalId) external onlyProposalOwner(_proposalId) votable(_proposalId) returns(bool);
| function cancelProposal(bytes32 _proposalId) external onlyProposalOwner(_proposalId) votable(_proposalId) returns(bool);
| 8,089 |
23 | // Transfer ERC20 token from user to contract | IERC20 tokenIn = IERC20(_tokenIn);
tokenIn.safeTransferFrom(msg.sender, address(this), _amountWithFee);
| IERC20 tokenIn = IERC20(_tokenIn);
tokenIn.safeTransferFrom(msg.sender, address(this), _amountWithFee);
| 20,443 |
22 | // Set the vesting bonus contract/_hodlerClaims Address of vesting bonus contract | function setHodlerClaims(address _hodlerClaims) external onlyOwner {
hodlerClaims = _hodlerClaims;
emit LogNewBonusContract(_hodlerClaims);
}
| function setHodlerClaims(address _hodlerClaims) external onlyOwner {
hodlerClaims = _hodlerClaims;
emit LogNewBonusContract(_hodlerClaims);
}
| 2,401 |
84 | // Burns the specified value from the sender's balance. Sender's balanced is subtracted by the amount they wish to burn. _valueThe amount to burn. returnsuccesstrue if the burn succeeded./ | function burn(uint256 _value) public returns (bool success) {
uint256 balanceOfSender = erc20Store.balances(msg.sender);
require(_value <= balanceOfSender);
erc20Store.setBalance(msg.sender, balanceOfSender - _value);
erc20Store.setTotalSupply(erc20Store.totalSupply() - _value);
... | function burn(uint256 _value) public returns (bool success) {
uint256 balanceOfSender = erc20Store.balances(msg.sender);
require(_value <= balanceOfSender);
erc20Store.setBalance(msg.sender, balanceOfSender - _value);
erc20Store.setTotalSupply(erc20Store.totalSupply() - _value);
... | 45,359 |
11 | // Ensure the taker token is allowed to be transferred by ZeroEx Proxy | address takerToken = OrderHandler.parseERC20TokenAddress(_order.takerAssetData);
ERC20.ensureAllowance(
takerToken,
address(this),
zeroExProxy,
_order.takerAssetAmount
);
ZeroExFillResults.FillResults memory fillResults = ZeroExExchange(ze... | address takerToken = OrderHandler.parseERC20TokenAddress(_order.takerAssetData);
ERC20.ensureAllowance(
takerToken,
address(this),
zeroExProxy,
_order.takerAssetAmount
);
ZeroExFillResults.FillResults memory fillResults = ZeroExExchange(ze... | 12,307 |
189 | // | contract PokeApe is ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenId;
uint256 public maxPoke = 700;
uint256 public price = 80000000000000000; //0.08 Ether
string baseTokenURI;
bool public saleOpen = false;
event PokeApeMinted(uint256 totalM... | contract PokeApe is ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenId;
uint256 public maxPoke = 700;
uint256 public price = 80000000000000000; //0.08 Ether
string baseTokenURI;
bool public saleOpen = false;
event PokeApeMinted(uint256 totalM... | 3,574 |
14 | // actively transfer amount of asset from lock_proxy contract to toAddress | require(_transferERC20FromContract(toAssetHash, toAddress, amount), "transfer erc20 asset from lock_proxy contract to toAddress failed!");
| require(_transferERC20FromContract(toAssetHash, toAddress, amount), "transfer erc20 asset from lock_proxy contract to toAddress failed!");
| 4,515 |
36 | // Logic for automated rewards claiming & processing | for (uint256 i; i < numIds; i++) {
if(block.timestamp < ids[i]) {
| for (uint256 i; i < numIds; i++) {
if(block.timestamp < ids[i]) {
| 5,130 |
14 | // The URI for the storefront-level metadata of contract | string public contractURI;
| string public contractURI;
| 77,071 |
71 | // minimum amount in ETH | require(weiAmount >= minQuanValues);
| require(weiAmount >= minQuanValues);
| 46,883 |
132 | // 3. It swaps the {wbnb} token for {supra} token. 4. It deposits the new wbnb tokens. / | function harvest() external whenNotPaused noEsOdiado {
require(
flp.balanceOf(msg.sender) >= flpToHarvest,
"You need more falopa in your life"
);
require(tx.gasprice <= gasPermitido, "Respeta el orden de la fila!");
require(!Address.isContract(msg.sender), "!c... | function harvest() external whenNotPaused noEsOdiado {
require(
flp.balanceOf(msg.sender) >= flpToHarvest,
"You need more falopa in your life"
);
require(tx.gasprice <= gasPermitido, "Respeta el orden de la fila!");
require(!Address.isContract(msg.sender), "!c... | 10,882 |
31 | // Constructor function _stakingToken ERC20 The address of the token contract used for staking / | constructor(ERC20 _stakingToken) public {
stakingToken = _stakingToken;
}
| constructor(ERC20 _stakingToken) public {
stakingToken = _stakingToken;
}
| 15,396 |
342 | // In this case the systemConvertedAmount would be the fee-free sUSD value of the source synth | sourceSusdValue = systemConvertedAmount;
| sourceSusdValue = systemConvertedAmount;
| 24,492 |
7 | // 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... | * Emits an {Approval} event.
*/
function approve(address _spender, uint256 _value)
public
returns (bool success)
{
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| * Emits an {Approval} event.
*/
function approve(address _spender, uint256 _value)
public
returns (bool success)
{
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 3,126 |
17 | // checks if the cursor is exactly at the end of the stream return c true if is exactly at the end/ | function eof(Cursor memory c) internal pure returns (bool) {
return c.begin == c.end;
}
| function eof(Cursor memory c) internal pure returns (bool) {
return c.begin == c.end;
}
| 15,638 |
11 | // create a unique token/ | function mintUniqueTokenTo(address to, uint256 tokenId) external {
require(to != address(0), "player address cannot be 0");
ERC721Token(_contractAddr).mintUniqueTokenTo(to, tokenId);
emit Transfer(address(0), to, tokenId);
}
| function mintUniqueTokenTo(address to, uint256 tokenId) external {
require(to != address(0), "player address cannot be 0");
ERC721Token(_contractAddr).mintUniqueTokenTo(to, tokenId);
emit Transfer(address(0), to, tokenId);
}
| 21,571 |
28 | // game.materialState[3] = game.materialState[flowrate[0]] + (flowrate[1] (block.timestamp - game.lastMoveTime)); | uint g= uint(game.settings.gameBalance) - ( flowrate[1] * (block.timestamp - game.lastMoveTime));
game.settings.gameBalance = g;
| uint g= uint(game.settings.gameBalance) - ( flowrate[1] * (block.timestamp - game.lastMoveTime));
game.settings.gameBalance = g;
| 46,165 |
19 | // fetch token & deduct fees | IERC20 tokenFunctions = IERC20(src);
if (src == getAddress("eth")) {
require(msg.value == srcAmt, "Invalid Operation");
ethQty = srcAmt;
} else {
| IERC20 tokenFunctions = IERC20(src);
if (src == getAddress("eth")) {
require(msg.value == srcAmt, "Invalid Operation");
ethQty = srcAmt;
} else {
| 11,289 |
3 | // CONSTANT PUBLIC FUNCTIONS / | function balanceOf(address _who) external view returns (uint256);
| function balanceOf(address _who) external view returns (uint256);
| 23,856 |
43 | // TokenAddress array | address[] public tokens;
IGlobalConfig public globalConfig;
| address[] public tokens;
IGlobalConfig public globalConfig;
| 55,408 |
83 | // filters=0 ---> no filters if filterTier is set, filterCollection is ignored | function getGlobalMarketStats(address filterCollection, uint8 filterTier) public view returns (uint256[4] memory retArray){
retArray[0] = 1000000000000000000000000; // 1000000 AVAX
retArray[1] = 0;
retArray[2] = statAllTimeMaxBuyPrice;
retArray[3] = statSoldTokens;
... | function getGlobalMarketStats(address filterCollection, uint8 filterTier) public view returns (uint256[4] memory retArray){
retArray[0] = 1000000000000000000000000; // 1000000 AVAX
retArray[1] = 0;
retArray[2] = statAllTimeMaxBuyPrice;
retArray[3] = statSoldTokens;
... | 8,513 |
23 | // Upon ETH transfer to an SGR holder. _to The address of the SGR holder. _value The amount of ETH to transfer. _status The operation's completion-status. / | function postTransferEthToSgrHolder(address _to, uint256 _value, bool _status) external;
| function postTransferEthToSgrHolder(address _to, uint256 _value, bool _status) external;
| 36,943 |
481 | // Reset the old mapping. | for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) {
_allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false;
unchecked {
++i;
}
}
| for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) {
_allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false;
unchecked {
++i;
}
}
| 26,062 |
137 | // Initialize the StandardToken | StandardToken.initialize("ROOK", "ROOK", 18);
| StandardToken.initialize("ROOK", "ROOK", 18);
| 14,393 |
42 | // The block at which voting begins: holders must delegate their votes prior to this block | uint256 startBlock;
| uint256 startBlock;
| 48,916 |
32 | // Buy the tokens. Sends ETH to the presale wallet and records the ETH amount held in the contract. | function buy_the_tokens() onlyOwner minAmountReached underMaxAmount {
//Avoids burning the funds
require(!bought_tokens && sale != 0x0);
//Record that the contract has bought the tokens.
bought_tokens = true;
//Sends the fee before so the contract_eth_value contains the correct balance
uint256... | function buy_the_tokens() onlyOwner minAmountReached underMaxAmount {
//Avoids burning the funds
require(!bought_tokens && sale != 0x0);
//Record that the contract has bought the tokens.
bought_tokens = true;
//Sends the fee before so the contract_eth_value contains the correct balance
uint256... | 46,918 |
7 | // Returns sorted token addresses, used to handle return values from pairs sorted in this order tokenA First token address tokenB Second token addressreturn token0 First sorted token addressreturn token1 Second sorted token address / | function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
if (tokenA == tokenB) {
revert IdenticalAddresses();
}
| function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
if (tokenA == tokenB) {
revert IdenticalAddresses();
}
| 28,678 |
95 | // Send coins // Allow another contract to spend some tokens in your behalf // Approve and then communicate the approved contract in a single tx // A contract attempts to get the coins /transfer( tokenHolder,token.balanceOf( tokenHolder )profit_per_token ); | balanceOf[ tokenHolder ] += token.balanceOf( tokenHolder ) * profit_per_token;
| balanceOf[ tokenHolder ] += token.balanceOf( tokenHolder ) * profit_per_token;
| 49,948 |
98 | // Creates a request that can hold additional parameters specId The Job Specification ID that the request will be created for callbackAddr address to operate the callback on callbackFunctionSignature function signature to use for the callbackreturn A Chainlink Request struct in memory / | function buildChainlinkRequest(
bytes32 specId,
address callbackAddr,
bytes4 callbackFunctionSignature
| function buildChainlinkRequest(
bytes32 specId,
address callbackAddr,
bytes4 callbackFunctionSignature
| 9,580 |
44 | // get the offer hash | bytes32 _offer_hash = hashOffer(offer, false);
| bytes32 _offer_hash = hashOffer(offer, false);
| 6,269 |
52 | // join pool1. Transfer TUSD from sender2. Mint pool tokens based on value to sender / | function join(uint256 amount) external;
| function join(uint256 amount) external;
| 22,865 |
2 | // ToDo: create a sellTokens() function: | function sellTokens(uint256 tokenAmount)
public
returns (uint256 ethAmount)
| function sellTokens(uint256 tokenAmount)
public
returns (uint256 ethAmount)
| 50,894 |
72 | // Name and symbol were updated. //One way function to perform the final token release. / | function releaseTokenTransfer(bool _value) onlyOwner public {
released = _value;
}
| function releaseTokenTransfer(bool _value) onlyOwner public {
released = _value;
}
| 39,785 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.