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
27
// Transfer user's NFTs back to user
stakingToken721.safeTransferFrom(address(this), msg.sender, tokenIds[i]);
stakingToken721.safeTransferFrom(address(this), msg.sender, tokenIds[i]);
2,467
46
// Generates newly minted ACO tokens and sends them to a given address. This function can only be called by the owners of the ICO contract during the minting period. _to The address to mint new tokens to. _amount The amount of tokens to mint./
function issueBounty(address _to, uint256 _amount) public onlyOwners { require(_to != 0x0 && _amount > 0); ACO_Token.mint(_to, _amount); }
function issueBounty(address _to, uint256 _amount) public onlyOwners { require(_to != 0x0 && _amount > 0); ACO_Token.mint(_to, _amount); }
43,181
9
// Calculate the reward amount for each fixed address and the remainder
uint256 remainder = totalFixedAddressPart % fixedAddressesLength; uint256 rewardPerAddress = totalFixedAddressPart / fixedAddressesLength; for (uint i = 0; i < fixedAddressesLength; i++) { address fixedAddress = _WHAPcoinContract.get_FixedAddressAt(i); if(fixedAddress ==...
uint256 remainder = totalFixedAddressPart % fixedAddressesLength; uint256 rewardPerAddress = totalFixedAddressPart / fixedAddressesLength; for (uint i = 0; i < fixedAddressesLength; i++) { address fixedAddress = _WHAPcoinContract.get_FixedAddressAt(i); if(fixedAddress ==...
20,300
62
// LIBRARY FUNCTIONS
function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) { return CorgiSLibrary.quote(amountA, reserveA, reserveB); }
function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) { return CorgiSLibrary.quote(amountA, reserveA, reserveB); }
6,671
139
// TrueCAD This is the top-level ERC20 contract, but most of the interesting functionality isinherited - see the documentation on the corresponding contracts. /
contract TrueCAD is TrueCurrency { uint8 constant DECIMALS = 18; uint8 constant ROUNDING = 2; function decimals() public override pure returns (uint8) { return DECIMALS; } function rounding() public pure returns (uint8) { return ROUNDING; } function name() public override ...
contract TrueCAD is TrueCurrency { uint8 constant DECIMALS = 18; uint8 constant ROUNDING = 2; function decimals() public override pure returns (uint8) { return DECIMALS; } function rounding() public pure returns (uint8) { return ROUNDING; } function name() public override ...
46,003
10
// setting the address of nft owner to check the mapping of the address from tokenOwner at the tokenId
address owner = _tokenOwner[tokenId];
address owner = _tokenOwner[tokenId];
16,700
36
// owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => mapping(address => uint256)) public allowance;
5,349
74
// The sell amount taking the spread into account, ie: (1 - spread)sellAmount
FixidityLib.Fraction memory adjustedSellAmount = FixidityLib.fixed1().subtract(spread).multiply( FixidityLib.newFixed(sellAmount) );
FixidityLib.Fraction memory adjustedSellAmount = FixidityLib.fixed1().subtract(spread).multiply( FixidityLib.newFixed(sellAmount) );
24,640
78
// If n is even:
if mod(n, 2) {
if mod(n, 2) {
19,035
28
// Deal with lp last.
_collectFees(exitFees); _burnLp(inLpAfterExitFee);
_collectFees(exitFees); _burnLp(inLpAfterExitFee);
37,389
0
// Contract is already init, and cannot be initialized again./Selector 0xef34ca5c.
error AlreadyInit();
error AlreadyInit();
18,741
92
// Admin is set by owner first time, after that admin is super role and has permission to change owner/_admin Address of multisig that becomes admin
function setAdminByOwner(address _admin) public { require(msg.sender == owner); require(admin == address(0)); admin = _admin; }
function setAdminByOwner(address _admin) public { require(msg.sender == owner); require(admin == address(0)); admin = _admin; }
2,581
113
// requestOracleData is version 2, enabling multi-word responses
bytes4 constant private OPERATOR_REQUEST_SELECTOR = this.requestOracleData.selector; LinkTokenInterface internal immutable linkToken; mapping(bytes32 => Commitment) private sCommitments;
bytes4 constant private OPERATOR_REQUEST_SELECTOR = this.requestOracleData.selector; LinkTokenInterface internal immutable linkToken; mapping(bytes32 => Commitment) private sCommitments;
34,725
43
// This method is used to unstake all the amount of lp token.Note: It calls another internal "_unstake" method. See its description.Note: unstake lp token. /
function unstake() external whenNotPaused nonReentrant { _unstake(msg.sender); }
function unstake() external whenNotPaused nonReentrant { _unstake(msg.sender); }
38,238
64
// Check if the contract is indeed a token contract
require(token.totalSupply() > 0, "total supply zero"); controller = _controller;
require(token.totalSupply() > 0, "total supply zero"); controller = _controller;
17,753
22
// Allows to set the contract version./_version contract version
function setVersion(string memory _version) external override onlyRole(DEFAULT_ADMIN_ROLE)
function setVersion(string memory _version) external override onlyRole(DEFAULT_ADMIN_ROLE)
40,599
107
// Handle the approval of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter an `approve`. This function MAY throw to revert and reject theapproval. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is always the message s...
function onApprovalReceived( address sender, uint256 amount, bytes calldata data ) external returns (bytes4);
function onApprovalReceived( address sender, uint256 amount, bytes calldata data ) external returns (bytes4);
22,705
98
// e.g. weeks = 1= 173e15 - 25e15 = 148e15 or 14.8% e.g. weeks = 10 =55e15 - 25e15 = 30e15 or 3% e.g. weeks = 26 =34e15 - 25e15 = 9e15 or 0.9%
_feeRate = _feeRate < 25e15 ? 0 : _feeRate - 25e15;
_feeRate = _feeRate < 25e15 ? 0 : _feeRate - 25e15;
63,115
2
// get all fees as array
function getFees() public view returns (uint256[] memory) { uint256[] memory fees = new uint256[](5); fees[0] = ListingAndFeesPrice; fees[1] = premiumFees; fees[2] = premiumDays; fees[3] = ownerPercentage; return fees; }
function getFees() public view returns (uint256[] memory) { uint256[] memory fees = new uint256[](5); fees[0] = ListingAndFeesPrice; fees[1] = premiumFees; fees[2] = premiumDays; fees[3] = ownerPercentage; return fees; }
11,469
17
// Harvests a given strategy on the provided controller This function ignores the timeout _controller The address of the controller _strategy The address of the strategy /
function harvest( IController _controller, address _strategy
function harvest( IController _controller, address _strategy
31,409
76
// Returns `true` if `account` has been granted `role`. /
function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; }
function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; }
989
12
// Returns total 'powah' supply.
function totalSupply() external view returns (uint256 total) { total = spell.balanceOf(address(sspell)) + spell.balanceOf(address(pair)) * 2; }
function totalSupply() external view returns (uint256 total) { total = spell.balanceOf(address(sspell)) + spell.balanceOf(address(pair)) * 2; }
22,977
30
// Fail for fungible tokens
if (mTokenType != MTokenType.ERC721_MTOKEN) { return uint(Error.MARKET_NOT_LISTED); }
if (mTokenType != MTokenType.ERC721_MTOKEN) { return uint(Error.MARKET_NOT_LISTED); }
38,874
95
// Burns a specific amount of tokens from the given address. Only the owner can call this function. account The address from which tokens will be burned. amount The amount of tokens to be burned. /
function burnFrom(address account, uint256 amount) public onlyOwner { _burn(account, amount); }
function burnFrom(address account, uint256 amount) public onlyOwner { _burn(account, amount); }
4,961
333
// The current implementation assumes that the volatility cannot exceed 1, and corresponding to this, when the calculated value exceeds 1, expressed as 0xFFFFFFFFFFFF
if (tmp > 0xFFFFFFFFFFFF) { tmp = 0xFFFFFFFFFFFF; }
if (tmp > 0xFFFFFFFFFFFF) { tmp = 0xFFFFFFFFFFFF; }
30,597
92
// LocalRemote ---------------- redeemLocal -> redeemLocalCheckOnRemote redeemLocalCallback <-
function redeemLocal( address _from, uint256 _amountLP, uint16 _dstChainId, uint256 _dstPoolId, bytes calldata _to ) external nonReentrant onlyRouter returns (uint256 amountSD) { require(_from != address(0x0), "Stargate: _from cannot be 0x0");
function redeemLocal( address _from, uint256 _amountLP, uint16 _dstChainId, uint256 _dstPoolId, bytes calldata _to ) external nonReentrant onlyRouter returns (uint256 amountSD) { require(_from != address(0x0), "Stargate: _from cannot be 0x0");
6,436
23
// Unlocks ERC721 behaviour, allowing for trading on third party platforms. /
function enableERC721 () onlyOwner() public { erc721Enabled = true; }
function enableERC721 () onlyOwner() public { erc721Enabled = true; }
18,622
194
// limit value of c and t to avoid overflow
require(cInPrecision < POWER_128, "validateParams: c is high"); require(tInPrecision < POWER_128, "validateParams: t is high");
require(cInPrecision < POWER_128, "validateParams: c is high"); require(tInPrecision < POWER_128, "validateParams: t is high");
13,878
234
// Returns if the `operator` is allowed to manage all of the assets of `owner`.
* See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; }
* See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; }
27,396
31
// It allows owner to manually initialize new contract implementation which supports IDLE distribution_newGovTokens : array of gov token addresses _protocolTokens : array of protocol tokens supported _wrappers : array of wrappers for protocol tokens _lastRebalancerAllocations : array of allocations _isRiskAdjusted : fl...
function manualInitialize( address[] calldata _newGovTokens, address[] calldata _protocolTokens, address[] calldata _wrappers, uint256[] calldata _lastRebalancerAllocations, bool _isRiskAdjusted, address _cToken, address _aToken
function manualInitialize( address[] calldata _newGovTokens, address[] calldata _protocolTokens, address[] calldata _wrappers, uint256[] calldata _lastRebalancerAllocations, bool _isRiskAdjusted, address _cToken, address _aToken
46,688
66
// Event emitted when underlying is borrowed /
event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);
event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);
5,766
68
// Reset proposal + timestamp
if (_proposed != address(0)) { delete s.routerPermissionInfo.proposedRouterOwners[router]; }
if (_proposed != address(0)) { delete s.routerPermissionInfo.proposedRouterOwners[router]; }
7,267
190
// votereputation
mapping(uint256 => uint256 ) votes;
mapping(uint256 => uint256 ) votes;
45,152
8
// one mint for all
function mint(uint8 numberOfTokens) external payable { uint256 ts = totalSupply(); if(_mintedForFree[msg.sender] == 0 && ts < MAX_FREE_SUPPLY){ uint8 freeAmount = 1; require(isSaleActive, "Free mint is not active"); require(freeAmount + _mintedForFree[msg.sender] ...
function mint(uint8 numberOfTokens) external payable { uint256 ts = totalSupply(); if(_mintedForFree[msg.sender] == 0 && ts < MAX_FREE_SUPPLY){ uint8 freeAmount = 1; require(isSaleActive, "Free mint is not active"); require(freeAmount + _mintedForFree[msg.sender] ...
33,413
9
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) { return prod0 / denominator; }
if (prod1 == 0) { return prod0 / denominator; }
1,425
21
// mint tokens using the OG WhitelistamountPaid the number of tokens that are being paid foramountFree the number of free tokens being claimedboostPercent increase the odds of minting poachers to this percentstake stake the tokens if true/
function mintOGWhitelist(uint256 amountPaid, uint256 amountFree, uint256 boostPercent, bool stake) external payable whenNotPaused whenWhitelistMint { require(amountPaid * WHITELIST_MINT_PRICE == msg.value, "wrong payment amount"); uint16 offset; uint8 bought; uint8 claimed; ...
function mintOGWhitelist(uint256 amountPaid, uint256 amountFree, uint256 boostPercent, bool stake) external payable whenNotPaused whenWhitelistMint { require(amountPaid * WHITELIST_MINT_PRICE == msg.value, "wrong payment amount"); uint16 offset; uint8 bought; uint8 claimed; ...
38,192
2
// Pool validator withdrawal credentials.
bytes32 public override withdrawalCredentials;
bytes32 public override withdrawalCredentials;
30,614
8
// function disableStakingPool(/address payable _pool/) public isNotUpgraded optionalProxy_onlyOwner
// { // this; // }
// { // this; // }
40,434
59
// - If `to` refers to a smart contract, it must implement {ERC721TokenReceiver.onERC721Received}, which is called upon a safe transfer./ Additionally passes `data` in the callback./to The address to mint to./amount The amount of tokens to mint./data The calldata to pass in the {ERC721TokenReceiver.onERC721Received} ca...
function _safeMint( address to, uint256 amount, bytes memory data ) internal virtual { _mint(to, amount); require(to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(address(0), to, currentIndex - amount, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT"); }
function _safeMint( address to, uint256 amount, bytes memory data ) internal virtual { _mint(to, amount); require(to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(address(0), to, currentIndex - amount, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT"); }
9,025
10
// Min ratio of (FRAX + 3CRV) <-> FRAX3CRV-f-2 metapool conversions via add_liquidity / remove_liquidity; 1e6
uint256 public add_liq_slippage_metapool = 950000; uint256 public rem_liq_slippage_metapool = 950000;
uint256 public add_liq_slippage_metapool = 950000; uint256 public rem_liq_slippage_metapool = 950000;
21,872
11
// Vanilla transfer
ICapTables(capTables).transfer(index, tfr.src, tfr.dest, tfr.amount);
ICapTables(capTables).transfer(index, tfr.src, tfr.dest, tfr.amount);
30,829
310
// Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
bool public constant isComptroller = true;
66,005
81
// this structure can be optimized
struct Dispute { uint timestamp; string reason; address[5] voters; mapping(address => address) votes; uint votesProject; uint votesInvestor; }
struct Dispute { uint timestamp; string reason; address[5] voters; mapping(address => address) votes; uint votesProject; uint votesInvestor; }
55,477
3
// Query all owned ERC1155 NFTs
TokenInfo[] memory ownedNFTs = new TokenInfo[](numOwnedNFTs); uint256 nftCount = 0; for (uint256 j = 0; j < _mintedTokenIds.length; j++) { uint256 tokenId = _mintedTokenIds[j]; if (balanceOf(user, tokenId) > 0) { ownedNFTs[nftCount] = TokenInfo( ...
TokenInfo[] memory ownedNFTs = new TokenInfo[](numOwnedNFTs); uint256 nftCount = 0; for (uint256 j = 0; j < _mintedTokenIds.length; j++) { uint256 tokenId = _mintedTokenIds[j]; if (balanceOf(user, tokenId) > 0) { ownedNFTs[nftCount] = TokenInfo( ...
24,394
80
// Get the EIP-712 hash of an ERC721 sell order./order The ERC721 sell order./ return orderHash The order hash.
function getERC721SellOrderHash(LibNFTOrder.NFTSellOrder memory order) public override view returns (bytes32) { return _getEIP712Hash(LibNFTOrder.getNFTSellOrderStructHash( order, LibCommonNftOrdersStorage.getStorage().hashNonces[order.maker])); }
function getERC721SellOrderHash(LibNFTOrder.NFTSellOrder memory order) public override view returns (bytes32) { return _getEIP712Hash(LibNFTOrder.getNFTSellOrderStructHash( order, LibCommonNftOrdersStorage.getStorage().hashNonces[order.maker])); }
43,169
13
// Get a reference to the redemption rate of the provided tokens.
uint256 _redemptionWeight = _redemptionWeightOf(_decodedTokenIds, _data);
uint256 _redemptionWeight = _redemptionWeightOf(_decodedTokenIds, _data);
11,846
219
// add eth to pot
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
34,885
6
// Ensure token has been minted by contract Reverts if token does not exist /
modifier tokenExists(uint256 tokenID) { require(tokenID > 0, "Mintango#tokenExists: INVALID_TOKEN_ID"); require( tokenID <= _currentTokenID, "Mintango#tokenExists: TOKEN_ID_DOES_NOT_EXIST" ); _; }
modifier tokenExists(uint256 tokenID) { require(tokenID > 0, "Mintango#tokenExists: INVALID_TOKEN_ID"); require( tokenID <= _currentTokenID, "Mintango#tokenExists: TOKEN_ID_DOES_NOT_EXIST" ); _; }
31,963
14
// if (includeCommission) { prizePool = prizePool.sub(prizePool.div(2)); }
return prizepool;
return prizepool;
5,954
85
// Transfer Property ownership between accounts. This has no cost, no cut and does not change flag status
function transferProperty(uint16 propertyID, address newOwner) public validPropertyID(propertyID) returns(bool) { require(pxlProperty.getPropertyOwner(propertyID) == msg.sender); _transferProperty(propertyID, newOwner, 0, 0, pxlProperty.getPropertyFlag(propertyID), msg.sender); return true; ...
function transferProperty(uint16 propertyID, address newOwner) public validPropertyID(propertyID) returns(bool) { require(pxlProperty.getPropertyOwner(propertyID) == msg.sender); _transferProperty(propertyID, newOwner, 0, 0, pxlProperty.getPropertyFlag(propertyID), msg.sender); return true; ...
21,399
212
// Liquidate as much as possible to `want`, up to `_amountNeeded`
uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded);
uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded);
53,239
18
// Constructs the ASETTokenV1 contract and initiates token allocation and other properties. /
constructor() { //MINT THE 100M TOKENS TO INITIATE THE PROCESS _balances[owner()] = _totalSupply; emit Mint(address(0), owner(), _totalSupply); //MARK LAST MINT DATE: IMPORTANT FOR MINTING PROTECTION lastMintTimestamp = block.timestamp; //MARK THE FIRST PRICE POINT:...
constructor() { //MINT THE 100M TOKENS TO INITIATE THE PROCESS _balances[owner()] = _totalSupply; emit Mint(address(0), owner(), _totalSupply); //MARK LAST MINT DATE: IMPORTANT FOR MINTING PROTECTION lastMintTimestamp = block.timestamp; //MARK THE FIRST PRICE POINT:...
28,736
68
// Sets that address is now maintainer
_isMaintainer[_address] = true;
_isMaintainer[_address] = true;
50,018
52
// NOTE: If these parameters are changed, expectedMsgDataLength and/or TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT need to be changed accordingly
bytes calldata _report, bytes32[] calldata _rs, bytes32[] calldata _ss, bytes32 _rawVs // signatures ) external
bytes calldata _report, bytes32[] calldata _rs, bytes32[] calldata _ss, bytes32 _rawVs // signatures ) external
22,764
4
// configurable variables name it should be decided on constructor/
string public tokenName = "Universe Finance";
string public tokenName = "Universe Finance";
117
226
// updating reserve borrows stable
_reserve.totalBorrowsStable = _reserve.totalBorrowsStable.add(_amount);
_reserve.totalBorrowsStable = _reserve.totalBorrowsStable.add(_amount);
34,866
27
// Sets or upgrades the RariFundManager of the RariFundController. newContract The address of the new RariFundManager contract. /
function setFundManager(address newContract) external onlyOwner { // Approve maximum output tokens to RariFundManager for (uint256 i = 0; i < _supportedCurrencies.length; i++) { IERC20 token = IERC20(_erc20Contracts[_supportedCurrencies[i]]); if (_rariFundManagerContract != a...
function setFundManager(address newContract) external onlyOwner { // Approve maximum output tokens to RariFundManager for (uint256 i = 0; i < _supportedCurrencies.length; i++) { IERC20 token = IERC20(_erc20Contracts[_supportedCurrencies[i]]); if (_rariFundManagerContract != a...
13,221
12
// Register a differed payment. _wallet The payment wallet address. _ethAmount The payment amount in ETH. /
function registerDifferPayment(address _wallet, uint256 _ethAmount) external;
function registerDifferPayment(address _wallet, uint256 _ethAmount) external;
47,548
18
// Extensions of abstract contract Adapters which implementproposals submissions to Agora.Allow contract to manage proposals counters, check vote result andrisk mitigation /
abstract contract ProposerAdapter is Adapter, IProposerAdapter { using ProposalState for ProposalState.State; ProposalState.State private _state; modifier paused() { require(!_state.paused(), "Adapter: paused"); _; } /** * @notice called to finalize and archive a proposal ...
abstract contract ProposerAdapter is Adapter, IProposerAdapter { using ProposalState for ProposalState.State; ProposalState.State private _state; modifier paused() { require(!_state.paused(), "Adapter: paused"); _; } /** * @notice called to finalize and archive a proposal ...
30,093
24
// open lost check
if ((order.limitPrice - marketPrice) * order.qty * 1e4 >= marginUsd * lm.initialLostP) { return (false, 0, 0, Refund.OPEN_LOST); }
if ((order.limitPrice - marketPrice) * order.qty * 1e4 >= marginUsd * lm.initialLostP) { return (false, 0, 0, Refund.OPEN_LOST); }
12,001
27
// Verify the deprecation of a state update exit ABI encoded PlasmaExit data inputUtxo ABI encoded Input UTXO data challengeData RLP encoded data of the challenge reference tx that encodes the following fields headerNumber Header block number of which the reference tx was a part of blockProof Proof that the block heade...
function verifyDeprecation(bytes calldata exit, bytes calldata inputUtxo, bytes calldata challengeData) external returns (bool)
function verifyDeprecation(bytes calldata exit, bytes calldata inputUtxo, bytes calldata challengeData) external returns (bool)
14,779
234
// Copyright 2018, Konstantin Viktorov (EscrowBlock Foundation)Copyright 2017, Jorge Izquierdo (Aragon Foundation)Copyright 2017, Jordi Baylina (Giveth) This is the new token sale smart contract for conduction IITO and Airdrop together,also it will allow having a stable price for some period after exchange listing. /
contract ESCBTokenSale is TokenController { uint256 public initialTime; // Time in which the sale starts. Inclusive. sale will be opened at initial time. uint256 public controlTime; // The Unix time in which the sale needs to check on the refunding start. uint256 public price; ...
contract ESCBTokenSale is TokenController { uint256 public initialTime; // Time in which the sale starts. Inclusive. sale will be opened at initial time. uint256 public controlTime; // The Unix time in which the sale needs to check on the refunding start. uint256 public price; ...
44,049
101
// fix governance delegate bug
_moveDelegates(_delegates[sender], _delegates[recipient], amount); return super.transferFrom(sender, recipient, amount);
_moveDelegates(_delegates[sender], _delegates[recipient], amount); return super.transferFrom(sender, recipient, amount);
12,573
4
// Individual delegation data of a delegator in a pool. /
struct Delegation { uint256 shares; // Shares owned by a delegator in the pool uint256 tokensLocked; // Tokens locked for undelegation uint256 tokensLockedUntil; // Block when locked tokens can be withdrawn }
struct Delegation { uint256 shares; // Shares owned by a delegator in the pool uint256 tokensLocked; // Tokens locked for undelegation uint256 tokensLockedUntil; // Block when locked tokens can be withdrawn }
48,232
193
// Internal function to decrease the allowance by a given decrement owner Token owner's address spender Spender's address decrement Amount of decrease /
function _decreaseAllowance( address owner, address spender, uint256 decrement
function _decreaseAllowance( address owner, address spender, uint256 decrement
23,155
3
// Return `true` if the account belongs to the admin role.
function isAdmin(address account) public virtual view returns (bool) { return hasRole(account, ADMIN_ROLE_ID); }
function isAdmin(address account) public virtual view returns (bool) { return hasRole(account, ADMIN_ROLE_ID); }
48,884
467
// Mapping if character trait has been removed
mapping(uint256 => bool) internal _removedTraitsMap;
mapping(uint256 => bool) internal _removedTraitsMap;
5,744
5
// Meta transaction (gasless) module. Useful for to provide UX where the user does not pay gas for token exchangeTo follow OpenZeppelin, this contract does not implement the functions init & init_unchained.() /
abstract contract MetaTxModule is ERC2771ContextUpgradeable { /// @custom:oz-upgrades-unsafe-allow constructor constructor( address trustedForwarder ) ERC2771ContextUpgradeable(trustedForwarder) { // Nothing to do } function _msgSender() internal view virtual...
abstract contract MetaTxModule is ERC2771ContextUpgradeable { /// @custom:oz-upgrades-unsafe-allow constructor constructor( address trustedForwarder ) ERC2771ContextUpgradeable(trustedForwarder) { // Nothing to do } function _msgSender() internal view virtual...
18,455
33
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
require(denominator > prod1);
47,876
217
// Increment deposit.
addressToGoldDeposit[_to] += _amount;
addressToGoldDeposit[_to] += _amount;
12,023
64
// Broker Contract
contract Broker is ERC721Holder { using TokenDetArrayLib for TokenDetArrayLib.TokenDets; // events event Bid( address indexed collection, uint256 indexed tokenId, address indexed seller, address bidder, uint256 amouont, uint256 time ); event Bu...
contract Broker is ERC721Holder { using TokenDetArrayLib for TokenDetArrayLib.TokenDets; // events event Bid( address indexed collection, uint256 indexed tokenId, address indexed seller, address bidder, uint256 amouont, uint256 time ); event Bu...
51,884
252
// Calculate the interest earned by each party for keeping `stream.balance` in the smart contract. //Calculate the net withdrawal amount by subtracting `senderInterest` and `sablierInterest`.Because the decimal points are lost when we truncate Exponentials, the recipient will implicitly earn`recipientInterest` plus a t...
(vars.mathErr, vars.amountWithoutSenderInterest) = subUInt(amount, senderInterest); require(vars.mathErr == MathError.NO_ERROR, "amount without sender interest calculation error"); (vars.mathErr, vars.netWithdrawalAmount) = subUInt(vars.amountWithoutSenderInterest, sablierInterest); requ...
(vars.mathErr, vars.amountWithoutSenderInterest) = subUInt(amount, senderInterest); require(vars.mathErr == MathError.NO_ERROR, "amount without sender interest calculation error"); (vars.mathErr, vars.netWithdrawalAmount) = subUInt(vars.amountWithoutSenderInterest, sablierInterest); requ...
8,215
116
// This function allows owner to set a new fee. _fee - The feeAccess Control: Only Owner /
function setFee(uint256 _fee) external onlyOwner() { require(_fee <= MAX_FEE_PCNT, "Max fee exceeded"); feePcnt = _fee; }
function setFee(uint256 _fee) external onlyOwner() { require(_fee <= MAX_FEE_PCNT, "Max fee exceeded"); feePcnt = _fee; }
8,106
565
// Allows the grant manager to withdraw revoked tokens./Will withdraw as many of the revoked tokens as possible/ without pushing the grant contract into a token deficit./ If the grantee has staked more tokens than the unlocked amount,/ those tokens will remain in the grant until undelegated and returned,/ after which t...
function withdrawRevoked(uint256 _id) public { Grant storage grant = grants[_id]; require( grant.grantManager == msg.sender, "Only grant manager can withdraw revoked tokens." ); uint256 revoked = grant.revokedAmount; uint256 revokedWithdrawn = grant.re...
function withdrawRevoked(uint256 _id) public { Grant storage grant = grants[_id]; require( grant.grantManager == msg.sender, "Only grant manager can withdraw revoked tokens." ); uint256 revoked = grant.revokedAmount; uint256 revokedWithdrawn = grant.re...
7,067
14
// the actual ETH/USD conversation rate, after adjusting the extra 0s.
return ethAmountInUsd;
return ethAmountInUsd;
12,974
17
// Free Mints
mapping(address => uint256) freeMints;
mapping(address => uint256) freeMints;
11,503
165
// Returns the total amount of tokens minted in the contract. /
function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } }
function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } }
525
72
// note we still don't put timestamp back into array (is this an issue? (shouldn't be))
_request.finalValues[disp.disputeUintVars[keccak256("timestamp")]] = disp.disputeUintVars[keccak256("value")];
_request.finalValues[disp.disputeUintVars[keccak256("timestamp")]] = disp.disputeUintVars[keccak256("value")];
55,376
115
// checking if appointee has rights to cast a vote
require(_sip.appointees[msg.sender] , 'should be appointee to cast vote' );
require(_sip.appointees[msg.sender] , 'should be appointee to cast vote' );
24,164
17
// Used when multiple can call./
modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) { string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function")); require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)...
modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) { string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function")); require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)...
27,330
50
// Mints batches of NFTs. Limited to maximum number of NFTs that can be minted for this drop. Needs to be called in tokenId sequence. creatorWallet The wallet address of the NFT creator. startId The tokenId from which to start batch mint. length The total number of NFTs to mint starting from the startId. recipient Opti...
function batchMint(address creatorWallet, uint256 startId, uint256 length, address recipient) public onlyOwner { require(!getMintingClosed(), "CXIP: minting is now closed"); require(_allTokens.length + length <= getTokenLimit(), "CXIP: over token limit"); require(isIdentityWallet(creatorWall...
function batchMint(address creatorWallet, uint256 startId, uint256 length, address recipient) public onlyOwner { require(!getMintingClosed(), "CXIP: minting is now closed"); require(_allTokens.length + length <= getTokenLimit(), "CXIP: over token limit"); require(isIdentityWallet(creatorWall...
29,384
290
// UPDATE STORAGE AFTER
{ uint128 stratTotalUnderlying = getStrategyBalance();
{ uint128 stratTotalUnderlying = getStrategyBalance();
34,298
208
// get current quote/base asset reserve.return (quote asset reserve, base asset reserve) /
function getReserve() external view override returns (Decimal.decimal memory, Decimal.decimal memory) { return (quoteAssetReserve, baseAssetReserve); }
function getReserve() external view override returns (Decimal.decimal memory, Decimal.decimal memory) { return (quoteAssetReserve, baseAssetReserve); }
6,499
282
// Parent NFT Contractmainnet addressaddress public nftAddress = 0x1cb1a5e65610aeff2551a50f76a87a7d3fb649c6;rinkeby address
address public nftAddress = 0x70BC4cCb9bC9eF1B7E9dc465a38EEbc5d73740FB; nftInterface nftContract = nftInterface(nftAddress);
address public nftAddress = 0x70BC4cCb9bC9eF1B7E9dc465a38EEbc5d73740FB; nftInterface nftContract = nftInterface(nftAddress);
72,348
0
// Enum for project state
enum State { Inactive, Active, Completed }
enum State { Inactive, Active, Completed }
2,983
57
// Allows token holders to vote_disputeId is the dispute id_supportsDispute is the vote (true=the dispute has basis false = vote against dispute)/
function vote(TellorStorage.TellorStorageStruct storage self, uint256 _disputeId, bool _supportsDispute) public { TellorStorage.Dispute storage disp = self.disputesById[_disputeId]; //Get the voteWeight or the balance of the user at the time/blockNumber the disupte began uint256 voteWeight ...
function vote(TellorStorage.TellorStorageStruct storage self, uint256 _disputeId, bool _supportsDispute) public { TellorStorage.Dispute storage disp = self.disputesById[_disputeId]; //Get the voteWeight or the balance of the user at the time/blockNumber the disupte began uint256 voteWeight ...
55,361
770
// Create a new instance of an app linked to this kernelCreate a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`_appId Identifier for app_appBase Address of the app's base implementation return AppProxy instance/
function newAppInstance(bytes32 _appId, address _appBase) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
function newAppInstance(bytes32 _appId, address _appBase) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
62,879
14
// record user deposit amount
pool.amount = pool.amount + amount; user.amount = user.amount + amount; accDeposit = accDeposit + amount; emit Deposit(msg.sender, pid, amount);
pool.amount = pool.amount + amount; user.amount = user.amount + amount; accDeposit = accDeposit + amount; emit Deposit(msg.sender, pid, amount);
41,934
500
// Gets the name of the NFT collection implemented by this contract
function name() external pure override returns (string memory) { return "AnglePerp"; }
function name() external pure override returns (string memory) { return "AnglePerp"; }
30,244
17
// ------------------------------------------------------------------------Total supply------------------------------------------------------------------------
function totalSupply() public override view returns (uint) { return _totalSupply - balances[address(0)]; }
function totalSupply() public override view returns (uint) { return _totalSupply - balances[address(0)]; }
14,484
13
// Check to see if there's already a commitment for this user that is active
Commitment currentForUser = commitments[msg.sender]; if (currentForUser.active == true) throw;
Commitment currentForUser = commitments[msg.sender]; if (currentForUser.active == true) throw;
9,295
451
// Check status, should be `ERROR` (4)
require(loanManager.getStatus(entry.debtId) == Status.ERROR, "collateral: the debt should be in status error"); emit Redeemed(_entryId, _to);
require(loanManager.getStatus(entry.debtId) == Status.ERROR, "collateral: the debt should be in status error"); emit Redeemed(_entryId, _to);
25,706
73
// Overload placeholder - could apply further logic
function xfer(address _from, address _to, uint _amount) internal noReentry returns (bool)
function xfer(address _from, address _to, uint _amount) internal noReentry returns (bool)
53,233
11
// Secondary market royalties in basis points (100 bps = 1%). Royalties use ERC2981 standard and support OpenSea standard.
uint256 public royaltiesBasisPoints;
uint256 public royaltiesBasisPoints;
28,927
81
// default to failure
uint256 returnValue = 0; assembly {
uint256 returnValue = 0; assembly {
42,511
94
// create the PixelDust and keep its address handy
PixelDust token = new PixelDust(name, symbol, 0); token_address = address(token);
PixelDust token = new PixelDust(name, symbol, 0); token_address = address(token);
15,062
35
// Sets cooldown status. Only callable by owner./onoff The boolean to set.
function setCooldownEnabled(bool onoff) external onlyOwner { cooldownEnabled = onoff; }
function setCooldownEnabled(bool onoff) external onlyOwner { cooldownEnabled = onoff; }
16,336
85
// This function disables token transfers for everyone.
function disableTransfers() public onlyWhitelisted { require(transfersEnabled); transfersEnabled = false; }
function disableTransfers() public onlyWhitelisted { require(transfersEnabled); transfersEnabled = false; }
54,557
4
// Errors
error WrongSender(); error WrongSourceAddress(); error InvalidChain();
error WrongSender(); error WrongSourceAddress(); error InvalidChain();
7,904
56
// Burn amount of token from specified account by an operator address /
function burn(address account, uint256 amount) external returns (bool);
function burn(address account, uint256 amount) external returns (bool);
11,259