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
1,008
// netFee = preFeeCashToAccount - postFeeCashToAccount netFee = (fCashToAccount / postFeeExchangeRate) - (fCashToAccount / preFeeExchangeRate) netFee = ((fCashToAccount / (feeExchangeRatepreFeeExchangeRate)) - (fCashToAccount / preFeeExchangeRate) netFee = (fCashToAccount / preFeeExchangeRate)(1 / feeExchangeRate - 1) ...
fee = preFeeCashToAccount.mul(Constants.RATE_PRECISION.sub(fee)).div(fee).neg();
fee = preFeeCashToAccount.mul(Constants.RATE_PRECISION.sub(fee)).div(fee).neg();
35,783
1
// ERC-20
function allowance(address owner, address spender) external view returns (uint256); function balanceOf(address account) external view returns (uint256); function totalSupply() external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transfe...
function allowance(address owner, address spender) external view returns (uint256); function balanceOf(address account) external view returns (uint256); function totalSupply() external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transfe...
28,610
11
// TODO: create mapping for balances
mapping (address => uint) public balances;
mapping (address => uint) public balances;
14,165
49
// VorteXVorteX contractVorteX is a game in which players navigate in the the crypto space.Players can move along specific directions: spaceships.Players are required to pay some fee to perform action in the game.The goal is to reach a beacon called the `vorteX` Rules:1. Playing: To start playing, a player needs to pay...
contract VorteX { struct Location { uint x; uint y; } /* Ship struct */ struct Ship { Location initialLocation; Location location; uint taxPrice; } /* Fee */ uint constant public PLAYING_FEE = 1000000000000000; uint constant public DEFAULT_T...
contract VorteX { struct Location { uint x; uint y; } /* Ship struct */ struct Ship { Location initialLocation; Location location; uint taxPrice; } /* Fee */ uint constant public PLAYING_FEE = 1000000000000000; uint constant public DEFAULT_T...
44,903
0
// minters only have the ability to mint new halloween tokens.
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); string private localuri; uint256 public totalMint = 0;
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); string private localuri; uint256 public totalMint = 0;
65,695
64
// Lets a protocol admin restrict token transfers.
function setRestrictedTransfer(bool _restrictedTransfer) external onlyModuleAdmin { transfersRestricted = _restrictedTransfer; emit RestrictedTransferUpdated(_restrictedTransfer); }
function setRestrictedTransfer(bool _restrictedTransfer) external onlyModuleAdmin { transfersRestricted = _restrictedTransfer; emit RestrictedTransferUpdated(_restrictedTransfer); }
2,138
121
// Buy zo assets from us
function buyZoAssets(bytes32 values) external payable whenNotPaused { // Check whether we need to refresh the daily limit bytes32 history = accountsBoughtZoAsset[msg.sender]; if (accountsZoLastRefreshTime[msg.sender] == uint256(0)) { // This account's first time to buy zo asset, ...
function buyZoAssets(bytes32 values) external payable whenNotPaused { // Check whether we need to refresh the daily limit bytes32 history = accountsBoughtZoAsset[msg.sender]; if (accountsZoLastRefreshTime[msg.sender] == uint256(0)) { // This account's first time to buy zo asset, ...
21,013
52
// ========== GOVERNANCE FUNCTIONS ========== /
function setGovernance(address _governance) public onlyGovernance { governance = _governance; }
function setGovernance(address _governance) public onlyGovernance { governance = _governance; }
34,135
343
// Creates a collection. Reverts if `collectionId` does not represent a collection. Reverts if `collectionId` has already been created.
* @dev Emits a {IERC1155Inventory-CollectionCreated} event. * @param collectionId Identifier of the collection. */ function createCollection(uint256 collectionId) external onlyOwner { _createCollection(collectionId); }
* @dev Emits a {IERC1155Inventory-CollectionCreated} event. * @param collectionId Identifier of the collection. */ function createCollection(uint256 collectionId) external onlyOwner { _createCollection(collectionId); }
77,289
135
// Withdraw all funds, normally used when migrating strategies
function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _jar = IController(controller).jars(address(want)); require(_jar != address(0), "!jar"); //...
function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _jar = IController(controller).jars(address(want)); require(_jar != address(0), "!jar"); //...
2,022
2
// --------------- AFFILIATE ----------------------------------------------
enum MembershipStatus {REGISTERED, APPROVED, SEED_FUNDED, SUSPENDED} struct Affiliate { MembershipStatus status; uint256 seed; uint256 updatedTimestamp; string title; uint256 approvals; mapping(address => bool) votes; }
enum MembershipStatus {REGISTERED, APPROVED, SEED_FUNDED, SUSPENDED} struct Affiliate { MembershipStatus status; uint256 seed; uint256 updatedTimestamp; string title; uint256 approvals; mapping(address => bool) votes; }
35,521
6
// fulfillRandomWordsWithOverride allows the user to pass in their own random words._requestId the request to fulfill _consumer the VRF randomness consumer to send the result to _words user-provided random words /
function fulfillRandomWordsWithOverride( uint256 _requestId, address _consumer, uint256[] memory _words
function fulfillRandomWordsWithOverride( uint256 _requestId, address _consumer, uint256[] memory _words
43,023
1,164
// The interface for a Float Protocol Asset Basket A Basket stores value used to stabilise price and assess thethe movement of the underlying assets we're trying to track. The Basket interface is broken up into many smaller pieces to allow onlyrelevant parts to be imported /
interface IBasket is IBasketReader, IBasketGovernedActions { }
interface IBasket is IBasketReader, IBasketGovernedActions { }
3,668
50
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
if (packed & _BITMASK_BURNED == 0) {
7,791
7
// Sets `_properties` as the ArtProperty of `tokenId`. Requirements: - `tokenId` must exist. /
function _setArtProperty(uint256 tokenId, ArtProperty memory _property) internal virtual { require(_exists(tokenId), "BlackSphere: ArtProperty set of nonexistent token"); _properties[tokenId] = _property; }
function _setArtProperty(uint256 tokenId, ArtProperty memory _property) internal virtual { require(_exists(tokenId), "BlackSphere: ArtProperty set of nonexistent token"); _properties[tokenId] = _property; }
23,399
65
// Sends an mail to the specific list of recipients with amount of MAIL tokens to spend on them, hash message, time unti when is message available and tokens_to List of recipients _weight Tokens to be spent on messages _hashedMessage Hashed content of mail _validUntil Mail is available until this specific time when wil...
function sendMail(address[] _to, uint256 _weight, bytes32 _hashedMessage, uint256 _validUntil, bytes32 _attachmentToken, uint256 _attachmentAmount) { bool useFreeTokens = false; if (_weight == 0 && freeToUseTokens > 0) { _weight = _to.length; useFreeTokens = true; } ...
function sendMail(address[] _to, uint256 _weight, bytes32 _hashedMessage, uint256 _validUntil, bytes32 _attachmentToken, uint256 _attachmentAmount) { bool useFreeTokens = false; if (_weight == 0 && freeToUseTokens > 0) { _weight = _to.length; useFreeTokens = true; } ...
34,653
20
// Custom configs
function setMintFee(uint256 _whitelistMintFee, uint256 _publicMintFee) external onlyOwner
function setMintFee(uint256 _whitelistMintFee, uint256 _publicMintFee) external onlyOwner
38,052
21
// This function is used to set the price of a tokenOnly admin is allowed to set the price of a token/
function setPrice(uint256 tokenId, uint256 price) public onlyAdmin { salePrice[tokenId] = price; }
function setPrice(uint256 tokenId, uint256 price) public onlyAdmin { salePrice[tokenId] = price; }
41,149
69
// Wei to buy amount of tokens
uint256 wei_amount = tokens_can_be_sold.div(tier_rate);
uint256 wei_amount = tokens_can_be_sold.div(tier_rate);
42,183
34
// allow exceptional transfer fro sender address - this mappingcan be modified only before the starting rounds
mapping (address => bool) public transferable;
mapping (address => bool) public transferable;
37,300
115
// An EXTERNAL update of tokens should be handled here This is due to token allocation The game should handle internal updates itself (e.g. tokens are betted)
function bankrollExternalUpdateTokens(uint divRate, uint newBalance) public fromBankroll
function bankrollExternalUpdateTokens(uint divRate, uint newBalance) public fromBankroll
82,349
24
// Event for token purchase loggingpurchaser The wallet address that bought the tokensvalue How many Weis were paid for the purchaseamount The amount of tokens purchased/
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
26,901
5
// Total interest amount after withdraws./
uint256 public totalInterestWithWithdraws;
uint256 public totalInterestWithWithdraws;
44,180
307
// We've found a leaf node with the given key. Simply need to update the value of the node to match.
newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value); totalNewNodes += 1;
newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value); totalNewNodes += 1;
34,477
19
// Create an auction. Store the auction details in the `auction` state variable and emit an AuctionCreated event.If the mint reverts, the minter was updated without pausing this contract first. To remedy this,catch the revert and pause this contract. /
function _createAuction() internal { try snoopDAONFT.mint(address(this)) returns (uint256 snoopDAONFTId) { uint256 startTime = block.timestamp; uint256 endTime = startTime + _getAuctionDuration(snoopDAONFTId); auction = Auction({ snoopDAONFTId: snoopDAONF...
function _createAuction() internal { try snoopDAONFT.mint(address(this)) returns (uint256 snoopDAONFTId) { uint256 startTime = block.timestamp; uint256 endTime = startTime + _getAuctionDuration(snoopDAONFTId); auction = Auction({ snoopDAONFTId: snoopDAONF...
33,458
254
// calculate & return dust
return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000)));
return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000)));
50,371
266
// Set the base URI for either predefined cards or custom cardswhich don't have it's own URI. The resulting uri is baseUri+[hex(tokenId)] + '.json'. wheretokenId will be reduces to upper 16 bit (>> 16) before building the hex string./
function setBaseMetadataURI(string memory baseContractMetadata) external;
function setBaseMetadataURI(string memory baseContractMetadata) external;
11,758
5
// return {UoA}
function maxTradeVolume() external view returns (uint192);
function maxTradeVolume() external view returns (uint192);
51,447
191
// MintableToken anyone can mint token. /
contract MintableERC721 is Ownable, IERC721, IERC721Metadata, ERC721Base { uint256 private tokenIdCounter; bool private onlyInitOnce; event SetTokenURI(uint256 _tokenId, string _tokenURI); function init( string memory _name, string memory _symbol, address _newOwner, str...
contract MintableERC721 is Ownable, IERC721, IERC721Metadata, ERC721Base { uint256 private tokenIdCounter; bool private onlyInitOnce; event SetTokenURI(uint256 _tokenId, string _tokenURI); function init( string memory _name, string memory _symbol, address _newOwner, str...
7,912
45
// Function for the public to call the results of the latest security audit
function getLatestSecurityAudit() public view returns (bool auditStatus, uint256 blockNum, uint256 time) { auditStatus = latestSecurityAudit.status; blockNum = latestSecurityAudit.blockNumber; time = latestSecurityAudit.timestamp; return (auditStatus, blockNum, time); }
function getLatestSecurityAudit() public view returns (bool auditStatus, uint256 blockNum, uint256 time) { auditStatus = latestSecurityAudit.status; blockNum = latestSecurityAudit.blockNumber; time = latestSecurityAudit.timestamp; return (auditStatus, blockNum, time); }
28,544
180
// Attempt to derive a smart wallet address that matches the one provided.
address target; for (uint256 nonce = 0; nonce < 10; nonce++) { target = address( // derive the target deployment address. uint160( // downcast to match the address type. uint256( // cast to uint to truncate upper digits. keccak256( ...
address target; for (uint256 nonce = 0; nonce < 10; nonce++) { target = address( // derive the target deployment address. uint160( // downcast to match the address type. uint256( // cast to uint to truncate upper digits. keccak256( ...
10,410
223
// Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp/To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing/ the beginning of the period and another for the end of the period. E.g., to get the last hour t...
function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
9,878
148
// Call trader to trade orders
trader.trade( isSell, orderData, volume, volumeEth );
trader.trade( isSell, orderData, volume, volumeEth );
25,439
154
// Establish path between provided token and WETH.
(address[] memory path, uint256[] memory amounts) = _createPathAndAmounts( address(tokenProvided), _WETH, false );
(address[] memory path, uint256[] memory amounts) = _createPathAndAmounts( address(tokenProvided), _WETH, false );
29,271
0
// Constructor that gives _msgSender() all of existing tokens. /
constructor () public ERC20Detailed("Cultiplan", "CTPL", 18) { _mint(_msgSender(), 3000000000 * (10 ** uint256(decimals()))); }
constructor () public ERC20Detailed("Cultiplan", "CTPL", 18) { _mint(_msgSender(), 3000000000 * (10 ** uint256(decimals()))); }
12,048
114
// The rebase window begins this many seconds into the minRebaseTimeInterval period. For example if minRebaseTimeInterval is 24hrs, it represents the time of day in seconds.
uint256 public rebaseWindowOffsetSec;
uint256 public rebaseWindowOffsetSec;
9,349
89
// Emitted when a loan is repaid by the borrower /
event LoanRepaid(uint256 loanId);
event LoanRepaid(uint256 loanId);
23,346
196
// if send failed let player withdraw via playerWithdrawPendingTransactions // pay winner update contract balance to calculate new max bet send reward if send of reward fails save value to playerPendingWithdrawals/
if(playerDieResult[myid] < playerNumber[myid]){
if(playerDieResult[myid] < playerNumber[myid]){
9,439
99
// Change
if(investorCount > MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE) { throw; }
if(investorCount > MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE) { throw; }
45,911
9
//
function substring(string str, uint startIndex, uint endIndex) public returns (string) { bytes memory strBytes = bytes(str); bytes memory result = new bytes(endIndex-startIndex); for(uint i = startIndex; i < endIndex; i++) { result[i-startIndex] = strBytes[i]; } return string(result); }
function substring(string str, uint startIndex, uint endIndex) public returns (string) { bytes memory strBytes = bytes(str); bytes memory result = new bytes(endIndex-startIndex); for(uint i = startIndex; i < endIndex; i++) { result[i-startIndex] = strBytes[i]; } return string(result); }
1,527
21
// permit nonces
mapping(address => uint) public nonces;
mapping(address => uint) public nonces;
7,083
1
// IRoyaltyManager ishan@highlight.xyz Enables interfacing with custom royalty managers that define conditions on setting royalties forNFT contracts /
interface IRoyaltyManager { /** * @notice Struct containing values required to adhere to ERC-2981 * @param recipientAddress Royalty recipient - can be EOA, royalty splitter contract, etc. * @param royaltyPercentageBPS Royalty cut, in basis points */ struct Royalty { address recipient...
interface IRoyaltyManager { /** * @notice Struct containing values required to adhere to ERC-2981 * @param recipientAddress Royalty recipient - can be EOA, royalty splitter contract, etc. * @param royaltyPercentageBPS Royalty cut, in basis points */ struct Royalty { address recipient...
14,233
52
// Whether DAO has admins./ return bool true if DAO has admins.
function hasAdmins() public override view returns (bool) { return _hasAdmins; }
function hasAdmins() public override view returns (bool) { return _hasAdmins; }
13,232
78
// Returns whether the `mintRandomness` has been enabled.return The configured value. /
function mintRandomnessEnabled() external view returns (bool);
function mintRandomnessEnabled() external view returns (bool);
42,643
93
// View the management address of the Vault to assert privileged functionscan only be called by management. The Strategy serves the Vault, so itis subject to management defined by the Vault. /
function management() external view returns (address);
function management() external view returns (address);
7,011
206
// public functions
function mintWitch(uint256 _mintAmount) public payable nonReentrant { require(!paused, "The contract is paused"); uint256 supply = totalSupply(); require(_mintAmount > 0, "Need to mint atleast 1 Witch"); require(_mintAmount <= maxMintAmount, "Can only mint 20 per Transaction"); require(supply + _m...
function mintWitch(uint256 _mintAmount) public payable nonReentrant { require(!paused, "The contract is paused"); uint256 supply = totalSupply(); require(_mintAmount > 0, "Need to mint atleast 1 Witch"); require(_mintAmount <= maxMintAmount, "Can only mint 20 per Transaction"); require(supply + _m...
9,914
11
// V2 AggregatorInterface
function latestAnswer( address base, address quote ) external view returns ( int256 answer );
function latestAnswer( address base, address quote ) external view returns ( int256 answer );
26,283
258
// Internally used to set a flag in a shrinked board array (used to save gas costs)./visited the array to update./position the position on the board we want to flag./flag the flag we want to set (either 1 or 2).
function setFlag(uint8[SHRINKED_BOARD_SIZE] visited, uint8 position, uint8 flag) private pure { visited[position / 4] |= flag << ((position % 4) * 2); }
function setFlag(uint8[SHRINKED_BOARD_SIZE] visited, uint8 position, uint8 flag) private pure { visited[position / 4] |= flag << ((position % 4) * 2); }
33,168
65
// Function for selling tokens in crowd time./
function sell(address _investor, uint256 amount) internal
function sell(address _investor, uint256 amount) internal
11,626
46
// Move the last entry to the index where the entry to delete is
map._entries[toDeleteIndex] = lastEntry;
map._entries[toDeleteIndex] = lastEntry;
1,714
116
// The below variables are related to the ethy strategy:
Strategy strat; // Executes a strategy using a given budget. IAccountant accountant; // set the budget strat for this pool. uint256 stratLastCalled; // When the strategy was last called;. uint256 shareTotals; // The sum of all active shares.
Strategy strat; // Executes a strategy using a given budget. IAccountant accountant; // set the budget strat for this pool. uint256 stratLastCalled; // When the strategy was last called;. uint256 shareTotals; // The sum of all active shares.
13,846
42
// for collecting all: type(uint128).max
amount0Max: amount0Max, amount1Max: amount1Max
amount0Max: amount0Max, amount1Max: amount1Max
36,017
2
// Interface ID for ERC721_METADATA - NFT metadata
bytes4 internal constant INTERFACE_ID_ERC721_METADATA = bytes4(0x5b5e139f);
bytes4 internal constant INTERFACE_ID_ERC721_METADATA = bytes4(0x5b5e139f);
15,190
56
// Sends tokens to a recipient tokenRecipient The address receiving the tokens outputAmount The amount of tokens to send /
function _sendTokenOutput(address payable tokenRecipient, uint256 outputAmount) internal virtual;
function _sendTokenOutput(address payable tokenRecipient, uint256 outputAmount) internal virtual;
4,500
270
// gets reward per share (RPS) for a stream/streamId stream index/ return streams[streamId].rps
function getRewardPerShare(uint256 streamId) external view virtual returns (uint256)
function getRewardPerShare(uint256 streamId) external view virtual returns (uint256)
34,207
61
// Atomically decreases the allowance granted to `spender` by the caller.
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `sub...
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `sub...
5,200
1
// Emitted when a set of staked token-ids are withdrawn.
event TokensWithdrawn(address indexed staker, uint256[] indexed tokenIds);
event TokensWithdrawn(address indexed staker, uint256[] indexed tokenIds);
6,709
458
// depositAddress: Special address respresenting L2.Ships sent to this address are controlled on L2 instead of here.
address constant public depositAddress = 0x1111111111111111111111111111111111111111;
address constant public depositAddress = 0x1111111111111111111111111111111111111111;
70,986
19
// Ticket max hit
emit successBoolMessage(false, string(abi.encodePacked("Error: Max tickets reached"))); return 0;
emit successBoolMessage(false, string(abi.encodePacked("Error: Max tickets reached"))); return 0;
23,633
6
// Deposits funds into the Charm Vault Only possible when contract not paused. _amount: number of tokens to deposit (in CHARM) /
function deposit(uint256 _amount) external whenNotPaused notContract { require(_amount > 0, "Nothing to deposit"); uint256 pool = balanceOf(); token.safeTransferFrom(msg.sender, address(this), _amount); uint256 currentShares = 0; if (totalShares != 0) { currentSh...
function deposit(uint256 _amount) external whenNotPaused notContract { require(_amount > 0, "Nothing to deposit"); uint256 pool = balanceOf(); token.safeTransferFrom(msg.sender, address(this), _amount); uint256 currentShares = 0; if (totalShares != 0) { currentSh...
27,662
153
// assumes the newly created claim is appended at the end of the list covers
coverId = quotationData.getCoverLength().sub(1);
coverId = quotationData.getCoverLength().sub(1);
16,759
6
// 资金方审核放货拒绝 _processId 流程id _user_id 操作用户id/
function confirmAuditReject(string _processId, string _user_id) external onlyOwner returns(bool){ onlyZJRole(_user_id); _log(_processId.empty(), "FinancingFundController fundConfirmAudit: _processId is empty"); require(!_processId.empty(), "FinancingFundController fundConfirmAudit: _processI...
function confirmAuditReject(string _processId, string _user_id) external onlyOwner returns(bool){ onlyZJRole(_user_id); _log(_processId.empty(), "FinancingFundController fundConfirmAudit: _processId is empty"); require(!_processId.empty(), "FinancingFundController fundConfirmAudit: _processI...
87
10
// A `IWitnetRequest` is constructed around a `bytes` value containing / a well-formed Witnet Data Request using Protocol Buffers.
function bytecode() external view returns (bytes memory);
function bytecode() external view returns (bytes memory);
23,218
27
// Модальные глаголы CAN, MAY и другие
class ENG_AUXVERB as AUXVERB_en
class ENG_AUXVERB as AUXVERB_en
21,815
3
// `Core` contract handling access control
ICore public core;
ICore public core;
38,384
222
// return xSushi for sushi
function leaveSushiBar(uint _amountXSushi) external onlyVaultManagers { _leaveSushiBar(_amountXSushi); }
function leaveSushiBar(uint _amountXSushi) external onlyVaultManagers { _leaveSushiBar(_amountXSushi); }
22,941
6
// Tells if contract is on maintenancereturn _maintenance if contract is on maintenance /
function maintenance() public view returns (bool _maintenance) { bytes32 position = maintenancePosition; assembly { _maintenance := sload(position) } }
function maintenance() public view returns (bool _maintenance) { bytes32 position = maintenancePosition; assembly { _maintenance := sload(position) } }
20,320
8
// execute the correct swap based on the type
if (_type == 0){ _executeCurveSwap(msg.value, swapInputs.zapperContract, swapInputs.zapperCallData); } else if (_type == 1){
if (_type == 0){ _executeCurveSwap(msg.value, swapInputs.zapperContract, swapInputs.zapperCallData); } else if (_type == 1){
17,627
1,008
// Checks whether the provided `collateral` and `numTokens` have a collateralization ratio above the global collateralization ratio.
function _checkCollateralization(FixedPoint.Unsigned memory collateral, FixedPoint.Unsigned memory numTokens) private view returns (bool)
function _checkCollateralization(FixedPoint.Unsigned memory collateral, FixedPoint.Unsigned memory numTokens) private view returns (bool)
21,711
14
// pathFrom Description:Used to storing how many tokens does each DAO send to the module Example on how the values are stored:token -> DAO -> amount[[123, 0, 123], [0, 123, 0]]token 1: DAO 1 sends 123, DAO 2 sends 0, DAO 3 sends 123, etc. pathTo Description:Used for storing how many tokens does each DAO receive from th...
struct TokenSwap { /// The participating DAOs address[] daos; /// The tokens involved in the swap address[] tokens; /// The token flow from the DAOs to the module, see above uint256[][] pathFrom; /// The token flow from the module to the DAO, see above ...
struct TokenSwap { /// The participating DAOs address[] daos; /// The tokens involved in the swap address[] tokens; /// The token flow from the DAOs to the module, see above uint256[][] pathFrom; /// The token flow from the module to the DAO, see above ...
5,469
15
// Returns the downcasted uint200 from uint256, reverting onoverflow (when the input is greater than largest uint200). Counterpart to Solidity's `uint200` operator. Requirements: - input must fit into 200 bits _Available since v4.7._ /
function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); }
function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); }
6,603
115
// reduce the amount to be sent
amount = amount.sub(burnAmount);
amount = amount.sub(burnAmount);
81,169
17
// public name
string public NAME;
string public NAME;
12,757
4
// Collection of messages communicated in a channel between two users
mapping(bytes32 => message[]) allMessages; // key : Hash(user1,user2)
mapping(bytes32 => message[]) allMessages; // key : Hash(user1,user2)
4,153
8
// Allows the owner to set the base URI
function setBaseURI(string calldata _baseTokenURI) external onlyOwner { baseTokenURI = _baseTokenURI; }
function setBaseURI(string calldata _baseTokenURI) external onlyOwner { baseTokenURI = _baseTokenURI; }
6,447
25
// Update House function Updates a house/
function updateHouse(address newHouseAddress,address oldHouseAddress) public { require(!trackerData.managed || msg.sender==owner,"Tracker is managed"); require(houses[oldHouseAddress].owner==msg.sender || houses[oldHouseAddress].owner==oldHouseAddress,"Caller isn't the owner of old House"); ...
function updateHouse(address newHouseAddress,address oldHouseAddress) public { require(!trackerData.managed || msg.sender==owner,"Tracker is managed"); require(houses[oldHouseAddress].owner==msg.sender || houses[oldHouseAddress].owner==oldHouseAddress,"Caller isn't the owner of old House"); ...
26,103
645
// Address of Audius DelegateManager contract, used to permission Governance method calls
address private delegateManagerAddress;
address private delegateManagerAddress;
38,645
45
// Emitted when a deposit is cancelled/id Deposit id
event CancelRequested(uint256 indexed id);
event CancelRequested(uint256 indexed id);
27,336
13
// The base interface is what the parent contract expects to be able to use.If rules change in the future, and new logic is introduced, it only has toimplement these methods, wtih the role of the curator being usedto execute the additional functionality (if any). /
contract LotteryGameLogicInterface { address public currentRound; function finalizeRound() returns(address); function isUpgradeAllowed() constant returns(bool); function transferOwnership(address newOwner); }
contract LotteryGameLogicInterface { address public currentRound; function finalizeRound() returns(address); function isUpgradeAllowed() constant returns(bool); function transferOwnership(address newOwner); }
40,185
20
// Function used to get the balance of the sender
function getBalance() public view returns (uint256) { return msg.sender.balance; }
function getBalance() public view returns (uint256) { return msg.sender.balance; }
41,525
19
// Change the payout address /
function setPayout(address payout) external adminRequired { require(payout != address(0), "can't be null address"); require(payout != address(this), "can't be this contract"); require(payout != _payout, "can't be the current Payout "); _payout = payout; }
function setPayout(address payout) external adminRequired { require(payout != address(0), "can't be null address"); require(payout != address(this), "can't be this contract"); require(payout != _payout, "can't be the current Payout "); _payout = payout; }
18,796
140
// Initializes the contract by setting a `name` and a `symbol` to the token collection. /
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
2,077
19
// gives the current twap price measured from amountIntokenIn gives amountOut
function current(address tokenIn, uint amountIn) external view returns (uint amountOut) { Observation memory _observation = lastObservation(); (uint reserve0Cumulative, uint reserve1Cumulative,) = currentCumulativePrices(); if (block.timestamp == _observation.timestamp) { _observ...
function current(address tokenIn, uint amountIn) external view returns (uint amountOut) { Observation memory _observation = lastObservation(); (uint reserve0Cumulative, uint reserve1Cumulative,) = currentCumulativePrices(); if (block.timestamp == _observation.timestamp) { _observ...
4,415
7
// If the option wasn't exercised, but it's not active - this means it expired - and only writers can withdraw the collateral
writerBalances[msg.sender] = writerBalances[msg.sender].sub( _amount, "Option.withdraw: Withdraw amount exceeds options written" );
writerBalances[msg.sender] = writerBalances[msg.sender].sub( _amount, "Option.withdraw: Withdraw amount exceeds options written" );
20,861
13
// difference
uint difNum = bb- aa;
uint difNum = bb- aa;
29,694
105
// protocol fee multiplied by 10 ^ 12
uint256 public protocolFee;
uint256 public protocolFee;
42,330
124
// Makes sure that the requested outbound components do not exceed the current positions_fundAddress of the fund subject of the trade /
function _checkOutboundComponents(ISetToken _fund) internal view { for (uint256 i = 0; i < proposalDetails[_fund].outboundTradeComponents.length; i++) { address tradeComponentAddress = proposalDetails[_fund] .outboundTradeComponents[i] .componentAddress; if (_fund.isComponent(tradeComponen...
function _checkOutboundComponents(ISetToken _fund) internal view { for (uint256 i = 0; i < proposalDetails[_fund].outboundTradeComponents.length; i++) { address tradeComponentAddress = proposalDetails[_fund] .outboundTradeComponents[i] .componentAddress; if (_fund.isComponent(tradeComponen...
10,308
45
// token being minted
if (from == address(0)) { _existingTokens += 1; }
if (from == address(0)) { _existingTokens += 1; }
17,013
47
// If the merkle root is non-zero this is a private sale and requires a valid proof
if (config.merkleRoot == bytes32(0)) {
if (config.merkleRoot == bytes32(0)) {
29,621
58
// ProductProxy This contract implements a proxy that it is deploied by ProxyFactory, and it's implementation is stored in factory. /
contract ProductProxy is Proxy { /** * @dev Storage slot with the address of the ProxyFactory. * This is the keccak-256 hash of "eip1967.proxy.factory" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant FACTORY_SLOT = 0x7a45a402e4cb6e08ebc196f20f66d5d30e67285a2a8aa...
contract ProductProxy is Proxy { /** * @dev Storage slot with the address of the ProxyFactory. * This is the keccak-256 hash of "eip1967.proxy.factory" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant FACTORY_SLOT = 0x7a45a402e4cb6e08ebc196f20f66d5d30e67285a2a8aa...
35,237
436
// Initializes the Factory with an instance of the Compound Prize Pool
constructor () public { instance = new CompoundPrizePool(); }
constructor () public { instance = new CompoundPrizePool(); }
58,005
25
// Mint `amount` debt tokens.//`recipient` must be non-zero or this call will revert with an {IllegalArgument} error./`amount` must be greater than zero or this call will revert with a {IllegalArgument} error.//Emits a {Mint} event.//_NOTE:_ This function is WHITELISTED.//Example:/```/uint256 amtDebt = 5000;/AlchemistV...
function mint(uint256 amount, address recipient) external;
function mint(uint256 amount, address recipient) external;
39,740
21
// Returns the contents joined with commas between them/contents1 The first content to join/contents2 The second content to join/contents3 The third content to join/contents4 The fourth content to join/contents5 The fifth content to join/contents6 The sixth content to join/ return A collection of bytes that represent a...
function commaSeparated(bytes memory contents1, bytes memory contents2, bytes memory contents3, bytes memory contents4, bytes memory contents5, bytes memory contents6) internal pure returns (bytes memory) { return abi.encodePacked(commaSeparated(contents1, contents2, contents3, contents4, contents5), contin...
function commaSeparated(bytes memory contents1, bytes memory contents2, bytes memory contents3, bytes memory contents4, bytes memory contents5, bytes memory contents6) internal pure returns (bytes memory) { return abi.encodePacked(commaSeparated(contents1, contents2, contents3, contents4, contents5), contin...
11,604
13
// Only allows the `owner` to execute the function.
modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; }
modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; }
1,459
183
// pre-sale
function presaleMint(uint256 _mintAmount) public payable { require( block.timestamp >= timeDeployed + presaleTime, "Pre-sale minting not allowed yet" ); require( block.timestamp < timeDeployed + allowMintingAfter, "Presale is over"); req...
function presaleMint(uint256 _mintAmount) public payable { require( block.timestamp >= timeDeployed + presaleTime, "Pre-sale minting not allowed yet" ); require( block.timestamp < timeDeployed + allowMintingAfter, "Presale is over"); req...
60,497
6
// 已放款待确认时取消申诉(转为发布中或者为已放款)
event CancelAppealInReleaseToConfirm(string loanId);
event CancelAppealInReleaseToConfirm(string loanId);
22,600
15
// Core logic of the `decreaseApproval` function. This function can only be called by the referenced proxy, which has a `decreaseApproval` function. Every argument passed to that function as well as the original `msg.sender` gets passed to this function. NOTE: approvals for the zero address (unspendable) are disallowed...
function decreaseApprovalWithSender( address _sender, address _spender, uint256 _subtractedValue ) public onlyProxy returns (bool success)
function decreaseApprovalWithSender( address _sender, address _spender, uint256 _subtractedValue ) public onlyProxy returns (bool success)
5,199
26
// console.log(payout, "payout amount");
sales.totalClaimed += uint96(payout); sales.ethBalance -= uint96(payout); _transfer(msg.sender, payout);
sales.totalClaimed += uint96(payout); sales.ethBalance -= uint96(payout); _transfer(msg.sender, payout);
13,211
73
// Transfer token to a specified address and forward the data to recipient ERC-677 standard_toReceiver address._value Amount of tokens that will be transferred._dataTransaction metadata./
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) { require(_to != address(0)); require(canAcceptTokens_[_to] == true); // security check that contract approved by the exchange require(transfer(_to, _value)); // do a normal token transfer to the contract ...
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) { require(_to != address(0)); require(canAcceptTokens_[_to] == true); // security check that contract approved by the exchange require(transfer(_to, _value)); // do a normal token transfer to the contract ...
63,561
320
// Gets the balance of the specified address owner address to query the balance ofreturn uint256 representing the amount owned by the passed address /
function balanceOf(address owner) public view returns (uint256) { require(owner != address(0)); return _ownedTokensCount[owner].current(); }
function balanceOf(address owner) public view returns (uint256) { require(owner != address(0)); return _ownedTokensCount[owner].current(); }
63,166