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 |
|---|---|---|---|---|
273 | // Sets `_tokenURI` as the tokenURI of `tokenId`. Requirements: - `tokenId` must exist. / | function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| 30,542 |
21 | // Sets the token path to blob for a feed token. _tokenPath New token path / | function setTokenPath(address[] memory _tokenPath) external onlyOwner {
tokenPath[_tokenPath[0]] = _tokenPath;
emit SetTokenPath(_tokenPath[0]);
}
| function setTokenPath(address[] memory _tokenPath) external onlyOwner {
tokenPath[_tokenPath[0]] = _tokenPath;
emit SetTokenPath(_tokenPath[0]);
}
| 43,326 |
27 | // The Redeem event is triggered | emit Redeem(username, msg.sender, newUserKarma);
| emit Redeem(username, msg.sender, newUserKarma);
| 32,075 |
117 | // Used to check whether an address has the minter role _address EOA or contract being checkedreturn bool True if the account has the role or false if it does not / | function hasMinterRole(address _address) external view returns (bool) {
return hasRole(MINTER_ROLE, _address);
}
| function hasMinterRole(address _address) external view returns (bool) {
return hasRole(MINTER_ROLE, _address);
}
| 10,760 |
35 | // Verify that the new implementation is not frozen post initialization. NOLINTNEXTLINE: low-level-calls controlled-delegatecall. | (success, returndata) = newImplementation.delegatecall(
abi.encodeWithSignature("isFrozen()"));
require(success, "CALL_TO_ISFROZEN_REVERTED");
require(!abi.decode(returndata, (bool)), "NEW_IMPLEMENTATION_FROZEN");
if (finalize) {
setFinalizedFlag();
e... | (success, returndata) = newImplementation.delegatecall(
abi.encodeWithSignature("isFrozen()"));
require(success, "CALL_TO_ISFROZEN_REVERTED");
require(!abi.decode(returndata, (bool)), "NEW_IMPLEMENTATION_FROZEN");
if (finalize) {
setFinalizedFlag();
e... | 46,800 |
223 | // Update the given pool's VALUE allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
PoolInfo storage pool = poolInfo[_pid];
if (pool.isStarted) {
totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add(_allocPoint);
... | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
PoolInfo storage pool = poolInfo[_pid];
if (pool.isStarted) {
totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add(_allocPoint);
... | 7,724 |
47 | // Returns a token ID in collection at a given `index` of its token list. | * Use along with {collectionSupply} to enumerate all of ``collection``'s tokens.
*/
function tokenInCollectionByIndex(uint collectionId, uint256 index) external view returns (uint256) {
return _collectionTokens[collectionId].at(index);
}
| * Use along with {collectionSupply} to enumerate all of ``collection``'s tokens.
*/
function tokenInCollectionByIndex(uint collectionId, uint256 index) external view returns (uint256) {
return _collectionTokens[collectionId].at(index);
}
| 40,722 |
82 | // return the token being sold. / | function token() public view returns (IERC20) {
return _token;
}
| function token() public view returns (IERC20) {
return _token;
}
| 3,195 |
446 | // There are three main outcome states: either the dispute succeeded, failed or was not updated. Based on the state, different parties of a liquidation can withdraw different amounts. Once a caller has been paid their address deleted from the struct. This prevents them from being paid multiple from times the same liqui... | FixedPoint.Unsigned memory withdrawalAmount = FixedPoint.fromUnscaledUint(0);
if (liquidation.state == Status.DisputeSucceeded) {
| FixedPoint.Unsigned memory withdrawalAmount = FixedPoint.fromUnscaledUint(0);
if (liquidation.state == Status.DisputeSucceeded) {
| 37,045 |
129 | // Check if last tx occurred this block - prevents sandwich attacks | if(cooldownEnabled) {
require(mappedAddresses[from]._lastTxBlock != block.number, "LUCKY: One tx per block.");
mappedAddresses[from]._lastTxBlock == block.number;
}
| if(cooldownEnabled) {
require(mappedAddresses[from]._lastTxBlock != block.number, "LUCKY: One tx per block.");
mappedAddresses[from]._lastTxBlock == block.number;
}
| 36,633 |
45 | // Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside thearray, and it may change when more values are added or removed. Requirements: | * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
| * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
| 4,466 |
109 | // accrues interest and sets a new admin fee for the protocol using _setAdminFeeFreshAdmin function to accrue interest and set a new admin fee return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setAdminFee(uint newAdminFeeMantissa) external nonReentrant(false) returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted admin fee change failed.
... | function _setAdminFee(uint newAdminFeeMantissa) external nonReentrant(false) returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted admin fee change failed.
... | 63,311 |
232 | // if we're in an auction, break the loop and don't update endId | break;
| break;
| 11,016 |
7 | // ERC20(tokenA).transferFrom(msg.sender, pair, amountA); | TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
| TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
| 26,281 |
9 | // === Find the number of bytes in a string | function lengthOfString(string memory _str) private pure returns (uint256) {
return bytes(_str).length;
}
| function lengthOfString(string memory _str) private pure returns (uint256) {
return bytes(_str).length;
}
| 30,662 |
60 | // ///// | struct Sale {
uint256 tokenId;
address tokenAddress;
address owner;
uint256 price;
bool buyed;
uint256 endDate;
}
| struct Sale {
uint256 tokenId;
address tokenAddress;
address owner;
uint256 price;
bool buyed;
uint256 endDate;
}
| 6,788 |
51 | // Minting function for Baal `loot`. | function _mintLoot(address to, uint96 loot) private {
unchecked {
if (totalSupply + loot <= type(uint96).max / 2) {
members[to].loot += loot; /*add `loot` for `to` account*/
totalLoot += loot; /*add to total Baal `loot`*/
emit... | function _mintLoot(address to, uint96 loot) private {
unchecked {
if (totalSupply + loot <= type(uint96).max / 2) {
members[to].loot += loot; /*add `loot` for `to` account*/
totalLoot += loot; /*add to total Baal `loot`*/
emit... | 12,637 |
14 | // ...otherwise copy over the stored number to the current matrix position. | tokenMatrix[random] = tokenMatrix[maxIndex - 1];
| tokenMatrix[random] = tokenMatrix[maxIndex - 1];
| 20,312 |
62 | // SimpleERC20 Implementation of the SimpleERC20 / | contract SimpleERC20 is ERC20, ServicePayer, GeneratorCopyright("v5.1.0") {
constructor(
string memory name_,
string memory symbol_,
uint256 initialBalance_,
address payable feeReceiver_
) payable ERC20(name_, symbol_) ServicePayer(feeReceiver_, "SimpleERC20") {
require(i... | contract SimpleERC20 is ERC20, ServicePayer, GeneratorCopyright("v5.1.0") {
constructor(
string memory name_,
string memory symbol_,
uint256 initialBalance_,
address payable feeReceiver_
) payable ERC20(name_, symbol_) ServicePayer(feeReceiver_, "SimpleERC20") {
require(i... | 3,229 |
71 | // rounding total allocated share price denominator UP, in order to minimise the total allocation share price which maximises the amount owed by the distributor, which they cannot withdraw/transfer (strict allocations) |
totalAllocated[msg.sender][_strict] = Allocation(totalAmount, totalPriceNum, totalPriceDenom);
|
totalAllocated[msg.sender][_strict] = Allocation(totalAmount, totalPriceNum, totalPriceDenom);
| 11,028 |
6 | // ======== MINTED ======== | mapping(address => uint256) public preSaleMinted;
mapping(address => bool) public communitySaleMinted;
mapping(address => uint256) public publicSaleMinted;
| mapping(address => uint256) public preSaleMinted;
mapping(address => bool) public communitySaleMinted;
mapping(address => uint256) public publicSaleMinted;
| 80,410 |
610 | // Fixes the global debt of the system. See 5./Can only be called once. | function fixGlobalDebt() external override {
if (live != 0) revert Tenebrae__fixGlobalDebt_stillLive();
if (debt != 0) revert Tenebrae__fixGlobalDebt_debtNotZero();
if (codex.credit(address(aer)) != 0) revert Tenebrae__fixGlobalDebt_surplusNotZero();
if (block.timestamp < add(lockedA... | function fixGlobalDebt() external override {
if (live != 0) revert Tenebrae__fixGlobalDebt_stillLive();
if (debt != 0) revert Tenebrae__fixGlobalDebt_debtNotZero();
if (codex.credit(address(aer)) != 0) revert Tenebrae__fixGlobalDebt_surplusNotZero();
if (block.timestamp < add(lockedA... | 26,241 |
234 | // get random level for attributes | function getRandomLevel() public view returns (uint256) {
uint256 randomNum = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender, tokensMinted))) % 100;
if (randomNum < 58) return 1;
if (randomNum < 83) return 2;
if (randomNum < 93) return 3;
if (randomNum < 98) r... | function getRandomLevel() public view returns (uint256) {
uint256 randomNum = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender, tokensMinted))) % 100;
if (randomNum < 58) return 1;
if (randomNum < 83) return 2;
if (randomNum < 93) return 3;
if (randomNum < 98) r... | 16,895 |
27 | // Owner only - Updates the price per episode _price Price per episode / | function setPricePerEpisode(uint256 _price) external onlyOwner {
pricePerEpisode = _price;
emit PricePerEpisodeChanged(_price);
}
| function setPricePerEpisode(uint256 _price) external onlyOwner {
pricePerEpisode = _price;
emit PricePerEpisodeChanged(_price);
}
| 20,912 |
17 | // Create a Payment. Use this payable function send money to the smart contract./_title the title of the payment/_payee the payee of the payment | function createPayment(string _title, address _payee) public onlyByParticipant() payable {
address _payer = msg.sender;
require(msg.value > 0);
require(_payee != _payer);
require(isParticipant(_payer));
require(isParticipant(_payee));
Payment memory payment = Payme... | function createPayment(string _title, address _payee) public onlyByParticipant() payable {
address _payer = msg.sender;
require(msg.value > 0);
require(_payee != _payer);
require(isParticipant(_payer));
require(isParticipant(_payee));
Payment memory payment = Payme... | 48,992 |
91 | // Creates a new wallet _controller - Controller of the new wallet recipientExternalID - The Recipient ID (managed externally)return true if success / | function CreateWallet(
address _controller,
string memory recipientExternalID
| function CreateWallet(
address _controller,
string memory recipientExternalID
| 7,411 |
14 | // expmods[9] = point^(trace_length / 8192). | mstore(0x4560, expmod(point, div(/*trace_length*/ mload(0x80), 8192), PRIME))
| mstore(0x4560, expmod(point, div(/*trace_length*/ mload(0x80), 8192), PRIME))
| 20,589 |
42 | // Computes the current state of a price request. See the State enum for more details. requester sender of the initial price request. identifier price identifier to identify the existing request. timestamp timestamp to identify the existing request. ancillaryData ancillary data of the price being requested.return the S... | function getState(
address requester,
bytes32 identifier,
uint256 timestamp,
bytes memory ancillaryData
| function getState(
address requester,
bytes32 identifier,
uint256 timestamp,
bytes memory ancillaryData
| 19,013 |
100 | // For checking approval of transfer for address _to | function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return PlayerIndexToApproved[_tokenId] == _to;
}
| function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return PlayerIndexToApproved[_tokenId] == _to;
}
| 35,164 |
264 | // uint sigmaSQ | ) = ICoFiXController(_cofixController).latestPriceInfo {
value: msg.value
} (
| ) = ICoFiXController(_cofixController).latestPriceInfo {
value: msg.value
} (
| 27,664 |
0 | // vote true for abnormal case | if(_pressure > 100) {
vote(_custodianAddr, true);
}
| if(_pressure > 100) {
vote(_custodianAddr, true);
}
| 51,125 |
2 | // deposit funds in the smart contract | function deposit(address _token, uint _amount) private {
tokenBalance[msg.sender][_token] = tokenBalance[msg.sender][_token] + _amount;
IERC20(_token).transferFrom(msg.sender, address(this), _amount);
}
| function deposit(address _token, uint _amount) private {
tokenBalance[msg.sender][_token] = tokenBalance[msg.sender][_token] + _amount;
IERC20(_token).transferFrom(msg.sender, address(this), _amount);
}
| 45,685 |
132 | // God may set the resource-to-resource contract's address/_resourceExchangeContract The new address | function godSetResourceExchangeContract(address _resourceExchangeContract)
public
onlyGod
| function godSetResourceExchangeContract(address _resourceExchangeContract)
public
onlyGod
| 26,199 |
166 | // increase our tend counter by 1 so we can know when we should harvest again | uint256 previousTendCounter = tendCounter;
tendCounter = previousTendCounter.add(1);
| uint256 previousTendCounter = tendCounter;
tendCounter = previousTendCounter.add(1);
| 16,838 |
7 | // The wallet address of the lender | address lender;
| address lender;
| 52,544 |
229 | // Sell DVD and receive mUSD in this contract | (returnedMUSD, marketTax, curveTax, taxedDVD) = _sell(msg.sender, address(this), dvdAmount);
| (returnedMUSD, marketTax, curveTax, taxedDVD) = _sell(msg.sender, address(this), dvdAmount);
| 49,186 |
32 | // ERC 20 | function totalSupply() public view returns (uint256){
return supply ;
}
| function totalSupply() public view returns (uint256){
return supply ;
}
| 49,704 |
478 | // Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address / | function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
| function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
| 439 |
1 | // Check that the execution is being performed through a delegatecall call and that the execution context isa proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the casefor UUPS and transparent proxies that are using the current contract as their implementation. Executio... | modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
| modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
| 9,316 |
157 | // There cannot be an owner with address 0. | address lastOwner = address(0);
address currentOwner;
uint8 v;
bytes32 r;
bytes32 s;
uint256 i;
for (i = 0; i < _threshold; i++) {
(v, r, s) = signatureSplit(signatures, i);
| address lastOwner = address(0);
address currentOwner;
uint8 v;
bytes32 r;
bytes32 s;
uint256 i;
for (i = 0; i < _threshold; i++) {
(v, r, s) = signatureSplit(signatures, i);
| 8,331 |
27 | // A method to retrieve the stake for a stakeholder._stakeholder The stakeholder to retrieve the stake for. return uint256 The amount of wei staked./ | function stakeOf(address _stakeholder)
public
view
returns(uint256)
| function stakeOf(address _stakeholder)
public
view
returns(uint256)
| 5,249 |
72 | // 10% of the resulting Ether is used to pay remaining holders. | var fee = div(numEthersBeforeFee, 10);
| var fee = div(numEthersBeforeFee, 10);
| 60,004 |
217 | // Calculates a Fixed18 mantissa given the numerator and denominator The mantissa = (numerator1e18) / denominatornumerator The mantissa numeratordenominator The mantissa denominator return The mantissa of the fraction/ | function calculateMantissa(uint256 numerator, uint256 denominator) internal pure returns (uint256) {
uint256 mantissa = numerator.mul(SCALE);
mantissa = mantissa.div(denominator);
return mantissa;
}
| function calculateMantissa(uint256 numerator, uint256 denominator) internal pure returns (uint256) {
uint256 mantissa = numerator.mul(SCALE);
mantissa = mantissa.div(denominator);
return mantissa;
}
| 13,638 |
1 | // Overload {grantRole} to track enumerable memberships. / | function grantRole(bytes32 _role, address _account)
public
override(AccessControlEnumerable)
onlyRole(ADMIN_ROLE)
{
super.grantRole(_role, _account);
}
| function grantRole(bytes32 _role, address _account)
public
override(AccessControlEnumerable)
onlyRole(ADMIN_ROLE)
{
super.grantRole(_role, _account);
}
| 20,427 |
7 | // estado de la reclamación (claim_status) | C_status claim_status;
| C_status claim_status;
| 14,609 |
3 | // Your subscription ID. | uint64 private s_subscriptionId;
event RandomNumbersReceived(uint256 start, uint256 incrementor);
bytes32 private keyHash;
ITheCoachFunds private fundsContract;
uint256 private mintIndex;
| uint64 private s_subscriptionId;
event RandomNumbersReceived(uint256 start, uint256 incrementor);
bytes32 private keyHash;
ITheCoachFunds private fundsContract;
uint256 private mintIndex;
| 79,907 |
26 | // accepts calls from token holders only | modifier tokenHoldersOnly(){
if (balances[msg.sender] == 0) throw;
_;
}
| modifier tokenHoldersOnly(){
if (balances[msg.sender] == 0) throw;
_;
}
| 32,281 |
9 | // Current raffle info | uint256 private raffleEndTime;
uint256 private raffleRareId;
uint256 private raffleTicketsBought;
address private raffleWinner; // Address of winner
bool private raffleWinningTicketSelected;
uint256 private raffleTicketThatWon;
| uint256 private raffleEndTime;
uint256 private raffleRareId;
uint256 private raffleTicketsBought;
address private raffleWinner; // Address of winner
bool private raffleWinningTicketSelected;
uint256 private raffleTicketThatWon;
| 6,751 |
170 | // Purchase is emitted when an ad unit is reserved. | event Purchase (
uint indexed amount,
address owner
);
event PauseEvent(bool pause);
| event Purchase (
uint indexed amount,
address owner
);
event PauseEvent(bool pause);
| 35,515 |
147 | // Emits a {ApprovalForAll} event. / | function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
| function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
| 695 |
57 | // modifier to allow action only before sale / | modifier beforeSale() {
require( now < preSaleStart);
_;
}
| modifier beforeSale() {
require( now < preSaleStart);
_;
}
| 4,252 |
168 | // Burns `tokenId`. See {ERC721-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./ | function burn(uint256 tokenId) public virtual {
| function burn(uint256 tokenId) public virtual {
| 50,458 |
16 | // / OVERRIDE ERC20 TRANSFERS / | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
require(false, "Cannot transfer delegation.");
return false;
}
| function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
require(false, "Cannot transfer delegation.");
return false;
}
| 32,323 |
77 | // addDividend(pool, outputAmount, fee); | totalStaked += _actualAmount;
totalVolume += _actualAmount;
totalFees += _DAO().UTILS().calcValueInBase(token, fee);
swapTx += 1;
_handleTransferOut(token, outputAmount, pool, member);
emit Swapped(BASE, token, _actualAmount, 0, outputAmount, fee, member);
return ... | totalStaked += _actualAmount;
totalVolume += _actualAmount;
totalFees += _DAO().UTILS().calcValueInBase(token, fee);
swapTx += 1;
_handleTransferOut(token, outputAmount, pool, member);
emit Swapped(BASE, token, _actualAmount, 0, outputAmount, fee, member);
return ... | 24,148 |
70 | // Swaps one token for another. The router must support swap callbacks and ensure there isn't too much slippage. | function flashSwap(bytes calldata data) public override lock returns (uint256 amountOut) {
(
address tokenIn,
address tokenOut,
address recipient,
bool unwrapBento,
uint256 amountIn,
bytes memory context
) = abi.decode(data, (ad... | function flashSwap(bytes calldata data) public override lock returns (uint256 amountOut) {
(
address tokenIn,
address tokenOut,
address recipient,
bool unwrapBento,
uint256 amountIn,
bytes memory context
) = abi.decode(data, (ad... | 30,999 |
100 | // See {IERC721Enumerable-totalSupply}. Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. / | function totalSupply() public view returns (uint256) {
| function totalSupply() public view returns (uint256) {
| 1,792 |
165 | // Emitted exactly once by a pool when initialize is first called on the pool/Mint/Burn/Swap cannot be emitted by the pool before Initialize/sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96/tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool | event Initialize(uint160 sqrtPriceX96, int24 tick);
| event Initialize(uint160 sqrtPriceX96, int24 tick);
| 41,011 |
0 | // Guardian registration contract interface | interface IGuardiansRegistration {
event GuardianRegistered(address indexed guardian);
event GuardianUnregistered(address indexed guardian);
event GuardianDataUpdated(address indexed guardian, bool isRegistered, bytes4 ip, address orbsAddr, string name, string website, uint256 registrationTime);
event GuardianMetad... | interface IGuardiansRegistration {
event GuardianRegistered(address indexed guardian);
event GuardianUnregistered(address indexed guardian);
event GuardianDataUpdated(address indexed guardian, bool isRegistered, bytes4 ip, address orbsAddr, string name, string website, uint256 registrationTime);
event GuardianMetad... | 25,682 |
221 | // 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: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId, 1);
| function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId, 1);
| 907 |
47 | // See {ERC1155-setApprovalForAll}. Requirements:- the caller must have roleTRANSFER_ROLE / | function setApprovalForAll(address operator, bool approved) public override onlyRole(TRANSFER_ROLE) {
super.setApprovalForAll(operator, approved);
}
| function setApprovalForAll(address operator, bool approved) public override onlyRole(TRANSFER_ROLE) {
super.setApprovalForAll(operator, approved);
}
| 8,785 |
86 | // calculate the minimum increase required | uint minIncrease = numerator.mul(auction.minIncreasePercent);
uint threshold = highest + minIncrease;
return threshold;
| uint minIncrease = numerator.mul(auction.minIncreasePercent);
uint threshold = highest + minIncrease;
return threshold;
| 40,813 |
186 | // Override to if default approved for OS proxy accounts or normal approval / | function isApprovedForAll(address owner, address operator)
public
view
override(ERC721, OpenSeaTradableNFT)
returns (bool)
| function isApprovedForAll(address owner, address operator)
public
view
override(ERC721, OpenSeaTradableNFT)
returns (bool)
| 58,803 |
5 | // Return the name of the current phase. / | function phase_nameOfCurrent() external view returns (string memory){
string[4] memory phaseNames = ["Setup", "Early-Minting", "Minting", "End"];
return phaseNames[uint256(_phase_current())];
}
| function phase_nameOfCurrent() external view returns (string memory){
string[4] memory phaseNames = ["Setup", "Early-Minting", "Minting", "End"];
return phaseNames[uint256(_phase_current())];
}
| 1,478 |
27 | // A new investor | investorCount++;
| investorCount++;
| 29,271 |
4 | // TODO: Make sure we don't go into this code block if the value set for dataHash should actually be 0 | if (value == 0) {
value = mockValues[func].uint256Value;
}
| if (value == 0) {
value = mockValues[func].uint256Value;
}
| 34,763 |
27 | // Snipers | uint256 private deadblocks = 1;
uint256 public launchBlock;
uint256 private latestSniperBlock;
| uint256 private deadblocks = 1;
uint256 public launchBlock;
uint256 private latestSniperBlock;
| 35,158 |
211 | // reduce indexDelta to account for minting | if (positive) {
uint256 mintPerc = indexDelta.mul(rebaseMintPerc).div(BASE);
indexDelta = indexDelta.sub(mintPerc);
mintAmount = currSupply.mul(mintPerc).div(BASE);
}
| if (positive) {
uint256 mintPerc = indexDelta.mul(rebaseMintPerc).div(BASE);
indexDelta = indexDelta.sub(mintPerc);
mintAmount = currSupply.mul(mintPerc).div(BASE);
}
| 72,343 |
63 | // the next line is the loop condition: while(uint(mc < end) + cb == 2) | } eq(add(lt(mc, end), cb), 2) {
| } eq(add(lt(mc, end), cb), 2) {
| 79,018 |
64 | // For winners, we add them to the winner's array so we can later calculate the total amount winners can withdraw (principal + interest). For non-winners, we already have their principal amount stored in state(amountPaid), so we just set this amount to the withdrawAmount. | if (player.mostRecentSegmentPaid == lastSegment.sub(1)) {
winners.push(player.addr);
} else {
| if (player.mostRecentSegmentPaid == lastSegment.sub(1)) {
winners.push(player.addr);
} else {
| 10,020 |
57 | // Check that tokenId was not transferred by `_beforeTokenTransfer` hook | require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
| require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
| 11,750 |
18 | // Enables/disables an address_newAddressThe new address to setaddressTypeAddress type/ | function _enableAddress(address _newAddress, uint256 addressType) private {
permittedAddresses[_newAddress] = true;
addressesTypes[_newAddress] = addressType;
emit AddNewPermittedAddress(_newAddress, addressType);
}
| function _enableAddress(address _newAddress, uint256 addressType) private {
permittedAddresses[_newAddress] = true;
addressesTypes[_newAddress] = addressType;
emit AddNewPermittedAddress(_newAddress, addressType);
}
| 42,102 |
20 | // 해당 판매 목록 인덱스의 NFT정보 | SaleItem memory sale = SaleTokenList[_saleIndex];
| SaleItem memory sale = SaleTokenList[_saleIndex];
| 2,156 |
50 | // Prevents a contract from calling itself, directly or indirectly.Calling a `nonReentrant` function from another `nonReentrant`function is not supported. It is possible to prevent this from happeningby making the `nonReentrant` function external, and make it call a`private` function that does the actual work. / | modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see... | modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see... | 5,584 |
24 | // "Cancels" an auction on-chain, if a valid bid hasn't been made yet. Transfers NFT back to auction owner auctionId ID of auction being "cancelled" / | function cancelAuctionOnChain(bytes32 auctionId) external;
| function cancelAuctionOnChain(bytes32 auctionId) external;
| 13,699 |
2 | // insuredId => Content | mapping(uint256 => Content) Contents;
| mapping(uint256 => Content) Contents;
| 4,235 |
2 | // Change the owner of the contract | function changeOwner(address newOwner) onlyOwner public {
owner = newOwner;
}
| function changeOwner(address newOwner) onlyOwner public {
owner = newOwner;
}
| 3,295 |
26 | // low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase /payable | function buyTokens(address _beneficiary) public view returns(address,uint256,address,address){
uint256 weiAmount = 1;
// _preValidatePurchase(_beneficiary, weiAmount);
return(_beneficiary,weiAmount,address(0),address(this));
// calculate token amount to be created
// uint256 tokens = _getTokenAmo... | function buyTokens(address _beneficiary) public view returns(address,uint256,address,address){
uint256 weiAmount = 1;
// _preValidatePurchase(_beneficiary, weiAmount);
return(_beneficiary,weiAmount,address(0),address(this));
// calculate token amount to be created
// uint256 tokens = _getTokenAmo... | 8,157 |
4 | // Devuelve un valor booleano resultado de la operación indicada | function transfer(address recipient, uint256 amount) external returns(bool);
| function transfer(address recipient, uint256 amount) external returns(bool);
| 2,940 |
1 | // {'. .' '. .'} { ~ '._|=__|_.'~} { ~~ '-._ (___________) _.-'~~} {~~~ ~.' '. ~~} {~ ~~ / /\ /\ \ ~~}{ ~ ~/__ __\ ~ ~} { ~/\/-<( o) ( o)>-\/\ ~ ~} { ~ ;(\/ .-. \/); ~ } { ~ ~\_()^ ( ) ^()_/ ~} | constructor() ERC1155Creator("D34D Labs Clown Cards", "CLOWN") {}
| constructor() ERC1155Creator("D34D Labs Clown Cards", "CLOWN") {}
| 30,348 |
77 | // sender must own AAC | require (
msg.sender == aacContract.ownerOf(_from),
"Sender is not owner of AAC"
);
| require (
msg.sender == aacContract.ownerOf(_from),
"Sender is not owner of AAC"
);
| 33,387 |
1 | // Check Admin Accessadmin - Address of Adminreturn whether user has admin access / | function isAdmin(address admin) public view returns (bool) {
return _admins[admin];
}
| function isAdmin(address admin) public view returns (bool) {
return _admins[admin];
}
| 20,852 |
10 | // set floor price and start purchases | function startPurchases() public {
uint totalSupply = _nft.totalSupply();
floor[address(_nft)] = floor[address(_nft)] + (amount / totalSupply);
(bool success, ) = transferFrom(msg.sender, address(this), amount);
require(success);
}
| function startPurchases() public {
uint totalSupply = _nft.totalSupply();
floor[address(_nft)] = floor[address(_nft)] + (amount / totalSupply);
(bool success, ) = transferFrom(msg.sender, address(this), amount);
require(success);
}
| 7,105 |
412 | // External function to change the token uri. This function can be called only by owner. _tokenURI Token uri _count Token uri count / | function updateTokenURICount(string memory _tokenURI, uint256 _count) external onlyOwner {
maxSupply = maxSupply - tokenURICount[_tokenURI] + _count;
tokenURICount[_tokenURI] = _count;
}
| function updateTokenURICount(string memory _tokenURI, uint256 _count) external onlyOwner {
maxSupply = maxSupply - tokenURICount[_tokenURI] + _count;
tokenURICount[_tokenURI] = _count;
}
| 21,120 |
144 | // Info of each user that stakes LP tokens. | mapping (uint256 => mapping (address => UserInfo)) public userInfo;
| mapping (uint256 => mapping (address => UserInfo)) public userInfo;
| 329 |
0 | // The interface for Graviton governance token lock/Locks governance tokens/Artemij Artamonov - <array.clean@gmail.com>/Anton Davydov - <fetsorn@gmail.com> | interface ILockGTON {
/// @notice User that can grant access permissions and perform privileged actions
function owner() external view returns (address);
/// @notice Transfers ownership of the contract to a new account (`_owner`).
/// @dev Can only be called by the current owner.
function setOwner(... | interface ILockGTON {
/// @notice User that can grant access permissions and perform privileged actions
function owner() external view returns (address);
/// @notice Transfers ownership of the contract to a new account (`_owner`).
/// @dev Can only be called by the current owner.
function setOwner(... | 25,171 |
14 | // 3: CLAIM | function claimRightAnswer(string memory userAnswer, bytes32 randomness) public onlyInPhase(Phase.Claim) {
//TODO: check timeout
require(
keccak256(abi.encodePacked(quizNumber, msg.sender, userAnswer, randomness)) == answers[msg.sender],
"The answer is wrong or malformed."
... | function claimRightAnswer(string memory userAnswer, bytes32 randomness) public onlyInPhase(Phase.Claim) {
//TODO: check timeout
require(
keccak256(abi.encodePacked(quizNumber, msg.sender, userAnswer, randomness)) == answers[msg.sender],
"The answer is wrong or malformed."
... | 39,685 |
2 | // check the everything is okay?? | require(campaign.deadline < block.timestamp, "The deadline should be a date in future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0... | require(campaign.deadline < block.timestamp, "The deadline should be a date in future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0... | 3,461 |
130 | // SNX | uint256 _snx = ICurveGauge(gauge).claimable_reward(address(this));
if (_snx > 0) {
(_retAmount, ) = OneSplitAudit(onesplit).getExpectedReturn(
snx,
to,
_snx,
parts,
0
);
_to = _to.add(_ret... | uint256 _snx = ICurveGauge(gauge).claimable_reward(address(this));
if (_snx > 0) {
(_retAmount, ) = OneSplitAudit(onesplit).getExpectedReturn(
snx,
to,
_snx,
parts,
0
);
_to = _to.add(_ret... | 24,158 |
207 | // Virtual value of liquid assets in the poolreturn Virtual liquid value of pool assets / | function liquidValue() public view returns (uint256) {
return currencyBalance().add(strategyValue());
}
| function liquidValue() public view returns (uint256) {
return currencyBalance().add(strategyValue());
}
| 43,252 |
295 | // UserInfo storage user = userInfo[_msgSender()]; user.rewards = earned(_msgSender()); user.lastUpdated = block.timestamp; |
addStakerList(_msgSender());
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 tokenId = _publicCounter.current();
if (_publicCounter.current() < MAX_SUPPLY) {
_publicCounter.increment();
if (!_exists(tokenId)) {
... |
addStakerList(_msgSender());
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 tokenId = _publicCounter.current();
if (_publicCounter.current() < MAX_SUPPLY) {
_publicCounter.increment();
if (!_exists(tokenId)) {
... | 43,048 |
142 | // Tokenomic decition from governance / | function changeFeeRate(uint8 _feerate) public onlyOwner {
FeeRate = _feerate;
}
| function changeFeeRate(uint8 _feerate) public onlyOwner {
FeeRate = _feerate;
}
| 35,918 |
12 | // Cancel one or more nonces Cancelled nonces are marked as used Emits a Cancel event Out of gas may occur in arrays of length > 400 nonces uint256[] List of nonces to cancel / | function cancel(uint256[] calldata nonces) external override {
for (uint256 i = 0; i < nonces.length; i++) {
uint256 nonce = nonces[i];
if (_markNonceAsUsed(msg.sender, nonce)) {
emit Cancel(nonce, msg.sender);
}
}
}
| function cancel(uint256[] calldata nonces) external override {
for (uint256 i = 0; i < nonces.length; i++) {
uint256 nonce = nonces[i];
if (_markNonceAsUsed(msg.sender, nonce)) {
emit Cancel(nonce, msg.sender);
}
}
}
| 45,067 |
0 | // Throws if called by any account other than a proxy / | modifier onlyCore {
require(core == msg.sender);
_;
}
| modifier onlyCore {
require(core == msg.sender);
_;
}
| 5,037 |
31 | // Emit an event logging the amounts | emit LiquidityRemoved(liquidity, amount0Min, amount1Min);
| emit LiquidityRemoved(liquidity, amount0Min, amount1Min);
| 29,370 |
1 | // 2. Is the SOUL NFT Collection | ERC1155Drop public immutable soul;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _ticketAddress,
address _soulAddress
| ERC1155Drop public immutable soul;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _ticketAddress,
address _soulAddress
| 31,729 |
54 | // donations, funding, replenish | function() public payable {}
}
| function() public payable {}
}
| 16,551 |
1 | // ================ EVENT SECTION ================ / Emits when tokens are bought | event TokensBought(
address buyerAddress,
uint256 buyAmount,
uint256 tokenAmount,
uint32 buyTime
);
| event TokensBought(
address buyerAddress,
uint256 buyAmount,
uint256 tokenAmount,
uint32 buyTime
);
| 45,280 |
7 | // External accounts withdraw money when the proposal is not passed, via treasuryIf proposal is sucessful upon conclusion, the account made the proposal shall retrieve the money;Although the function is public, onlyOwner can successfully transfer the money. Return true upon success._proposalID the reference ID of propo... | function withdrawMoney(
bytes32 _proposalID,
address _adr
| function withdrawMoney(
bytes32 _proposalID,
address _adr
| 45,167 |
2 | // ESCROW .. project .. total amount | mapping (bytes32 => uint256) private _escrowtotal;
| mapping (bytes32 => uint256) private _escrowtotal;
| 51,815 |
64 | // loop 'for' wrapper, where 100,000%, 10^3 decimal / | function loopFor(uint256 _condition, uint256 _data, uint256 _bonus) internal pure returns (uint256 r) {
assembly {
for { let i := 0 } lt(i, _condition) { i := add(i, 1) } {
let m := mul(_data, _bonus)
let d := div(m, 100000)
_data := add(_data, d)
... | function loopFor(uint256 _condition, uint256 _data, uint256 _bonus) internal pure returns (uint256 r) {
assembly {
for { let i := 0 } lt(i, _condition) { i := add(i, 1) } {
let m := mul(_data, _bonus)
let d := div(m, 100000)
_data := add(_data, d)
... | 36,255 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.