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 |
|---|---|---|---|---|
2 | // ================= Permit ====================== |
bytes32 public DOMAIN_SEPARATOR;
|
bytes32 public DOMAIN_SEPARATOR;
| 11,899 |
2 | // ============ Events ============ // ============ Constants ============ / 0 index stores protocol fee % on the controller, charged in the trade function | uint256 constant internal PROTOCOL_TRADE_FEE_INDEX = 0;
| uint256 constant internal PROTOCOL_TRADE_FEE_INDEX = 0;
| 30,879 |
234 | // Due to reason error bloat, internal functions are used to reduce bytecode size Module must be initialized on the SetToken and enabled by the controller / | function _validateOnlyModule() internal view {
require(
moduleStates[msg.sender] == ISetToken.ModuleState.INITIALIZED,
"Only the module can call"
);
require(
controller.isModule(msg.sender),
"Module must be enabled on controller"
);
... | function _validateOnlyModule() internal view {
require(
moduleStates[msg.sender] == ISetToken.ModuleState.INITIALIZED,
"Only the module can call"
);
require(
controller.isModule(msg.sender),
"Module must be enabled on controller"
);
... | 44,786 |
1 | // Contracts placing orders on the OrderBook must implement this method.In this method, the contract has to send the required token, or the transaction will revert.If there is a claim bounty to be refunded, it will be transferred via msg.value. inputToken The address of the token the user has to send. outputToken The a... | function cloberMarketSwapCallback(
address inputToken,
address outputToken,
uint256 inputAmount,
uint256 outputAmount,
bytes calldata data
) external payable;
| function cloberMarketSwapCallback(
address inputToken,
address outputToken,
uint256 inputAmount,
uint256 outputAmount,
bytes calldata data
) external payable;
| 39,766 |
22 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| 1,894 |
77 | // ERC721TokenGeneric implementation for the required functionality of the ERC721 standard / | contract Economeme is ERC721, Ownable {
using SafeMath for uint256;
// Total amount of tokens
uint256 private totalTokens;
uint256 public developerCut;
uint256 public submissionPool; // The fund amount gained from submissions.
uint256 public submissionPrice; // How much it costs to submit a meme.
uint256... | contract Economeme is ERC721, Ownable {
using SafeMath for uint256;
// Total amount of tokens
uint256 private totalTokens;
uint256 public developerCut;
uint256 public submissionPool; // The fund amount gained from submissions.
uint256 public submissionPrice; // How much it costs to submit a meme.
uint256... | 20,627 |
18 | // return of interest on the deposit | function collectPercent() isUserExists timePayment internal {
uint payout = payoutAmount(msg.sender);
_payout(msg.sender, payout, false);
}
| function collectPercent() isUserExists timePayment internal {
uint payout = payoutAmount(msg.sender);
_payout(msg.sender, payout, false);
}
| 48,668 |
16 | // Modifier to make a function callable only when the contract is not paused. Requirements: - The contract must not be paused. / | modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
| modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
| 1,895 |
51 | // are we before or after the sale period? | if(blockNow < blockStart || block02w <= blockNow) {
throw;
}
| if(blockNow < blockStart || block02w <= blockNow) {
throw;
}
| 43,764 |
89 | // Transfer between all splits. | for (uint256 _i = 0; _i < _splits.length; _i++) {
| for (uint256 _i = 0; _i < _splits.length; _i++) {
| 1,325 |
19 | // Sends a fee to this contract for splitting, as an ERC20 token. No royalties are expected./_token Currency for the fee as an ERC20 token/_amount Amount of token as fee to be claimed by this contract | function sendFees(IERC20 _token, uint256 _amount) external nonReentrant {
uint256 weights;
unchecked {
weights = totalWeights - royaltiesWeight;
}
uint256 balanceBeforeTransfer = _token.balanceOf(address(this));
SafeERC20.safeTransferFrom(_token, _msgSender(), ad... | function sendFees(IERC20 _token, uint256 _amount) external nonReentrant {
uint256 weights;
unchecked {
weights = totalWeights - royaltiesWeight;
}
uint256 balanceBeforeTransfer = _token.balanceOf(address(this));
SafeERC20.safeTransferFrom(_token, _msgSender(), ad... | 56,279 |
21 | // call return false when something wrong | require(_erc20Addr.call(bytes4(keccak256("transfer(address,uint256)")), _to, _value), "asmTransfer error");
| require(_erc20Addr.call(bytes4(keccak256("transfer(address,uint256)")), _to, _value), "asmTransfer error");
| 19,398 |
213 | // we're at the right boundary | return (atOrAfter.tickCumulative, atOrAfter.secondsPerLiquidityCumulativeX128);
| return (atOrAfter.tickCumulative, atOrAfter.secondsPerLiquidityCumulativeX128);
| 76,294 |
134 | // Fee management contract | address payable private treasury;
event PublicMintToggled();
event AllowlistMintToggled();
event MerkleRootSet(bytes32 indexed newMerkleRoot);
event HashingModuleSet(address indexed newHashingModule);
event LegacyMintingModuleSet(address indexed legacyMintingModule);
event PublicFeeSet(uint256 indexed ne... | address payable private treasury;
event PublicMintToggled();
event AllowlistMintToggled();
event MerkleRootSet(bytes32 indexed newMerkleRoot);
event HashingModuleSet(address indexed newHashingModule);
event LegacyMintingModuleSet(address indexed legacyMintingModule);
event PublicFeeSet(uint256 indexed ne... | 34,189 |
124 | // hasResidual is set to true if fCash assets need to be put back into the redeemer's portfolio | bool hasResidual = true;
if (sellTokenAssets) {
int256 assetCash;
| bool hasResidual = true;
if (sellTokenAssets) {
int256 assetCash;
| 88,432 |
77 | // Returns multiplied the number by 10^18.This is used when there is a very large difference between the two numbers passed to the `outOf` function. / | function mulBasis(uint256 _a) internal pure returns (uint256) {
return _a.mul(basisValue);
}
| function mulBasis(uint256 _a) internal pure returns (uint256) {
return _a.mul(basisValue);
}
| 20,531 |
12 | // while (current_id_owner != 0){pushstr("false"); | return;
| return;
| 66,868 |
109 | // ercAmount = amounttoken.balanceOf(exchane) / total_liquidity | ercAmount = _amount.mul(token.balanceOf(_exchange)).div(totalLiquidity);
| ercAmount = _amount.mul(token.balanceOf(_exchange)).div(totalLiquidity);
| 60,003 |
300 | // Since we pre-mint to "owner", allow this contract to transfer on behalf of "owner" for sales. | _setApprovalForAll(_msgSender(), address(this), true);
| _setApprovalForAll(_msgSender(), address(this), true);
| 29,577 |
22 | // Crowdsale{constructor}fired when contract is crated. Initializes all constant and initial values._dollarToEtherRatio {uint} how many dollars are in one eth.$333.44/ETH would be passed as 33344 | function Crowdsale(WhiteList _whiteList) public {
multisig = 0x10f78f2a70B52e6c3b490113c72Ba9A90ff1b5CA;
team = 0x10f78f2a70B52e6c3b490113c72Ba9A90ff1b5CA;
maxCap = 1510000000e8;
minInvestETH = 1 ether/2;
currentStep = Step.FundingPreSale;
... | function Crowdsale(WhiteList _whiteList) public {
multisig = 0x10f78f2a70B52e6c3b490113c72Ba9A90ff1b5CA;
team = 0x10f78f2a70B52e6c3b490113c72Ba9A90ff1b5CA;
maxCap = 1510000000e8;
minInvestETH = 1 ether/2;
currentStep = Step.FundingPreSale;
... | 44,747 |
112 | // stablecoins | address public constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
| address public constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
| 48,670 |
84 | // solhint-disable-next-line | pragma solidity ^0.4.19;
| pragma solidity ^0.4.19;
| 12,415 |
32 | // Performs a Solidity function call using a low level `call`. A plain`call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expec... | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| 10,130 |
218 | // remove token ownership record (also clears approval), remove token from both local and global collections | __removeToken(_tokenId);
| __removeToken(_tokenId);
| 3,683 |
6 | // Returns the Router contract address./ return The address of the Router contract. | function hashflowRouter() external view returns (address);
| function hashflowRouter() external view returns (address);
| 10,439 |
37 | // used to get the avarge price for Room, which will be used by rewrd center to determine how much room will be sent based on Reward | function getPrice() external view returns(uint256 roomAmount, uint256 usdAmount, uint8 decimals){
roomAmount = 1e18;
usdAmount = roomAvgPrice;
decimals = USDdecimals;
}
| function getPrice() external view returns(uint256 roomAmount, uint256 usdAmount, uint8 decimals){
roomAmount = 1e18;
usdAmount = roomAvgPrice;
decimals = USDdecimals;
}
| 29,956 |
124 | // Swap fee token for Lon | IUniswapRouterV2 router = IUniswapRouterV2(_exchangeAddr);
uint256[] memory amounts = router.swapExactTokensForTokens(
_amountFeeTokenToSwap,
_minLonAmount, // Minimum amount of Lon expected to receive
_path,
address(this),
block.timestamp + ... | IUniswapRouterV2 router = IUniswapRouterV2(_exchangeAddr);
uint256[] memory amounts = router.swapExactTokensForTokens(
_amountFeeTokenToSwap,
_minLonAmount, // Minimum amount of Lon expected to receive
_path,
address(this),
block.timestamp + ... | 33,483 |
13 | // Solidity does not require us to clean the trailing bytes. We do it anyway | result := and(result, 0xFFFF000000000000000000000000000000000000000000000000000000000000)
| result := and(result, 0xFFFF000000000000000000000000000000000000000000000000000000000000)
| 39,243 |
265 | // Splits the slice, setting `self` to everything after the first occurrence of `needle`, and returning everything before it. If `needle` does not occur in `self`, `self` is set to the empty slice, and the entirety of `self` is returned. self The slice to split. needle The text to search for in `self`.return The part o... | function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
split(self, needle, token);
}
| function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
split(self, needle, token);
}
| 44,573 |
78 | // Interface of the ERC20 standard as defined in the EIP. Does not includethe optional functions; to access them see `ERC20Detailed`. / | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 4,904 |
75 | // Throws if called by any account other than a guardian account (temporary account allowed access to settings before DAO is fully enabled)/ | modifier onlyGuardian() {
require(msg.sender == rocketStorage.getGuardian(), "Account is not a temporary guardian");
_;
}
| modifier onlyGuardian() {
require(msg.sender == rocketStorage.getGuardian(), "Account is not a temporary guardian");
_;
}
| 7,982 |
51 | // update the rate / | function updateRate(uint256 rate_) public onlyOwner {
require(now <= initialTime);
rate = rate_;
emit UpdateRate(rate);
}
| function updateRate(uint256 rate_) public onlyOwner {
require(now <= initialTime);
rate = rate_;
emit UpdateRate(rate);
}
| 1,860 |
2 | // include ethereum signed approve ERC20 and call hash(`ERC20Token(baseToken).approve(_to, _value)` + `_to.call(_data)`).in return of gas proportional amount multiplied by `_gasPrice` of `_baseToken`fixes race condition in double transaction for ERC20. _baseToken token approved for `_to` and token being used for paying... | function approveAndCallGasRelay(
| function approveAndCallGasRelay(
| 39,139 |
97 | // Transfer a CobeFriend owned by another address, for which the calling address/has previously been granted transfer approval by the owner./_from The address that owns the CobeFriend to be transfered./_to The address that should take ownership of the CobeFriend. Can be any address,/including the caller./_tokenId The I... | function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
external
whenNotPaused
| function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
external
whenNotPaused
| 26,466 |
3 | // We do our own memory management here. Solidity uses memory offset 0x40 to store the current end of memory. We write past it (as writes are memory extensions), but don&39;t update the offset so Solidity will reuse it. The memory used here is only needed for this context. |
bool ret;
address addr;
assembly {
let size := mload(0x40)
mstore(size, hash)
mstore(add(size, 32), v)
mstore(add(size, 64), r)
mstore(add(size, 96), s)
|
bool ret;
address addr;
assembly {
let size := mload(0x40)
mstore(size, hash)
mstore(add(size, 32), v)
mstore(add(size, 64), r)
mstore(add(size, 96), s)
| 37,655 |
127 | // Returns the cost of an amount of votes._votes Number of votes being used./ | function determineCatnipCost(uint256 _votes) view public returns(uint256) {
return _votes.div(voteDiv);
}
| function determineCatnipCost(uint256 _votes) view public returns(uint256) {
return _votes.div(voteDiv);
}
| 26,415 |
15 | // Apply the transaction and verify the state root after that. | bool ok;
bytes memory returnData;
| bool ok;
bytes memory returnData;
| 5,804 |
190 | // MODIFIER | modifier onlyMember1 {
require(msg.sender == member1);
_;
}
| modifier onlyMember1 {
require(msg.sender == member1);
_;
}
| 25,888 |
57 | // Removes a value from a set. O(1).Returns false if the value was not present in the set. / | function removeBytes32(Bytes32Set storage set, bytes32 value)
internal
returns (bool)
| function removeBytes32(Bytes32Set storage set, bytes32 value)
internal
returns (bool)
| 37,530 |
38 | // Stake Creator finalizes the stake, the stake receives the accumulated ETH as reward and calculates everyone's percentages. / | function closeStake() external {
require(msg.sender == stakeCreator, 'You cannot call this function');
Stake memory stake = stakes[stakeNum];
require(now >= stake.start.add(stakePeriod), 'You cannot call this function until stakePeriod is over');
stake.end = now;
stake.ethR... | function closeStake() external {
require(msg.sender == stakeCreator, 'You cannot call this function');
Stake memory stake = stakes[stakeNum];
require(now >= stake.start.add(stakePeriod), 'You cannot call this function until stakePeriod is over');
stake.end = now;
stake.ethR... | 29,791 |
229 | // ADD a horse index to exchange | if( currentProposal.methodId == 3 ) HorseyToken(tokenAddress).addHorseIndex(bytes32(currentProposal.parameter));
| if( currentProposal.methodId == 3 ) HorseyToken(tokenAddress).addHorseIndex(bytes32(currentProposal.parameter));
| 16,965 |
87 | // 返回已结束的一期彩票的中奖地址 | function getWinners() public view returns(ticket[] memory){
return winners;
}
| function getWinners() public view returns(ticket[] memory){
return winners;
}
| 2,716 |
1 | // struct to store a stake's token, owner, and earning values | struct Stake {
uint16 tokenId;
uint80 value;
address owner;
}
| struct Stake {
uint16 tokenId;
uint80 value;
address owner;
}
| 75,484 |
23 | // Standard ERC20 tokenImplementation of the basic standard token. / | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... | 15,546 |
57 | // Keep track of addresses seen before, push new ones into accounts list/_tokenholder address to check for "newness" | function trackAddresses(address _tokenholder) internal {
if (!seenBefore[_tokenholder].seen) {
seenBefore[_tokenholder].seen = true;
accounts.push(_tokenholder);
seenBefore[_tokenholder].accountArrayIndex = accounts.length - 1;
}
| function trackAddresses(address _tokenholder) internal {
if (!seenBefore[_tokenholder].seen) {
seenBefore[_tokenholder].seen = true;
accounts.push(_tokenholder);
seenBefore[_tokenholder].accountArrayIndex = accounts.length - 1;
}
| 62,548 |
29 | // Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _... | function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
| function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
| 33,515 |
603 | // [Batched] version of {mint}.Requirements:- `_ids` and `_amounts` must have the same length.- If `_to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. / | function mintBatch(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
) external onlyPermit {
require(_to != address(0), Errors.VL_ZERO_ADDR_1155);
require(_ids.length == _amounts.length, Errors.VL_INPUT_ERROR);
address operator = _msgSender();
| function mintBatch(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
) external onlyPermit {
require(_to != address(0), Errors.VL_ZERO_ADDR_1155);
require(_ids.length == _amounts.length, Errors.VL_INPUT_ERROR);
address operator = _msgSender();
| 38,957 |
5 | // maximum limit | uint256 public maxLimit;
| uint256 public maxLimit;
| 24,837 |
5 | // A function to delete the image passed.Image will only be deleted if the current user is the owner of the image/ | function deleteImage(address sender, uint index) onlyOwner onlyImageOwner(sender, index) returns bool {
deleted++;
delete imagelist[index];
return true;
}
| function deleteImage(address sender, uint index) onlyOwner onlyImageOwner(sender, index) returns bool {
deleted++;
delete imagelist[index];
return true;
}
| 51,298 |
199 | // ZKSwap account id bytes lengths | uint8 constant ACCOUNT_ID_BYTES = 4;
uint8 constant AMOUNT_BYTES = 16;
| uint8 constant ACCOUNT_ID_BYTES = 4;
uint8 constant AMOUNT_BYTES = 16;
| 35,879 |
43 | // add to the deposit of the given account / | function depositTo(address account) external payable;
| function depositTo(address account) external payable;
| 10,325 |
6 | // Definition of contract accepting Halo3D tokensGames, casinos, anything can reuse this contract to support Halo3D tokens / | contract AcceptsHalo3D {
Halo3D public tokenContract;
function AcceptsHalo3D(address _tokenContract) public {
tokenContract = Halo3D(_tokenContract);
}
modifier onlyTokenContract {
require(msg.sender == address(tokenContract));
_;
}
/**
* @dev Standard ERC677 funct... | contract AcceptsHalo3D {
Halo3D public tokenContract;
function AcceptsHalo3D(address _tokenContract) public {
tokenContract = Halo3D(_tokenContract);
}
modifier onlyTokenContract {
require(msg.sender == address(tokenContract));
_;
}
/**
* @dev Standard ERC677 funct... | 32,917 |
2 | // Exit the Dancefloor Valid next states: Restroom, Bar, VIP Lounge, and Foyer | function NightClub_Dancefloor_Exit(address _user, string memory _nextStateName)
external
pure
returns(string memory message)
| function NightClub_Dancefloor_Exit(address _user, string memory _nextStateName)
external
pure
returns(string memory message)
| 34,751 |
16 | // No gas refunds since London Fork, thus just returns | return(0, 0)
| return(0, 0)
| 29,957 |
82 | // Get the timestamp at which a forced trade request was queued. argsHashThe hash of the forced trade request args. return Timestamp at which the forced trade was queued, or zero, if it was not queued or was vetoed by the VETO_GUARDIAN_ROLE. / | function getQueuedForcedTradeTimestamp(
bytes32 argsHash
)
external
view
returns (uint256)
| function getQueuedForcedTradeTimestamp(
bytes32 argsHash
)
external
view
returns (uint256)
| 38,497 |
10 | // approve busd before call | function buyByBusd(uint256 amount) public {
validate(amount);
uint256 buyAmount = amount.mul(amountPerStable);
require(buyAmount <= token.balanceOf(address(this)), "Not Enough Token To Buy");
busdToken.transferFrom(msg.sender, address(this), amount);
token.transferTokenLock... | function buyByBusd(uint256 amount) public {
validate(amount);
uint256 buyAmount = amount.mul(amountPerStable);
require(buyAmount <= token.balanceOf(address(this)), "Not Enough Token To Buy");
busdToken.transferFrom(msg.sender, address(this), amount);
token.transferTokenLock... | 26,222 |
6 | // Transfer tokens to the beneficiary | token.transfer(beneficiary, amountToRelease);
emit TokensReleased(amountToRelease);
| token.transfer(beneficiary, amountToRelease);
emit TokensReleased(amountToRelease);
| 18,861 |
50 | // Only owner or Fair.xyz - withdraw contract balance to owner wallet. 6% primary sale fee to Fair.xyz / | function withdraw() external payable nonReentrant {
address fairWithdraw = IFairXYZWallets(FAIR_WALLETS_ADDRESS)
.viewWithdraw();
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender) ||
msg.sender == fairWithdraw,
"Not owner or Fair.xyz!"
);
... | function withdraw() external payable nonReentrant {
address fairWithdraw = IFairXYZWallets(FAIR_WALLETS_ADDRESS)
.viewWithdraw();
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender) ||
msg.sender == fairWithdraw,
"Not owner or Fair.xyz!"
);
... | 47,070 |
78 | // ERC721 token receiver interface Interface for any contract that wants to support safeTransfersfrom ERC721 asset contracts. / | contract ERC721Receiver {
/**
* @dev Magic value to be returned upon successful reception of an NFT
* Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
* which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
*/
bytes4 internal constant ERC721_RECEI... | contract ERC721Receiver {
/**
* @dev Magic value to be returned upon successful reception of an NFT
* Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
* which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
*/
bytes4 internal constant ERC721_RECEI... | 5,474 |
0 | // The receiver address that will receive the targetToken after burn function is run / | address public receiver;
| address public receiver;
| 24,212 |
31 | // Provides a registered token's metadata, looked up by symbol./_symbol Symbol of registered token./ return Token metadata. | function getTokenBySymbol(string _symbol)
public
view
returns (
address, //tokenAddress
string, //name
string, //symbol
uint8, //decimals
string //url
)
| function getTokenBySymbol(string _symbol)
public
view
returns (
address, //tokenAddress
string, //name
string, //symbol
uint8, //decimals
string //url
)
| 8,140 |
58 | // Update prodInv to be 1/(d_0...d_{i-1}) by multiplying by d_i. | prodInv := mulmod(prodInv,
mload(add(currentPartialProductPtr, productsToValuesOffset)),
PRIME)
| prodInv := mulmod(prodInv,
mload(add(currentPartialProductPtr, productsToValuesOffset)),
PRIME)
| 31,314 |
131 | // Hotfricoin for Loot holders!/Hotfricoin <https:twitter.com/Hotfriescoin>/This contract mints Hotfriescoin for Loot holders and provides/ administrative functions to the Loot DAO. It allows:/Loot holders to claim Hotfriescoin/A DAO to set seasons for new opportunities to claim Hotfriescoin/A DAO to mint Hotfriescoin ... | contract Hotfriescoin is Context, Ownable, ERC20 {
// Loot contract is available at https://etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7
address public lootContractAddress =
0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7;
IERC721Enumerable public lootContract;
// Give out 1243 Hotfriescoin for every... | contract Hotfriescoin is Context, Ownable, ERC20 {
// Loot contract is available at https://etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7
address public lootContractAddress =
0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7;
IERC721Enumerable public lootContract;
// Give out 1243 Hotfriescoin for every... | 2,091 |
49 | // 2byte opcode to push well-known context data to the stack byte 1 is the push codepoint, byte 2 well-known context id | function execPushContext(Context memory context, bytes32[] memory, bytes32[] memory) internal view {
uint contextId = uint256(context.stack[context.stackLength-1]);
if (contextId == CONTEXT_TOKEN_ID) {
context.stack[context.stackLength-1] = bytes32(context.tokenId);
} else if (contextId == CONTEXT_... | function execPushContext(Context memory context, bytes32[] memory, bytes32[] memory) internal view {
uint contextId = uint256(context.stack[context.stackLength-1]);
if (contextId == CONTEXT_TOKEN_ID) {
context.stack[context.stackLength-1] = bytes32(context.tokenId);
} else if (contextId == CONTEXT_... | 39,171 |
16 | // SafeMath.sol // Ownable.sol // Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender... | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender... | 16,444 |
8 | // Vesting records. / | struct Beneficiary {
uint256 start;
uint256 duration;
uint256 cliff;
uint256 totalAmount;
uint256 releasedAmount;
}
| struct Beneficiary {
uint256 start;
uint256 duration;
uint256 cliff;
uint256 totalAmount;
uint256 releasedAmount;
}
| 75,163 |
26 | // Only deploy if a smart wallet doesn't already exist at expected address. | bytes32 hash;
| bytes32 hash;
| 8,382 |
40 | // A Solidity high level call has three parts:1. The target address is checked to verify it contains contract code2. The call itself is made, and success asserted3. The return value is decoded, which in turn checks the size of the returned data. solhint-disable-next-line max-line-length | require(address(token).isContract(), "SafeERC20: call to non-contract");
| require(address(token).isContract(), "SafeERC20: call to non-contract");
| 18,181 |
7 | // Internal call to take collateral tokens from the bank./token The token to take back./amount The amount to take back. | function doTakeCollateral(address token, uint amount) internal {
if (amount > 0) {
if (amount == uint(-1)) {
(, , , amount) = bank.getCurrentPositionInfo();
}
bank.takeCollateral(address(werc20), uint(token), amount);
werc20.burn(token, amount);
}
}
| function doTakeCollateral(address token, uint amount) internal {
if (amount > 0) {
if (amount == uint(-1)) {
(, , , amount) = bank.getCurrentPositionInfo();
}
bank.takeCollateral(address(werc20), uint(token), amount);
werc20.burn(token, amount);
}
}
| 52,319 |
759 | // Import a position from src urn to the urn owned by cdp | function enter(
address src,
uint cdp
) public urnAllowed(src) cdpAllowed(cdp) {
(uint ink, uint art) = VatLike(vat).urns(ilks[cdp], src);
VatLike(vat).fork(
ilks[cdp],
src,
urns[cdp],
toInt(ink),
| function enter(
address src,
uint cdp
) public urnAllowed(src) cdpAllowed(cdp) {
(uint ink, uint art) = VatLike(vat).urns(ilks[cdp], src);
VatLike(vat).fork(
ilks[cdp],
src,
urns[cdp],
toInt(ink),
| 12,103 |
16 | // Withdraw all from Gauge | (, uint256 gaugePTokens, uint256 totalPTokens) = _getTotalPTokens();
_lpWithdraw(gaugePTokens);
| (, uint256 gaugePTokens, uint256 totalPTokens) = _getTotalPTokens();
_lpWithdraw(gaugePTokens);
| 20,953 |
111 | // unwrap WETH | if (_token == WETH) {
IWETH(WETH).withdraw(_balance);
}
| if (_token == WETH) {
IWETH(WETH).withdraw(_balance);
}
| 6,445 |
111 | // tokens created | uint256 created;
| uint256 created;
| 41,350 |
19 | // 30.11.2017 09:00:00 | dividends.push(Dividend(1512032400, 20, 0));
| dividends.push(Dividend(1512032400, 20, 0));
| 37,524 |
5 | // We do not use decimals here becuase the msg.sender will send wei | uint value = msg.value.div(2);
require(value <= balanceOf(owner()), "Not enough supply.");
_transfer(owner(), msg.sender, value);
| uint value = msg.value.div(2);
require(value <= balanceOf(owner()), "Not enough supply.");
_transfer(owner(), msg.sender, value);
| 11,193 |
6 | // This method relies on extcodesize/address.code.length, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. |
return account.code.length > 0;
|
return account.code.length > 0;
| 40,633 |
208 | // Get member stakerAddressesaccount Member address return Address array / | function getStakerAddresses(address account) external view returns (address[] memory);
| function getStakerAddresses(address account) external view returns (address[] memory);
| 74,361 |
144 | // Prevents other msg.sender than controller address | modifier onlyController() {
require(_msgSender() == controller, "!controller");
_;
}
| modifier onlyController() {
require(_msgSender() == controller, "!controller");
_;
}
| 65,547 |
39 | // the following function were added for transparency regarding ETH raised and prize pool calculations | uint256 totalWithdrawn = 0;
| uint256 totalWithdrawn = 0;
| 22,460 |
31 | // Returns detailed information for a Pool's registered token. `cash` is the number of tokens the Vault currently holds for the Pool. `managed` is the number of tokenswithdrawn and held outside the Vault by the Pool's token Asset Manager. The Pool's total balance for `token`equals the sum of `cash` and `managed`. Inter... | function getPoolTokenInfo(bytes32 poolId, IERC20 token)
| function getPoolTokenInfo(bytes32 poolId, IERC20 token)
| 4,844 |
19 | // This function uses pseudorandomness to choose a faction that has remaining availability and remove 1 from the availability and return it to the CREATE DNA function, which assigns the faction to the tokenFaction map. the big 🧠 play is this function will MOST LIKELY give a somewhat equal distribution of factions to a... |
function subtractFromRandomFaction(uint256 totalminted)
public
returns (uint256 faction)
|
function subtractFromRandomFaction(uint256 totalminted)
public
returns (uint256 faction)
| 22,469 |
175 | // Liquidity generation logic/ Steps - All tokens tat will ever exist go to this contract/ This contract accepts ETH as payable/ ETH is mapped to people/ When liquidity generationevent is over veryone can call/ the mint LP function which will put all the ETH and tokens inside the uniswap contract/ without any involveme... |
string public liquidityGenerationParticipationAgreement = "I agree that the developers and affiliated parties of the Levels team are not responsible for your funds";
|
string public liquidityGenerationParticipationAgreement = "I agree that the developers and affiliated parties of the Levels team are not responsible for your funds";
| 23,105 |
21 | // pragma solidity 0.6.7; // import "./LinkedList.sol"; / | abstract contract SAFEEngineLike_12 {
function collateralTypes(bytes32) virtual public view returns (
uint256 debtAmount, // [wad]
uint256 accumulatedRate // [ray]
);
function updateAccumulatedRate(bytes32,address,int256) virtual external;
function coinBalance(address) virtual pu... | abstract contract SAFEEngineLike_12 {
function collateralTypes(bytes32) virtual public view returns (
uint256 debtAmount, // [wad]
uint256 accumulatedRate // [ray]
);
function updateAccumulatedRate(bytes32,address,int256) virtual external;
function coinBalance(address) virtual pu... | 54,547 |
195 | // Reimburse transmitter of the report for gas usage | require(txOracle.role == Role.Transmitter,
"sent by undesignated transmitter"
);
uint256 gasPrice = impliedGasPrice(
tx.gasprice / (1 gwei), // convert to ETH-gwei units
billing.reasonableGasPrice,
billing.maximumGasPrice
);
| require(txOracle.role == Role.Transmitter,
"sent by undesignated transmitter"
);
uint256 gasPrice = impliedGasPrice(
tx.gasprice / (1 gwei), // convert to ETH-gwei units
billing.reasonableGasPrice,
billing.maximumGasPrice
);
| 26,000 |
15 | // OBJECT BIT SHIFTS FOR READING FROM CALLDATA -- don't bother with using 'shr' if any of these is 0 uint256 internal constant BIT_SHIFT_headerHash = 256 - BIT_LENGTH_headerHash; uint256 internal constant BIT_SHIFT_durationDataStoreId = 256 - BIT_LENGTH_durationDataStoreId; uint256 internal constant BIT_SHIFT_globalDat... | uint256 internal constant BIT_SHIFT_headerHash = 0;
uint256 internal constant BIT_SHIFT_durationDataStoreId = 224;
uint256 internal constant BIT_SHIFT_globalDataStoreId = 224;
uint256 internal constant BIT_SHIFT_referenceBlockNumber = 224;
uint256 internal constant BIT_SHIFT_blockNumber = 224;
u... | uint256 internal constant BIT_SHIFT_headerHash = 0;
uint256 internal constant BIT_SHIFT_durationDataStoreId = 224;
uint256 internal constant BIT_SHIFT_globalDataStoreId = 224;
uint256 internal constant BIT_SHIFT_referenceBlockNumber = 224;
uint256 internal constant BIT_SHIFT_blockNumber = 224;
u... | 29,606 |
11 | // the address of the GenesisGroup contract/ return genesis group contract | function genesisGroup() external view returns(address);
| function genesisGroup() external view returns(address);
| 56,246 |
59 | // Internal function to remove a unicorn ID from the list of a given address_from address representing the previous owner of the given unicorn ID_unicornId uint256 ID of the unicorn to be removed from the unicorns list of the given address/ | function removeUnicorn(address _from, uint256 _unicornId) private {
require(owns(_from, _unicornId));
uint256 unicornIndex = ownedUnicornsIndex[_unicornId];
// uint256 lastUnicornIndex = balanceOf(_from).sub(1);
uint256 lastUnicornIndex = ownedUnicorns[_from].length.sub(1);
... | function removeUnicorn(address _from, uint256 _unicornId) private {
require(owns(_from, _unicornId));
uint256 unicornIndex = ownedUnicornsIndex[_unicornId];
// uint256 lastUnicornIndex = balanceOf(_from).sub(1);
uint256 lastUnicornIndex = ownedUnicorns[_from].length.sub(1);
... | 28,127 |
14 | // event for investor disapproval logginginvestor disapproved investor/ | event Disapproved(address indexed investor);
constructor(address _owner)
public
Ownable(_owner)
| event Disapproved(address indexed investor);
constructor(address _owner)
public
Ownable(_owner)
| 39,667 |
26 | // Sparkly | setWingType(
6,
| setWingType(
6,
| 17,135 |
24 | // loop through _recipients | for {
let i := 0
} lt(i, sz) {
| for {
let i := 0
} lt(i, sz) {
| 31,522 |
38 | // Renders a custom animation as an embedded data URI/ | function getAnimationDataUri(uint tokenId, uint animationId) external override view returns(string memory) {
GIFEncoder.GIF memory gif = getAnimation(tokenId, animationId);
string memory dataUri = GIFEncoder.getDataUri(gif);
return dataUri;
}
| function getAnimationDataUri(uint tokenId, uint animationId) external override view returns(string memory) {
GIFEncoder.GIF memory gif = getAnimation(tokenId, animationId);
string memory dataUri = GIFEncoder.getDataUri(gif);
return dataUri;
}
| 29,254 |
160 | // Returns the percentage of the keyPrice to be sent to the referrer (in basis points) _referrer the address of the referrerreturn referrerFee the percentage of the keyPrice to be sent to the referrer (in basis points) / | function referrerFees(
| function referrerFees(
| 13,430 |
67 | // Multiplies x and y, rounding up to the closest representable number./ Assumes x and y are both fixed point with `decimals` digits. | function muldrup(uint256 x, uint256 y) internal pure returns (uint256)
| function muldrup(uint256 x, uint256 y) internal pure returns (uint256)
| 78,313 |
194 | // Start at token id 1 | _tokenIdCounter.increment();
| _tokenIdCounter.increment();
| 72,981 |
35 | // MasterChef was the master of LCN. He now governs over LCNS. He can make LCNs and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once LCNS is sufficiently distributed and the community can show to govern itself. Have fun... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some fancy... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some fancy... | 12,324 |
26 | // Transfer tokens from one address to another.Note that while this function emits an Approval event, this is not required as per the specification,and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer to... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| 8,537 |
34 | // Checks if `_operator` is an approved operator for `_owner`. _owner The address that owns the NFTs. _operator The address that acts on behalf of the owner.return True if approved for all, false otherwise. / | function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
| function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
| 20,389 |
164 | // Transition the minimum number of terms between the amount requested and the amount actually needed | uint64 neededTransitions = _neededTermTransitions();
uint256 transitions = uint256(_maxRequestedTransitions < neededTransitions ? _maxRequestedTransitions : neededTransitions);
require(transitions > 0, ERROR_INVALID_TRANSITION_TERMS);
uint64 blockNumber = getBlockNumber64();
uin... | uint64 neededTransitions = _neededTermTransitions();
uint256 transitions = uint256(_maxRequestedTransitions < neededTransitions ? _maxRequestedTransitions : neededTransitions);
require(transitions > 0, ERROR_INVALID_TRANSITION_TERMS);
uint64 blockNumber = getBlockNumber64();
uin... | 12,807 |
36 | // collect eth |
mapping (address => uint256) public buyers;
address[] private keys;
|
mapping (address => uint256) public buyers;
address[] private keys;
| 16,805 |
219 | // Internally calculates a swap between two tokens.The caller is expected to transfer the actual amounts (dx and dy)using the token contracts.self Swap struct to read from tokenIndexFrom the token to sell tokenIndexTo the token to buy dx the number of tokens to sell. If the token charges a fee on transfers,use the amou... | function _calculateSwap(
Swap storage self,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx
| function _calculateSwap(
Swap storage self,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx
| 19,630 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.