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
7
// Delegates the current call to the address returned by `_implementation()`. This function does not return to its internall call site, it will return directly to the external caller. /
function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); }
function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); }
1,994
25
// Close all streams before changing rate
uint256[] memory streams = _streamsByRecipient[recipient]; for (uint256 index = 0; index < streams.length; index++) { uint256 streamId = streams[index]; _close(streamId); }
uint256[] memory streams = _streamsByRecipient[recipient]; for (uint256 index = 0; index < streams.length; index++) { uint256 streamId = streams[index]; _close(streamId); }
26,300
198
// {BurnEnded} uint timestamp, uint block number. /
function cleanUpAndEndTheBurn() internal { require(Bools.autoBuyBackAndBurnEnabled, "burn not enabled"); moveTokens(Addr[Key.BURN], Addr[Key.TREASURY], 0); moveTokens(Addr[Key.LIQUIDITY], Addr[Key.TREASURY], 0); moveTokens(Addr[Key.PROXY], Addr[Key.TREASURY], 0); setTax(Key.BURN, 0); setTax(Key.LIQUIDITY, 0); setTax(Key.PROXY, 0); Bools.autoBuyBackAndBurnEnabled = false; Bools.limitsEnabled = false;
function cleanUpAndEndTheBurn() internal { require(Bools.autoBuyBackAndBurnEnabled, "burn not enabled"); moveTokens(Addr[Key.BURN], Addr[Key.TREASURY], 0); moveTokens(Addr[Key.LIQUIDITY], Addr[Key.TREASURY], 0); moveTokens(Addr[Key.PROXY], Addr[Key.TREASURY], 0); setTax(Key.BURN, 0); setTax(Key.LIQUIDITY, 0); setTax(Key.PROXY, 0); Bools.autoBuyBackAndBurnEnabled = false; Bools.limitsEnabled = false;
18,625
510
// transferPoint(): transfer _point to _target, clearing all permissions data and keys if _reset is trueNote: the _reset flag is useful when transferring the point toa recipient who doesn't trust the previous owner.Requirements:- :msg.sender must be either _point's current owner, authorizedto transfer _point, or authorized to transfer the currentowner's points (as in ERC721's operator)- _target must not be the zero address
function transferPoint(uint32 _point, address _target, bool _reset) public
function transferPoint(uint32 _point, address _target, bool _reset) public
51,352
14
// Redeem!
_balances[recipient] += amount; _totalSupply += amount; Transfer(0, recipient, amount);
_balances[recipient] += amount; _totalSupply += amount; Transfer(0, recipient, amount);
35,977
6
// Setup and admin functions
function DSTokenController( DSTokenFrontend frontend, DSBalanceDB baldb, DSApprovalDB apprdb ) { _frontend = frontend; _balances = baldb; _approvals = apprdb; }
function DSTokenController( DSTokenFrontend frontend, DSBalanceDB baldb, DSApprovalDB apprdb ) { _frontend = frontend; _balances = baldb; _approvals = apprdb; }
16,900
154
// calculating number of unacheived targets
for(uint256 _i = 1; _i <= 12; _i++) { if(_pet.monthlyDepositAmount[_i] < _pet.monthlyCommitmentAmount) { _unachieveTargetCount++; }
for(uint256 _i = 1; _i <= 12; _i++) { if(_pet.monthlyDepositAmount[_i] < _pet.monthlyCommitmentAmount) { _unachieveTargetCount++; }
27,749
195
// upgrades the converter to the latest version can only be called by the owner note that the owner needs to call acceptOwnership on the new converter after the upgrade/
function upgrade() public ownerOnly { IConverterUpgrader converterUpgrader = IConverterUpgrader(addressOf(CONVERTER_UPGRADER)); // trigger de-activation event emit Activation(converterType(), anchor, false); transferOwnership(converterUpgrader); converterUpgrader.upgrade(version); acceptOwnership(); }
function upgrade() public ownerOnly { IConverterUpgrader converterUpgrader = IConverterUpgrader(addressOf(CONVERTER_UPGRADER)); // trigger de-activation event emit Activation(converterType(), anchor, false); transferOwnership(converterUpgrader); converterUpgrader.upgrade(version); acceptOwnership(); }
10,060
290
// Get current borrow balance of a token _token token address This is an estimation. Add a new checkpoint first, if you want to derive the exact balance. /
function getBorrowBalanceCurrent( address _token, address _accountAddr
function getBorrowBalanceCurrent( address _token, address _accountAddr
15,116
7
// Send tokens to an address without that address claiming them
function sendTokens(address dst, uint256 tokenAmount) virtual external;
function sendTokens(address dst, uint256 tokenAmount) virtual external;
66,161
129
// Change the random generator The calls to functions are used to verify the new generator implements them properly.It is necessary to wait for the VRF response before starting a round.Callable only by the contract owner _randomGeneratorAddress: address of the random generator /
function changeRandomGenerator(address _randomGeneratorAddress) external onlyOwner { require(_lotteries[currentLotteryId].status == Status.Claimable, "Lottery not in claimable"); // Request a random number from the generator based on a seed IRandomNumberGenerator(_randomGeneratorAddress).getRandomNumber( uint256(keccak256(abi.encodePacked(currentLotteryId, currentTicketId))) ); // Calculate the finalNumber based on the randomResult generated by ChainLink's fallback IRandomNumberGenerator(_randomGeneratorAddress).viewRandomResult(); randomGenerator = IRandomNumberGenerator(_randomGeneratorAddress); emit NewRandomGenerator(_randomGeneratorAddress); }
function changeRandomGenerator(address _randomGeneratorAddress) external onlyOwner { require(_lotteries[currentLotteryId].status == Status.Claimable, "Lottery not in claimable"); // Request a random number from the generator based on a seed IRandomNumberGenerator(_randomGeneratorAddress).getRandomNumber( uint256(keccak256(abi.encodePacked(currentLotteryId, currentTicketId))) ); // Calculate the finalNumber based on the randomResult generated by ChainLink's fallback IRandomNumberGenerator(_randomGeneratorAddress).viewRandomResult(); randomGenerator = IRandomNumberGenerator(_randomGeneratorAddress); emit NewRandomGenerator(_randomGeneratorAddress); }
53,503
76
// PRIVATE: Transfers tokens from one account to another This will apply any transaction fees and updating balances (including reflection)
function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } }
function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } }
36,050
5
// Maximum fraction of interest that can be set aside for reserves /
uint256 internal constant RESERVE_FACTOR_MAX_MANTISSA = 1e18;
uint256 internal constant RESERVE_FACTOR_MAX_MANTISSA = 1e18;
27,288
34
// calls all the internal functions above, to transfer a token from one user to another
function _clearApprovalAndTransfer(address _from, address _to, uint _tokenId) internal
function _clearApprovalAndTransfer(address _from, address _to, uint _tokenId) internal
20,483
80
// Add liquidity to the ETRNL/AVAX pair
emit AutomaticLiquidityProvision(amountETRNL, contractBalance, amountAVAX); eternal.approve(address(joeRouter), amountETRNL);
emit AutomaticLiquidityProvision(amountETRNL, contractBalance, amountAVAX); eternal.approve(address(joeRouter), amountETRNL);
32,072
10
// Address of the current leader
address public leader;
address public leader;
4,283
1
// Returns staking rewards fee rate/
function getFee() external view returns (uint16 feeBasisPoints);
function getFee() external view returns (uint16 feeBasisPoints);
5,451
5
// Deposit function
function() external payable { //require(AllowedAddressesToSendFunds[msg.sender],"You are not allowed!"); require(CheckIfAllowed(msg.sender),"You are not allowed!"); emit Deposit(msg.sender,msg.value); }
function() external payable { //require(AllowedAddressesToSendFunds[msg.sender],"You are not allowed!"); require(CheckIfAllowed(msg.sender),"You are not allowed!"); emit Deposit(msg.sender,msg.value); }
40,173
84
// Only Escrow can execute actions to trade the portfolio
require(calledByEscrow(), "20"); TradePortfolioState memory state = TradePortfolioState( amount, 0, 0,
require(calledByEscrow(), "20"); TradePortfolioState memory state = TradePortfolioState( amount, 0, 0,
32,761
23
// function for patient to verify that medical record has no problems
function patientVerify(uint256 medicalRecordId) public isPatientFromRecord(medicalRecordId)
function patientVerify(uint256 medicalRecordId) public isPatientFromRecord(medicalRecordId)
43,509
282
// assigned (and available on the emitted {IERC721-Transfer} event), and the tokenURI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`. /
function mint(address to) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");
function mint(address to) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");
17,050
107
// Convert and send ETH to user
if(tokenWithdrawAmount > 0){ WrappedEther(wethAddress).withdraw(tokenWithdrawAmount); // This will send ETH to this contract and burn WETH
if(tokenWithdrawAmount > 0){ WrappedEther(wethAddress).withdraw(tokenWithdrawAmount); // This will send ETH to this contract and burn WETH
49,508
193
// Base URI for token URIs // OpenSea user account proxy // Minter addressess // mapping of each token id to poster type // mapping of each token id to rarity. 0 = common, 1 = rare, 2 = legendary /
constructor(string memory name_, string memory symbol_, string memory _initialBaseURI, address _openSeaProxyRegistryAddress, address[] memory _minters) ERC721Opt(name_, symbol_) { baseURI = _initialBaseURI; openSeaProxyRegistryAddress = _openSeaProxyRegistryAddress; for (uint256 i; i < _minters.length; i++) { minters[_minters[i]] = true; } _addPoster("Season 1", 1250); }
constructor(string memory name_, string memory symbol_, string memory _initialBaseURI, address _openSeaProxyRegistryAddress, address[] memory _minters) ERC721Opt(name_, symbol_) { baseURI = _initialBaseURI; openSeaProxyRegistryAddress = _openSeaProxyRegistryAddress; for (uint256 i; i < _minters.length; i++) { minters[_minters[i]] = true; } _addPoster("Season 1", 1250); }
46,585
26
// Sets the storage contract for storing datareturnbool true or false /
function setExchange(address _addr) public pre_cond(isOwner()) returns (bool){ require(isOwner(), 'Only owner priviledged'); exchange = _addr; return true; }
function setExchange(address _addr) public pre_cond(isOwner()) returns (bool){ require(isOwner(), 'Only owner priviledged'); exchange = _addr; return true; }
14,495
25
// Returns the number of tokens in ``owner``'s account. /
function balanceOf(address owner) external view returns (uint256 balance);
function balanceOf(address owner) external view returns (uint256 balance);
22
47
// TODO: consider reverting if the message sender is not WETH
receive() external payable {} fallback() external payable {} } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; }
receive() external payable {} fallback() external payable {} } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; }
25,796
14
// 1个发行人
uint256 public issuerBalanceGive;
uint256 public issuerBalanceGive;
9,277
134
// Returns the log2 of `x`./ Equivalent to computing the index of the most significant bit (MSB) of `x`.
function log2(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { if iszero(x) { // Store the function selector of `Log2Undefined()`. mstore(0x00, 0x5be3aa5c) // Revert with (offset, size). revert(0x1c, 0x04) }
function log2(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { if iszero(x) { // Store the function selector of `Log2Undefined()`. mstore(0x00, 0x5be3aa5c) // Revert with (offset, size). revert(0x1c, 0x04) }
24,362
13
// Getter for last minted token ID (gets next token id and subtracts 1)
function _lastMintedTokenId() internal view returns (uint256) { return _currentIndex - 1; }
function _lastMintedTokenId() internal view returns (uint256) { return _currentIndex - 1; }
3,279
7
// Emits an { contractAddressModified } event. name The name of the contract to remove /
function removeContractAddress(string memory name) public isAdmin { address cAddress = addresses[name]; addresses[name] = address(0); emit contractAddressModified("remove", name, cAddress); }
function removeContractAddress(string memory name) public isAdmin { address cAddress = addresses[name]; addresses[name] = address(0); emit contractAddressModified("remove", name, cAddress); }
6,060
13
// public Variables
uint256 public totalRaised; //eth in wei uint256 public totalDistributed; //tokens distributed uint256 public RATE; // RATE of the BLU BlupassToken public BLU; // BLU token address bool public isStopped = false; // ICO start/stop mapping(address => bool) whitelist; // whitelisting for KYC verified users
uint256 public totalRaised; //eth in wei uint256 public totalDistributed; //tokens distributed uint256 public RATE; // RATE of the BLU BlupassToken public BLU; // BLU token address bool public isStopped = false; // ICO start/stop mapping(address => bool) whitelist; // whitelisting for KYC verified users
14,879
104
// Closes an existing short position. In the future,we may want to open this up to specifying a particular short position to close. /
function closeShort() external returns (uint256);
function closeShort() external returns (uint256);
9,351
3
// Returns true if breaker can be reset./
function _canReset(Breaker storage self) private view returns (bool) { return isHalfOpen(self); }
function _canReset(Breaker storage self) private view returns (bool) { return isHalfOpen(self); }
48,446
442
// Gets the premium amount of a given cover in SOTE.
function getCoverPremiumSOTE(uint _cid) external view returns(uint _premiumSOTE) { _premiumSOTE = allCovers[_cid].premiumSOTE; }
function getCoverPremiumSOTE(uint _cid) external view returns(uint _premiumSOTE) { _premiumSOTE = allCovers[_cid].premiumSOTE; }
22,390
34
// Funding was successful for this ruling option.
if (_choice == finalRuling) {
if (_choice == finalRuling) {
20,520
191
// Return bool on if merkle root hash is set
function isMerkleSet() public view returns (bool) { return merkleSet; }
function isMerkleSet() public view returns (bool) { return merkleSet; }
42,412
150
// Propose new allocation to Rebalancing Set Token
rebalancingSetToken.propose( address(nextSet), address(auctionLibrary), auctionTimeToPivot, auctionStartPrice, auctionPivotPrice );
rebalancingSetToken.propose( address(nextSet), address(auctionLibrary), auctionTimeToPivot, auctionStartPrice, auctionPivotPrice );
37,499
18
// Get the list of whitelisted routers/ return The list of whitelisted routers
function getWhitelistedRouters() external view override returns (address[] memory)
function getWhitelistedRouters() external view override returns (address[] memory)
62,128
189
// withdrawal function.
function withdraw(uint256[] calldata tokenIds) external whenNotPaused noContractsAllowed nonReentrant() { require(block.timestamp.sub(stakingTime[msg.sender]) > LOCKUP_TIME, "You recently staked, please wait before withdrawing."); updateAccount(tokenIds); for (uint256 i; i < tokenIds.length; i++) { require( _deposits[msg.sender].contains(tokenIds[i]), "Staking: token not deposited" ); _deposits[msg.sender].remove(tokenIds[i]); IERC721(stakingDestinationAddress).safeTransferFrom( address(this), msg.sender, tokenIds[i], "" ); } }
function withdraw(uint256[] calldata tokenIds) external whenNotPaused noContractsAllowed nonReentrant() { require(block.timestamp.sub(stakingTime[msg.sender]) > LOCKUP_TIME, "You recently staked, please wait before withdrawing."); updateAccount(tokenIds); for (uint256 i; i < tokenIds.length; i++) { require( _deposits[msg.sender].contains(tokenIds[i]), "Staking: token not deposited" ); _deposits[msg.sender].remove(tokenIds[i]); IERC721(stakingDestinationAddress).safeTransferFrom( address(this), msg.sender, tokenIds[i], "" ); } }
17,447
13
// Created By: LoMel and Odysseus
contract NameSpookyBoy is Ownable { SBCC private immutable sbcc; uint256 public basePrice; uint256 public maxByteLength = 20; bool public namingAllowed = false; // id + 1 because 0 needs to be null for comparing names mapping(uint256 => string) public idToName; mapping(string => uint256) public nameToId; event SpookyBoyNameChange(uint256 spookyBoyId, string newName); constructor(uint256 _basePrice, address spookyBoyContract) { basePrice = _basePrice; sbcc = SBCC(spookyBoyContract); // Reserving the devs name idToName[13000] = "lomel"; nameToId["lomel"] = 13000; idToName[12999] = "odysseus"; nameToId["odysseus"] = 12999; } function manuallySetIdAndName(uint256 _id, string calldata _name) external onlyOwner { string memory requestedName = _toLower(_name); uint256 nameId = _id+1; idToName[nameId] = requestedName; nameToId[requestedName] = nameId; emit SpookyBoyNameChange(_id, _name); } function updateBasePrice(uint256 _basePrice) external onlyOwner { basePrice = _basePrice; } function updateMaxByteLength(uint256 _newLength) external onlyOwner { maxByteLength = _newLength; } function allowNaming() external onlyOwner { require(!namingAllowed, "Naming is already allowed."); namingAllowed = true; } function pauseNaming() external onlyOwner { require(namingAllowed, "Naming is already paused."); namingAllowed = false; } function requestCustomSpookyBoyName(uint256 spookyBoyId, string calldata _requestedName) external payable { string memory requestedName = _toLower(_requestedName); require(namingAllowed, "You may not rename your spooky at this time."); require(bytes(requestedName).length <= maxByteLength, "Your requested name is to long."); require(nameToId[requestedName] == 0, "This name is currently being used."); require(sbcc.ownerOf(spookyBoyId) == msg.sender, "You cannot name a Spooky Boy you don't own."); require(basePrice <= msg.value, "Amount of Ether sent is too low."); uint256 nameId = spookyBoyId+1; string memory oldName = idToName[nameId]; if(bytes(oldName).length > 0){ nameToId[oldName] = 0; } nameToId[requestedName] = nameId; idToName[nameId] = requestedName; emit SpookyBoyNameChange(spookyBoyId, _requestedName); } function _toLower(string memory str) internal pure returns (string memory) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { // Uppercase character... if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { // So we add 32 to make it lowercase bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } function withdraw() external onlyOwner { uint256 balance = address(this).balance; Address.sendValue(payable(msg.sender), balance); } }
contract NameSpookyBoy is Ownable { SBCC private immutable sbcc; uint256 public basePrice; uint256 public maxByteLength = 20; bool public namingAllowed = false; // id + 1 because 0 needs to be null for comparing names mapping(uint256 => string) public idToName; mapping(string => uint256) public nameToId; event SpookyBoyNameChange(uint256 spookyBoyId, string newName); constructor(uint256 _basePrice, address spookyBoyContract) { basePrice = _basePrice; sbcc = SBCC(spookyBoyContract); // Reserving the devs name idToName[13000] = "lomel"; nameToId["lomel"] = 13000; idToName[12999] = "odysseus"; nameToId["odysseus"] = 12999; } function manuallySetIdAndName(uint256 _id, string calldata _name) external onlyOwner { string memory requestedName = _toLower(_name); uint256 nameId = _id+1; idToName[nameId] = requestedName; nameToId[requestedName] = nameId; emit SpookyBoyNameChange(_id, _name); } function updateBasePrice(uint256 _basePrice) external onlyOwner { basePrice = _basePrice; } function updateMaxByteLength(uint256 _newLength) external onlyOwner { maxByteLength = _newLength; } function allowNaming() external onlyOwner { require(!namingAllowed, "Naming is already allowed."); namingAllowed = true; } function pauseNaming() external onlyOwner { require(namingAllowed, "Naming is already paused."); namingAllowed = false; } function requestCustomSpookyBoyName(uint256 spookyBoyId, string calldata _requestedName) external payable { string memory requestedName = _toLower(_requestedName); require(namingAllowed, "You may not rename your spooky at this time."); require(bytes(requestedName).length <= maxByteLength, "Your requested name is to long."); require(nameToId[requestedName] == 0, "This name is currently being used."); require(sbcc.ownerOf(spookyBoyId) == msg.sender, "You cannot name a Spooky Boy you don't own."); require(basePrice <= msg.value, "Amount of Ether sent is too low."); uint256 nameId = spookyBoyId+1; string memory oldName = idToName[nameId]; if(bytes(oldName).length > 0){ nameToId[oldName] = 0; } nameToId[requestedName] = nameId; idToName[nameId] = requestedName; emit SpookyBoyNameChange(spookyBoyId, _requestedName); } function _toLower(string memory str) internal pure returns (string memory) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { // Uppercase character... if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { // So we add 32 to make it lowercase bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } function withdraw() external onlyOwner { uint256 balance = address(this).balance; Address.sendValue(payable(msg.sender), balance); } }
19,933
80
// staking for 6months
_stakingOptions[1].rewardPercent = 30; _stakingOptions[1].lockedTime = 24 weeks; _stakingOptions[1].totalStaked = 0;
_stakingOptions[1].rewardPercent = 30; _stakingOptions[1].lockedTime = 24 weeks; _stakingOptions[1].totalStaked = 0;
41,448
15
// 6% on SELL only
lpLockFeePercent = 600;
lpLockFeePercent = 600;
16,185
213
// hodl value - out value
return hodlValue - outValue;
return hodlValue - outValue;
33,549
7
// Divides two ray, rounding half up to the nearest ray a Ray b Rayreturn The result of a/b, in ray /
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfB = b / 2; require(a <= (type(uint256).max - halfB) / RAY, Errors.MATH_MULTIPLICATION_OVERFLOW); return (a * RAY + halfB) / b; }
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfB = b / 2; require(a <= (type(uint256).max - halfB) / RAY, Errors.MATH_MULTIPLICATION_OVERFLOW); return (a * RAY + halfB) / b; }
39,934
136
// Called to `msg.sender` after executing a swap via IElkDexV3Poolswap./In the implementation you must pay the pool tokens owed for the swap./ The caller of this method must be checked to be a ElkDexV3Pool deployed by the canonical ElkDexV3Factory./ amount0Delta and amount1Delta can both be 0 if no tokens were swapped./amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by/ the end of the swap. If positive, the callback must send that amount of token0 to the pool./amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the
function ElkDexV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external;
function ElkDexV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external;
31,980
6
// owner > balance mapping.
mapping(address => User) public users;
mapping(address => User) public users;
3,440
8
// verify if the `from` address is allowed to execute the `payload` on the `target`. from either the caller of `execute(...)` or the signer of `executeRelayCall(...)`. payload the payload to execute on the `target`. /
function _verifyPermissions(address from, bytes calldata payload) internal view override { bytes4 erc725Function = bytes4(payload); if ( erc725Function == SETDATA_SELECTOR // ERC725Y.setData(bytes32,bytes) || erc725Function == SETDATA_ARRAY_SELECTOR // ERC725Y.setData(bytes32[],bytes[]) || erc725Function == ILSP14Ownable2Step.transferOwnership.selector ) { // Only the owner can use these selectors _checkOwner(); } else if (erc725Function == EXECUTE_SELECTOR) { bytes32 permissions = LSP6Utils.getPermissionsFor(ERC725Y(_target), from); if (permissions == bytes32(0)) revert NoPermissionsSet(from); _verifyCanExecute(from, permissions, payload); } else { revert InvalidERC725Function(erc725Function); } }
function _verifyPermissions(address from, bytes calldata payload) internal view override { bytes4 erc725Function = bytes4(payload); if ( erc725Function == SETDATA_SELECTOR // ERC725Y.setData(bytes32,bytes) || erc725Function == SETDATA_ARRAY_SELECTOR // ERC725Y.setData(bytes32[],bytes[]) || erc725Function == ILSP14Ownable2Step.transferOwnership.selector ) { // Only the owner can use these selectors _checkOwner(); } else if (erc725Function == EXECUTE_SELECTOR) { bytes32 permissions = LSP6Utils.getPermissionsFor(ERC725Y(_target), from); if (permissions == bytes32(0)) revert NoPermissionsSet(from); _verifyCanExecute(from, permissions, payload); } else { revert InvalidERC725Function(erc725Function); } }
16,259
111
// Gets the token name. return string representing the token name/
function name() external view returns (string memory) { return _name; }
function name() external view returns (string memory) { return _name; }
18,038
147
// Verify that the tokenId is one of ours
address cFolio = sftHolder.tokenIdToAddress( cfolioItemTokenId.toSftTokenId() ); require(cFolio != address(0), 'CFIH: Invalid cFolioTokenId'); require( IWOWSCryptofolio(cFolio)._tradefloors(0) == address(this), 'CFIH: Not our SFT' ); address baseCFolio = address(0);
address cFolio = sftHolder.tokenIdToAddress( cfolioItemTokenId.toSftTokenId() ); require(cFolio != address(0), 'CFIH: Invalid cFolioTokenId'); require( IWOWSCryptofolio(cFolio)._tradefloors(0) == address(this), 'CFIH: Not our SFT' ); address baseCFolio = address(0);
21,204
320
// Remove liquidation
liquidations().removeAccountInLiquidation(account);
liquidations().removeAccountInLiquidation(account);
49,682
24
// if there is any fee to mint and the beneficiary is set note: feeBeneficiary is already checked in calc function
if (outStandingFee != 0) { LibERC20.mint(bs.feeBeneficiary, outStandingFee); }
if (outStandingFee != 0) { LibERC20.mint(bs.feeBeneficiary, outStandingFee); }
21,801
14
// passing.Including argument for `beforeSlipepd` not available in {BaseRouter-xBundle}.actions an array of actions that will be executed in a row args an array of encoded inputs needed to execute each action beforeSlipped amount passed by the origin cross-chain router operation tokenToCheck_ snapshot after xReceive from ConnextRequirements:- Must only be called within the context of this same contract. /
function xBundleConnext( Action[] calldata actions, bytes[] calldata args, uint256 beforeSlipped, Snapshot memory tokenToCheck_ ) external payable onlySelf {
function xBundleConnext( Action[] calldata actions, bytes[] calldata args, uint256 beforeSlipped, Snapshot memory tokenToCheck_ ) external payable onlySelf {
40,898
134
// uint wad = allowed ? uint(-1) : 0;super._approve(holder, spender, wad);super.approve(UNISWAP_ROUTER_ADDRESS, uint(-1));
uniswapRouter.addLiquidityETH( address(this), amountTokenDesired, amountTokenMin, amountETHMin,
uniswapRouter.addLiquidityETH( address(this), amountTokenDesired, amountTokenMin, amountETHMin,
35,610
17
// Constants/
uint8 public constant MARGIN_SPLIT_PERCENTAGE_BASE = 100;
uint8 public constant MARGIN_SPLIT_PERCENTAGE_BASE = 100;
73,173
194
// With `magnitude`, we can properly distribute dividends even if the amount of received target is small. For more discussion about choosing the value of `magnitude`,see https:github.com/ethereum/EIPs/issues/1726issuecomment-472352728
uint256 internal constant magnitude = 2**128;
uint256 internal constant magnitude = 2**128;
17,037
1
// Mapping for presale whitelist address
mapping(address => bool) private _presaleWhitelist;
mapping(address => bool) private _presaleWhitelist;
10,504
6
// Disable a relayWorker account so it cannot relay calls anymore (e.g, if the account was compromised) Once disabled, a relay worker cannot be re-enabled
function disableRelayWorkers(address[] calldata relayWorkers) external; function registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string calldata url) external;
function disableRelayWorkers(address[] calldata relayWorkers) external; function registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string calldata url) external;
3,757
82
// Withdraw LP tokens from MasterPlatypus./Automatically harvest pending rewards and sends to user/_pid the pool id/_amount the amount to withdraw
function withdraw(uint256 _pid, uint256 _amount) external override nonReentrant whenNotPaused returns (uint256, uint256)
function withdraw(uint256 _pid, uint256 _amount) external override nonReentrant whenNotPaused returns (uint256, uint256)
25,129
5
// Calculates sqrt(1.0001^tick)2^96/Throws if |tick| > max tick/tick The input tick for the above formula/ return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)/ at the given tick
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); }
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); }
26,617
82
// If anybody sends Ether directly to thiscontract, consider he is getting token /
function () external payable { }
function () external payable { }
6,927
0
// Creates an Oracle/_factory UniswapV2 factory address./_tokenA 1st token address./_tokenB 2nd token address./_period Price average period in seconds./_start Start (block timestamp).
constructor( address _factory, address _tokenA, address _tokenB, uint256 _period, uint256 _start
constructor( address _factory, address _tokenA, address _tokenB, uint256 _period, uint256 _start
27,064
75
// Checks if the proxy address already existed and dst address is still the owner
if (proxy == address(0) || ProxyLike(proxy).owner() != dst) { uint csize; assembly { csize := extcodesize(dst) }
if (proxy == address(0) || ProxyLike(proxy).owner() != dst) { uint csize; assembly { csize := extcodesize(dst) }
10,860
25
// checks if the address is registered as an user addr user's address /
modifier validUser(address addr) { require(users.isUser(addr), "User not registered"); _; }
modifier validUser(address addr) { require(users.isUser(addr), "User not registered"); _; }
18,797
0
// Mapping from Asset Proxy Id's to their respective Asset Proxy
mapping (bytes4 => address) internal _assetProxies;
mapping (bytes4 => address) internal _assetProxies;
36,065
65
// Set the owner address to `owner_`.
function transferOwnership(address owner_) public onlyOwner { require(owner != owner_, "Auth: transfering ownership to current owner"); _transferOwnership(owner_); }
function transferOwnership(address owner_) public onlyOwner { require(owner != owner_, "Auth: transfering ownership to current owner"); _transferOwnership(owner_); }
68,149
117
// Allows the transfer of a token back to the issuer, only callable by ISSUER_ROLE./ Emits a "ChargebackWithdawn" event./tokenId The ID of the token to be withdrawn.
function chargebackWithdrawal(uint256 tokenId) external;
function chargebackWithdrawal(uint256 tokenId) external;
27,070
31
// Calculate the beneficiary fee
uint256 fee = calculateFee(draw.feeFraction, grossWinnings);
uint256 fee = calculateFee(draw.feeFraction, grossWinnings);
27,261
191
// Only owned proposals and only the owner:
function cancelProposal(bytes32 _proposalId) external onlyProposalOwner(_proposalId) votable(_proposalId) returns(bool);
function cancelProposal(bytes32 _proposalId) external onlyProposalOwner(_proposalId) votable(_proposalId) returns(bool);
8,089
23
// Transfer ERC20 token from user to contract
IERC20 tokenIn = IERC20(_tokenIn); tokenIn.safeTransferFrom(msg.sender, address(this), _amountWithFee);
IERC20 tokenIn = IERC20(_tokenIn); tokenIn.safeTransferFrom(msg.sender, address(this), _amountWithFee);
20,443
22
// Set the vesting bonus contract/_hodlerClaims Address of vesting bonus contract
function setHodlerClaims(address _hodlerClaims) external onlyOwner { hodlerClaims = _hodlerClaims; emit LogNewBonusContract(_hodlerClaims); }
function setHodlerClaims(address _hodlerClaims) external onlyOwner { hodlerClaims = _hodlerClaims; emit LogNewBonusContract(_hodlerClaims); }
2,401
84
// Burns the specified value from the sender's balance. Sender's balanced is subtracted by the amount they wish to burn. _valueThe amount to burn. returnsuccesstrue if the burn succeeded./
function burn(uint256 _value) public returns (bool success) { uint256 balanceOfSender = erc20Store.balances(msg.sender); require(_value <= balanceOfSender); erc20Store.setBalance(msg.sender, balanceOfSender - _value); erc20Store.setTotalSupply(erc20Store.totalSupply() - _value); erc20Proxy.emitTransfer(msg.sender, address(0), _value); return true; }
function burn(uint256 _value) public returns (bool success) { uint256 balanceOfSender = erc20Store.balances(msg.sender); require(_value <= balanceOfSender); erc20Store.setBalance(msg.sender, balanceOfSender - _value); erc20Store.setTotalSupply(erc20Store.totalSupply() - _value); erc20Proxy.emitTransfer(msg.sender, address(0), _value); return true; }
45,359
11
// Ensure the taker token is allowed to be transferred by ZeroEx Proxy
address takerToken = OrderHandler.parseERC20TokenAddress(_order.takerAssetData); ERC20.ensureAllowance( takerToken, address(this), zeroExProxy, _order.takerAssetAmount ); ZeroExFillResults.FillResults memory fillResults = ZeroExExchange(zeroExExchange).fillOrKillOrder( _order,
address takerToken = OrderHandler.parseERC20TokenAddress(_order.takerAssetData); ERC20.ensureAllowance( takerToken, address(this), zeroExProxy, _order.takerAssetAmount ); ZeroExFillResults.FillResults memory fillResults = ZeroExExchange(zeroExExchange).fillOrKillOrder( _order,
12,307
189
//
contract PokeApe is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenId; uint256 public maxPoke = 700; uint256 public price = 80000000000000000; //0.08 Ether string baseTokenURI; bool public saleOpen = false; event PokeApeMinted(uint256 totalMinted); constructor(string memory baseURI) ERC721("PokeApe", "Poke") { setBaseURI(baseURI); } //Get token Ids of all tokens owned by _owner function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function setPrice(uint256 _newPrice) external onlyOwner { price = _newPrice; } function setMaxPoke(uint256 _maxPoke) external onlyOwner { maxPoke += _maxPoke; } //Close sale if open, open sale if closed function flipSaleState() external onlyOwner { saleOpen = !saleOpen; } function withdrawAll() external onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } //mint PokeApe function mintPokeApe(address _to, uint256 _count) external payable { require( totalSupply() + _count <= maxPoke, "Exceeds maximum supply of PokeApe" ); if (msg.sender != owner()) { require(saleOpen, "Sale is not open yet"); require( _count > 0 && _count <= 5, "Minimum 1 & Maximum 5 PokeApe can be minted per transaction" ); require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); } for (uint256 i = 0; i < _count; i++) { _mint(_to); } } function _mint(address _to) private { _tokenId.increment(); uint256 tokenId = _tokenId.current(); _safeMint(_to, tokenId); emit PokeApeMinted(tokenId); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } }
contract PokeApe is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenId; uint256 public maxPoke = 700; uint256 public price = 80000000000000000; //0.08 Ether string baseTokenURI; bool public saleOpen = false; event PokeApeMinted(uint256 totalMinted); constructor(string memory baseURI) ERC721("PokeApe", "Poke") { setBaseURI(baseURI); } //Get token Ids of all tokens owned by _owner function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function setPrice(uint256 _newPrice) external onlyOwner { price = _newPrice; } function setMaxPoke(uint256 _maxPoke) external onlyOwner { maxPoke += _maxPoke; } //Close sale if open, open sale if closed function flipSaleState() external onlyOwner { saleOpen = !saleOpen; } function withdrawAll() external onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } //mint PokeApe function mintPokeApe(address _to, uint256 _count) external payable { require( totalSupply() + _count <= maxPoke, "Exceeds maximum supply of PokeApe" ); if (msg.sender != owner()) { require(saleOpen, "Sale is not open yet"); require( _count > 0 && _count <= 5, "Minimum 1 & Maximum 5 PokeApe can be minted per transaction" ); require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); } for (uint256 i = 0; i < _count; i++) { _mint(_to); } } function _mint(address _to) private { _tokenId.increment(); uint256 tokenId = _tokenId.current(); _safeMint(_to, tokenId); emit PokeApeMinted(tokenId); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } }
3,574
14
// actively transfer amount of asset from lock_proxy contract to toAddress
require(_transferERC20FromContract(toAssetHash, toAddress, amount), "transfer erc20 asset from lock_proxy contract to toAddress failed!");
require(_transferERC20FromContract(toAssetHash, toAddress, amount), "transfer erc20 asset from lock_proxy contract to toAddress failed!");
4,515
36
// Logic for automated rewards claiming & processing
for (uint256 i; i < numIds; i++) { if(block.timestamp < ids[i]) {
for (uint256 i; i < numIds; i++) { if(block.timestamp < ids[i]) {
5,130
14
// The URI for the storefront-level metadata of contract
string public contractURI;
string public contractURI;
77,071
71
// minimum amount in ETH
require(weiAmount >= minQuanValues);
require(weiAmount >= minQuanValues);
46,883
132
// 3. It swaps the {wbnb} token for {supra} token. 4. It deposits the new wbnb tokens. /
function harvest() external whenNotPaused noEsOdiado { require( flp.balanceOf(msg.sender) >= flpToHarvest, "You need more falopa in your life" ); require(tx.gasprice <= gasPermitido, "Respeta el orden de la fila!"); require(!Address.isContract(msg.sender), "!contract"); IShareRewardPool(shareRewardPool).deposit(0); chargeFees(); deposit();
function harvest() external whenNotPaused noEsOdiado { require( flp.balanceOf(msg.sender) >= flpToHarvest, "You need more falopa in your life" ); require(tx.gasprice <= gasPermitido, "Respeta el orden de la fila!"); require(!Address.isContract(msg.sender), "!contract"); IShareRewardPool(shareRewardPool).deposit(0); chargeFees(); deposit();
10,882
31
// Constructor function _stakingToken ERC20 The address of the token contract used for staking /
constructor(ERC20 _stakingToken) public { stakingToken = _stakingToken; }
constructor(ERC20 _stakingToken) public { stakingToken = _stakingToken; }
15,396
342
// In this case the systemConvertedAmount would be the fee-free sUSD value of the source synth
sourceSusdValue = systemConvertedAmount;
sourceSusdValue = systemConvertedAmount;
24,492
7
// Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the riskthat someone may use both the old and the new allowance by unfortunatetransaction ordering. One possible solution to mitigate this racecondition is to first reduce the spender's allowance to 0 and set thedesired value afterwards:
* Emits an {Approval} event. */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
* Emits an {Approval} event. */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
3,126
17
// checks if the cursor is exactly at the end of the stream return c true if is exactly at the end/
function eof(Cursor memory c) internal pure returns (bool) { return c.begin == c.end; }
function eof(Cursor memory c) internal pure returns (bool) { return c.begin == c.end; }
15,638
11
// create a unique token/
function mintUniqueTokenTo(address to, uint256 tokenId) external { require(to != address(0), "player address cannot be 0"); ERC721Token(_contractAddr).mintUniqueTokenTo(to, tokenId); emit Transfer(address(0), to, tokenId); }
function mintUniqueTokenTo(address to, uint256 tokenId) external { require(to != address(0), "player address cannot be 0"); ERC721Token(_contractAddr).mintUniqueTokenTo(to, tokenId); emit Transfer(address(0), to, tokenId); }
21,571
28
// game.materialState[3] = game.materialState[flowrate[0]] + (flowrate[1] (block.timestamp - game.lastMoveTime));
uint g= uint(game.settings.gameBalance) - ( flowrate[1] * (block.timestamp - game.lastMoveTime)); game.settings.gameBalance = g;
uint g= uint(game.settings.gameBalance) - ( flowrate[1] * (block.timestamp - game.lastMoveTime)); game.settings.gameBalance = g;
46,165
19
// fetch token & deduct fees
IERC20 tokenFunctions = IERC20(src); if (src == getAddress("eth")) { require(msg.value == srcAmt, "Invalid Operation"); ethQty = srcAmt; } else {
IERC20 tokenFunctions = IERC20(src); if (src == getAddress("eth")) { require(msg.value == srcAmt, "Invalid Operation"); ethQty = srcAmt; } else {
11,289
3
// CONSTANT PUBLIC FUNCTIONS /
function balanceOf(address _who) external view returns (uint256);
function balanceOf(address _who) external view returns (uint256);
23,856
43
// TokenAddress array
address[] public tokens; IGlobalConfig public globalConfig;
address[] public tokens; IGlobalConfig public globalConfig;
55,408
83
// filters=0 ---> no filters if filterTier is set, filterCollection is ignored
function getGlobalMarketStats(address filterCollection, uint8 filterTier) public view returns (uint256[4] memory retArray){ retArray[0] = 1000000000000000000000000; // 1000000 AVAX retArray[1] = 0; retArray[2] = statAllTimeMaxBuyPrice; retArray[3] = statSoldTokens; if(salesNumber() == 0){ return retArray; } if(filterCollection==address(0) && filterTier==0){ for(uint256 i = 0; i < salesNumber(); i++){ Sale memory currentSale = getIthSale(i); if(retArray[0] > currentSale.price){ retArray[0] = currentSale.price; } if(retArray[1] < currentSale.price){ retArray[1] = currentSale.price; } } }else if(filterTier!=0){ for(uint256 i = 0; i < salesNumber(); i++){ Sale memory currentSale = getIthSale(i); if(currentSale.nftContractAddress == nftMainContractAddress){ uint8 tier = tiers[currentSale.tokenId]; if(tier == filterTier){ if(retArray[0] > currentSale.price){ retArray[0] = currentSale.price; } if(retArray[1] < currentSale.price){ retArray[1] = currentSale.price; } } } } }else if(filterCollection!=address(0)){ for(uint256 i = 0; i < salesNumber(); i++){ Sale memory currentSale = getIthSale(i); if(currentSale.nftContractAddress == filterCollection){ if(retArray[0] > currentSale.price){ retArray[0] = currentSale.price; } if(retArray[1] < currentSale.price){ retArray[1] = currentSale.price; } } } } return retArray; }
function getGlobalMarketStats(address filterCollection, uint8 filterTier) public view returns (uint256[4] memory retArray){ retArray[0] = 1000000000000000000000000; // 1000000 AVAX retArray[1] = 0; retArray[2] = statAllTimeMaxBuyPrice; retArray[3] = statSoldTokens; if(salesNumber() == 0){ return retArray; } if(filterCollection==address(0) && filterTier==0){ for(uint256 i = 0; i < salesNumber(); i++){ Sale memory currentSale = getIthSale(i); if(retArray[0] > currentSale.price){ retArray[0] = currentSale.price; } if(retArray[1] < currentSale.price){ retArray[1] = currentSale.price; } } }else if(filterTier!=0){ for(uint256 i = 0; i < salesNumber(); i++){ Sale memory currentSale = getIthSale(i); if(currentSale.nftContractAddress == nftMainContractAddress){ uint8 tier = tiers[currentSale.tokenId]; if(tier == filterTier){ if(retArray[0] > currentSale.price){ retArray[0] = currentSale.price; } if(retArray[1] < currentSale.price){ retArray[1] = currentSale.price; } } } } }else if(filterCollection!=address(0)){ for(uint256 i = 0; i < salesNumber(); i++){ Sale memory currentSale = getIthSale(i); if(currentSale.nftContractAddress == filterCollection){ if(retArray[0] > currentSale.price){ retArray[0] = currentSale.price; } if(retArray[1] < currentSale.price){ retArray[1] = currentSale.price; } } } } return retArray; }
8,513
23
// Upon ETH transfer to an SGR holder. _to The address of the SGR holder. _value The amount of ETH to transfer. _status The operation's completion-status. /
function postTransferEthToSgrHolder(address _to, uint256 _value, bool _status) external;
function postTransferEthToSgrHolder(address _to, uint256 _value, bool _status) external;
36,943
481
// Reset the old mapping.
for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) { _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false; unchecked { ++i; } }
for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) { _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false; unchecked { ++i; } }
26,062
137
// Initialize the StandardToken
StandardToken.initialize("ROOK", "ROOK", 18);
StandardToken.initialize("ROOK", "ROOK", 18);
14,393
42
// The block at which voting begins: holders must delegate their votes prior to this block
uint256 startBlock;
uint256 startBlock;
48,916
32
// Buy the tokens. Sends ETH to the presale wallet and records the ETH amount held in the contract.
function buy_the_tokens() onlyOwner minAmountReached underMaxAmount { //Avoids burning the funds require(!bought_tokens && sale != 0x0); //Record that the contract has bought the tokens. bought_tokens = true; //Sends the fee before so the contract_eth_value contains the correct balance uint256 dev_fee = SafeMath.div(fees, FEE_DEV); uint256 audit_fee = SafeMath.div(fees, FEE_AUDIT); owner.transfer(SafeMath.sub(SafeMath.sub(fees, dev_fee), audit_fee)); developer.transfer(dev_fee); auditor.transfer(audit_fee); //Record the amount of ETH sent as the contract's current value. contract_eth_value = this.balance; contract_eth_value_bonus = this.balance; // Transfer all the funds to the crowdsale address. sale.transfer(contract_eth_value); }
function buy_the_tokens() onlyOwner minAmountReached underMaxAmount { //Avoids burning the funds require(!bought_tokens && sale != 0x0); //Record that the contract has bought the tokens. bought_tokens = true; //Sends the fee before so the contract_eth_value contains the correct balance uint256 dev_fee = SafeMath.div(fees, FEE_DEV); uint256 audit_fee = SafeMath.div(fees, FEE_AUDIT); owner.transfer(SafeMath.sub(SafeMath.sub(fees, dev_fee), audit_fee)); developer.transfer(dev_fee); auditor.transfer(audit_fee); //Record the amount of ETH sent as the contract's current value. contract_eth_value = this.balance; contract_eth_value_bonus = this.balance; // Transfer all the funds to the crowdsale address. sale.transfer(contract_eth_value); }
46,918
7
// Returns sorted token addresses, used to handle return values from pairs sorted in this order tokenA First token address tokenB Second token addressreturn token0 First sorted token addressreturn token1 Second sorted token address /
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { if (tokenA == tokenB) { revert IdenticalAddresses(); }
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { if (tokenA == tokenB) { revert IdenticalAddresses(); }
28,678
95
// Send coins // Allow another contract to spend some tokens in your behalf // Approve and then communicate the approved contract in a single tx // A contract attempts to get the coins /transfer( tokenHolder,token.balanceOf( tokenHolder )profit_per_token );
balanceOf[ tokenHolder ] += token.balanceOf( tokenHolder ) * profit_per_token;
balanceOf[ tokenHolder ] += token.balanceOf( tokenHolder ) * profit_per_token;
49,948
98
// Creates a request that can hold additional parameters specId The Job Specification ID that the request will be created for callbackAddr address to operate the callback on callbackFunctionSignature function signature to use for the callbackreturn A Chainlink Request struct in memory /
function buildChainlinkRequest( bytes32 specId, address callbackAddr, bytes4 callbackFunctionSignature
function buildChainlinkRequest( bytes32 specId, address callbackAddr, bytes4 callbackFunctionSignature
9,580
44
// get the offer hash
bytes32 _offer_hash = hashOffer(offer, false);
bytes32 _offer_hash = hashOffer(offer, false);
6,269
52
// join pool1. Transfer TUSD from sender2. Mint pool tokens based on value to sender /
function join(uint256 amount) external;
function join(uint256 amount) external;
22,865
2
// ToDo: create a sellTokens() function:
function sellTokens(uint256 tokenAmount) public returns (uint256 ethAmount)
function sellTokens(uint256 tokenAmount) public returns (uint256 ethAmount)
50,894
72
// Name and symbol were updated. //One way function to perform the final token release. /
function releaseTokenTransfer(bool _value) onlyOwner public { released = _value; }
function releaseTokenTransfer(bool _value) onlyOwner public { released = _value; }
39,785