file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/3/0x1cef903848781D05A2C62773cab8489906091b8F/sources/MockERC20.sol
Converts token passed as an argument to WETH If the passed token is Sushi, don't convert anything
function _toWETH(address token) internal returns (uint256) { uint amount = IERC20(token).balanceOf(address(this)); _safeTransfer(token, bar, amount); return 0; }
5,161,156
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimizatio...
Grant the items to the minter
function mint(string _name, uint256 _totalSupply, string _uri, uint8 _decimals, string _symbol) external returns(uint256 _id) { _id = ++nonce; items[_id].name = _name; items[_id].totalSupply = _totalSupply; metadataURIs[_id] = _uri; decimals[_id] = _decimals; sym...
952,630
./partial_match/137/0x9390c94B7891f0247d5645528590AF4e8c118B49/sources/MinerManager.sol
Calculate e^x. Uses the series given at Lets you artificially limit the number of iterations. Note that it is potentially possible to get an un-converged value; lack of convergence does not throw./ We will accumulate the result here We use this to save work computing terms Add in the term Compute the next term We must ...
function expLimited(int128 real_arg, int256 max_iterations) public pure returns (int128) { int128 real_result = 0; int128 real_term = REAL_ONE; for (int88 n = 0; n < max_iterations; n++) { real_result += real_term; real_term = mul(real_t...
3,529,219
./full_match/80001/0x3d93f674C40beD9Bf8417Cf8F8D8AB0fF7C2145a/sources/contracts/TomiGovernance.sol
require(_amount >= getConfigValue(ConfigNames.LIST_TGAS_AMOUNT), "TomiGovernance: NOT_ENOUGH_AMOUNT_TO_LIST");
function listToken(address _token, uint _amount, string calldata _subject, string calldata _content) external returns (address) { uint status = ITokenRegistry(configAddr).tokenStatus(_token); require(status == ITokenRegistry(configAddr).NONE() || status == ITokenRegistry(configAddr).CLOSED(), 'TomiGove...
5,560,447
// 定义语言和版本 pragma solidity ^0.4.16; // 调用人合约 contract owned { //地址 address public owner; constructor () public { owner = msg.sender; } //必须是自己 modifier onlyOwner { require(msg.sender == owner); _; } //转移所有权 function transferOwnership(address newOwner) onl...
Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive 蒸发
function mintToken( address target, uint256 mintedAmount ) onlyOwner public { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; emit Transfer(0, this, mintedAmount); emit Transfer(this, target, mintedAmount); }
9,838,093
./partial_match/1/0x1E3F86092187be49bb4C12c63eF3Ffb31f27d967/sources/__AdminUpgradeabilityProxy__.sol
Upgrade the backing implementation of the proxy. Only the admin can call this function. newImplementation Address of the new implementation./function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation);}
function __upgradeTo__(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); }
3,713,852
pragma solidity ^0.4.24; import "@settlemint/solidity-mint/contracts/marketplaces/tokensystem/interfaces/IApproveAndCallable.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../token/LocalDTXToken.sol"; import "./Validatable.sol"; contract ForeignBridge is Ownable, Validatable, IApproveA...
Token should be registered Unique hash for this request Request shouldnt be done Request shouldnt already be signed by validator Burn the tokens we received
function signWithdrawRequest( bytes32 _transactionHash, address _mainToken, address _recipient, uint256 _amount, uint256 _withdrawBlock, uint8 _v, bytes32 _r, bytes32 _s) public { require(_amount > 0, "the amount should be greater than 0"); require(tokenMap[_mainToken] != ...
946,588
./partial_match/1/0xB9DFFBb4ac8705A463D0FB76fBA4CFC8b2B075b6/sources/CVXStaker.sol
Set operator _operator New operator/
function setOperator(address _operator) external onlyOwner { operator = _operator; emit SetOperator(_operator); }
4,172,626
./partial_match/1/0xEEEEEcf99b5d7e9c0bca6E2769E895d8F956BbAF/sources/ERC20.sol
Returns the downcasted int200 from int256, reverting on overflow (when the input is less than smallest int200 or greater than largest int200). Counterpart to Solidity's `int200` operator. Requirements: - input must fit into 200 bits/
function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } }
4,210,467
./full_match/43114/0x23BECb8A22D3C6978F1A04b891262C832f5Ef3D2/sources/contracts/MasterStar.sol
Add a new lp to the pool. Can only be called by the owner.
function add( uint256 _allocPoint, IERC20 _lpToken, uint16 _depositFeeBP ) external onlyOwner nonDuplicated(_lpToken) { require( _depositFeeBP <= maximumDepositFeeBp, "add: invalid deposit fee basis points" ); uint256 lastRewardBlock = blo...
4,535,665
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/utils/Base64.sol"; /// @title OnChain metadata support library /** * @dev These methods are best suited towards view/pure only function calls (ALL the way through the call stack). * Do not waste gas using these methods in functio...
Returns the contents joined with commas between them contents1 The first content to join contents2 The second content to join contents3 The third content to join return A string that represent all contents joined with commas
function commaSeparated(string memory contents1, string memory contents2, string memory contents3) internal pure returns (string memory) { return string.concat(commaSeparated(contents1, contents2), continuesWith(contents3)); }
5,472,222
//based https://github.com/0xcert/ethereum-erc721 // //Author NZRI_Kaz-Naz_https://github.com/Kaz-Naz,Toshiya Y_https://github.com/Toshiya-Y-K-N //rinkeby //by pragma solidity 0.6.2; import "./nf-token.sol"; import "./nf-token-metadata.sol"; import "./nf-token-enumerable.sol"; import "../ownership/ownable.sol"; /*...
setCreatorOneTimeNum public onlyOwner手動でワンタイムパスワード(OTP)を変えるの数値を入力できる関数。運営者のオーナーのみが関数を実行出来る。 setCreatorOneTimeNum(uint256 _newNum) public onlyOwner/
function setCreatorOneTimeNum(uint256 _newNum) public onlyOwner { _creatorOneTimeNum = _newNum ; }
1,756,445
pragma solidity 0.4.18; /// @title Math operations with safety checks library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; require(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure ret...
validate that the tokens balances don't goes below reserves
function validateReserves() public view returns (bool) { return (token1.balanceOf(this) >= R1 && token2.balanceOf(this) >= R2); }
12,717,838
pragma solidity ^0.5.8; import "../libs/Math.sol"; import "../libs/SafeMath.sol"; import "../libs/SignedSafeMath.sol"; import {IncentiveMechanism, IncentiveMechanism64} from "./IncentiveMechanism.sol"; import {Ownable} from "../ownership/Ownable.sol"; /** * A base class for contracts that want to accept deposits to...
return The amount of wei required to add data now. Note that since this method uses `now` which depends on the last block time, when testing, the output of this function may not change over time unless blocks are created. see also `getNextAddDataCost(uint)`/
function getNextAddDataCost() public view returns (uint) { }
12,662,387
pragma solidity ^0.4.24; import "../Roles.sol"; import "./MinterAdminRole.sol"; /** * @title MinterRole * * @dev Role for providing access control to functions that mint tokens. * This contract inherits from MinterAdminRole so that minterAdmins can administer this role. */ contract MinterRole is MinterAdminRole ...
Internal function that replaces the `previousAccount` in `_minters` with the `newAccount`. Emits a MinterRemoved event. Emits a MinterAdded event. previousAccount The account address having access removed from the minter role newAccount The account address being given access to the minter role/
function _replaceMinter(address previousAccount, address newAccount) internal { _minters.replace(previousAccount, newAccount); emit MinterRemoved(previousAccount); emit MinterAdded(newAccount); }
12,636,104
./full_match/5/0x278f941f4d167E6f75f7607c6ff12d86a2757568/sources/contracts/prebuilts/account/dynamic/DynamicAccount.sol
Returns whether all relevant permission and other checks are met before any upgrade.
function isAuthorizedCallToUpgrade() internal view virtual override returns (bool) { return isAdmin(msg.sender); }
7,061,095
pragma solidity 0.5.11; library SafeMath { function MUL499(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING if (a =...
inject NONSTANDARD NAMING
function INCREASEAPPROVAL746 (address _spender, uint _addedValue) public returns (bool success) {
6,400,069
./partial_match/56/0xF7Cb81E39bE4778B8f950F949edB4f5461B6036F/sources/MasterDrunk.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner { require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBl...
11,141,548
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Pausable.s...
if( reward > 0 ){ GovernToken govToken = AddressBookLib.governToken(mAddressBook); govToken.mint( addr, reward ); }
function mint( uint256 curBlock, uint key, uint256 amount, address addr ) external override onlyVault { _deposit( curBlock, key, amount ); emit LogMint( curBlock, key, amount, addr, mAccRewardPerShare, mRewardPerBlock ); }
6,229,481
// SPDX-License-Identifier: MIT // https://github.com/paxosglobal/simple-multisig pragma solidity ^0.8.4; contract MultiSig { // EIP712 Precomputed hashes: // keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") bytes32 private constant EIP712DOMAINTYPE_HASH = 0x8b73...
Note that owners_ must be strictly increasing, in order to prevent duplicates remove old owners from map
function setOwners_(uint threshold_, address[] memory owners_) private { require(owners_.length <= 20 && threshold_ <= owners_.length && threshold_ > 0, "Invalid threshold"); for (uint i = 0; i < ownersArr.length; i++) { isOwner[ownersArr[i]] = false; } for (uint i = 0; i < owners_.length; i++...
6,544,927
./full_match/11155111/0xf94BdC648A30719fF0cf91B436f9819F7804e1a0/sources/project_/contracts/UnicornPresale.sol
initialize smart contract being deployed through proxy totalAmount The total items amount for predale price The price in ETH per item collector The address of the wallet, the funds are transfered to manager The address of the wallet responsible to start/pause/finish Presale claimer The address of the smart contrac...
function initialize( uint256 totalAmount, uint256 price, address collector, address manager, address claimer ) external virtual initializer { __AccessControl_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MANAGER_ROLE, manager); ...
3,795,086
pragma solidity >=0.5.0; // Inheritance import "./Ownable.sol"; import "./interfaces/ITradegenEscrow.sol"; // Libraires import "./libraries/SafeMath.sol"; // Internal references import "./interfaces/IERC20.sol"; import "./interfaces/IAddressResolver.sol"; contract TradegenEscrow is Ownable, ITradegenEscrow { us...
Get the time at which a given schedule entry will vest./
function getVestingTime(address account, uint index) public view override returns (uint) { return getVestingScheduleEntry(account, index)[TIME_INDEX]; }
1,033,623
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./InterestRateModel.sol"; /** * @title tropykus CToken Contract * @notice Abstract base for CTokens * @author tropykus */ ...
Accrue interest then return the up-to-date exchange rate return Calculated exchange rate scaled by 1e18/
function exchangeRateCurrent() public nonReentrant returns (uint256) { require(accrueInterest() == uint256(Error.NO_ERROR), "T7"); return exchangeRateStored(); }
12,741,624
./full_match/1/0x467a2B91f231D930F5eeB6B982C7666E81DA8626/sources/contracts/nft/ZKSeaNFT.sol
Store withdrawal, which should be called when partial exit or full exit is verified Save L1 L2 mapping data first time withdraw internal NFT: create new token info do withdraw internal NFT: mint now external NFT: prepare to withdraw
function addWithdraw(Operations.WithdrawNFTData calldata wd) external onlyZksCore { if (!wd.valid) { return; } L1Info memory info1 = infoMapL1[wd.globalId]; if (info1.tokenContract == address(0x0)) { if (wd.creatorId != 0) { info1 = L1Info({ ...
3,857,716
//Address: 0xCB95cA62AACdc3C608aA2E78057e918a1B180616 //Contract name: PapyrusPrototypeToken //Balance: 0 Ether //Verification Date: 11/23/2017 //Transacion Count: 1978 // CODE STARTS HERE pragma solidity ^0.4.17; /// @title SafeMath /// @dev Math operations with safety checks that throw on error. library SafeMath...
Approves the specified address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to firs...
function approve(address _spender, uint256 _value) public returns (bool) { allowances[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
923,500
./full_match/1/0x7132c10A5fDeb8236Be65F451c1973E26E8515EF/sources/contracts/sugartown/SugartownOrasNFT.sol
getter function for users' guaranteed free mint count user address of user we want to get mint count of/
function getGuaranteedFreeMintCount(address user) public view returns(uint64) { return _userToMintCounts[user].guaranteedFreeMintCount; }
3,072,444
./full_match/1/0x765c1D9B32BB20C143AEebfE56e6e7F15D2E8AF0/sources/contracts/ERC721SeaDrop.sol
Update the drop URI for this nft contract on SeaDrop. Only the owner can use this function. seaDropImpl The allowed SeaDrop contract. dropURI The new drop URI./ Ensure the sender is only the owner or contract itself. Ensure the SeaDrop is allowed. Update the drop URI.
function updateDropURI( address seaDropImpl, string calldata dropURI ) external virtual override { _onlyOwnerOrSelf(); _onlyAllowedSeaDrop(seaDropImpl); ISeaDrop(seaDropImpl).updateDropURI(dropURI); }
8,290,968
// File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b...
Sets the minimum amount of CRV needed to trigger a sale./
function setSellFloor(uint256 floor) public onlyGovernance { sellFloor = floor; }
227,837
./partial_match/1/0xD2Eedb0A785A64F478B2741bA4E81426c6b2fD5d/sources/DebaseToken.sol
Returns the total fee percentage applied to transactions. return totalFeePercentage The total fee percentage./
function getTotalFeePercentage() public view returns ( uint totalFeePercentage ) { for (uint i; i < feePercentages.length; i++) { totalFeePercentage += feePercentages[i]; } }
3,600,217
./full_match/8453/0x0d18a1876A1Df3271f441C3693F906dee9272125/sources/contracts/marketplace/offers/OffersLogic.sol
Returns existing offer with the given uid.
function getOffer(uint256 _offerId) external view returns (Offer memory _offer) { OffersStorage.Data storage data = OffersStorage.offersStorage(); _offer = data.offers[_offerId]; }
11,558,834
./full_match/1/0xbeE4a1515eA341B4309f832A4E4e2AC58dc7479F/sources/contracts/GenericToken2.sol
change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= (totalSupply() * 1) / 100000, 'Swap amount cannot be lower than 0.001% total supply.'); require(newAmount <= (totalSupply() * 5) / 1000, 'Swap amount cannot be higher than 0.5% total supply.'); sw...
3,138,041
pragma solidity 0.5.11; // optimization runs: 200 interface CTokenInterface { function balanceOf(address) external view returns (uint256); function approve(address, uint256) external returns (bool); function transfer(address, uint256) external returns (bool); function transferFrom(address, address, uint256) e...
quotedExchangeRate uint256 The expected cUSDC/cDAI exchange rate, scaled up by 10^18 - this value is returned from the `getExchangeRateAndExpectedDai` view function as `exchangeRate`. Get the total cUSDC balance of the caller. Use that balance and quoted exchange rate to derive required cDai. Transfer all cUSDC from th...
function tradeCUSDCForCDai(uint256 quotedExchangeRate) external { uint256 cUSDCBalance = _CUSDC.balanceOf(msg.sender); require(cUSDCBalance > 5000000, "cUSDC balance too low to trade."); uint256 minimumCDai = _getMinimumCDai(cUSDCBalance, quotedExchangeRate); require(_CUSDC.transferFrom(msg....
13,013,599
pragma solidity ^0.5.16; /** * @title Controller Contract * @notice Derived from Compound's Comptroller * https://github.com/compound-finance/compound-protocol/tree/master/contracts */ /** * @title Careful Math * @notice Derived from OpenZeppelin's SafeMath library * https://github.com/OpenZeppe...
Recalculate and update ARTEM speeds for all ARTEM markets/
function refreshArtemSpeeds() public { require(msg.sender == tx.origin, "only externally owned accounts may refresh speeds"); refreshArtemSpeedsInternal(); }
7,696,155
/* AMP Copyright 2017-2020 AMP Development Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
remove the asset from the assets mapping remove the issuer of the token delete its resolution date then emit an event explaining why the asset was inactivated
function inactivateAsset(address tokenAddress, string memory reasonGivenByAdminOrCreator ) public { delete assets[tokenAddress]; delete tokenIssuers[tokenAddress]; delete assetResolutionDates[tokenAddress]; emit AssetInactivated(tokenAddress, reasonGivenByAdminOrC...
12,562,692
/** *Submitted for verification at Etherscan.io on 2021-09-28 */ // File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `...
Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. Emits an Approval event (reflecting the reduced allowance). account The account whose tokens will be burnt. amount The amount that will be burnt./
function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount)); } uint256[50] private ______gap;
2,420,875
./full_match/4/0x697fFC91295Ec99fe7AAf6DAef9e624a6a5263c0/sources/IdentityID.sol
Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a...
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
785,784
./full_match/4/0xED29Aa36E5ADd906371dE324Fea2f973628e98E3/sources/contracts/HopeRaffle.sol
Utility function to check if a value is inside an array
function _isInArray(address _value, address[] memory _array) internal pure returns(bool) { uint256 length = _array.length; for (uint256 i = 0; i < length; ++i) { if (_array[i] == _value) { return true; } } return false; }
12,390,359
./partial_match/1/0x067C5714f9c034fda974f909591c75A710C8f6eb/sources/MULTINFT_METAVERSE_NIGHTS.sol
Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event for each mint./
function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual { if (to == _ADDRESS_ZERO) _revert(MintToZeroAddress.selector); uint256 packedMetadata = _packedTokenMetadata[id]; if ((((packedMetadata >> _BITPOS_NUMBER_MINTED) & _BITMASK_DATA_ENTRY) + amount) > (pa...
9,130,770
// contracts/twigsProject.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by othe...
Set a specific URI for a certain twig, overiding the generic
function SetTwigURI (uint _twigId, string memory _uri) public onlyOwner { uris[_twigId] = _uri; }
14,634,466
./full_match/1/0x32646d326AdACd0E1e3d7826Bc2def30ABA35bE5/sources/contracts/reGenZ.sol
Minting the NFT for the user For the sake of simplicity, the following code assumes the existence of a mint function in the inherited ERC721LazyMint contract.
function burnWithoutMainNFT(address _claimer) external { require(burnNFT.balanceOf(_claimer, 0) >= 3, "You don't have enough VaccineZ"); require(_currentIndex + 1 <= nextTokenIdToLazyMint, "All deGenZ have already been Vaccinated"); uint256[] memory tokenIds = new uint256[](1); uint2...
3,078,315
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./TradingAction.sol"; import "./ActionGuards.sol"; import "./nTokenMintAction.sol"; import "./nTokenRedeemAction.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256...
Present value of an fCash asset without any risk adjustments. NOTE: this will revert if maturity < blockTime. That is the correct behavior because we cannot discount matured assets.
function getPresentfCashValue( int256 notional, uint256 maturity, uint256 blockTime, uint256 oracleRate ) internal pure returns (int256) { if (notional == 0) return 0; uint256 timeToMaturity = maturity.sub(blockTime); int256 discountFactor = getDiscountFa...
12,422
./full_match/42220/0x1914EA95139FEd935a524984497895619B347F46/sources/project:/contracts/common/linkedlists/SortedLinkedList.sol
Returns the keys of the elements greaterKey than and less than the provided value. list A storage pointer to the underlying list. value The element value. lesserKey The key of the element which could be just left of the new value. greaterKey The key of the element which could be just right of the new value. return ...
function getLesserAndGreater( List storage list, uint256 value, bytes32 lesserKey, bytes32 greaterKey ) private view returns (bytes32, bytes32) { if (lesserKey == bytes32(0) && isValueBetween(list, value, lesserKey, list.list.tail)) { return (lesserKey, list.list.tail); } else if ( ...
16,357,125
./full_match/1/0xDE2b84fcAE56A0BebC94B1dAcEd90c3b9043161b/sources/src/DssVest.sol
call parent initializer
function initialize(address _czar, address _gem, address _ward, uint256 _cap) initializer public { super.initialize(_ward, _cap); require(_czar != address(0), "DssVestTransferrable/Invalid-distributor-address"); require(_gem != address(0), "DssVestTransferrable/Invalid-token-address"); ...
17,098,042
/** *Submitted for verification at Etherscan.io on 2021-09-09 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a,...
prevent direct frontrunning
function _preventTransactionsInSameBlock() internal { if (_lastTransactionBlock[tx.origin] == block.number) { emit Event("SandwichAttack", tx.origin); revert("Cannot execute two transactions in same block."); } _lastTransactionBlock[tx.origin] = block.number; } ...
10,707,666
./full_match/1/0x8F9DA6d38939411340b19401E8c54Ea1f51B8f95/sources/contracts/Registry.sol
Return the staking balance of a given staker staker address of the account used to stake return balance of the staker account/
function balanceOf(address staker) external view returns (uint256) { uint256 tokenCount = supportedTokens[staker].length(); if (tokenCount == 0) { return 0; } return obligationCost + tokenCost * tokenCount; }
3,068,487
pragma solidity ^0.5.0; import "@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../access/roles/AdministratorRole.sol"; import "../utils/Addresses...
Sets the VASP legal name. name New name value Requirements: - Should not be an empty string. - Should not be equal to the current name./
function setName( string calldata name ) external onlyAdministrator { _setName(name); }
13,101,933
./full_match/5/0xbcf55467F85BbE20f965A5B4af455FC40e897C72/sources/contracts/ArbitrageFlashLoaner.sol
+-The Trader has to monitor Price Differences between UniSwap and SushiSwap and when finds one, Call This Function:_+-It looks for the Coin Pair in UniSwap:_+-You have to make sure that the Coin Pair actually exists in UniSwap:_+-Initiates the FlashLoan(To Better Understanding, see UniSwap A.P.I. Documentation):_
function startArbitrage( address token0, /**+-Asset Token S.Contract Address. Ex:_ WBTC.*/ address token1, /**+-StableCoin Token S.Contract Address. Ex:_ DAI.*/ uint256 amount0, /**+-ZERO Amount of the Asset "token0" that we want to use in the Transaction.*/ uint256 amount1 /**+-Amou...
1,887,963
./full_match/40/0x730d2Fa7dC7642E041bcE231E85b39e9bF4a6a64/sources/Charm-Dojo/CharmDojo.sol
returns how much Charm someone gets for redeeming Karma
function karmaForCharm(uint256 _karmaAmount) external view returns (uint256 charmAmount_) { uint256 totalCharm = balanceOfCharm(); uint256 totalKarma = totalSupply(); if(totalKarma == 0 || totalCharm == 0) { charmAmount_ = _karmaAmount; charmAmount_ = _karmaA...
9,546,023
./full_match/4/0x32F00510946a4A1Aff618F4311ABBc8Dacd3bFBd/sources/browser/MultiSigWallet.sol
Returns true if the pending transaction has been confirmed or if the given address has signed the transaction. _add, a former or active Unbank Owner address
function knowIfAlreadySignTransactionByAddress ( address _add ) external notNull(_add) view returns (bool) { if (pendingTransaction.signatureCounter >= pendingTransaction.signatureThreshold) { return true; ...
12,496,519
// SPDX-License-Identifier: MIT pragma solidity 0.7.3; import "../YakStrategyV2.sol"; import "../interfaces/IPair.sol"; import "../lib/DexLibrary.sol"; /** * @notice Adapter strategy for MasterChef. */ abstract contract MasterChefStrategy is YakStrategyV2 { using SafeMath for uint256; IWAVAX private consta...
Approve tokens for use in Strategy Deprecated; approvals should be handled in context of staking/
function setAllowances() public override onlyOwner { revert("setAllowances::deprecated"); }
1,039,625
/* StaticERC20 - static calls for ERC20 trades */ pragma solidity 0.7.5; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../lib/ArrayUtils.sol"; import "../registry/AuthenticatedProxy.sol"; contract StaticERC20 { function transferERC20Exact(bytes memory extra, address[7] memor...
Decode extradata Call target = token to give Call type = call Assert calldata
function transferERC20ExactTo(bytes memory extra, address[7] memory addresses, AuthenticatedProxy.HowToCall howToCall, uint[6] memory, bytes memory data) public pure { (address token, uint amount, address receiptor) = abi.decode(extra, (address, uint, address)); ...
6,462,095
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import "@openzeppelin/contracts-upgradeable/token/ERC1155/presets/ERC1155PresetMinterPauserUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@op...
Get's the max mintable./
function getMaxReserved() public view returns (uint) { return totalReserved; }
1,347,191
./full_match/23294/0x6e4039C3330681F91bC4bd394dc1a5AAE615FB36/sources/lib/sapphire-paratime/contracts/contracts/Sapphire.sol
Encrypt and authenticate the plaintext and additional data using DeoxysII. key The key to use for encryption. nonce The nonce. Note that only the first 15 bytes of this parameter are used. plaintext The plaintext to encrypt and authenticate. additionalData The additional data to authenticate. return The ciphertext ...
function encrypt( bytes32 key, bytes32 nonce, bytes memory plaintext, bytes memory additionalData ) internal view returns (bytes memory) { (bool success, bytes memory ciphertext) = ENCRYPT.staticcall( abi.encode(key, nonce, plaintext, additionalData) )...
3,843,100
./partial_match/40/0xE51F6F19Ebfb47d3284A6B15Cc04B1b39C6c4dB2/sources/contracts/Milkomeda/AdaReflectionsLfgo.sol
Feeless transfer only transfers and autostakesRemoves token and handles stakingAdds token and handles staking
function _feelessTransfer( address sender, address recipient, uint256 amount ) private { require(_balances[sender] >= amount, ">balance"); _removeToken(sender, amount); _addToken(recipient, amount); emit Transfer(sender, recipient, amount); }
8,827,713
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "../client/node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title A digital time capsule for images * @author John Park * @notice This smart contract's main purpose is to store the state for an image time capsule application. Alon...
John Park Fetches the total number of Entries stored in the contract return Total number of Entries in the contract/
function getTotalEntries() public view checkIfPaused returns(uint256 x) { return counter; }
1,072,821
pragma solidity >=0.4.25 <0.5.0; /** * @title NMRSafeMath * @dev Unsigned math operations with safety checks that revert on error. */ library NMRSafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint2...
Convert uint256 to uint128 without concatenating a Uint number return result
function shrink128(uint a) internal returns (uint128) { assert(a < 0x100000000000000000000000000000000); return uint128(a); }
12,850,917
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0 <= 0.7.5; import "./SmartDCPABEUsers.sol"; import "./Collection.sol"; /** * @author Bruno C. P. Arruda * @title SmartDCPABE File Management Contract * @notice This contract allow the management and search of files published by this contract. * The contract als...
registers a server domain server domain path path to query for files port service port/
function addServer( string memory domain, string memory path, uint16 port ) public returns (uint64 serverIndex) { servers.push(FileServer(domain, path, port)); serverIndex = numServers; numServers++; }
1,018,646
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./LandNFT.sol"; contract LockedNFT is Ownable, ReentrancyGuard, IERC721Receiver...
To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and then delete the last slot (swap and pop). When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so rarely (when the last minted token is burnt) that we still do the ...
function removeLandFromAllStakedEnumeration(uint256 tokenId) private { uint256 lastTokenIndex = _allStakedTokens.length - 1; uint256 tokenIndex = allStakedIndex[tokenId]; uint256 lastTokenId = allStakedIndex[lastTokenIndex]; delete allStakedIndex[tokenId]; _allStakedTokens...
7,310,514
./partial_match/1/0xBCCCADd0E2030c82f3AD3Dd3A8f81e1a4D5a73f0/sources/General.sol
Update maximum transaction amount
function setMaxTxnAmount(uint256 newNum) external onlyOwner { require(newNum >= ((totalSupply() * 1) / 1000) / (10 ** decimals()), "Cannot set maxTransactionAmount lower than 0.1%"); maxTransactionAmount = newNum * (10**18); }
2,668,190
pragma solidity =0.6.6; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions...
Unpauses all transfers from the distribution address (initial liquidity pool)./
function unpause() external virtual onlyInitialDistributionAddress { super._unpause(); }
2,193,893
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../Interfaces/IERC20Market.sol"; import "../Interfaces/IERC721Market.sol"; import "../Interfaces/IMarketERC20Factory.sol"; import "../Interfaces/IMarketFactory.sol"; import "../Interfaces/IERC20Detailed.sol"; import "...
TODO: check addresses equals to tokens
function resolve(Outcome[] memory _outcome) external override withStatus(Status.Started) returns (bool) { require(_outcome.length == tokens.length, "Market: WRONG_RESOLVE_AMOUNT"); require(msg.sender == resolver, "Market: FORBIDDEN"); require(_outcome.length == tokens.length, "Market: MISSIN...
937,158
./partial_match/1/0xe5b5CECDdB34A42A8A0eFC876C56306DBDD5d8Fc/sources/SPYdeployer.sol
transfer Ownership to other address
function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0x0)); emit OwnershipTransferred(owner,_newOwner); owner = _newOwner; }
9,220,680
/* * OOP implementation of THQBY in Solidity */ pragma solidity ^0.4.25; //pragma experimental ABIEncoderV2; ///////////////////////////////////////////////////////////////////////// ////////////////////////// Abstact Contracts //////////////////////////// contract ChatMessage { uint public timestamp; int...
attempt to change signiture to be uint[]
function Initialize(StrArr roles) public { _numRoles = roles.GetLength(); for (uint i = 0; i < _numRoles; i++) { string memory role = roles.GetStrI(i); _string2RoleIndx[role][0] = 1; _string2RoleIndx[role][1] = i; _roleIndx2String[int(i)] = role; ...
883,084
./full_match/1/0xFA391De95Fcbcd3157268B91d8c7af083E607A5C/sources/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_1.sol
/ Get a reference to the project's held fees. Delete the current held fees. Get a reference to the leftover amount once all fees have been settled. Push length in stack Process each fee.
{ JBFee[] memory _heldFees = _heldFeesOf[_projectId]; delete _heldFeesOf[_projectId]; uint256 leftoverAmount = _amount; uint256 _heldFeesLength = _heldFees.length; function _addToBalanceOf( uint256 _projectId, uint256 _amount, bool _shouldRefundHeldFees, string memory _memo, ...
4,912,486
pragma solidity ^0.4.24; contract Crowdsale { using SafeMath for uint256; using SafeERC20 for ERC20; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei. // The rate is the conversion betwee...
Update pledge closing time _pledgeClosingTime Pledge closing time/
function setPledgeClosingTime(uint256 _pledgeClosingTime) external onlyOwner { require(_pledgeClosingTime >= openingTime && _pledgeClosingTime <= closingTime); pledgeClosingTime = _pledgeClosingTime; }
889,591
//Address: 0x2de60f36bb208b5c96acb36d4a49aad3e2be0627 //Contract name: GJCICO //Balance: 0 Ether //Verification Date: 10/27/2017 //Transacion Count: 824 // CODE STARTS HERE pragma solidity ^0.4.15; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; ...
return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool nonMinimumPurchase = msg.value >= minContribAmount; bool icoTokensAvailable = icoSoldTokens < icoCap; return !icoEnded && icoEnabled && withinPeriod && nonMinimumPurchase && icoToke...
6,457,510
./full_match/44787/0x2406B05Ba68C2c1532570422a9c3D6c2AC1f8045/sources/contracts/QuboMerchant.sol
Customer signs the contract denoting order delivered
function sign(uint256 orderID) public { require(keccak256(bytes(orderList[orderID].orderStatus)) != keccak256(bytes("Closed")), "Customer has already received!"); require(orderList[orderID].customerAddress == msg.sender, "Order ID does not belong to user"); orderList[orderID].orderStatus = "...
13,258,474
/** *Submitted for verification at Etherscan.io on 2022-02-12 */ //SPDX-License-Identifier: MIT // Note: SafeMath is not used as it's redundant since Solidity 0.8 // ****** ARCADE Token ****** // // Vesting contract for gradual release of pre-allocated private-sale tokens. // To be used with the provided dApp or d...
token amounts are to be input WITHOUT DECIMALS!!!
function addRecipient(address[] calldata recipients, uint256 tokenAmountWithoutDecimals) external onlyOwner { require(!vestingActive, "Vesting is already active, wait till finished"); require(recipients.length <= 500,"Cannot set more than 500 recipients at a time"); uint256 tokenBalance = _...
10,899,451
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import '@o...
/ require(isAccountWhitelisted(_account), 'ER: You are not authorized to get final picture NFT');
function airdropFinalPictureToFinalOwners() internal { require(endedAt > 0, 'ER: Game has not ended yet'); require( finalPictureTokenIds + finalOwners.length <= MAX_FINAL_PUZZLE_PICTURE_NUMBER, 'ER: Final puzzle pictures exceeded quota' ); finalPictureTokenId...
6,256,851
// SPDX-License-Identifier: MIT // @title: MOAR // @desc: "MOAR by Joan Cornellà is an unusual mansion in the metaverse proudly presented by FWENCLUB, where 5,555 creatures with their souls minted with the ERC721 blockchain as NFTs. Each of these "peacefully-living-together" humans, cyborgs or even zombies, i...
Returns the URI for a given token ID Throws if the token ID does not exist. tokenId uint256 ID of the token to query/
function tokenURI(uint256 tokenId) public view override returns (string memory) { if (bytes(_baseURI).length > 0) return string(abi.encodePacked(_baseURI, tokenId.toString())); }
10,342,086
// ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄ // ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ // ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ // ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓...
Sets whether a swap should revert if at least one open auction exists. _revertIfAuctionOpen If true, revert the swap if there is at least one open auction. If false, open auctions won't be taken into account.
function setRevertIfAuctionOpen(bool _revertIfAuctionOpen) external onlyOwner { revertIfAuctionOpen = _revertIfAuctionOpen; }
919,690
/** *Submitted for verification at Etherscan.io on 2021-05-28 */ pragma solidity ^0.5.10; /** * @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 o...
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
7,820,264
pragma solidity ^0.4.18; contract ERC20Interface { uint256 public totalSupply; function balanceOf(address _owner) public constant returns (uint balance); // Get the account balance of another account with address _owner function transfer(address _to, uint256 _value) public returns (bool success); // Send _value amo...
Get the account balance of another account with address _owner
function balanceOf(address _owner) public constant returns (uint balance);
10,249,203
./partial_match/82/0xB7F024C1807082A8F497627aA3EF58b442E17816/sources/flattened/XCAmpleController.sol
Upcoming rebase information reported by a bridge gateway and updated in storage. nextGlobalAmpleforthEpoch_ The new epoch after rebase on the base chain. nextGlobalAMPLSupply_ The new globalAMPLSupply after rebase on the base chain./
function reportRebase(uint256 nextGlobalAmpleforthEpoch_, uint256 nextGlobalAMPLSupply_) external onlyBridgeGateway { nextGlobalAmpleforthEpoch = nextGlobalAmpleforthEpoch_; nextGlobalAMPLSupply = nextGlobalAMPLSupply_; emit GatewayRebaseReported( msg.sender,...
16,901,449
// SPDX-License-Identifier: MIT pragma solidity 0.8; // micro dbank system contract TREASURY { mapping (address => uint256) private _keep; bool internal locked; modifier noReentrant() { require(!locked, "no re entrancy"); locked = true; _; locked = false; } event Deposit (address indexed _c...
receive () external payable {} fallback () external payable {}
function _income() internal { _keep[msg.sender] += msg.value; emit Deposit(msg.sender, msg.value); }
922,321
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view ret...
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poo...
10,660,644
// SPDX-License-Identifier: Unlicensed pragma solidity >= 0.7.0 < 0.8.0; pragma abicoder v2; import { SafeMath } from "../Utils/SafeMath.sol"; import { Formulas } from "../Utils/Formulas.sol"; contract EIP1167_Question { using SafeMath for uint256; using Formulas for uint256; enum State {BETTING, IN...
Can be called multiple times
function changeStake(uint256 _fromOptionId, uint256 _toOptionId, uint256 _amount) external changeState checkState(State.BETTING) validOption(_fromOptionId) validOption(_toOptionId) { require(hasStaked[msg.sender], "You haven't voted before!"); require(stakeDetails[msg.sender][_fromOptionId] >= ...
12,772,665
./partial_match/1/0xF8243ECF8f734452B184A1dF3AD3cD92fC93B58a/sources/project_/contracts/lending/wrapper/CappedGovToken.sol
set the Cap
function setCap(uint256 cap_) external onlyOwner { _cap = cap_; }
2,879,079
./partial_match/1/0x34d039D6fEa46Ad6934f8849571e7C5121F167c2/sources/GSHIB.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Green Shibarium", "GSHIB") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Fact...
4,306,502
// SPDX-License-Identifier: BlueOak-1.0.0 pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "contracts/libraries/Fixed.s...
Constructor function, can only be called once Expects sell tokens to already be present @custom:interaction reentrancy-safe b/c state-locking {buyTok/sellTok} == Interactions ==
function init( IBroker broker_, address origin_, IGnosis gnosis_, uint32 auctionLength, uint256 minBidSize, TradeRequest memory req ) external stateTransition(TradeStatus.NOT_STARTED, TradeStatus.OPEN) { require(req.sell.erc20().balanceOf(address(this)) >=...
12,634,194
./full_match/4/0x3b85837Ed9C20ee81265D3180486405309c3943D/sources/contracts/CryptoPoly.sol
check for different conditionsconfirm the amount paid was correct
function moveAgain() public payable returns (bytes32) { _validateGame(); Game memory game = games[msg.sender]; require(msg.value == game.amount, "Amount should be same as the initial amount"); require(game.taxTobePaid == 0, "Tax needs to be paid in order to proceed"); byt...
691,700
/** *Submitted for verification at Etherscan.io on 2021-02-21 */ pragma solidity ^0.5.17; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit ...
2,262,887
./partial_match/1/0x00dcAd22C93afc3d27D19436C1Dd2aF408AD277E/sources/MLGMEMES.sol
See {IERC20-allowance}./
function allowance(address owner, address spender) public view virtual override returns (uint256) { return tokenAllowances[owner][spender]; }
2,581,956
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title The Lazy Corner Contract * @author Idoia Rojo Lázaro * @dev Contract for selling and bying notes */ contract TheLazyCornerContract { using SafeMat...
Users / Register of a new user isSeller Is seller or buyer?/
function addUser(bool isSeller) theLazyCornerIsOpen external{ require(users[msg.sender].exits == 0, "User already registered"); User memory user; user.id = usersArr.length + 1; user.userAddr = msg.sender; user.seller = isSeller; user.exits = 1; users[msg.sender] = user; usersArr.pu...
15,846,275
/** *Submitted for verification at Etherscan.io on 2020-08-11 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.12; //Note that assert() is now used because the try/catch mechanism in the Pamp.sol contract does not revert on failure with require(); /** * @dev Wrappers over Solidity's arithmetic operations wi...
Determines the transaction burn fee
function burnFee() internal view returns (uint256) {
1,072,330
// File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b...
set QuotaDistribution
function setQuotaDistribution(address _quotaDistribution) external onlyOwner { quotaDistribution = _quotaDistribution; }
2,459,934
pragma solidity ^0.5.0; contract EventFactory{ mapping (uint => Event) public events; uint public eventIndex; struct Ticket{ address payable owner; uint ticketId; uint eventId; } struct Event{ address payable owner; uint eventId; string nam...
if not all tickets have been issued, the buyer automatically buys from the event owner if people want to sell tickets, the buyer automatically buys from the earliest seller if nobody wants to sell yet, the buyer joins the buying queue
function buyTicket(uint _eventId) public payable{ Event storage e = events[_eventId]; require(msg.value == e.ticketPrice, "The value does not match the ticket price."); if(e.ticketIndex < e.numTickets){ issueTicket(e, msg.sender); } else if(e.sel...
6,412,083
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol"; import "./interfaces/IMasterChef.sol"; import "hardhat/console.so...
提现 IMasterChef(masterChef).withdraw(_pid, amountToken);
function withdraw(uint256 _pid) public { uint256 amountToken = stakeAmounts[msg.sender]; IMasterChef(masterChef).withdraw(0, amountToken); IERC20(myToken).safeTransfer(msg.sender, amountToken); stakeAmounts[msg.sender] = 0; }
13,056,678
/* ,▄▓▓██▌ ,╓▄▄▓▓▓▓▓▓▓▓▄▄▄,, ,▓██▓███▓▄▓███▓╬╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▄, ▄█ ▓██╬╣███████╬▓▀╬╬▓▓▓████████████▓█████▄, ...
68 = 4-byte selector + 32 bytes offset + 32 bytes length solhint-disable no-inline-assembly 36 = 32 bytes data length + 4-byte selector 36 = 4-byte selector + 32 bytes integer solhint-disable no-inline-assembly 36 = 32 bytes data length + 4-byte selector
function parse(bytes memory data, string memory prefix) internal pure returns (string memory) { if (data.length >= 4) { bytes4 selector; selector := mload(add(data, 0x20)) } if (selector == _ERROR_SELECTOR && data.length >= 68) { uint256 o...
12,840,479
// SPDX-License-Identifier: BSD-4-Clause pragma solidity 0.8.3; import "./IOddzLiquidityPool.sol"; import "../Libs/DateTimeLibrary.sol"; import "../Libs/ABDKMath64x64.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; abstract contract AbstractOddzPool is Ow...
Updates liquidity provider balance _provider liquidity provider address _amount amount of liquidity added/removed _type Transaction type/
function _updateProviderBalance( address _provider, uint256 _amount, TransactionType _type ) private { if (_type == TransactionType.ADD) liquidityProvider[_provider]._amount += _amount; else liquidityProvider[_provider]._amount -= _amount; liquidityProvider[_prov...
5,430,749
pragma solidity 0.5.15; contract IAugur { function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA...
inject NONSTANDARD NAMING
function MINIMUM_LIQUIDITY585() external pure returns (uint);
2,554,138
./full_match/4/0x5d756f47359fD500b646FBf690f104D10360102b/sources/jb3/ERC202.sol
------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function totalSupply() public view virtual override returns (uint) { return _totalSupply.sub(balances[address(0)]); }
758,420
./partial_match/1/0xa9Ad658D3890222a59c9BE3882F8F2B3FbcF6d38/sources/Moloch.sol
transfer shares to loot
function processGuildKickProposal(uint256 proposalIndex) external { _validateProposalForProcessing(proposalIndex); uint256 proposalId = proposalQueue[proposalIndex]; Proposal storage proposal = proposals[proposalId]; require(proposal.flags[5] == 1, "not kick proposal"); b...
16,127,214
./full_match/1/0x5B458d71a353384087CE1c48dA405D9cab14d155/sources/vesper-strategies/contracts/strategies/frax-lend/FraxLendVesperXy.sol
Accrue and update interest _borrow increases every block. Convert collateral to borrowToken. When _yTokensInProtocol exceeds _yTokensBorrowed from protocol then we have profit from investing borrow tokens. _yTokensHere is profit.
function _rebalance() internal override returns (uint256 _profit, uint256 _loss, uint256 _payback) { fraxLend.addInterest(); uint256 _excessDebt = IVesperPool(pool).excessDebt(address(this)); uint256 _totalDebt = IVesperPool(pool).totalDebtOf(address(this)); uint256 _yTokensBorrowed...
9,703,250
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); ...
1SplitAudit 1split on-chain aggregator/
interface One { function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, ) external view returns( uint256 returnAmount, uint256[] memory distribution ); function getExpectedReturnWi...
1,722,578
./full_match/5/0x49B622913cb4F4C83DF8e7A79f51F76A3761907E/sources/contracts/OLPs.sol
Kills multiple active LP positions epochStrikeToken epoch strike token address lpIndices Index of LP position return Whether LP positions were killed/
function multiKillLPPosition( address epochStrikeToken, uint256[] memory lpIndices ) external nonReentrant returns (bool) { require( getOptionTokenInfo[epochStrikeToken].ssov != address(0), "Epoch strike token was never added to LP" ); require(lpIn...
11,593,775
pragma solidity ^0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract FlightSuretyData is Ownable{ using SafeMath for uint256; /********************************************************************************************/ /* ...
Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/
function setOperatingStatus(bool mode) onlyOwner external{ operational = mode; }
14,097,057
pragma solidity ^0.5.0; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Medical.sol"; contract TestMedical { Medical medical = Medical(DeployedAddresses.Medical()); // Testing the addPatient() function returns true function testUserCanAddRecord() publ...
Testing the number of patients
function testGetNumOfPatients() public { uint returnStatus = medical.getNumPatients(); uint expected = 1; Assert.equal(returnStatus, expected, "Retrieval of patient ID should be 0."); } bool expected = true; Assert.equal(returnStatus, expected, "Retrieval of patient mapp...
12,867,201
// SPDX-License-Identifier: Unlicensed /** 1% fee auto add to the liquidity pool when selling 3% fee auto distribute to all holders 1% fee auto converted to ETH and moved to marketing wallet */ pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 {...
Pause `contract` - pause events. See {ERC20Pausable-_pause}./
function unPauseAddress(address account) external virtual onlyOwner { pausedAddress[account] = false; }
10,318,531
pragma ton-solidity >=0.45.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; import "./Imports.sol"; import "./D4Base.sol"; contract D4Root is ID4Root { uint16 public m_version = 1; ////////////////////////////////////////////////////////////////////////////////////////...
msg.sender.transfer({value: 0, bounce: true, flag: Flags.messageValue});
function _returnIfIntAdm() internal view { if (owner.wid != Sys.ExternalMetaChain) { tvm.rawReserve(address(this).balance - msg.value, 0); } }
15,824,281