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
98
// Appends a byte to the buffer. Resizes if doing so would exceed thecapacity of the buffer.buf The buffer to append to.data The data to append. return The original buffer, for chaining./
function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) { return writeUint8(buf, buf.buf.length, data); }
function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) { return writeUint8(buf, buf.buf.length, data); }
4,999
88
// Address of the Uniswap liquidity pair (token)
IUniswapV2Pair public liquidityToken;
IUniswapV2Pair public liquidityToken;
33,421
131
// Mints `tokenId` and transfers it to `to`.
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721:...
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721:...
5,633
14
// SlowDump Limit
uint256 public slowDump = 100e18;
uint256 public slowDump = 100e18;
21,399
6
// Allows deposit ERC20 token towiseLending and takes token amount asargument. /
function depositExactAmount( uint256 _nftId, address _underlyingAsset, uint256 _amount ) public syncPool(_underlyingAsset) returns (uint256)
function depositExactAmount( uint256 _nftId, address _underlyingAsset, uint256 _amount ) public syncPool(_underlyingAsset) returns (uint256)
15,811
47
// transfer koala token owner to new owner for fair launch update
function transferKoalaOwner(address new_owner) external onlyOwner { require(new_owner != address(0), "invalid new owner"); koala.transferOwnership(new_owner); }
function transferKoalaOwner(address new_owner) external onlyOwner { require(new_owner != address(0), "invalid new owner"); koala.transferOwnership(new_owner); }
47,768
100
// SafeCheckToken More secure functionality. /
contract SafeCheckToken is PausableToken { function transfer(address _to, uint256 _value) public returns (bool) { // Do not send tokens to this contract require(_to != address(this)); // Check Short Address require(msg.data.length >= 68); // Check Value is not zero require(_va...
contract SafeCheckToken is PausableToken { function transfer(address _to, uint256 _value) public returns (bool) { // Do not send tokens to this contract require(_to != address(this)); // Check Short Address require(msg.data.length >= 68); // Check Value is not zero require(_va...
19,241
48
// Check we are still in the crowdsale period
require(block.timestamp >= START_DATE && block.timestamp <= END_DATE);
require(block.timestamp >= START_DATE && block.timestamp <= END_DATE);
5,537
115
// cancels crowdsale
function stop() public onlyOwner() hasntStopped() { // we can stop only not started and not completed crowdsale if (started) { require(!isFailed()); require(!isSuccessful()); } stopped = true; }
function stop() public onlyOwner() hasntStopped() { // we can stop only not started and not completed crowdsale if (started) { require(!isFailed()); require(!isSuccessful()); } stopped = true; }
47,127
200
// Modify record mutableStorage1 data /
function modifyMutableStorage( bytes32 _idxHash, bytes32 _mutableStorage1, bytes32 _mutableStorage2 ) external;
function modifyMutableStorage( bytes32 _idxHash, bytes32 _mutableStorage1, bytes32 _mutableStorage2 ) external;
5,445
1
// the time of last payout // Array of depositors // PUBLIC FUNCTIONS // contract constructor /
{ contract_latestPayoutTime = now; }
{ contract_latestPayoutTime = now; }
37,807
127
// round 57
ark(i, q, 10156146186214948683880719664738535455146137901666656566575307300522957959544); sbox_full(i, q); mix(i, q); return i.t0;
ark(i, q, 10156146186214948683880719664738535455146137901666656566575307300522957959544); sbox_full(i, q); mix(i, q); return i.t0;
28,320
145
// insufficient liquidity swapfor a given currency and a given balance. curr Currency Asset to buy maxIACurr Investment Asset to sell amount Amount of Investment Asset to sell /
function _externalInsufficientLiquiditySwap( bytes4 curr, bytes4 maxIACurr, uint256 amount ) internal returns (bool trigger)
function _externalInsufficientLiquiditySwap( bytes4 curr, bytes4 maxIACurr, uint256 amount ) internal returns (bool trigger)
12,789
54
// Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {ISBTReceiver-onSBTReceived}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
* - If `to` refers to a smart contract, it must implement {ISBTReceiver-onSBTReceived}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
7,345
260
// Returns the memory address of the first byte after the last occurrence of `needle` in `self`, or the address of `self` if not found.
function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); bytes32 needledata; ...
function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); bytes32 needledata; ...
44,568
11
// See {IERC20-transfer}. /
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
31,373
48
// Internal transfer, only can be called by this contract/
function _transfer(address _from, address _to, uint256 value) internal { require(_from != address(0), "ERC20: transfer to the zero address"); require(_to != address(0), "ERC20: transfer to the zero address"); require(value > 0, "ERC20: value must be bigger than zero"); require(value ...
function _transfer(address _from, address _to, uint256 value) internal { require(_from != address(0), "ERC20: transfer to the zero address"); require(_to != address(0), "ERC20: transfer to the zero address"); require(value > 0, "ERC20: value must be bigger than zero"); require(value ...
44,299
4
// SelfieAttacker Jonatas Campos Martins The main idea is to create an action passing a data that get all tokens from the pool and thensend the tokens to the attacker /
contract SelfieAttacker { ERC20Snapshot private token; SelfiePool private selfiePool; SimpleGovernance private simpleGovernance; uint256 private actionId; constructor( address _token, address _selfiePool, address _simpleGovernance ) { token = ERC20Snapshot(_token...
contract SelfieAttacker { ERC20Snapshot private token; SelfiePool private selfiePool; SimpleGovernance private simpleGovernance; uint256 private actionId; constructor( address _token, address _selfiePool, address _simpleGovernance ) { token = ERC20Snapshot(_token...
54,218
84
// Pay fees
_payFees(address(this), IERC20(quote.inputToken), _referrer, quote.fee, quote.feeReferrer, quote.inputDecimals); uint256 profit = quote.output.sub(tokenAmountUsed);
_payFees(address(this), IERC20(quote.inputToken), _referrer, quote.fee, quote.feeReferrer, quote.inputDecimals); uint256 profit = quote.output.sub(tokenAmountUsed);
37,963
34
// Get debt issuance module registered to this module and require that it is initialized
require(_setToken.isInitializedModule(getAndValidateAdapter(DEFAULT_ISSUANCE_MODULE_NAME)), "Issuance not initialized");
require(_setToken.isInitializedModule(getAndValidateAdapter(DEFAULT_ISSUANCE_MODULE_NAME)), "Issuance not initialized");
9,969
29
// Fee to be paid when registering oracle
uint256 public constant REGISTRATION_FEE = 1 ether;
uint256 public constant REGISTRATION_FEE = 1 ether;
43,642
5
// this disables all previous initializers
_disableInitializers();
_disableInitializers();
10,838
89
// balance threshold of SYA tokens which actives feeless swapping
uint256 public balanceThreshold;
uint256 public balanceThreshold;
8,035
146
// If allowance is not 2256 - 1, consume allowance
if (allowanceFrom != uint(-1)) {
if (allowanceFrom != uint(-1)) {
1,510
585
// Admin Functions /
function _setPendingImplementation(address newPendingImplementation) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK); } address oldPendingImplementation = pendingComptrollerImplementation; ...
function _setPendingImplementation(address newPendingImplementation) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK); } address oldPendingImplementation = pendingComptrollerImplementation; ...
23,099
135
// Returns a fraction roughly equaling E^((1/2)^x) for integer x /
function getPrecomputedEToTheHalfToThe( uint256 x ) internal pure returns (Fraction.Fraction128 memory)
function getPrecomputedEToTheHalfToThe( uint256 x ) internal pure returns (Fraction.Fraction128 memory)
35,106
2
// token address
address tokenAddress;
address tokenAddress;
31,806
40
// Checks whether the cap has been reached. return Whether the cap was reached/
function capReached() public view returns (bool) { return tokensSold >= cap; }
function capReached() public view returns (bool) { return tokensSold >= cap; }
3,922
10
// transferir para alguém uma quantidade de MWH certificada
function transfer(address certificationAddr, address to, uint16 mwh) public returns (bool success) { EnergyCert cert = EnergyCert(certificationAddr); // referencia do certificado if ( cert.owner == msg.sender ) // o dono do certificado deve ser o requerente retur...
function transfer(address certificationAddr, address to, uint16 mwh) public returns (bool success) { EnergyCert cert = EnergyCert(certificationAddr); // referencia do certificado if ( cert.owner == msg.sender ) // o dono do certificado deve ser o requerente retur...
41,655
35
// Calls generateLongterm() function to generate USDP for collateral. _borrowID borrower id borrower want to generate.return bool true. /
function generateLongterm( uint _borrowID) public returns (bool){ require(borrow[_borrowID].borrower == borrower[msg.sender].identity, "generateLongterm: Invalid collateral access"); require(borrow[_borrowID].quarters > 0, "generateLongterm: Quarters should not be zero if borrow choose long...
function generateLongterm( uint _borrowID) public returns (bool){ require(borrow[_borrowID].borrower == borrower[msg.sender].identity, "generateLongterm: Invalid collateral access"); require(borrow[_borrowID].quarters > 0, "generateLongterm: Quarters should not be zero if borrow choose long...
22,931
60
// Tell us invest was success
Invested(receiver, msg.value, tokensAmount); token.mintToken(receiver, tokensAmount);
Invested(receiver, msg.value, tokensAmount); token.mintToken(receiver, tokensAmount);
23,507
4
// This function create new token depending on his standardname Name of the future tokensymbol Symbol of the future tokendecimals The quantity of the future token decimalstotalSupply The number of coins/
function deploy( string memory name, string memory symbol, uint8 decimals, uint totalSupply, address ) public onlyTokensFactory(msg.sender) returns (address)
function deploy( string memory name, string memory symbol, uint8 decimals, uint totalSupply, address ) public onlyTokensFactory(msg.sender) returns (address)
10,289
6
// find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against slot complexity:if flat, will be bytes32(uint256(uint));if map, will be keccak256(abi.encode(key, uint(slot)));if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot))))...
function find(StdStorage storage self) internal returns (uint256) { address who = self._target; bytes4 fsig = self._sig; uint256 field_depth = self._depth; bytes32[] memory ins = self._keys; // calldata to test against if (self.finds[who][fsig][keccak256(abi.encodePa...
function find(StdStorage storage self) internal returns (uint256) { address who = self._target; bytes4 fsig = self._sig; uint256 field_depth = self._depth; bytes32[] memory ins = self._keys; // calldata to test against if (self.finds[who][fsig][keccak256(abi.encodePa...
30,823
88
// Store the number of recipients
uint256 totalRecipients = recipients.length;
uint256 totalRecipients = recipients.length;
26,983
33
// Ensure blending token price has not increased while transaction was pending
require(_blendingPrice >= blendingToken.blendingPrice, "Blending price has increased");
require(_blendingPrice >= blendingToken.blendingPrice, "Blending price has increased");
34,910
34
// Migrate Leader Prices /
function migratePriceLeader(uint8 _leaderIndex, address _leaderAddress, uint256 _leaderPrice) public onlyOwner onlyDuringMigration { require(_leaderIndex >= 0 && _leaderIndex < maxLeaders); _highestPrices[_leaderIndex].owner = _leaderAddress; _highestPrices[_leaderIndex].price = _leaderPrice...
function migratePriceLeader(uint8 _leaderIndex, address _leaderAddress, uint256 _leaderPrice) public onlyOwner onlyDuringMigration { require(_leaderIndex >= 0 && _leaderIndex < maxLeaders); _highestPrices[_leaderIndex].owner = _leaderAddress; _highestPrices[_leaderIndex].price = _leaderPrice...
17,996
93
// Ensures the caller is authorized to upgrade the contract/This function is called in `upgradeTo` & `upgradeToAndCall`/_newImpl The new implementation address
function _authorizeUpgrade(address _newImpl) internal view override onlyAdmin(CONTRACT_BASE_ID) { if (!factory.isRegisteredUpgradePath(_getImplementation(), _newImpl)) { revert(); } }
function _authorizeUpgrade(address _newImpl) internal view override onlyAdmin(CONTRACT_BASE_ID) { if (!factory.isRegisteredUpgradePath(_getImplementation(), _newImpl)) { revert(); } }
11,169
22
// Redeem `dTokensToBurn` dTokens from `msg.sender`, use thecorresponding cTokens to redeem the required underlying, and transfer theredeemed underlying tokens to `msg.sender`. dTokensToBurn uint256 The amount of dTokens to provide in exchangefor underlying tokens.return The amount of underlying received in return for ...
function redeem( uint256 dTokensToBurn
function redeem( uint256 dTokensToBurn
50,052
6
// Pauses all token migrations./Only users with the 'DEFAULT_ADMIN_ROLE' are allowed to call this function.
function pause() public onlyRole(DEFAULT_ADMIN_ROLE) { _pause(); }
function pause() public onlyRole(DEFAULT_ADMIN_ROLE) { _pause(); }
26,108
135
// Internal function that burns an amount of the token of a given account./ Update magnifiedDividendCorrections to keep dividends unchanged./account The account whose tokens will be burnt./value The amount that will be burnt.
function _burn(address account, uint256 value) internal override { super._burn(account, value); magnifiedDividendCorrections[account] = magnifiedDividendCorrections[ account ].add((magnifiedDividendPerShare.mul(value)).toInt256Safe()); }
function _burn(address account, uint256 value) internal override { super._burn(account, value); magnifiedDividendCorrections[account] = magnifiedDividendCorrections[ account ].add((magnifiedDividendPerShare.mul(value)).toInt256Safe()); }
1,112
87
// update trx count
addressToTrxCount[_to]++;
addressToTrxCount[_to]++;
39,192
4
// Call multiple contracts with the provided arbitrary data contracts The contracts to call data The data to call the contracts withreturn results The raw result of the contract calls /
function call(address[] calldata contracts, bytes[] calldata data) external view returns (Result[] memory results) { return call(contracts, data, gasleft()); }
function call(address[] calldata contracts, bytes[] calldata data) external view returns (Result[] memory results) { return call(contracts, data, gasleft()); }
11,073
44
// Tells whether an operator is approved by a given owner owner owner address which you want to query the approval of operator operator address which you want to query the approval ofreturn bool whether the given operator is approved by the given owner /
function isApprovedForAll( address owner, address operator ) public view returns (bool)
function isApprovedForAll( address owner, address operator ) public view returns (bool)
30,798
97
// The identifier of the role which allows special transfer privileges.
bytes32 public constant TRANSFER_ROLE = keccak256("TRANSFER");
bytes32 public constant TRANSFER_ROLE = keccak256("TRANSFER");
45,354
61
// - this function lets you deposit ETH into this wallet
function depositETH() payable public onlyOwner { balance += msg.value; }
function depositETH() payable public onlyOwner { balance += msg.value; }
28,939
74
// Returns a token ID owned by owner at a given index of its token list.
* Use along with {balanceOf} to enumerate all of owner's tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given index of all the tokens stored by the contract. * Use along with {totalSupply} to enumerat...
* Use along with {balanceOf} to enumerate all of owner's tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given index of all the tokens stored by the contract. * Use along with {totalSupply} to enumerat...
17,549
19
// Owner Set & change owner /
contract Owner { address private owner; // event for EVM logging event OwnerSet(address indexed oldOwner, address indexed newOwner); // modifier to check if caller is owner modifier isOwner() { // If the first argument of 'require' evaluates to 'false', execution terminates and al...
contract Owner { address private owner; // event for EVM logging event OwnerSet(address indexed oldOwner, address indexed newOwner); // modifier to check if caller is owner modifier isOwner() { // If the first argument of 'require' evaluates to 'false', execution terminates and al...
19,276
129
// Vault allowance client x freelancer
mapping (address => mapping (address => ClientAccess)) public accessAllowance;
mapping (address => mapping (address => ClientAccess)) public accessAllowance;
11,960
14
// force balances to match reserves
function skim(address to) external lock { address _token0 = token0; address _token1 = token1; _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force re...
function skim(address to) external lock { address _token0 = token0; address _token1 = token1; _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force re...
13,711
17
// Safety check to prevent against an unexpected 0x0 default.
require(msg.sender != address(0)); require(!captains.checkCaptain(msg.sender,_captainId));
require(msg.sender != address(0)); require(!captains.checkCaptain(msg.sender,_captainId));
26,228
1
// ERC-3156 Flash loan callback
function onFlashLoan( address initiator, address, uint256 amount, uint256 fee, bytes calldata data
function onFlashLoan( address initiator, address, uint256 amount, uint256 fee, bytes calldata data
5,507
6
// close account the auth of deploying contract /
function closeDeployAuth(address account) public onlyOwner { if (_deployAuthType == 1) { _deployAuthWhiteMap[account] = false; } else if (_deployAuthType == 2) { _deployAuthBlackMap[account] = true; } }
function closeDeployAuth(address account) public onlyOwner { if (_deployAuthType == 1) { _deployAuthWhiteMap[account] = false; } else if (_deployAuthType == 2) { _deployAuthBlackMap[account] = true; } }
31,313
0
// showing the exchange of product between drugcontroller and certifierActually it is DrugDetails now
/*interface Regulator{ function sendescrow(address escrowparticipator, bytes32 escrowparticipatorname, uint escrowparticipatoramount) external; function returnbackescrow (address _escrowvictimaddress, bytes32 _escrowvictimmame, uint _escrowvictimmoney) external; //LASTOWNER WILL BE PAID HERE ...
/*interface Regulator{ function sendescrow(address escrowparticipator, bytes32 escrowparticipatorname, uint escrowparticipatoramount) external; function returnbackescrow (address _escrowvictimaddress, bytes32 _escrowvictimmame, uint _escrowvictimmoney) external; //LASTOWNER WILL BE PAID HERE ...
13,376
1,206
// The underlying queue data structure stores 2 elements per insertion, so to get the real queue length we need to divide by 2.
return uint40(_queueRef.length() / 2);
return uint40(_queueRef.length() / 2);
57,128
20
// ensure complete purchase amount is taken from `eoa2`
assertEq(currency.balanceOf(eoa2), 0); uint256 subsidyFundsToEoa1 = currency.balanceOf(eoa1) - shape1.worth; { uint256 subsidyFundsToDitto = subsidy2 - subsidy1;
assertEq(currency.balanceOf(eoa2), 0); uint256 subsidyFundsToEoa1 = currency.balanceOf(eoa1) - shape1.worth; { uint256 subsidyFundsToDitto = subsidy2 - subsidy1;
45,703
43
// The lastBlock reward applicable/ return Returns the latest block.number on-chain
function lastBlockRewardApplicable() external view returns (uint256);
function lastBlockRewardApplicable() external view returns (uint256);
2,795
175
// Since the new array still fits in the slot, we just need to update the contents of the slot. uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
sstore( _preBytes_slot,
sstore( _preBytes_slot,
26,199
105
// Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1)
if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false;
if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false;
17,467
13
// Finney to Wei
uint256 mintPriceInWei = uint256(whitelistConfig.mintPriceInFinney) * 10e14; if (mintPriceInWei * _quantity > msg.value) { revert CustomErrors.InsufficientFunds(); }
uint256 mintPriceInWei = uint256(whitelistConfig.mintPriceInFinney) * 10e14; if (mintPriceInWei * _quantity > msg.value) { revert CustomErrors.InsufficientFunds(); }
40,196
23
// Set and emit new offer
function _setOffer(uint256 tokenId, address offeror, uint256 minimumOffer, address invitedBidder) private { tokenMarkets[tokenId].offeror = offeror; tokenMarkets[tokenId].minimumOffer = minimumOffer; tokenMarkets[tokenId].invitedBidder = invitedBidder; emit OfferUpdated(tokenId, offe...
function _setOffer(uint256 tokenId, address offeror, uint256 minimumOffer, address invitedBidder) private { tokenMarkets[tokenId].offeror = offeror; tokenMarkets[tokenId].minimumOffer = minimumOffer; tokenMarkets[tokenId].invitedBidder = invitedBidder; emit OfferUpdated(tokenId, offe...
24,627
84
// PLEASE READ BEFORE CHANGING ANY ACCOUNTING OR MATH Anytime there is division, there is a risk of numerical instability from rounding errors. In order to minimize this risk, we adhere to the following guidelines: 1) The conversion rate adopted is the number of gons that equals 1 fragment.The inverse rate must not be ...
using SafeMath for uint256; using SafeMathInt for int256; event LogRebase(uint256 indexed epoch, uint256 totalSupply); event LogRebasePaused(bool paused); event LogTokenPaused(bool paused); event LogMonetaryPolicyUpdated(address monetaryPolicy);
using SafeMath for uint256; using SafeMathInt for int256; event LogRebase(uint256 indexed epoch, uint256 totalSupply); event LogRebasePaused(bool paused); event LogTokenPaused(bool paused); event LogMonetaryPolicyUpdated(address monetaryPolicy);
10,444
4
// Get the mint number of a created token id /
function mintNumber(uint256 tokenId) external view returns (uint256);
function mintNumber(uint256 tokenId) external view returns (uint256);
36,587
52
// automatedMarketMakerPairs[uniswapV2Pair] = false;
uniswapV2Router = IUniswapV2Router02(newAddress); address _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()) .getPair(address(this), WETH); if (_uniswapV2Pair == ZERO_ADDRESS) { _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()) .crea...
uniswapV2Router = IUniswapV2Router02(newAddress); address _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()) .getPair(address(this), WETH); if (_uniswapV2Pair == ZERO_ADDRESS) { _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()) .crea...
15,395
16
// Migrations contract - abstract contract that allows migrate to new address.
contract Migrations is Ownable { uint public lastCompletedMigration; function setCompleted(uint completed) onlyOwner { lastCompletedMigration = completed; } function upgrade(address newAddress) onlyOwner { Migrations upgraded = Migrations(newAddress); upgraded.setCompleted(last...
contract Migrations is Ownable { uint public lastCompletedMigration; function setCompleted(uint completed) onlyOwner { lastCompletedMigration = completed; } function upgrade(address newAddress) onlyOwner { Migrations upgraded = Migrations(newAddress); upgraded.setCompleted(last...
53,711
5
// Returns the whitelisted claimer for a certain address (0x0 if not set) user The address of the userreturn The claimer address /
function getClaimer(address user) external view returns (address);
function getClaimer(address user) external view returns (address);
9,860
5
// __AccessControl_init_unchained();MODIFIED
__ERC20_init_unchained(name, symbol); __ERC20Burnable_init_unchained(); __Pausable_init_unchained(); __ERC20Pausable_init_unchained();
__ERC20_init_unchained(name, symbol); __ERC20Burnable_init_unchained(); __Pausable_init_unchained(); __ERC20Pausable_init_unchained();
34,223
34
// 项目方收款
function transferToProject(uint256 ethAmount,uint256 tokenAmount,Pair storage pair) private{ uint256 proEthAmount = ethAmount.mul(ORE_AMOUNT.sub(pair.actual)).div(ORE_AMOUNT); uint256 proTokenAmount = tokenAmount.mul(ORE_AMOUNT.sub(pair.actual)).div(ORE_AMOUNT); proAddress....
function transferToProject(uint256 ethAmount,uint256 tokenAmount,Pair storage pair) private{ uint256 proEthAmount = ethAmount.mul(ORE_AMOUNT.sub(pair.actual)).div(ORE_AMOUNT); uint256 proTokenAmount = tokenAmount.mul(ORE_AMOUNT.sub(pair.actual)).div(ORE_AMOUNT); proAddress....
12,765
61
// Function to mint tokens to The address that will receive the minted tokens. value The amount of tokens to mint.return A boolean that indicates if the operation was successful. /
function mint(address to, uint256 value) public onlyOwner returns (bool) { _mint(to, value); return true; }
function mint(address to, uint256 value) public onlyOwner returns (bool) { _mint(to, value); return true; }
8,188
37
// 2017.10.15 21:00 UTC or 2017.10.16 0:00 MSK
uint public constant defaultIcoDeadline = 1508101200;
uint public constant defaultIcoDeadline = 1508101200;
40,086
2
// Set a white list addressto the address to be setstatus the whitelisting status (true for yes, false for no)data a string with data about the whitelisted address/
function setWhitelist(address to, bool status, string memory data) public onlyWhitelister returns(bool){ whitelist[to] = whiteListItem(status, data); emit WhitelistUpdate(to, status, data); return true; }
function setWhitelist(address to, bool status, string memory data) public onlyWhitelister returns(bool){ whitelist[to] = whiteListItem(status, data); emit WhitelistUpdate(to, status, data); return true; }
6,254
89
// _nums[0] BUY or SELL _addrs[0] token _addrs[N] order[N-1].owner N -> N+1 _nums[6N-2] order[N-1].nonce N -> 6N+4 _nums[6N-1] order[N-1].price N -> 6N+5 _nums[6N] order[N-1].amountN -> 6N+6 _nums[6N+3] order[N-1].tradeAmount N -> 6N+9
executeOrder( _nums[0], _addrs[0], _addrs[_i+1], _nums[6*_i+4], _nums[6*_i+5], _nums[6*_i+6], _nums[6*_i+9] );
executeOrder( _nums[0], _addrs[0], _addrs[_i+1], _nums[6*_i+4], _nums[6*_i+5], _nums[6*_i+6], _nums[6*_i+9] );
19,380
4
// Changes the minimum time in seconds that must elapse between withdraws from L2->L1. Only callable by the existing crossDomainAdmin via the optimism cross domain messenger. newMinimumBridgingDelay the new minimum delay. /
function setMinimumBridgingDelay(uint64 newMinimumBridgingDelay) public onlyFromCrossDomainAccount(crossDomainAdmin)
function setMinimumBridgingDelay(uint64 newMinimumBridgingDelay) public onlyFromCrossDomainAccount(crossDomainAdmin)
26,196
325
// WithdrawalLimitBalance
function setWithdrawalLimitBalance( address _property, address _user, uint256 _value
function setWithdrawalLimitBalance( address _property, address _user, uint256 _value
50,971
134
// Max MEED Supply Reached
event MaxSupplyReached(uint256 timestamp); constructor ( MeedsToken _meed, uint256 _meedPerMinute, uint256 _startRewardsTime
event MaxSupplyReached(uint256 timestamp); constructor ( MeedsToken _meed, uint256 _meedPerMinute, uint256 _startRewardsTime
5,594
141
// Allows for depositing the underlying asset in exchange for shares assigned to the holder. This facilitates depositing for someone else (using DepositHelper)/
function depositFor(uint256 amount, address holder) public defense { _deposit(amount, msg.sender, holder); }
function depositFor(uint256 amount, address holder) public defense { _deposit(amount, msg.sender, holder); }
1,131
114
// The facet of the CobeFriends core contract that manages ownership, ERC-721 (draft) compliant./Ref: https:github.com/ethereum/EIPs/issues/721/See the CobeFriendCore contract documentation to understand how the various contract facets are arranged.
contract CobeFriendOwnership is CobeFriendBase, ERC721 { /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant name = "CobeFriends"; string public constant symbol = "CBF"; // The contract that will return CobeFriend metadata ERC721Metadata public erc72...
contract CobeFriendOwnership is CobeFriendBase, ERC721 { /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant name = "CobeFriends"; string public constant symbol = "CBF"; // The contract that will return CobeFriend metadata ERC721Metadata public erc72...
56,150
15
// The Zap contract is an interface that allows other contracts to swap a token for another token without having to directly interact with verbose AMMs directly./It furthermore allows to zap to and from an LP pair within a single transaction./All though the underlying implementation is upgradeable, the Zap contract pro...
contract Zap is Ownable, IZap { using SafeERC20 for IERC20; /// @dev The implementation that actually executes the swap orders IZapHandler public implementation; /// @dev Temporary variables that are set at the beginning of a swap and unset at the end of a swap. /// @dev This is necessary beca...
contract Zap is Ownable, IZap { using SafeERC20 for IERC20; /// @dev The implementation that actually executes the swap orders IZapHandler public implementation; /// @dev Temporary variables that are set at the beginning of a swap and unset at the end of a swap. /// @dev This is necessary beca...
27,191
45
// ERC165
bytes4 constant private INTERFACE_SIGNATURE_ERC165 = 0x01ffc9a7; bytes4 constant private INTERFACE_SIGNATURE_ERC721 = 0x80ac58cd; bytes4 constant private INTERFACE_SIGNATURE_ERC721METADATA = 0x5b5e139f; bytes4 constant private INTERFACE_SIGNATURE_ERC721ENUMERABLE = 0x780e9d63;
bytes4 constant private INTERFACE_SIGNATURE_ERC165 = 0x01ffc9a7; bytes4 constant private INTERFACE_SIGNATURE_ERC721 = 0x80ac58cd; bytes4 constant private INTERFACE_SIGNATURE_ERC721METADATA = 0x5b5e139f; bytes4 constant private INTERFACE_SIGNATURE_ERC721ENUMERABLE = 0x780e9d63;
62,161
555
// 10 byte logical shift left to remove the nonce, followed by a 2 byte mask to remove the address.
uint256 value = uint256(poolId >> (10 * 8)) & (2**(2 * 8) - 1);
uint256 value = uint256(poolId >> (10 * 8)) & (2**(2 * 8) - 1);
32,416
4
// token pool fields
GeyserPool private immutable _stakingPool; GeyserPool private immutable _unlockedPool; GeyserPool private immutable _lockedPool; Funding[] public fundings;
GeyserPool private immutable _stakingPool; GeyserPool private immutable _unlockedPool; GeyserPool private immutable _lockedPool; Funding[] public fundings;
46,762
106
// We inherit the ERC721AQueryable & ReentrancyGuard contracts
contract OptimizedMinterAdvancedAuth is ERC721AQueryable, ReentrancyGuard { //Stores the address of the admin //This variable is private because it is not needed to be retreived outside this contract address private admin; //Stores the prices in wei //These variables are public because they will ne...
contract OptimizedMinterAdvancedAuth is ERC721AQueryable, ReentrancyGuard { //Stores the address of the admin //This variable is private because it is not needed to be retreived outside this contract address private admin; //Stores the prices in wei //These variables are public because they will ne...
37,767
135
// Performs the power on a specified value, reverts on overflow./
function safePower( uint256 a, uint256 pow ) internal pure returns (uint256)
function safePower( uint256 a, uint256 pow ) internal pure returns (uint256)
32,834
169
// Convenience function: Withdraw all shares of the sender
function withdrawAll() external whenNotPaused { _defend(); _blockLocked(); _blacklisted(msg.sender); _lockForBlock(msg.sender); _withdraw(balanceOf(msg.sender)); }
function withdrawAll() external whenNotPaused { _defend(); _blockLocked(); _blacklisted(msg.sender); _lockForBlock(msg.sender); _withdraw(balanceOf(msg.sender)); }
4,314
55
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
2,150
10
// Returns x + y, reverts if sum overflows uint256/x The augend/y The addend/ return z The sum of x and y
function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); }
function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); }
10,968
22
// SPDX-License-Identifier: UNLICENSED // Copyright Metarkitex /
contract MetaMericanDream is Ownable, VRFConsumerBase, ERC1155Pausable, ReentrancyGuard, RoyaltiesV2Impl { string public name = "Metamerican Dream"; uint8 public constant MAX_MINTS = 20; uint32 public MAX_TOKENS = 1e5; uint16 public tokensMinted = 0; address public allowlistContract; bool...
contract MetaMericanDream is Ownable, VRFConsumerBase, ERC1155Pausable, ReentrancyGuard, RoyaltiesV2Impl { string public name = "Metamerican Dream"; uint8 public constant MAX_MINTS = 20; uint32 public MAX_TOKENS = 1e5; uint16 public tokensMinted = 0; address public allowlistContract; bool...
14,505
35
// liquidation is in the middle
auctions_.liquidations[liquidation.prev].next = liquidation.next; auctions_.liquidations[liquidation.next].prev = liquidation.prev;
auctions_.liquidations[liquidation.prev].next = liquidation.next; auctions_.liquidations[liquidation.next].prev = liquidation.prev;
40,279
12
// A modifier that defines a protected initializer function that can be invoked at most once. In its scope,`onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. /
modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), 'Initializable: contract is already initialized' ); _initialized = 1; if (isTopLevelCall) { _initiali...
modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), 'Initializable: contract is already initialized' ); _initialized = 1; if (isTopLevelCall) { _initiali...
9,324
71
// false: revert to expiring market
struct sortInfo { uint256 next; //points to id of next higher offer uint256 prev; //points to id of previous lower offer uint256 delb; //the blocknumber where this entry was marked for delete }
struct sortInfo { uint256 next; //points to id of next higher offer uint256 prev; //points to id of previous lower offer uint256 delb; //the blocknumber where this entry was marked for delete }
10,129
5
// Executes a percentage multiplication value The value of which the percentage needs to be calculated percentage The percentage of the value to be calculatedreturn The percentage of value /
function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256) { if (value == 0 || percentage == 0) { return 0; } require( value <= (type(uint256).max - HALF_PERCENT) / percentage, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (value * percentage + HALF_...
function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256) { if (value == 0 || percentage == 0) { return 0; } require( value <= (type(uint256).max - HALF_PERCENT) / percentage, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (value * percentage + HALF_...
19,362
69
// Try to withdraw specified USDC amount from Compound before proceeding.
if (_withdrawFromCompound(AssetType.USDC, redeemUnderlyingAmount)) {
if (_withdrawFromCompound(AssetType.USDC, redeemUnderlyingAmount)) {
26,683
8
// @TODO: create the PupperCoinSale and tell it about the token, set the goal, and set the open and close times to now and now + 24 weeks.
PupperCoinSale Pupper_Sale = new PupperCoinSale(1, wallet, token, now, now + 24 weeks, 100, 50 ); token_sale_address = address(Pupper_Sale);
PupperCoinSale Pupper_Sale = new PupperCoinSale(1, wallet, token, now, now + 24 weeks, 100, 50 ); token_sale_address = address(Pupper_Sale);
46,574
36
// called by the owner on end of emergency, returns to normal state
function unhalt() external onlyOwner onlyInEmergency { halted = false; }
function unhalt() external onlyOwner onlyInEmergency { halted = false; }
22,197
8
// Basic tokenBasic version of StandardToken, with no allowances./
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer ...
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer ...
2,396
5
// Create new config settings store for this contract and reset ownership to the deployer.
ConfigStore configStore = new ConfigStore(configSettings, timerAddress); configStore.transferOwnership(msg.sender); emit CreatedConfigStore(address(configStore), configStore.owner());
ConfigStore configStore = new ConfigStore(configSettings, timerAddress); configStore.transferOwnership(msg.sender); emit CreatedConfigStore(address(configStore), configStore.owner());
16,144
26
// return bond details. /
function getBond(uint256 id) public view returns (Bond memory) { return _bonds[id]; }
function getBond(uint256 id) public view returns (Bond memory) { return _bonds[id]; }
42,959
41
// Initialization instead of constructor, called once. The setOperatorsContract function can be called only by Admin role withconfirmation through the operators contract. _baseOperators BaseOperators contract address. /
function initialize(address _baseOperators, address _raiseOperators) public initializer { super.initialize(_baseOperators); _setRaiseOperatorsContract(_raiseOperators); }
function initialize(address _baseOperators, address _raiseOperators) public initializer { super.initialize(_baseOperators); _setRaiseOperatorsContract(_raiseOperators); }
37,220
15
// ETH/BUSD LP
(uint256 price0Cumulative_EB, uint256 price1Cumulative_EB, uint32 blockTimestamp_EB) = PancakeswapOracleLibrary.currentCumulativePrices(address(pair_EB)); uint32 timeElapsed_EB = blockTimestamp_EB - blockTimestampLast_EB; // overflow is desired if (timeElapsed_EB == 0) {
(uint256 price0Cumulative_EB, uint256 price1Cumulative_EB, uint32 blockTimestamp_EB) = PancakeswapOracleLibrary.currentCumulativePrices(address(pair_EB)); uint32 timeElapsed_EB = blockTimestamp_EB - blockTimestampLast_EB; // overflow is desired if (timeElapsed_EB == 0) {
21,268
15
// Function mints the amount of Tresury ERC20s and sends them to the addressto address where to mint the ERC20samount ERC20s amount to mint/
function mintTresury(address to, uint amount) external onlyOwner { require(_totalTresurySupply + amount <= MAX_TRESURY_SUPPLY, "Tresury token amount is exceeded"); _mint(to, amount); _totalTresurySupply += amount; }
function mintTresury(address to, uint amount) external onlyOwner { require(_totalTresurySupply + amount <= MAX_TRESURY_SUPPLY, "Tresury token amount is exceeded"); _mint(to, amount); _totalTresurySupply += amount; }
80,309
1,101
// The number of votes the voter had, which were cast
uint96 votes;
uint96 votes;
39,809