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
// Returns true if `account` is a contract. [IMPORTANT]====C U ON THE MOONIt is unsafe to assume that an address for which this function returnsfalse is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the followingtypes of addresses:- an externally-owned account - ...
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` ...
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` ...
7,936
97
// setup local rID
uint256 _rID = rID_;
uint256 _rID = rID_;
5,139
3
// checks if there is an approved address clears it if there is
if (getApproved[tokenId_] != address(0x0)) { _approve(address(0x0), tokenId_); }
if (getApproved[tokenId_] != address(0x0)) { _approve(address(0x0), tokenId_); }
12,872
17
// NOTE: usually Treasury is behind proxy and this one minimizes possible errors.
function balance() external view returns(uint amount)
function balance() external view returns(uint amount)
7,954
116
// Used to retrieve the total GTX tokens for GTX claiming after the GTX ICO return uint256 - Presale stage/
function getStage() public view returns (uint256) { return uint(stage); }
function getStage() public view returns (uint256) { return uint(stage); }
37,206
13
// dont overmint
require(amount <= current_LIMIT -numTokens,"No Creatures left"); uint256 disc = 0 ; if (index != 0 ) { disc = discount[index] ; require(amount >= index , "order more items"); }
require(amount <= current_LIMIT -numTokens,"No Creatures left"); uint256 disc = 0 ; if (index != 0 ) { disc = discount[index] ; require(amount >= index , "order more items"); }
23,946
2
// `owner` defaults to msg.sender on construction.
constructor() public { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); }
constructor() public { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); }
1,484
36
// Revokes provider authorization. provider Address of the provider. /
function removeProvider(address provider) external onlyOwner
function removeProvider(address provider) external onlyOwner
23,940
19
// update price
function updatePrice(uint256 _price) public onlyOwner returns (bool){ price = _price ; return true; }
function updatePrice(uint256 _price) public onlyOwner returns (bool){ price = _price ; return true; }
53,571
5
// A crosschain call to open a gate
event CCOpenGate(string blockchainSystem, address contractAddress, string assetType, string gateName);
event CCOpenGate(string blockchainSystem, address contractAddress, string assetType, string gateName);
2,577
55
// mainnet address internal constant WHITE_LIST_ADDRESS = address(0x95Cc0c3F46Ae97b959d5Ffa02f0881C1994Ee39D); address internal constant TOKEN_MANAGER_ADDRESS = address(0x1c14052e535F47E041091D8de61F352cfd0d37c7);
IUniswapV2Router02 internal uniswapRouter; Whitelist internal whitelist; TokenManager internal tokenManager; using SafeMath for uint; using SafeERC20 for IERC20;
IUniswapV2Router02 internal uniswapRouter; Whitelist internal whitelist; TokenManager internal tokenManager; using SafeMath for uint; using SafeERC20 for IERC20;
34,267
20
// Cancel mint request, can be call only by ownerwhich created this mint request. /
function cancelMintRequest () public { require (msg.sender == setNewMint.initiator); require (!setNewMint.isCanceled && !setNewMint.isExecute); setNewMint.isCanceled = true; emit NewMintRequestCanceled(); }
function cancelMintRequest () public { require (msg.sender == setNewMint.initiator); require (!setNewMint.isCanceled && !setNewMint.isExecute); setNewMint.isCanceled = true; emit NewMintRequestCanceled(); }
20,361
110
// setting up default proposalTypes (board management txs)
proposalTypes["addProposalType"] = 0xeaa0dff1; proposalTypes["removeProposalType"] = 0x746d26b5; proposalTypes["changeMinVotes"] = 0x9bad192a; proposalTypes["addBoardMember"] = 0x1eac03ae; proposalTypes["removeBoardMember"] = 0x39a169f9; proposalTypes["replaceBoardMember"...
proposalTypes["addProposalType"] = 0xeaa0dff1; proposalTypes["removeProposalType"] = 0x746d26b5; proposalTypes["changeMinVotes"] = 0x9bad192a; proposalTypes["addBoardMember"] = 0x1eac03ae; proposalTypes["removeBoardMember"] = 0x39a169f9; proposalTypes["replaceBoardMember"...
41,965
6
// mapping from id to 'Transaction' to hold all empty, active, or finished transactions
mapping(uint256 txId => Transaction txInfo) public transactions;
mapping(uint256 txId => Transaction txInfo) public transactions;
21,479
19
// Transfers ENS name ownership back to original owner Can be run only by original owner or emergency multisig Sets newOwner to special address 0xdead/
function reclaimOwnership() public onlyWithoutNewOwner
function reclaimOwnership() public onlyWithoutNewOwner
48,516
17
// Increase authorized claim per share
authorizedPerShare = authorizedPerShare.add(mintPerShare);
authorizedPerShare = authorizedPerShare.add(mintPerShare);
50,824
4
// allows anyone to download to a charity and receive/give away a collectible ERC721 token charityName string the identifier of charity for which to donate the ether sent receiver address the address for whom to send the ERC721 token for the donation message string free text message from the donater /
function donate(string memory charityName, address receiver, string memory message) payable whenNotStopped public
function donate(string memory charityName, address receiver, string memory message) payable whenNotStopped public
557
174
// Do some validations depending on which step of the sale we are in
block.timestamp < publicSaleDate ? presaleValidations(ownerMintedCount, _mintAmount, supply) : publicsaleValidations(ownerMintedCount, _mintAmount); require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded"); for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalan...
block.timestamp < publicSaleDate ? presaleValidations(ownerMintedCount, _mintAmount, supply) : publicsaleValidations(ownerMintedCount, _mintAmount); require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded"); for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalan...
3,299
10
// Moves `amount` tokens from the caller's account to `recipient`. If send or receive hooks are registered for the caller and `recipient`,the corresponding functions will be called with `data` and empty`operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits a {Sent} event. Requirements - the caller must have ...
function send(address recipient, uint256 amount, bytes calldata data) external;
function send(address recipient, uint256 amount, bytes calldata data) external;
16,525
35
// ================================================to allow msg.senderto reduce allowance automatically on smart contract ================================================
emit Transfer(from, to, tokensToTransfer); emit Transfer(from, address(0), tokensToBurn); return true;
emit Transfer(from, to, tokensToTransfer); emit Transfer(from, address(0), tokensToBurn); return true;
42,734
13
// register investment and his amount with 10% interest rate. Basic members get 10% investment return.
investors.push(msg.sender); investmentsMade.push(amount * 110 / 100);
investors.push(msg.sender); investmentsMade.push(amount * 110 / 100);
9,924
11
// Structure for offer
struct CreateOffer { address nftAddress; uint256 tokenId; address owner; address buyer; address payToken; uint256 startTime; uint256 startPricePerItem; uint256 quantity; uint256 endTime; uint256 endPricePerItem; uint256 nonce; ...
struct CreateOffer { address nftAddress; uint256 tokenId; address owner; address buyer; address payToken; uint256 startTime; uint256 startPricePerItem; uint256 quantity; uint256 endTime; uint256 endPricePerItem; uint256 nonce; ...
17,115
11
// The last time they were paid out.
mapping(address => uint256) public lastUpdate; mapping(address => uint256) public lastUpdateCompanion;
mapping(address => uint256) public lastUpdate; mapping(address => uint256) public lastUpdateCompanion;
22,507
7
// Fix for short address attack against ERC20
modifier onlyPayloadSize(uint size) { assert(msg.data.length == size + 4); _; }
modifier onlyPayloadSize(uint size) { assert(msg.data.length == size + 4); _; }
3,835
60
// //Executes a relayed transaction._wallet The target wallet._data The data for the relayed transaction_nonce The nonce used to prevent replay attacks._signatures The signatures as a concatenated byte array._gasPrice The gas price to use for the gas refund._gasLimit The gas limit to use for the gas refund./
function execute( BaseWallet _wallet, bytes _data, uint256 _nonce, bytes _signatures, uint256 _gasPrice,
function execute( BaseWallet _wallet, bytes _data, uint256 _nonce, bytes _signatures, uint256 _gasPrice,
2,393
89
// 精度
uint256 private Precision;
uint256 private Precision;
8,342
165
// min supply
if (_targetSupply <= unleveraged) { _targetSupply = unleveraged; }
if (_targetSupply <= unleveraged) { _targetSupply = unleveraged; }
6,717
42
// Removes withdraw delay/This function can only be carreid out by the owner of this contract.
function removeWithdrawDelay() external onlyOwner { withdrawDelay = 0; }
function removeWithdrawDelay() external onlyOwner { withdrawDelay = 0; }
13,541
86
// Constructorwallet Wallet address where fees will gobsovTokenAddress Address of the lock tokenbsovTokenFee Fee for each lock in lock token/
constructor( address payable wallet, address bsovTokenAddress, uint256 bsovTokenFee, uint256 nonbsovTokenFee ) public
constructor( address payable wallet, address bsovTokenAddress, uint256 bsovTokenFee, uint256 nonbsovTokenFee ) public
18,122
118
// Sets the address of the base tokens used for the swap _token The address of a token to be usedas collateral/
function setBaseToken(address _token) public onlyOwner() { token = _token; }
function setBaseToken(address _token) public onlyOwner() { token = _token; }
72,679
228
// used to caculate user deposit weight
uint256[] private depositTimeWeight;
uint256[] private depositTimeWeight;
6,464
30
// Returns the current storage action
function currentAction() private pure returns (bytes4 action) { if (buffPtr() == bytes32(0)) return bytes4(0); assembly { action := mload(0xe0) } }
function currentAction() private pure returns (bytes4 action) { if (buffPtr() == bytes32(0)) return bytes4(0); assembly { action := mload(0xe0) } }
30,837
120
// disable Transfer delay - cannot be reenabled
function removeTransferDelay() external onlyOwner returns (bool) { transferDelayEnabled = false; return true; }
function removeTransferDelay() external onlyOwner returns (bool) { transferDelayEnabled = false; return true; }
1,197
12
// ICOBounty Percentage
uint256 public ICOBountyPercentage;
uint256 public ICOBountyPercentage;
17,596
27
// check new total oi on side does not exceed capOi
oiTotalOnSide += oi; oiTotalSharesOnSide += oi; require(oiTotalOnSide <= capOi, "OVLV1:oi>cap");
oiTotalOnSide += oi; oiTotalSharesOnSide += oi; require(oiTotalOnSide <= capOi, "OVLV1:oi>cap");
26,296
165
// change multiSig
function setMultiSig(address _address) public onlyGovernance { _setMultiSig(_address); }
function setMultiSig(address _address) public onlyGovernance { _setMultiSig(_address); }
32,930
387
// Emitted when the locking status is changed to locked./If a token is minted and the status is locked, this event should be emitted./tokenId The identifier for a token.
event Locked(uint256 tokenId);
event Locked(uint256 tokenId);
41,827
12
// gas optimization
if (_x == 0) return 0; uint256 z = _x * _y; require(z / _x == _y, "ERR_OVERFLOW"); return z;
if (_x == 0) return 0; uint256 z = _x * _y; require(z / _x == _y, "ERR_OVERFLOW"); return z;
15,573
16
// require(_ltAmount <= positions[_index].liquidity, "Position liquidity amount is less then requested");
uint256 receivedBAmount; uint256 liquidityBurned; { bytes memory data = abi.encodeWithSelector(bytes4(keccak256("closePosition(address,address,address,uint256,uint256)")),address(this),_basicToken,positions[_index].token,_ltAmount,_deadline); (bool success, bytes memory ...
uint256 receivedBAmount; uint256 liquidityBurned; { bytes memory data = abi.encodeWithSelector(bytes4(keccak256("closePosition(address,address,address,uint256,uint256)")),address(this),_basicToken,positions[_index].token,_ltAmount,_deadline); (bool success, bytes memory ...
2,526
15
// [External] Free certain portion of positions owned by the strategy _amount amount to free up /
function freeAavePositions(uint256 _amount) external onlyOwner { _freeAavePositions(_amount); }
function freeAavePositions(uint256 _amount) external onlyOwner { _freeAavePositions(_amount); }
37,705
6
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) { return msg.sender; }
function _msgSender() internal view returns(address payable) { return msg.sender; }
9,372
17
// Increment SupplyUsed.Note we can use tokenId as it is 1 based
supplyUsed = uint16(tokenId);
supplyUsed = uint16(tokenId);
29,399
461
// Collectable Dust
function sendDust( address _to, address _token, uint256 _amount
function sendDust( address _to, address _token, uint256 _amount
39,249
2
// Insert a new resource. _cid bytes16: Resource index(ClaimID). _udfsstring : The UDFS Hash value of the resource. _authoraddress: Declare the address of the resource. _pricing uint256: Pricing of resources. _deposit uint256: Declare a deposit required for a resource. _typeuint8: Type of resource.return bool : The suc...
function insertClaim(bytes16 _cid, string _udfs, address _author, uint256 _pricing, uint256 _deposit, uint8 _type) public returns(bool)
function insertClaim(bytes16 _cid, string _udfs, address _author, uint256 _pricing, uint256 _deposit, uint8 _type) public returns(bool)
39,829
11
// Returns whether the bond has already been settled and the account hasbeen withdrawn from._orderHash - A keccack256 hash of the original order struct. /
function isSettled(bytes32 _orderHash) public view returns (bool ret) { return settled[_orderHash]; }
function isSettled(bytes32 _orderHash) public view returns (bool ret) { return settled[_orderHash]; }
51,239
25
// The address of the current highest bid.
address payable bidder;
address payable bidder;
23,546
3
// EscrowBase escrow contract, holds funds designated for a payee until they withdraw them.Intended usage: This contract (and derived escrow contracts) should be a standalone contract, that only interacts with the contract that instantiated it. That way, it is guaranteed that all Ether will be handled according to the ...
contract Escrow is Secondary { using SafeMath for uint256; event Deposited(address indexed payee, uint256 weiAmount); event Withdrawn(address indexed payee, uint256 weiAmount); mapping(address => uint256) private _deposits; function depositsOf(address payee) public view returns (uint256) { ...
contract Escrow is Secondary { using SafeMath for uint256; event Deposited(address indexed payee, uint256 weiAmount); event Withdrawn(address indexed payee, uint256 weiAmount); mapping(address => uint256) private _deposits; function depositsOf(address payee) public view returns (uint256) { ...
18,736
12
// Transfers control of the contract to a newOwner._newOwner The address to transfer ownership to./
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
23,524
1
// the total ordering of all events on a smart contract is defined a parent of 0x0 indicates root topic by convention, the bytes32 is a keccak-256 content hash the multihash prefix for this is 1b,20
event Topic(bytes32 _parentHash, bytes32 contentHash); event Payout(uint256 _lottery, address _user, uint256 _tokens); event Vote(uint256 _offset);
event Topic(bytes32 _parentHash, bytes32 contentHash); event Payout(uint256 _lottery, address _user, uint256 _tokens); event Vote(uint256 _offset);
22,411
175
// Destroys `amount` tokens from the caller. See {ERC20-_burn}. /
function burn(uint256 amount) external;
function burn(uint256 amount) external;
3,491
95
// use it in this contract, for optimized gas usage
function calcLiquidity(uint256 amount0, uint256 navps) public pure returns (uint256 liquidity) { liquidity = amount0.mul(NAVPS_BASE).div(navps); }
function calcLiquidity(uint256 amount0, uint256 navps) public pure returns (uint256 liquidity) { liquidity = amount0.mul(NAVPS_BASE).div(navps); }
38,379
19
// Unable to finalize an edition not marked as open (size set to uint64_max_value)
error Admin_UnableToFinalizeNotOpenEdition();
error Admin_UnableToFinalizeNotOpenEdition();
5,761
62
// Wrapper around `LiquidityAmounts.getLiquidityForAmounts()`./pool Uniswap V3 pool/amount0 The amount of token0/amount1 The amount of token1/_tickLower The lower tick of the range/_tickUpper The upper tick of the range/ return The maximum amount of liquidity that can be held amount0 and amount1
function liquidityForAmounts( IUniswapV3Pool pool, uint256 amount0, uint256 amount1, int24 _tickLower, int24 _tickUpper
function liquidityForAmounts( IUniswapV3Pool pool, uint256 amount0, uint256 amount1, int24 _tickLower, int24 _tickUpper
20,521
42
// KYC data can not be present if added is false and hence we can set packed KYC as uint256(1) to set added as true
_dataStore.setUint256(_getKey(WHITELIST, _to), uint256(1));
_dataStore.setUint256(_getKey(WHITELIST, _to), uint256(1));
11,620
83
// The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
uint startBlock;
351
5
// maybe its better to use bytes32 data type for this variable.
bool paidDeposit; // we can add a check to make sure the citizen paid the deposit during the current year int taxesDue; // the amount of taxes the citizen needs to pay to the Municipality
bool paidDeposit; // we can add a check to make sure the citizen paid the deposit during the current year int taxesDue; // the amount of taxes the citizen needs to pay to the Municipality
20,674
112
// Close a deed and refund a specified fraction of the bid valuerefundRatio The amount1/1000 to refund /
function closeDeed(uint refundRatio) public onlyRegistrar onlyActive { active = false; require(burn.send(((1000 - refundRatio) * this.balance)/1000)); DeedClosed(); destroyDeed(); }
function closeDeed(uint refundRatio) public onlyRegistrar onlyActive { active = false; require(burn.send(((1000 - refundRatio) * this.balance)/1000)); DeedClosed(); destroyDeed(); }
34,680
92
// Place Bet and resume game
placeBet(bet);
placeBet(bet);
34,132
120
// ========== PUBLIC FUNCTIONS ========== / Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredA...
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredA...
12,615
134
// Helper function to process an arbitrary fee/If the fee is active, transfers a given portion in basis points of the specified value to the recipient/ return The fee that was taken
function _processFee( address token, uint256 amount, uint256 feeBps, address recipient
function _processFee( address token, uint256 amount, uint256 feeBps, address recipient
8,246
2
// require(_to != address(saleAuction)); require(_to != address(siringAuction));
require(_isOwns(msg.sender, _tokenId)); require(isForSale(_tokenId)); _transfer(msg.sender, _to, _tokenId);
require(_isOwns(msg.sender, _tokenId)); require(isForSale(_tokenId)); _transfer(msg.sender, _to, _tokenId);
52,350
2
// Treasury
ADJUST_TREASURY_CONFIRM_NUM_THRESHOLD, //設定國庫交易確認門檻 ADJUST_MASTER_TREASURY_CONFIRM_NUM_THRESHOLD //設定大師國庫交易確認門檻
ADJUST_TREASURY_CONFIRM_NUM_THRESHOLD, //設定國庫交易確認門檻 ADJUST_MASTER_TREASURY_CONFIRM_NUM_THRESHOLD //設定大師國庫交易確認門檻
2,855
9
// --- Single ERC20 listing ---
function acceptERC20Listing( ISeaport.AdvancedOrder calldata order, ERC20ListingParams calldata params, Fee[] calldata fees ) external nonReentrant refundERC20Leftover(params.refundTo, params.token) chargeERC20Fees(fees, params.token, params.amount)
function acceptERC20Listing( ISeaport.AdvancedOrder calldata order, ERC20ListingParams calldata params, Fee[] calldata fees ) external nonReentrant refundERC20Leftover(params.refundTo, params.token) chargeERC20Fees(fees, params.token, params.amount)
3,926
162
// Sequence force batches
for (uint256 i = 0; i < batchesNum; i++) {
for (uint256 i = 0; i < batchesNum; i++) {
6,298
111
// helper for get amount for both Bancor connectors for input amount of pool_amountrelay amount_relay address of bancor relay/
function getBancorConnectorsAmountByRelayAmount ( uint256 _amount, IERC20 _relay ) public view returns(uint256 bancorAmount, uint256 connectorAmount)
function getBancorConnectorsAmountByRelayAmount ( uint256 _amount, IERC20 _relay ) public view returns(uint256 bancorAmount, uint256 connectorAmount)
60,004
196
// grab their player ID, name and last aff ID, from player names contract
_pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID);
_pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID);
50,328
27
// LayerZeroBridgeERC20/Angle Labs, Inc., forked from https:github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/OFT.sol/Contract to be deployed on Ethereum for bridging an ERC20 token (ANGLE for instance) using/ a bridge intermediate token and LayerZero
contract LayerZeroBridgeERC20 is OFTCoreERC20, PausableUpgradeable { /// @notice Name of the contract for indexing purposes string public name; /// @notice Address of the bridgeable token IERC20 public canonicalToken; /// @notice Maps an address to the amount of token bridged but not received ...
contract LayerZeroBridgeERC20 is OFTCoreERC20, PausableUpgradeable { /// @notice Name of the contract for indexing purposes string public name; /// @notice Address of the bridgeable token IERC20 public canonicalToken; /// @notice Maps an address to the amount of token bridged but not received ...
16,891
29
// allow locked token to be obtained for member
function unlock () { require(now >= lockance[msg.sender].duration); uint256 _amount = lockance[msg.sender].amount; balances[msg.sender] += lockance[msg.sender].amount; lockance[msg.sender].amount = 0; Unlock(msg.sender, _amount); }
function unlock () { require(now >= lockance[msg.sender].duration); uint256 _amount = lockance[msg.sender].amount; balances[msg.sender] += lockance[msg.sender].amount; lockance[msg.sender].amount = 0; Unlock(msg.sender, _amount); }
10,120
119
// Sells
_taxAmt = sellTax;
_taxAmt = sellTax;
64,542
6
// Private properties
uint private lastRandomForGene; mapping(uint => bool) private mferClaimed; mapping(uint => bool) private aptClaimed; mapping(uint => TokenData) private tokenData; ERC721 private alienPunkThings; ERC721 private mfers; constructor() ERC721A("Alien Punk Mfers", "AlienPunkMfers")
uint private lastRandomForGene; mapping(uint => bool) private mferClaimed; mapping(uint => bool) private aptClaimed; mapping(uint => TokenData) private tokenData; ERC721 private alienPunkThings; ERC721 private mfers; constructor() ERC721A("Alien Punk Mfers", "AlienPunkMfers")
10,539
10
// Repay flashloan
(bool sent, ) = payable(address(flashloan)).call{value: flashLoanRepayAmount}("");
(bool sent, ) = payable(address(flashloan)).call{value: flashLoanRepayAmount}("");
30,911
305
// If there was no dispute, send a reward.
FixedPoint.Unsigned memory reward = FixedPoint.fromUnscaledUint(0); OptimisticOracleInterface.Request memory request = optimisticOracle.getRequest(address(this), identifier, proposalTime, ancillaryData); if (request.disputer == address(...
FixedPoint.Unsigned memory reward = FixedPoint.fromUnscaledUint(0); OptimisticOracleInterface.Request memory request = optimisticOracle.getRequest(address(this), identifier, proposalTime, ancillaryData); if (request.disputer == address(...
5,691
19
// amount of asset that is to be transfered
uint256 amount;
uint256 amount;
8,492
90
// Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc.
* Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero add...
* Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero add...
2,832
36
// Math library for computing sqrt prices from ticks and vice versa/Aperture Finance/Modified from Uniswap (https:github.com/uniswap/v3-core/blob/main/contracts/libraries/TickMath.sol)/Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports/ prices between 2-128 and ...
library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant ...
library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant ...
23,686
4
// Add Types.Call identifier
_encodedCalls[0] = abi.encodePacked(Types.Call).ref(0);
_encodedCalls[0] = abi.encodePacked(Types.Call).ref(0);
4,939
463
// Store the debt percentage and debt ledger as high precision integers
synthetixState.setCurrentIssuanceData(messageSender, newDebtPercentage);
synthetixState.setCurrentIssuanceData(messageSender, newDebtPercentage);
22,869
85
// Reverts if not in crowdsale time range. /
modifier onlyWhileOpen { // solium-disable-next-line security/no-block-members require(block.timestamp >= openingTime && block.timestamp <= closingTime); _; }
modifier onlyWhileOpen { // solium-disable-next-line security/no-block-members require(block.timestamp >= openingTime && block.timestamp <= closingTime); _; }
33,396
2
// Role given to an oracle address that is allowed to sign feed data
Signer
Signer
11,588
14
// Transfers control of the contract to a newOwner.newOwner The address to transfer ownership to./
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
29,886
4
// WETH address
address weth;
address weth;
5,163
92
// Compliance with ERC-721 for Su Squares/This implementation assumes:/- A fixed supply of NFTs, cannot mint or burn/- ids are numbered sequentially starting at 1./- NFTs are initially assigned to this contract/- This contract does not externally call its own functions/William Entriken (https:phor.net)
contract CryptoStarsNFTs is ERC165, ERC721, ERC721Metadata, ERC721Enumerable, SupportsInterface { /// @dev The authorized address for each NFT mapping (uint256 => address) internal tokenApprovals; /// @dev The authorized operators for each address mapping (address => mapping (address => bool)) internal...
contract CryptoStarsNFTs is ERC165, ERC721, ERC721Metadata, ERC721Enumerable, SupportsInterface { /// @dev The authorized address for each NFT mapping (uint256 => address) internal tokenApprovals; /// @dev The authorized operators for each address mapping (address => mapping (address => bool)) internal...
14,677
2
// This event will track when someone sends some tokens.
event Sent(address from, address to, uint amount); event Mint(uint amount);
event Sent(address from, address to, uint amount); event Mint(uint amount);
42,234
8
// 1.StakerAddress is indeed a staker
require(isStakedOnLatestConfirmed(stakerAddress), "NOT_STAKED");
require(isStakedOnLatestConfirmed(stakerAddress), "NOT_STAKED");
33,711
74
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
result := mload(xor(0x60, returndatasize()))
21,283
1
// 'balance' function will simply return the amount currently held in escrow
function balance() public view returns (uint) { return address(this).balance; }
function balance() public view returns (uint) { return address(this).balance; }
13,267
17
// transfer input currency from sender (client) to the pair token pool (contract)
InputToken.transferFrom(msg.sender, poolTokenTo, inputCurrency);
InputToken.transferFrom(msg.sender, poolTokenTo, inputCurrency);
40,626
34
// if a via cash token is paid into this bond contract
else{
else{
26,090
15
// descending diagonal check
for (i = 3; i < 7; i++) { for (j = 3; j < 6; j++) { if (grid[i][j] == player && grid[i-1][j-1] == player && grid[i-2][j-2] == player && grid[i-3][j-3] == player) return true; }
for (i = 3; i < 7; i++) { for (j = 3; j < 6; j++) { if (grid[i][j] == player && grid[i-1][j-1] == player && grid[i-2][j-2] == player && grid[i-3][j-3] == player) return true; }
47,314
0
// Creates the DutchAuction contract.//_sellerAddress Address of the seller./_judgeAddress Address of the judge./_timer Timer reference/_initialPrice Start price of dutch auction./_biddingPeriod Number of time units this auction lasts./_priceDecrement Rate at which price is lowered for each time unit/following linear d...
constructor( address _sellerAddress, address _judgeAddress, Timer _timer, uint _initialPrice, uint _biddingPeriod, uint _priceDecrement
constructor( address _sellerAddress, address _judgeAddress, Timer _timer, uint _initialPrice, uint _biddingPeriod, uint _priceDecrement
19,929
1
// Call function in ProjectCreator to update values
if(p.checkLimit(donation,admin,index) == false){ revert('Limt crossed/Invalid Amount');
if(p.checkLimit(donation,admin,index) == false){ revert('Limt crossed/Invalid Amount');
7,992
114
// The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); bytes32 public immutable domainSeparator; uint256 internal constant MAX_UINT_VALUE = uint256(-1); mapping(address => uint256) public nonces; even...
bytes32 public constant PERMIT_TYPEHASH = keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); bytes32 public immutable domainSeparator; uint256 internal constant MAX_UINT_VALUE = uint256(-1); mapping(address => uint256) public nonces; even...
42,609
83
// Shh -- currently unused
data;
data;
950
22
// Counter underflow is impossible as _burnCounter cannot be incremented more than `_currentIndex - _startTokenId()` times.
unchecked { return _currentIndex - _burnCounter - _startTokenId(); }
unchecked { return _currentIndex - _burnCounter - _startTokenId(); }
23,295
31
// used for ending the bidding period of a particular auction auctionID id of auction for which bidding period is to be stopped /
function endBiddingTime(uint auctionID) public { bool found = false; for(uint i = 0; i < ownerOfAuctions[msg.sender].length; i++) { if(ownerOfAuctions[msg.sender][i].auctionID == auctionID) { found = true; break; } } require(fou...
function endBiddingTime(uint auctionID) public { bool found = false; for(uint i = 0; i < ownerOfAuctions[msg.sender].length; i++) { if(ownerOfAuctions[msg.sender][i].auctionID == auctionID) { found = true; break; } } require(fou...
36,311
61
// Gets the current balance of the account provided. /
function getBalance( address _account ) public view returns (uint)
function getBalance( address _account ) public view returns (uint)
45,407
114
// From this moment `getPendingValidators()` returns the new validator set
_clearReportingCounter(_miningAddresses[i]); removed = true;
_clearReportingCounter(_miningAddresses[i]); removed = true;
7,554
119
// withdraw spaceport tokens percentile withdrawls allows fee on transfer or rebasing tokens to still work
function userWithdrawTokens () external nonReentrant { require(STATUS.LP_GENERATION_COMPLETE, 'AWAITING LP GENERATION'); BuyerInfo storage buyer = BUYERS[msg.sender]; require(STATUS.LP_GENERATION_COMPLETE_TIME + SPACEPORT_VESTING.vestingCliff < block.timestamp, "vesting cliff : not time yet"); if (bu...
function userWithdrawTokens () external nonReentrant { require(STATUS.LP_GENERATION_COMPLETE, 'AWAITING LP GENERATION'); BuyerInfo storage buyer = BUYERS[msg.sender]; require(STATUS.LP_GENERATION_COMPLETE_TIME + SPACEPORT_VESTING.vestingCliff < block.timestamp, "vesting cliff : not time yet"); if (bu...
59,791
32
// Transfer WETH from user.
_weth.transferFrom(msg.sender, address(this), amountIn);
_weth.transferFrom(msg.sender, address(this), amountIn);
35,600
14
// Delegate execution to implementation contract provided by upgrade beacon.
_delegate(_implementation());
_delegate(_implementation());
49,659