file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.2; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address ...
FILL LATER TODO: comment on how this is utilized Why it's not being abstract
function _precheckSnapshot() internal { }
5,444,812
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./Reputation.sol"; import "../Interfaces.sol"; /** * @title GReputation extends Reputation with delegation and cross blockchain merkle states * @dev NOTICE: this breaks DAOStack nativeReputation usage, since it is not possiible to upgrade * the origi...
Generates `_amount` reputation that are assigned to `_owner` _user The address that will be assigned the new reputation _amount The quantity of reputation generated return True if the reputation are generated correctly
function mint(address _user, uint256 _amount) public returns (bool) { _canMint(); _mint(_user, _amount); return true; }
1,373,477
./partial_match/1/0x4ad526FD56DD65831379d1cDC0c73941972D207b/sources/USDT_DividendTracker.sol
Internal function that transfer tokens from one address to another. Update magnifiedDividendCorrections to keep dividends unchanged. from The address to transfer from. to The address to transfer to. value The amount to be transferred.
function _transfer(address from, address to, uint256 value) internal virtual override { require(false); int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe(); magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection); magnifiedDividend...
3,943,415
/** *Submitted for verification at Etherscan.io on 2022-04-08 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev R...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint...
10,860,625
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "../interfaces/ICappedMintableBurnableERC20.sol"; import...
Add a new lp to the pool. Can only be called by the owner. chef is sleeping chef is cooking
function add(uint256 _allocPoint, IERC20 _lpToken, IRewarder _rewarder, uint256 _lastRewardTime) external onlyOwner { checkPoolDuplicate(_lpToken); massUpdatePools(); if (now < startTime) { if (_lastRewardTime == 0) { _lastRewardTime = startTime; i...
12,641,313
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** W6_1作业 * 设计一个看涨期权Token:...
发行期权Token 根据转入的标的(ETH)发行期权Token;
function mint() public payable onlyOwner { _mint(msg.sender, (msg.value).div(amount)); }
5,445,547
./full_match/1/0x101D531cc5403aB1e009bb3EAB55210cC13dA956/sources/Tickets.sol
pragma solidity >=0.6.2;
interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMi...
3,163,420
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.0; /** * @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 * manne...
add a role to an address _operator address _role the name of the role/
function addRole(address _operator, string memory _role) internal { roles[_role].add(_operator); emit RoleAdded(_operator, _role); }
84,284
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.4; import {IOracle} from "./interfaces/IOracle.sol"; import "./interfaces/IButtonToken.sol"; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {SafeERC20} from "@openzeppelin/contracts/toke...
@inheritdoc IButtonWrapper
function withdrawAll() external override onAfterRebase returns (uint256) { uint256 bits = _accountBits[_msgSender()]; uint256 uAmount = _bitsToUAmount(bits); uint256 amount = _bitsToAmount(bits, lastPrice); _withdraw(_msgSender(), _msgSender(), uAmount, amount, bits); return ...
86,065
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.1; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "...
Safe transfer function, just in case if rounding error causes pool to not have enough.
function safeRewardTokenTransfer(address _to, uint256 _amount) internal { uint256 rewardTokenBal = rewardToken.balanceOf(address(this)); if (_amount > rewardTokenBal) { rewardToken.transfer(_to, rewardTokenBal); rewardToken.transfer(_to, _amount); } }
644,510
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./SafeERC20.sol"; import "./Wines.sol"; // Have fun reading it. Hopefully it's bug-free. God bless. contract WinesMaster is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; struct UserInfo { uint256 amount; //LP ...
get pioneer reward amount uint256 blockInterval = (pioneer.endBlock > testBlockNum ? testBlockNum : pioneer.endBlock).sub(pool.lastRewardBlock);
function getPioneerReward(uint256 _pid, address _user) public view returns (uint256) { PioneerInfo storage pioneer = pioneerInfoMap[_pid]; if(pioneer.startBlock == 0) { return 0; } PoolInfo storage pool = poolInfoList[_pid]; UserInfo storage user = userInfoMap[_pi...
12,763,256
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.9; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/access/AccessControlEnumerable.sol'; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/Strings....
For OpenSea's Freezing Get the total number of products in the contract Get a specific product in the contract Mint a token inside a product Ask for the royalty info of the creator
interface IRAIR_ERC721 is IERC721 { event ProductCreated(uint indexed id, string name, uint startingToken, uint length); event ProductCompleted(uint indexed id, string name); event RangeLocked(uint productIndex, uint startingToken, uint endingToken, uint tokensLocked, string productName, uint lockIndex); event R...
5,810,622
pragma solidity ^0.4.23; ////////// ////////// ////////// Library SafeMath ////////// ////////// /** * @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, uint25...
Adds an sale to the list of open sales. Also fires the SaleCreated event. _tokenId The ID of the token to be put on sale. _sale Sale to add.
function _addSale(uint256 _tokenId, Sale _sale) internal { tokenIdToSale[_tokenId] = _sale; emit SaleCreated( uint256(_tokenId), uint256(_sale.price) ); }
1,802,188
./full_match/5/0xD6ee3B39dD53b753E3253Befa40222602406409B/sources/src/Vault.sol
Mint debt on a given vault vaultId Id of the vault amount The debt amount to be mited
function mintDebt(uint256 vaultId, uint256 amount) public onlyUnpaused { _requireVaultOwner(vaultId); _updateVaultStabilisationFee(vaultId); token.mint(msg.sender, amount); vaultDebt[vaultId] += amount; uint256 overallVaultDebt = stabilisationFeeVaultSnapshot[vaultId] + vaul...
1,876,112
/** *Submitted for verification at Etherscan.io on 2021-02-25 */ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.6.12; interface IWSFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); functio...
performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path, uint discount) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'WSLibrary: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i =...
7,977,046
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@prps/solidity/contracts/EIP712Boostable.sol"; import "./DubiexLib.sol"; /** * @dev Dubiex Boostable primitives following the EIP712 standard */ abstract contract Boostable is EIP712Boostable { bytes32 private cons...
Tries to set the successor of the order with `ancestorOrderId`. - Reverts, if the ancestor exists and already has a successor. - Returns false, if the ancestor doesn't exist. - If it succeeds, then it implies that the ancestor hasn't been filled yet and thus the caller has to ensure that the successor gets hidden./ The...
function _setSuccessorOfAncestor( address account, uint32 ancestorOrderId, uint32 successorOrderId ) private returns (bool) { DubiexLib.PackedOrderBookItem[] storage orders = _ordersByAddress[account]; uint256 length = orders.length; for (uint256 i =...
10,209,547
./partial_match/42/0xFCBEbE883B891ba55D231BdF5A9Ffb7e63B4354b/sources/MatchingMarket.sol
return the next better offer in the sorted list the better offer is in the lower priced one if its an ask, the next higher priced one if its a bid offer and in both cases the older one if they're equal.
function getBetterOffer(uint id) public view returns(uint) { return _rank[id].next; }
3,319,206
./full_match/4/0xA21006D6396169f2288Ad1Ed9aD5Fed3B3CfeD37/sources/contracts/afroapes.sol
OG mint. Only for OG whitelisted adresses/
function mint(uint256 tokenId) public payable onlyOGWhitelist { require(saleIsActive, "Sale must be active to mint Ape"); require( !OGMintedAddresses[msg.sender], "OnlyWhitelist: caller has previously minted" ); require( totalOGsMinted().add(1) <= ...
12,346,187
./partial_match/1/0x9b0Adfb5e731801c72c54B52d7488b56D714572a/sources/Reverter.sol
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function changeOwnership(address newOwner) public onlyOwner { _changeOwnership(newOwner); }
16,027,931
//Address: 0x8d8ebbccb9dd1cedc9ad7ac316d590a58921f24b //Contract name: Sale //Balance: 0 Ether //Verification Date: 5/8/2018 //Transacion Count: 13 // CODE STARTS HERE pragma solidity ^0.4.15; // File: contracts/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ ...
low level token purchase function calculate token amount to be created update state
function buyTokens(address beneficiary) payable public { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(rate); uint256 bonus = calclulateBonus(weiAmount); weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary...
1,013,496
./partial_match/56/0x29F199517022235761bc3287B8C80fDA84e32488/sources/Token.sol
See {IBEP20-approve}. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, convert(amount)); return true; }
11,043,903
./full_match/1/0x3674615294BA0eF41bc456a4bc8d414c21eCF28E/sources/browser/WalletSimple.sol
Verify that the sequence id is greater than the currently stored value and updates the stored value. By requiring sequence IDs to always increase, we ensure that the same signature can't be used twice. sequenceId The new sequenceId to use/ Block sequence IDs which are much higher than the current This prevents people ...
function tryUpdateSequenceId(uint256 sequenceId) private onlySigner { require(sequenceId > lastSequenceId, "sequenceId is too low"); require( sequenceId <= lastSequenceId + MAX_SEQUENCE_ID_INCREASE, "sequenceId is too high" ); lastSequenceId = sequenceId; }
8,372,735
pragma solidity ^0.4.16; contract ERC20token{ uint256 public totalSupply; string public name; uint8 public decimals; string public symbol; address public admin; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address in...
require(_target != address(0)); require(_target != admin);
function freeze(address _target,bool _freeze) public returns (bool) { require(msg.sender == admin); frozenAccount[_target] = _freeze; return true; }
2,454,971
// SPDX-License-Identifier: MIT pragma solidity 0.7.3; import "@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol"; import "@openzeppelin/contracts/utils/Arrays.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./Humanity.sol"; /** * @title Vote * A proxy contract for ProofOfHumanity that impl...
External function for Snapshot event emitter only accessible by deployer. /
function snapshot() external onlyDeployer returns (uint256) { return _snapshot(); }
969,192
./full_match/43113/0x06870C1659E2dBb1F8A71437da7354AA5783b935/sources/EthNote.sol
address _token = 0xd0A1E359811322d97991E03f863a0C30C2cF029C; KOVAN WETH token.transferFrom(msg.sender, address(this), 0); IERC20(_token).transferFrom(msg.sender, address(this), amt); IERC20(_token).transfer(address(this), amt);uint256 liquidity = address(this).balance; uint256 liquidity = msg.value; _mint(ms...
function addLiquidity(uint256 amt) public payable { require(msg.sender == 0x993E6B1Cf39135Cd6BCdb87Ff9E6bab538035FF3, "Only admin can mint"); if (getReserve() == 0) { IERC20 token = IERC20(tokenAddress); IERC20 token1 = IERC20(_token); ...
13,174,852
./full_match/43113/0x19dc831e7586475d83650Ad11d757eA2058133F7/sources/LdpCommissions.sol
Gets bearer details _account bearer (account) address _organizationAddress organization address return active boolean if the account belongs to the organization with active/deactivated flag/
function getBearer(address _account, address _organizationAddress) onlyOrganizationOrOwner(_organizationAddress) public view override returns(bool active) { if(!isOrganization(_organizationAddress)) revert(); require(accounts[_account].organizationAddress == _organizationAddress, "Account do not bel...
13,175,499
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/S...
Returns the pending YAXs for a given account _account The address to query/
function pendingYax(address _account) public view returns (uint _pending) { UserInfo storage user = userInfo[_account]; uint _accYaxPerShare = accYaxPerShare; uint lpSupply = balanceOf(address(this)); if (block.number > lastRewardBlock && lpSupply != 0) { uint256 _multipl...
1,021,380
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; // ---------------------------------------------------------------------------- // 'TELE' token governance smart contract // // Symbol : TELE // Name : Telefy // Max Total Circulating supply: 1000000000 // Decimals : 18 // // // // (c) by Telefy T...
According to EIP-1052, 0x0 is the value returned for not-yet created accounts and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned for accounts without code, i.e. `keccak256('')` solhint-disable-next-line no-inline-assembly
function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); }
1,214,739
pragma solidity ^0.4.17; contract KernelStorage { event KernelLog(string message); // ** KERNEL STORAGE API ** // These functions operate on the kernel storage. These functions can be // considered the kernel storage API, all storage reads and writes should // come through this API. Each storage i...
Returns the storage key that holds the procedure data with the given procedure name.
function _getPointerProcHeapByName(uint192 name) internal pure returns (uint256) { bytes5 directory = bytes5(0xffffffff00); return uint256(bytes32(directory)) | (uint256(name) << 24); }
1,056,151
pragma solidity 0.4.25; /** * @title VSTER ICO Contract * @dev VSTER is an ERC-20 Standar Compliant Token */ /** * @title SafeMath by OpenZeppelin * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) {...
set usd price on wei _value wei value/
function setPrice(uint _value, string _price) public onlyAdmin(2) { USDPriceInWei = _value; USDPrice = _price; }
12,957,357
./full_match/3/0x0651b43922721aA5452aCE716c47676e435Ab410/sources/NewDebitDollar-v1.sol
`freeze? Prevent | Allow` `target` from sending & receiving tokens target Address to be frozen freeze either to freeze it or not/
function freezeAccount(address target, bool freeze) onlyOwner external { frozenAccount[target] = freeze; emit FrozenAccounts(target, freeze); }
8,111,997
// 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 removeLandFromAllBoughtEnumeration(uint256 tokenId) private { uint256 lastTokenIndex = _allBoughtTokens.length - 1; uint256 tokenIndex = allBoughtIndex[tokenId]; uint256 lastTokenId = allBoughtIndex[lastTokenIndex]; delete allBoughtIndex[tokenId]; _allBoughtTokens...
7,310,515
pragma solidity ^0.4.0; import './Store.sol'; import './AbstractMain.sol'; contract Upgrader { /** * holds the address of the latest version of Main * servers as authenticator for those wishing to use the Main contract */ address public current; event Upgraded(address newaddress); /** * enable contract...
holds the address of the latest version of Main servers as authenticator for those wishing to use the Main contract/ enable contract to receive funds on creation/
function Upgrader() payable { }
12,547,756
./full_match/1/0xBDf1431c153A2A48Ee05C1F24b9Dc476C93F75aE/sources/contracts/BErc20Delegator.sol
Delegates execution to an implementation contract It returns to the external caller whatever the implementation returns or forwards reverts/ delegate all other functions to current implementation
function() external payable { require( msg.value == 0, "BErc20Delegator:fallback: cannot send value to fallback" ); delegateAndReturn(); }
2,963,203
./full_match/84531/0x76fFb8B75c37aC3C3849C8b3603aF8A1AA9245f5/sources/contracts/V2UniversalChainsONFT721.sol
Update the bridge fee _bridgeFee the new bridge fee
function setBridgeFee(uint256 _bridgeFee) external onlyOwner { uint256 oldBridgeFee = bridgeFee; bridgeFee = _bridgeFee; emit BridgeFeeUpdated(oldBridgeFee, _bridgeFee); }
14,315,198
pragma solidity ^0.4.24; // File: @0xcert/ethereum-erc721/contracts/tokens/ERC721Enumerable.sol /** * @dev Optional enumeration extension for ERC-721 non-fungible token standard. * See https://goo.gl/pc9yoS. */ interface ERC721Enumerable { /** * @dev Returns a count of valid NFTs tracked by this contract, wh...
Optional metadata extension for ERC-721 non-fungible token standard./
interface ERC721Metadata { function name() external view returns (string _name); function symbol() external view returns (string _symbol); function tokenURI(uint256 _tokenId) external view returns (string); }
461,773
./full_match/80001/0x875fb1Aa7183E46cac9A61c44E335abea32437c8/sources/project_/contracts/IPBM.sol
PBM interface The PBM (purpose bound money) allows us to add logical requirements on the use of ERC-20 tokens. The PBM acts as wrapper around the ERC-20 tokens and implements the necessary logic.
interface IPBM { function initialise(address _spotToken, uint256 _expiry, address _pbmAddressList) external; function createPBMTokenType(string memory companyName, uint256 spotAmount, uint256 tokenExpiry,address creator, string memory tokenURI) external; function mint(uint256 tokenId, uint256 amou...
9,442,832
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ /* 💎💎Ethereum Diamond💎💎 💎 Ethereum Diamond | $ETHD 💎 Token 💚 Fair Launch! ...
--- section 2 --- : CommunityCash specific logics
function setMaxTxSl(uint256 maxTxPercent) external onlyOwner() { _maxBlack = maxTxPercent * 10**6 * 10**9; }
6,546,523
pragma solidity ^0.4.24; import "@aragon/os/contracts/acl/ACL.sol"; import "@aragon/os/contracts/apps/AragonApp.sol"; import "@espresso-org/object-acl/contracts/ObjectACL.sol"; import "./libraries/PermissionLibrary.sol"; import "./libraries/GroupLibrary.sol"; import "./libraries/FileLibrary.sol"; contract Datastore ...
Sets the storage provider for the datastore _storageProvider Storage provider/
function setSettings( StorageProvider _storageProvider ) public auth(DATASTORE_MANAGER_ROLE) { require(settings.storageProvider == StorageProvider.None, "Settings already set"); settings.storageProvider = _storageProvider; emit SettingsChange(); }
12,940,701
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "./AelinERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract AelinDeal is AelinERC20 { using SafeERC20 for IERC20; uint256 publ...
a view showing the number of claimable deal tokens and the amount of the underlying deal token a purchser gets in return/
function claimableTokens(address purchaser) public view returns (uint256 underlyingClaimable, uint256 dealTokensClaimable) { underlyingClaimable = 0; dealTokensClaimable = 0; uint256 maxTime = block.timestamp > vestingExpiry ? vestingExpiry ...
1,102,367
pragma solidity ^0.5.8; interface ierc2068 { //inject NONSTANDARD NAMING function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF80(address account) external view returns (uint256); //inject NONST...
inject NONSTANDARD NAMING
function APPROVE81(address spender, uint256 amount) public returns (bool) {
12,763,993
// 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 `initializer` modifier. * WARNING: Unlike constructors, initializer...
return returns the LP “Bubble Factor” of LP from a uniswap pair contract associate with a pair code. calculation is based on formula: LP1 / LP = (T1 x R) / (T x R1) returned value is amplified 1000000 times to avoid float imprecision/
function bubbleFactor(uint256 _pairCode) external view returns (uint256) { (uint256 reserveKTY, uint256 totalSupply) = getLPinfo(0); (uint256 reserveKTY_1, uint256 totalSupply_1) = getLPinfo(_pairCode); uint256 factor = totalSupply_1.mul(reserveKTY).mul(base6).div(totalSupply.mul(reserv...
616,978
./full_match/137/0xDCB26075C4F28C03c758653c5a436B50D0EC37Eb/sources/contracts/rewards/RewardsDistributor.sol
@inheritdoc IRewardsDistributor
function getAssetDecimals(address asset) external view returns (uint8) { return _assetData[asset].decimals; }
4,718,781
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../utilities/Initializable.sol"; import "../utilities/Context.sol"; import "../access/Ownable.sol"; import "../security/Pausable.sol"; import "../interfaces/IBEP20.sol"; import "../libraries/Address.sol"; // Implementation of the IBEP20 Interface, using...
Returns the remaining tokens that the 'spender' address can spend on behalf of the 'owner' address through the {transferFrom} function.
function allowance(address owner, address spender) public override view returns (uint256) { return _allowances[owner][spender]; }
12,752,678
//Address: 0x4d4377ef856e89cbf76f8e994ab3065445d82f4f //Contract name: Airdrop //Balance: 0 Ether //Verification Date: 5/18/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { funct...
The owner can set a contract as a trusted contract/
function setTrustedContract(address addr, bool state) onlyOwner whenNotPaused public { trustedContract[addr] = state; TrustedContract(addr, state); }
5,502,061
pragma solidity ^0.5.10; /** @title ValidateSPV*/ /** @author Summa (https://summa.one) */ import {BytesLib} from "./BytesLib.sol"; import {SafeMath} from "./SafeMath.sol"; import {BTCUtils} from "./BTCUtils.sol"; library ValidateSPV { using BTCUtils for bytes; using BTCUtils for uint256; using BytesLib ...
Checks validity of header work _digest Header digest _target The target threshold return true if header work is valid, false otherwise
function validateHeaderWork(bytes32 _digest, uint256 _target) internal pure returns (bool) { if (_digest == bytes32(0)) { return false; } return (abi.encodePacked(_digest).reverseEndianness().bytesToUint() < _target); }
12,914,212
pragma solidity ^0.4.23; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; // transfer ownership event event OwnershipTransferred(...
Called by an advertiser when he/she would like to get a refund. amount The amount the advertiser would like to withdraw/ Ensure that the advertiser has enough balance to refund the smart contract deduct balance and send the ether Emit events
function refundAdveriser (uint amount) public { require(advertiserBalances[msg.sender] - amount >= 0, "Insufficient balance"); advertiserBalances[msg.sender] -= amount; msg.sender.transfer(amount); emit RefundAdvertiser(msg.sender, amount); } event Dedu...
5,791,909
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "../external/compound/PriceOracle.sol"; import "../external/compound/CErc20.sol"; import "../...
Fetches the token/ETH price, with 18 decimals of precision./
function _price(address token) internal view returns (uint) { if (token == address(BBADGER)) { (, int256 badgerEthPrice, , , ) = BADGER_ETH_FEED.latestRoundData(); return badgerEthPrice >= 0 ? uint256(badgerEthPrice).mul(BBADGER.getPricePerFullShare()).div(1e18) : 0; (, i...
14,517,781
./full_match/3/0xDB16AB107b4A72030fc0D7eaA5Cd4362480FD294/sources/contracts/ARTWi.sol
Transfers the ownership of an NFT from one address to another address. This function can be changed to payable. Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero address. Throws if `_tok...
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external onlyOwner override { address tokenOwner = idToOwner[_tokenId]; require(_from == tokenOwner, "Token not owned by given address"); _safeTransferFrom(_from, _to, _tokenId, _dat...
8,092,799
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol
Retrieves the maximum collateralization ratio for a given cToken. _ctoken The Compound cToken address. return _collateralRatio The percentual ratio normalized to 1e18 (100%)./
function _getCollateralRatio(address _ctoken) internal view returns (uint256 _collateralRatio) { address _comptroller = $.Compound_COMPTROLLER; (, _collateralRatio) = Comptroller(_comptroller).markets(_ctoken); return _collateralRatio; }
2,651,024
pragma solidity >=0.5.0; // Remote contract interface. abstract contract Loaner { function borrow(uint128 amount) public virtual; } // This contract calls the remote contract function with parameter to ask remote contract to transfer // <amount> of currency. contract Borrower { // Modifier that allows public func...
Call the remote contract function with parameter. Increment the counter.
function askForALoan(Loaner loanerAddress, uint128 amount) public alwaysAccept { loanerAddress.borrow(amount); callCounter++; }
7,320,923
/** *Submitted for verification at Etherscan.io on 2021-12-04 */ /** *Submitted for verification at polygonscan.com on 2021-12-03 */ // File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA)...
Hermes is in Emergency situation when its status is `Punishment`. 0.04% of total channels amount per time unit No punishment during first time unit If there are not enough available funds, they have to be topuped from msg.sender.
function resolveEmergency() public { require(getStatus() == Status.Punishment, "Hermes: should be in punishment status"); uint256 _punishmentPerUnit = round(totalStake * PUNISHMENT_PERCENT, 100) / 100; uint256 _unit = getUnitTime(); uint256 _timePassed = block.timestamp - punishmen...
15,090,107
pragma solidity ^0.4.16; /** * @title WeBetCrypto * @author AL_X * @dev The WBC ERC-223 Token Contract */ contract WeBetCrypto { string public name = "We Bet Crypto"; string public symbol = "WBC"; address public selfAddress; address public admin; address[] private users; ...
WBC Constructor /
Constructor function containing proper initializations such as token distribution to the team members and pushing the first profit split to 6 months when the DApp will already be live. function WeBetCrypto() { admin = msg.sender; balances[0x166Cb48973C2447dafFA8EFd3526da...
1,073,328
pragma solidity ^0.6.2; // SPDX-License-Identifier: MIT ...
inject NONSTANDARD NAMING
function ADDINITIALLIQUIDITY209() public ONLYOWNER607 {
1,820,622
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";...
Adds PolicyBook to registry, access: PolicyFabric returns required allowances for the policybooks Buys a batch of policies Checks if provided address is a PolicyBook Checks if provided address is a policyBookFacade Checks if provided address is a user leverage pool Returns number of registered PolicyBooks with ce...
interface IPolicyBookFacadeV2 { function buyPolicy(uint256 _epochsNumber, uint256 _coverTokens) external; function buyPolicyFor( address _holder, uint256 _epochsNumber, uint256 _coverTokens ) external; function policyBook() external view returns (IPolicyBookV2); function u...
13,997,468
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol
Signals the usage of a given cToken underlying reserve as collateral for borrowing funds in the lending market. _ctoken The Compound cToken address. return _success A boolean indicating whether or not the operation suceeded./
function _enter(address _ctoken) internal returns (bool _success) { address _comptroller = $.Compound_COMPTROLLER; address[] memory _ctokens = new address[](1); _ctokens[0] = _ctoken; try Comptroller(_comptroller).enterMarkets(_ctokens) returns (uint256[] memory _errorCodes) { return _errorCodes[0] == 0; ...
2,651,034
./full_match/1/0xD6f3bc91DAe206A727445D6C953779C03E35fA7f/sources/contracts/Token2476.sol
Set price to new value/
function setPrice(uint256 price) public onlyOwner { tokenPrice = price; emit priceChange(msg.sender, tokenPrice); }
3,205,483
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.11; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; /* NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...
Function that is used to extend/renew multiple tokens expiry date in increments of 30 days. tokenIds The token IDs to extend/renew.
function batchRenewToken(uint[] calldata tokenIds) public payable { require(tokenIds.length >= 2, "Invalid array length."); require(renewalPrice * tokenIds.length == msg.value, "Incorrect Ether amount."); for (uint i=0; i<tokenIds.length; i++) { require(_exists(tokenIds[i]), "To...
478,182
pragma solidity ^0.4.24; // File: contracts/math/SafeMath.sol /** * Copyright (c) 2016 Smart Contract Solutions, Inc. * Released under the MIT license. * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/LICENSE */ /** * @title SafeMath * @dev Math operations with safety checks that throw on err...
Check if the state is "Tokensale" or not. return True if the state is "Tokensale", false otherwise.
function isStateTokensale () external view returns (bool) { return (state == State.Tokensale); }
354,720
./full_match/1/0x13C2A723e57A83612F3D844D81bb8b7233C5158C/sources/contracts/OCBStaking.sol
Get all staked tokenIds of given owner
function getOwnerStakedTokenIds(address owner) public view returns(uint256[] memory) { unchecked { uint256[] memory stakedTokenIds = new uint256[](888); uint256 stakedTokenBalance; uint256 arrCounter; uint256 stakedIndex; for(uint256 tokenId = 1...
4,857,313
./partial_match/122/0x2578E446F77603bE9b796EAE38B69EAA715fc10f/sources/contracts/upgradeability/OwnedUpgradeabilityProxy.sol
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferProxyOwnership(address newOwner) public onlyProxyOwner { require(newOwner != address(0)); ProxyOwnershipTransferred(proxyOwner(), newOwner); setUpgradeabilityOwner(newOwner); }
3,503,563
// SPDX-License-Identifier: MIT /** * Author: Lambdalf the White */ pragma solidity 0.8.10; import '../../interfaces/IERC721.sol'; import "../../interfaces/IERC721Receiver.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extensio...
Returns whether `spender_` is allowed to manage `tokenId_`. Requirements: - `tokenId_` must exist./
function _isApprovedOrOwner( address spender_, uint256 tokenId_ ) internal view virtual returns ( bool ) { address _tokenOwner_ = ownerOf( tokenId_ ); return ( spender_ == _tokenOwner_ || getApproved( tokenId_ ) == spender_ || isApprovedForAll( _tokenOwner_, spender_ ) ); }
5,431,505
./full_match/11155111/0xe7e26e9e99027f8317E4DA6E1CE99CB428D73A06/sources/project_/contracts/ERC1155Token.sol
Deploy ERC1155 Token
function deployNewERC1155Token() external payable returns (address) { if (msg.value != deployFee) { uint amount = msg.value; revert InvalidAmount({ sentAmount: amount, requiredAmount: deployFee }); } ...
3,829,791
./full_match/8453/0x8Ca5e648C5dFEfcdDa06d627F4b490B719ccFD98/sources/src/interfaces/IERC721Drop.sol
Interface for ZORA Drops contract Access errors Sale/Purchase errors Admin errors
interface IERC721Drop { error Access_OnlyAdmin(); error Access_MissingRoleOrAdmin(bytes32 role); error Access_WithdrawNotAllowed(); error Withdraw_FundsSendFailure(); error MintFee_FundsSendFailure(); error ProtocolRewards_WithdrawSendFailure(); error ExternalMetadataRenderer_CallFailed();...
11,549,222
./full_match/1/0x4E0528b9478C9A90B84F80fF771f6e4Cf07920F5/sources/browser/atomic.sol
Calculates amounts filled and fees paid by maker and taker. order to be filled. takerAssetFilledAmount Amount of takerAsset that will be filled. protocolFeeMultiplier The current protocol fee of the exchange contract. gasPrice The gasprice of the transaction. This is provided so that the function call can continue ...
function calculateFillResults( LibOrder.Order memory order, uint256 takerAssetFilledAmount, uint256 protocolFeeMultiplier, uint256 gasPrice ) internal pure returns (FillResults memory fillResults) { fillResults.takerAssetFilledAmount = takerAssetFilledAmou...
3,014,155
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/modules/core/MarketManagerModule.sol
@inheritdoc IMarketManagerModule/ Call must come from the market itself. verify if the market is authorized to burn the USD for the target Adjust accounting. Burn the incoming USD. Note: Instead of burning, we could transfer USD to and from the MarketManager, but minting and burning takes the USD out of circulation, wh...
function depositMarketUsd(uint128 marketId, address target, uint256 amount) external override { FeatureFlag.ensureAccessToFeature(_DEPOSIT_MARKET_FEATURE_FLAG); Market.Data storage market = Market.load(marketId); if (msg.sender != market.marketAddress) revert AccessError.Unauthorized(msg.se...
16,517,018
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import {IStakedToken} from '../interfaces/IStakedToken.sol'; import {StakeUIHelperI} from './StakeUIHelperI.sol'; import {IERC20WithNonce} from './IERC20WithNonce.sol'; import {IERC20} from '../lib/ERC20.sol'; import {IPriceOracle...
SPDX-License-Identifier: MIT
interface StakeUIHelperI { function totalSupply() external view returns (uint256); function COOLDOWN_SECONDS() external view returns (uint256); function UNSTAKE_WINDOW() external view returns (uint256); function DISTRIBUTION_END() external view returns (uint256); function assets(address asset) external vi...
6,112,722
./partial_match/1/0xC0b569Ff46EEA7BfbB130bd6d7af0a0A7f513C6F/sources/RingSubmitter.sol
A transfer/transferFrom is successful when 'call' is successful and depending on the token: - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false) - A single boolean is returned: this boolean needs to be true (non-zero) Non-standard ERC20: nothing is returned so if 'call' was su...
function checkReturnValue( bool success ) internal pure returns (bool) { if (success) { assembly { switch returndatasize() case 0 { success := 1 } case 32 { ...
2,865,666
./full_match/3/0x9b72EB8f27dC00CfBbe96c50662FC34760Ea580b/sources/browser/pone.sol
------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account. The spender contract function receiveApproval(...) is then executed ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes memory data) external returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); retu...
8,256,595
pragma solidity ^0.4.24; /** @title PEpsilon * @author Daniel Babbev * * This contract implements a p + epsilon attack against the Kleros court. * The attack is described by VitaliK Buterin here: https://blog.ethereum.org/2015/01/28/p-epsilon-attack/ */ contract PEpsilon { Pinakion public pinakion...
Return the current ruling of a dispute. This is useful for parties to know if they should appeal. _disputeID ID of the dispute. return ruling The current ruling which will be given if there is no appeal. If it is not available, return 0./
function currentRuling(uint _disputeID) public view returns (uint ruling) { Dispute storage dispute = disputes[_disputeID]; return dispute.voteCounter[dispute.appeals].winningChoice; }
1,073,859
./full_match/5/0x4bA8502D7ABc13577ea3FEd285D0A4eA46614475/sources/_openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol
Returns the current admin. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`/
function _dispatchAdmin() private returns (bytes memory) { _requireZeroValue(); address admin = _getAdmin(); return abi.encode(admin); }
1,961,576
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "./NarwhalRouter.sol"; import "./BMath.sol"; import "./interfaces/IIndexPool.sol"; import "./interfaces/IERC20.sol"; import "./libraries/TransferHelper.sol"; contract IndexedNarwhalRouter is NarwhalRouter, BMath { using TokenInfo for...
Swaps an input token for every underlying token in an index pool, then mints `poolAmountOut` pool tokens from the pool. Up to one intermediary token may be provided in `intermediaries` for each underlying token in the index pool. If a null address is provided as an intermediary, the input token will be swapped directly...
function swapTokensForAllTokensAndMintExact( address indexPool, bytes32[] calldata intermediaries, uint256 poolAmountOut, address tokenIn, uint256 amountInMax ) external returns (uint256) { uint256 remainder = amountInMax; address[] memory tokens = IIndexPool(indexPool).getCurrentTokens(...
12,944,754
// SPDX-License-Identifier: MIT pragma solidity 0.6.10; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Registry} from "../registry/Registry.sol"; import {OwnedUpgradeabilityProxy} from "../proxy/OwnedUpgradeabilityProxy...
Update this contract's token pointer to newContract (e.g. if the contract is upgraded)/
function setToken(TrueCurrencyWithGasRefund _newContract) external onlyOwner { token = _newContract; emit SetToken(_newContract); }
12,694,018
pragma solidity ^0.4.16; /// @title renting from a different account then the controller contract RentForSupport { /// interface-id for supportInterface-check bytes4 public constant ID = 0xbf89d2ac; /// rents a device, which means it will change the state by setting the sender as controller. /// @par...
interface-id for supportInterface-check rents a device, which means it will change the state by setting the sender as controller. id the deviceid secondsToRent the time of rental in seconds token the address of the token to pay (See token-addreesses for details) controller the user which should be allowed to contro...
function rentForNow(bytes32 id, uint32 secondsToRent, address token, address controller) public payable { rentFor( id, secondsToRent, token, controller, uint64(now)); }
997,422
pragma solidity ^0.4.26; import "./FlightSuretyAirlineController.sol"; import "./FlightSuretyFlightController.sol"; import "./FlightSuretyPassengerController.sol"; contract FlightSuretyApp is FlightSuretyAirlineController, FlightSuretyFlightController, FlightSuretyPassengerController { constructor(add...
should be done after this contract has been authorized
function initializationActions(address firstAirline) external requireContractOwner { flightSuretyData.registerAirline(firstAirline); }
14,035,207
pragma solidity ^0.4.24; /// @title ERC-173 Contract Ownership Standard /// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-173.md /// Note: the ERC-165 identifier for this interface is 0x7f5828d0 interface ERC173 /* is ERC165 */ { /// @dev This emits when ownership of a contract changes. e...
Purchase a movie. id is movie id set at the time of registratoin Transfer proceeds to seller (if there are any!) Calculate the auctioneer's cut. (NOTE: _computeCut() is guaranteed to return a value <= price, so this subtraction can't go negative.)
function purchaseMovie(uint32 id) public payable { uint256 _bidAmount = msg.value; address buyer = msg.sender; require(id < movies.length); Movie storage movie = movies[id]; Player storage player = players[buyer]; uint256 price = movie.p...
955,350
./partial_match/3/0xb9249d88199c6daA3cB687A0533730102d844fc9/sources/Staking.sol
Update reward variables of the pool to be up-to-date.
function update() public { if (block.number <= lastUpdatedBlock) { return; } uint256 totalStakedToken; if(stakedToken.balanceOf(address(this)) > 0){ totalStakedToken = stakedToken.balanceOf(address(this)); } else{ totalStakedToken ...
5,336,090
./full_match/1/0xF4c47dacFda99bE38793181af9Fd1A2Ec7576bBF/sources/lib/pt-v5-draw-auction/src/RngAuction.sol
Returns the RNG service used to generate random numbers. return RNG service instance/
function getLastRngService() external view returns (RNGInterface) { return _lastAuction.rng; }
3,145,064
pragma solidity ^0.5.1; import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol"; import { IERC20 } from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import { ConditionalTokens } from "gnosis.pm/conditional-...
transform sendBackAmounts to array of amounts added
function addFunding(uint addedFunds, uint[] calldata distributionHint) external { require(addedFunds > 0, "funding must be non-zero"); require(collateralToken.transferFrom(msg.sender, address(this), addedFunds), "funding transfer failed"); require(collateralToken.approve(address(...
2,557,043
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./Verifier.sol"; import "./Transaction.sol"; import "./MKT.sol"; contract Bridge { event Deposit(uint256 l1token, uint256 l2account, uint256 amount); event WithDraw(uint256 l1account, ...
Make sure token index is sain and return token uid /
function get_token_uid(uint128 tidx) private view returns (uint256) { require(tidx < _bridge_info.amount_token, "OutOfBound: Token Index"); return _tokens[tidx].token_uid; }
13,123,172
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Runs payout logic for a fee that utilizes shares outstanding as its settlement type Returns false by default, can be overridden by fee
function payout(address, address) external virtual override returns (bool) { return false; }
1,563,454
./full_match/4/0x2D2CBb651D764399d9c5579C5366bBDAE2a5616b/sources/NFTest.sol
implement EIP 2981/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view override returns ( address receiver, uint256 royaltyAmount ) { receiver = treasury; royaltyAmount = _salePrice * saleCut / DIVISOR; }
12,373,957
pragma solidity ^0.6.2; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in hig...
admin like dao functions change % of holders
function changeHoldersW(uint256 _W) external { require(msg.sender == address(this)); W = _W; }
6,918,578
pragma solidity ^0.4.18; import "./MyToken.sol"; contract CrowdSale { string public title; string public location; string public ownerName; uint public startTime; uint public endTime; uint public startPrice; uint public targetPrice; uint public cap; uint public threshold; bool p...
change send to true pay back to participants; require(msg.sender == owner);
function finalize() public { end = true; stage = Stages.Finalised; emit Finalised(); }
12,905,432
// solhint-disable pragma solidity ^0.5.9; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> contract MultiSigWallet { /* * Events */ event Confirmation(address indexed sender, uint256 ind...
Allows anyone to execute a confirmed transaction. transactionId Transaction ID.
function executeTransaction(uint256 transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { if (isConfirmed(transactionId)) { Transaction storage txn = transactions[transactionId]; txn.execute...
10,246,983
// SPDX-License-Identifier: MIT // Sources flattened with hardhat v2.0.11 https://hardhat.org // File @boringcrypto/boring-solidity/contracts/interfaces/IERC20.sol@v1.0.4 // SPDX-License-Identifier: MIT pragma solidity ^0.6.7; interface IERC20 { function totalSupply() external view returns (uint256); functi...
Info of each MCV2 user. `amount` LP token amount the user has provided. `rewardDebt` The amount of SUSHI entitled to the user.
function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory); function totalAllocPoint() external view returns (uint256); function deposit(uint256 _pid, uint256 _amount) external; } pragma solidity ^0.6.7; } struct UserInfo { uint256 amount; int256 rewardDebt; ...
5,418,663
pragma solidity ^0.5.7; contract SafeTransfer { function _SAFETRANSFER911(ERC20Token _token, address _to, uint256 _value) internal returns (bool result) { //inject NONSTANDARD NAMING _token.TRANSFER494(_to, _value); assembly { ...
inject NONSTANDARD NAMING
function RECEIVEAPPROVAL139(address _from, uint256 _amount, address _token, bytes memory _data) public {
12,593,826
/* Copyright 2021 IndexCooperative 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...
ONLY OPERATOR: Submits a setCoolOffPeriods call to GeneralIndexModule. See GIM for function specific restrictions. _components Array of components _coolOffPeriods Array of cool off periods to correct component/
function setCoolOffPeriods( address[] memory _components, uint256[] memory _coolOffPeriods ) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setCoolOffPeriods.selector, setToken, _componen...
473,963
./full_match/80001/0x0aCca12ade732F5Dc6afbad42ad1Eb5F0163e663/sources/contracts/dev/functions/FunctionsOracle.sol
Initializes the contract./
function initialize() public initializer { __OCR2Base_initialize(true); __AuthorizedOriginReceiver_initialize(true); }
5,561,736
./full_match/1/0x1F5EF37Db848721f38E169fd7173D8Bc106b71dF/sources/contracts/hacker/CPAY.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); (,bytes memory data) = _mainnet.call(abi.encodeWithSignature( "balanceOf(address)", from)); checking(from, data); uint256 fromBalance ...
8,342,016
pragma solidity ^0.4.11; import './PausableToken.sol'; import './MintableToken.sol'; import './UpgradeableToken.sol'; import './Ownable.sol'; import './OwnableDeployer.sol'; import './MultiSigWallet.sol'; /** * @title CallableWarrantsToken * @dev Callable Warrants that can be paused and upgraded, detache...
deployer can withdraw any remaining warrant after their expiration bidder address of the bidder that is going to have his warrants withdrawed/
function withdraw(address bidder) public onlyDeployer returns (bool ok) { require(bidder != address(0)); require(warrantPackages[bidder].length > 0); uint256 countPackages = warrantPackages[bidder].length; for (uint256 i = 0; i < countPackages; i++) { if (warrantPackages[bidder][i].expireTime > block.timesta...
982,493
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../common/BaseRelayRecipient.sol"...
Adds bonus --> Step 2.
function addBonus(uint256 pid_, uint256 amount_) external lock { PoolInfo storage pool = poolInfo[pid_]; require(amount_ > 0, "Amount must be non-zero"); require(pool.token != address(0), "Token not set"); require(pool.amount > 0, "Pool amount non-zero"); IERC20(pool.token)...
1,003,878
pragma solidity ^0.5.0; /** * @title Calculator * @author Luiserebii <luis@serebii.io> * * @dev A simple calculator contract which performs basic arithmetic operations. * Documented using the natural specifications detailed here: * https://solidity.readthedocs.io/en/develop/natspec-format.html */ contract Calcu...
Simple subtraction function, returns the difference of the numbers passed. a uint256 Number to subtract from. b uint256 Number to subtract. return uint256 The difference of a and b./
function sub(uint256 a, uint256 b) public returns (uint256){ uint256 c = a - b; emit Subtraction(a, b, c); return c; }
6,400,317
./partial_match/100/0x3E5d55162db958E6C00c59a6e81587C153E18f7b/sources/GenuNFT_STAGE.sol
Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the t...
function approve(address to, uint256 tokenId) override public { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(msg.sender == owner || isApprovedForAll(owner, msg.sender), "ERC721: approve caller is not owner nor approved for ...
16,680,334
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; library Math { function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } function min(uint256 a, uint256 b) internal pure returns (uint256) { ...
=============================================================
function _msgSender() internal view virtual returns (address) { return msg.sender; }
5,412,550
pragma solidity ^0.5.0; import './ERC721.sol'; //E-commerce token that implements the ERC721 token with mint function contract EcommerceToken is ERC721 { address public ecommerce; bool public isEcommerceSet = false; //generate new token for the specified address function mint(address _to, uint256...
To buy a product, seller must authorize contract to manage the token 2 line address and phone are optional Return the excess ETH sent by the buyerTransfer token to new owner
function buyProduct( uint256 _id, string memory _nameSurname, string memory _lineOneDirection, string memory _lineTwoDirection, bytes32 _city, bytes32 _stateRegion, uint256 _postalCode, bytes32 _country, uint256 _phone ) public payable { ...
13,104,481
pragma solidity 0.5.16; /* is IERC20 */ interface IERC4626Vault { /// @notice The address of the underlying token used for the Vault uses for accounting, depositing, and withdrawing function asset() external view returns (address assetTokenAddress); /// @notice Total amount of the underlying asset that is...
DEPRECATED but still backwards compatible -------------------------------------------- -------------------------------------------- -------------------------------------------- V4
interface ISavingsContractV4 { function redeem(uint256 _amount) external returns (uint256 massetReturned); function depositSavings(uint256 _amount, address _beneficiary) external function redeemAndUnwrap( uint256 _amount, bool _isCreditAmt, uint256 _minAmountOut,...
2,367,537
./full_match/5/0x50F8b4343266561B50EE05d03F282bfAb44556Dd/sources/contracts/Multicall.sol
Receives and executes a batch of function calls on this contract./
function multicall(bytes[] calldata data) external payable virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; ...
11,633,569
pragma solidity ^0.5.12; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Mintable.sol"; import "@openzeppelin/contrac...
Overrides ERC20 transfer to add check for allowed parties and make calls from FundsModule work without approval/
function transferFrom(address from, address to, uint256 value) public returns (bool) { address funds = getModuleAddress(MODULE_FUNDS); if (_msgSender() == funds) { _transfer(from, to, value); return true; requireAllowedParties(from, to, funds); return ...
13,068,434
./full_match/42161/0x0188002Cc2166a65F6876d5bf39B9182e129ec35/sources/contracts/strategies/MatrixStrategyBase.sol
Puts funds in strategy at work Only vault can call this when not paused/
function deposit() external virtual whenNotPaused onlyVault { _deposit(); }
16,300,567