file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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 * manner, since when d...
Emitted fetch max share is changed newShare New share set/ Emitted when whitelist status for a token changes token Address of token status New whitelist status/ Emitted when a loan gets liquidated loan Loan that has been liquidated defaultedValue Remaining loan debt to repay withdrawnTru Amount of TRU transferr...
function swap( address caller, SwapDescription calldata desc, bytes calldata data ) external returns ( uint256 returnAmount, uint256 gasLeft, uint256 chiSpent ); function unoswap( address srcToken, uint256 a...
6,228,205
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../common/FixidityLib.sol"; import "../common/Initializable.sol"; import "../common/UsingRegistry.sol"; import "../common/interfaces/ICeloVersionedContract.sol";...
Sets the maximum allowed change in the CELO/stable token price when an exchange proposal is being approved relative to the price when the proposal was created. Sender must be owner. newMaxApprovalExchangeRateChange The new value for maxApprovalExchangeRateChange to be wrapped./
function setMaxApprovalExchangeRateChange(uint256 newMaxApprovalExchangeRateChange) public onlyOwner { maxApprovalExchangeRateChange = FixidityLib.wrap(newMaxApprovalExchangeRateChange); emit MaxApprovalExchangeRateChangeSet(newMaxApprovalExchangeRateChange); }
2,543,982
// SPDX-License-Identifier: Bprotocol Foundation (Bancor) LICENSE // File: solidity/contracts/token/interfaces/IERC20Token.sol pragma solidity 0.6.12; /* ERC20 Standard Token interface */ interface IERC20Token { function name() external view returns (string memory); function symbol() external view return...
an account/contract attempts to get the coins throws on any error rather then return a false flag to minimize user errors in addition to the standard checks, the function throws if transfers are disabled _from source address _to target address _value transfer amount return true if the transfer was successf...
function transferFrom(address _from, address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transferFrom(_from, _to, _value); }
1,352,351
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
Whitelist mint using the voucher make sure voucher is valid if haven't redeemed then redeem first update minter info
function whitelistMint( NFTVoucher calldata voucher, bytes calldata signature, uint8 amount ) external payable { MinterInfo storage minterInfo = whitelistInfo[_msgSender()]; _verify(voucher, signature); if (voucher.nonce > minterInfo.nonce) { minterInf...
13,990,400
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol
Performs a deposit of the reserve asset to the given gToken. _token The gToken to deposit to. _amount The amount to be deposited. return _success A boolean indicating whether or not the action succeeded./
function _depositUnderlying(Self storage _self, address _token, uint256 _amount) internal returns (bool _success) { _amount = G.min(_amount, G.getBalance(_self.reserveToken)); if (_amount == 0) return true; G.approveFunds(_self.reserveToken, _token, _amount); try GCToken(_token).depositUnderlying(_amount) { ...
2,650,985
./partial_match/1/0xa77e44A139cb3C4A58d73708b2cB25b9D101AEF5/sources/DHedge.sol
Unsafe internal method that assumes we are removing an element that exists overwrite the asset to be removed with the last supported asset delete the last supported asset and resize the array
function _removeFromSupportedAssets(bytes32 key) internal { uint256 length = supportedAssets.length; bytes32 lastAsset = supportedAssets[length.sub(1)]; supportedAssets[index] = lastAsset; supportedAssets.pop(); emit AssetRemoved(address(this), manager(), key); }
2,784,428
./full_match/1/0x453F310662345de095E98053c767d916D6a30e82/sources/HoboTownDaoContract.sol
Mints a token to an address with a tokenURI. fee may or may not be required _to address of the future owner of the token _amount number of tokens to mint/
function mintToMultiple(address _to, uint256 _amount) public payable { require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction"); require(mintingOpen == true, "Minting is not open right now!"); ...
17,053,787
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "../governance/Managed.sol"; import "../upgrades/GraphUpgradeable.sol"; import "./DisputeManagerStorage.sol"; ...
Get the message hash that an indexer used to sign the receipt. Encodes a receipt using a domain separator, as described on Return the message hash used to sign the receipt _receipt Receipt returned by indexer and submitted by fisherman return Message hash used to sign the receipt/
function encodeHashReceipt(Receipt memory _receipt) public override view returns (bytes32) { return keccak256( abi.encodePacked( DOMAIN_SEPARATOR, keccak256( abi.encode( RECEIPT_TYPE_HASH,...
908,954
./partial_match/1/0x9fA4C76131EF8eA649fE1a6bdcB015e847E08776/sources/RewardedWbtcPbtcUniV2Pair.sol
Swap _amount / 2 pBTC sent to this contract into WBTC and put them into a pBTC/WBTC Uniswap pool. The amount of UniV2 token will be sent to ModifiedUnipool in order to mature reward. _user address of the user who will have UniV2 tokens in ModifiedUnipool _amount amount of pbtc to use to perfor...
function _stakeFor(address _user, uint256 _amount) internal { uint256 pbtcAmountIn = _amount / 2; (uint256 wbtcReserve, uint256 pbtcReserve, ) = uniV2.getReserves(); uint256 wbtcAmountOut = UniswapV2Library.getAmountOut( pbtcAmountIn, pbtcReserve, wbtcRes...
4,393,101
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import './interfaces/IBuyBackAndBurn.sol'; import './interfaces/IMultiSignatureOracle.sol'; import './utils/MyPausableUpgradeable.sol'; import './token/MintableERC721.sol'; import 'hardhat/console....
Adds an outside pegged collection (= same collection but in a different network) can only be called by MANAGE_OUTSIDE_PEGGED_COLLECTION_ROLE depositChainCollectionAddress the address of the collection in the network the deposit is possible (deposit collection) peggedCollectionAddress the address of the pegged collec...
function addOutsidePeggedCollection(address depositChainCollectionAddress, address peggedCollectionAddress) external { require( hasRole(MANAGE_OUTSIDE_PEGGED_COLLECTION_ROLE, _msgSender()), 'CrossChainBridgeERC721: must have MANAGE_OUTSIDE_PEGGED_COLLECTION_ROLE role to execute this function' ); ...
1,512,059
./full_match/80001/0x2964913Bc09333d3a744F6B87f741F86bcd768F1/sources/contracts/RecruitmentATSSmartContract.sol
Function to add an employer Ensure the employer does not already exist Add the employer
function addEmployer( string memory name, string memory emailAddress, address ethAddress ) public { require( employers[ethAddress].ethAddress == address(0), 'Employer already exists.' ); employers[ethAddress] = Employer(emailAddress, name,...
5,670,054
./full_match/1/0xF5F0C19c4Fc2dc2A69eDcFCAE9E29892D544333b/sources/contracts/collections/ADaydreamForLibby/ADaydreamForLibby.sol
Computes a pseudorandom seed for a mint batch. Even though this process can be gamed in principle, it is extremly difficult to do so in practise. Therefore we can still rely on this to derive fair seeds.
function _computeBatchSeed(address to) private view returns (uint24) { return uint24( bytes3( keccak256( abi.encodePacked( block.timestamp, block.difficulty, ...
8,412,479
/** * SPDX-License-Identifier: MIT * * * Reference: https://github.com/ajlopez/DeFiProt/blob/master/contracts/test/StandardToken.sol * * * @Author defi3 * * * Creation, 2021-05 * * Main Update 1, 2021-06-17, migrate to ^0.8.0 * */ pragma solidity ^0.8.0; import "./IERC20.sol"; import "./ERC2...
Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to amount uint256 the amount of tokens to be transferred/
function transferFrom(address from, address to, uint256 amount) public override returns (bool) { require(_allowances[from][msg.sender] >= amount); _balances.move(from, to, amount); _allowances[from][msg.sender] -= amount; emit Transfer(from, to, amount); ...
6,486,213
pragma solidity ^0.4.19; import "./Fundraiser.sol"; import "../util/SafeMath.sol"; contract Core is Fundraiser { uint256 public campaignEscrowAmount = 0; // Required escrow to create a campaign. Default, zero uint256 public totalRaised = 0; // Total funds raised by the contract event ReadyCampaign(ui...
Contract owner changes the amount required to start a campaign
function changeEscrowAmount(uint64 _campaignEscrowAmount) public onlyOwner { campaignEscrowAmount = _campaignEscrowAmount; }
6,475,763
pragma solidity ^0.4.20; contract LotteryGenerator { address[] public lotteries; struct lottery{ uint index; address manager; } mapping(address => lottery) lotteryStructs; function createLottery(string name) public { require(bytes(name).length > 0); addr...
NOTE: This should not be used for generating random number in real world
function generateRandomNumber() private view returns(uint) { return uint(keccak256(block.difficulty, now, lotteryBag)); }
5,424,077
pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./libraries/TransferHelper.sol"; import "./interfaces/IPancakeRouter02.s...
given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function _getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) internal pure returns (uint256 amountIn) { require(amountOut > 0, "FloozRouter: INSUFFICIENT_OUTPUT_AMOUNT"); require(reserveIn > 0 && reserveOut > 0, "FloozRouter: INSUFFICIENT_LIQUIDITY");...
600,895
./full_match/44787/0x79DC9f411386313e9E684151FEc5A2fb7431ca84/sources/contracts/StarFarm.sol
View function to see pending STARs on frontend.
function pendingStar(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accStarPerShare = pool.accStarPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)).add(pool...
13,246,977
./full_match/1/0xdbE5a8BBac5b3ba4e05BB9b9Ca51A6741bc81Bd1/sources/contracts/brokers/BrokersTokenTransferrer.sol
Transfer fee to the brokers. _from User address fees Fees details to be transferred
function _transferFee(address _from, Fees calldata fees) internal { if (fees.brokerAmount > 0) IERC20(fees.token).safeTransferFrom( _from, fees.broker, fees.brokerAmount ); if (fees.platformAmount > 0) IERC20(fees.t...
17,074,784
./full_match/43114/0x9A641E87c60472D90F9A7e2e60e006bE66408B6F/sources/contracts/IsolatedLending.sol
Extinguish debt from payer wallet balance
function _repay( address payer, uint256 trancheId, uint256 repayAmount ) internal virtual { if (repayAmount > 0) { _burnStable(payer, repayAmount); trancheDebt[trancheId] -= repayAmount; } }
4,536,039
// Sources flattened with hardhat v2.8.3 https://hardhat.org // File @openzeppelin/contracts/access/IAccessControl.sol@v4.4.2 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC16...
/ Add the vote id to the list and track it if it's new
function setDaoProposal(uint256 voteId, uint256 deadline) external onlyAuthorized { if ( voteIds.length == 0 || (indexOfVoteId[voteId] == 0 && voteIds[0] != voteId) ) { voteIds.push(voteId); indexOfVoteId[voteId] = voteIds.length - ...
14,943,363
./full_match/97/0x20610C85207106d89e43335Cf8DDd7C58D6a3b4c/sources/contracts/StrategyRouter.sol
Rebalance strategies, so that their balances will match their weights. return balances Balances of the strategies after rebalancing. Admin function.
function rebalanceStrategies() external onlyOwner returns (uint256[] memory balances) { return StrategyRouterLib.rebalanceStrategies(exchange, strategies); }
3,273,905
pragma solidity ^0.4.23; // File: contracts/grapevine/crowdsale/BurnableTokenInterface.sol /** * @title Burnable Token Interface, defining one single function to burn tokens. * @dev Grapevine Crowdsale **/ contract BurnableTokenInterface { /** * @dev Burns a specific amount of tokens. * @param _value The am...
Computes the bonus. The bonus is - 0 by default - 30% before reaching the softCap for those whitelisted. - 15% the first week - 10% the second week - 8% the third week - 6% the remaining time. _time when the purchased happened. _beneficiary Address performing the token purchase. _value Value in wei involved in the p...
function getBonus(uint256 _time, address _beneficiary, uint256 _value) view internal returns (uint256 _bonus) { _bonus = 0; if ( (weiRaised.sub(_value) < goal) && earlyInvestors.whitelist(_beneficiary) ) { _bonus = 30; if (_time < openingTime.add(7 days)) { _bonus = 15; _bonus...
2,370,953
./full_match/1/0x90513700BdccAc963FCbBa2D60CDD002ae0D4817/sources/contracts/UPGRD/Sale.sol
Returns token amount and left over wei amount for given wei amount If there is not enough tokens left, return all tokens left
function getTokensForEthAmount(uint256 weiAmount) public view returns (uint256, uint256) { if (weiAmount == 0) revert InsufficientAmount(weiAmount); uint256 tokens = (weiAmount / meta.price) * 10 ** 18; uint256 left = meta.supply - meta.sold; if(tokens > left) tokens = left; ...
16,509,755
./partial_match/1/0x74C37294407a48Ee3Fb813b80Fc346b1F6E5dB2C/sources/BLASTAR.sol
force Swap back if slippage issues.
function makeManualSwapBack() external onlyOwner { require(balanceOf(address(this)) >= swapTokensAtAmount, "Can only swap when token amount is at or higher than restriction"); swapping = true; swapBack(); swapping = false; emit OwnerForcedSwapBack(block.timestamp); }
2,754,519
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; import "../../libs/SafeMath.sol"; import "../../common/IdentityRegistry.sol"; //import "../../common/Token.sol"; import "../../common/IERC20TOKEN.sol"; import "../../common/Whitelistable.sol"; abstract contract DelawareStockToken is IERC2...
Return an array with all the token owners
function getTokenOwners() public view returns(address[] memory){ return tokenOwners; }
12,787,630
/* * Offer to respond to a proposal. */ contract Offer { /* * The seller who made this offer. */ address public owner; /* * Price offered at the minimum amount. */ uint public price; /* * Minimum amount of products to be bought. */ uint public minimumAmount; ...
For very low prices: force a very low amount. Settled in end payment.
function getPledgePaymentAmount(uint backerIndex) constant returns (uint amount) { amount = backers[backerIndex].amount * pledgePaymentPercentage * maxPrice / 100; if (amount == 0) amount = 1; }
14,070,252
./full_match/8453/0x0972892bDa852a6A8C2346Bc552f7782E22D55a9/sources/contracts/providers/TokenVault.sol
getTokenTypes Given a specific key, will return the contract addresses for all ERC20s held in the vault. keyId the key you are using to access the trust return the token registry for that trust/ I really should be taking the arns from the ledger and recoding it to get the contract addresses, but for 20-30 arns thats g...
function getTokenTypes(uint256 keyId) external view returns(address[] memory) { (,,uint256 trustId,,) = locksmith.inspectKey(keyId); return witnessedTokenAddresses[trustId].values(); }
11,550,911
pragma solidity ^0.5.0; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; /// @Author RickGriff /// EtherSplit dApp contract AgreementFactory { address public factoryOwner; mapping(address => bool) public allAgreements; /// Map user to list of agreements they've created or joined mapping(address ...
Set the invited friend's address
function inviteFriend(address _friend) onlyUser1 onlyUser2NotRegistered public { require(_friend != msg.sender, 'You cant invite yourself!'); require(invited_friend == address(0), 'You have already invited someone!'); invited_friend = _friend; AgreementFactory factory = AgreementFactory(parentFactory)...
14,112,353
pragma solidity ^0.4.24; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/
function fund ( address caller ) public payable requireIsCallerAuthorized requireIsOperational { airl...
5,477,925
./partial_match/3/0xD4Bcc3f1C483Ea10fDb97523357CA660E6B3c71E/sources/IERC721.sol
Required interface of an ERC721 compliant contract./
interface IERC721 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function balanceOf(add...
5,083,842
pragma solidity 0.6.12; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `...
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...
59,438
./full_match/100/0xEd469d6aa0658b71B9dE75c2fe401924FCf0534d/sources/src/BzzRouter.sol
ERC677 transfer callback function for use with honeyswap or similar ERC677 transfer and call function amount the amount of bzz tokens that were sent to be evenly distributed data the data to be used for determining which batch to topUp should only be able to call this from the erc677 contract
function onTokenTransfer(address, uint256 amount, bytes memory data) external returns (bool) { require(msg.sender == address(bzz) && data.length != 0, "erc677/invalid-tx"); execute(amount, data); return true; }
14,279,983
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./base/EternalStorage.sol"; import "./base/IMarketCoreFacet.sol"; import "./base/IMarketObserver.sol"; import "./base/IMarketOfferStates.sol"; import "./base/IParent.sol"; import "./base/IChild.sol"; import "./base/IDiamondFacet.sol"; import "./base/Contr...
(a / b) c = c a / b -> do multiplication first to avoid underflow check bounds and update balances calculate and take out fees do the transfer notify observers cancel offer if it has become dust
) private { (TokenAmount memory offerSell, TokenAmount memory offerBuy) = _getOfferTokenAmounts(_offerId); uint256 thisSaleSellAmount = _requestedBuyAmount.mul(offerSell.amount).div(offerBuy.amount); _checkBoundsAndUpdateBalances(_offerId, thisSaleSellAmount, _requestedBuyAmount); ( uint256 f...
12,560,192
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity 0.5.9; import "../Land/erc721/LandBaseToken.sol"; import "../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol"; import "../BaseWithStorage/ERC2771Handler.sol"; import "../contracts_common/BaseWithStorage/PausableW...
total width of the map return width
function width() external returns(uint256) { return GRID_SIZE; }
1,471,357
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Part: AddressUpgradeable /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== ...
invest the amount of want When this function is called, the controller has already sent want to this Just get the current balance and then invest accordingly Lock tokens for 16 weeks, send credit to strat, always use max boost cause why not?
function _deposit(uint256 _amount) internal override { LOCKER.lock(address(this), _amount, getBoostPayment()); }
2,045,362
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @artist: Anna Ridler /// @author: manifold.xyz import "@prb/math/contracts/PRBMathSD59x18.sol"; import "./libraries/Trigonometry.sol"; import "./libraries/BokkyPooBahsDateTimeLibrary.sol"; import "./dynamic/DynamicArweaveHash.sol"; import "./extensions/ERC...
Yields the least greatest signed 59.18 decimal fixed-point number greater than or equal to x. Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions. Requirements: - x must be less than or equal to...
function ceil(int256 x) internal pure returns (int256 result) { if (x > MAX_WHOLE_SD59x18) { revert PRBMathSD59x18__CeilOverflow(x); } unchecked { int256 remainder = x % SCALE; if (remainder == 0) { result = x; result = x - ...
10,297,495
pragma solidity 0.6.4; interface IBEP20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); function getOwner() external view retu...
sets initials supply and the owner/
function initialize(string memory name, string memory symbol, uint8 decimals, uint256 amount, bool mintable, bool burnable, address owner, address _teamWallet) public initializer { _owner = owner; _name = name; _symbol = symbol; _decimals = decimals; _mintable = mintable; ...
5,707,977
./partial_match/1/0xF06af63b86591b1ceC25107fE7E93Bdb235c0b6d/sources/contracts/strategies/Common/StrategyMiniChefLP.sol
puts the funds to work
function deposit() public whenNotPaused { uint256 wantBal = IERC20(want).balanceOf(address(this)); if (wantBal > 0) { IMiniChefV2(chef).deposit(poolId, wantBal, address(this)); } }
15,723,869
pragma solidity 0.6.12; // File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 a...
Set throttling duration Only owner/
function setThrottlingDuration(uint256 _throttlingDuration) external onlyOwner { throttlingDuration = _throttlingDuration; emit SetThrottlingDuration(throttlingDuration); }
12,108,398
./full_match/1/0x57FF2c5134a4B252A85Fac1791403fee4A186B1C/sources/browser/LPstaking.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function maxSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(a...
9,788,550
pragma solidity 0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b...
Transfer the balance from owner's account to another account
function transferTokens(address _to, uint256 _amount) private returns(bool success) { require( _to != 0x0); require(balances[address(this)] >= _amount && _amount > 0); balances[address(this)] = (balances[address(this)]).sub(_amount); balances[_to] = (balances[_to]).add(_amount...
973,743
/** <<https://github.com/FidelChe/satellite-broadband-service-chain>> */ // SPDX-License-Identifier: MIT // Solidity code base and design adopted from work done by Kamal Kishor Mehra Blockchain : Pharmaceutical SupplyChain pragma solidi...
Register New user by Owner cryptoAddress Cryptocurrency Network Address of User Name User name Location User Location Role User Role/
function registerUser( address cryptoAddress, bytes32 Name, bytes32 Location, uint Role ) public onlyOwner { require(UsersDetails[cryptoAddress].role == roles.norole, "User Already registered"); UsersDetails[cryptoAddress].name = Name; ...
886,557
pragma solidity >=0.4.24; import "../math/SafeMath.sol"; /** * @dev 资产列表共通,除资产负债之外提供一个账目清单数组,便于统计和查找. */ library BalanceList { using SafeMath for uint256; struct element { address addr; uint256 idx; uint256 balance; } struct balanceMap { mapping(address => uint256) mapList; element[] li...
获取指定下标范围的数据,本函数可以用于分页查询
function getList( balanceMap storage self, uint256 from, uint256 _count ) internal view returns (element[] memory) { require(_count > 0, "count number must bigger than 0"); uint256 _idx = 0; element[] memory res = new element[](_count); for (uint256 i = from; i < self.list.length; i++)...
1,847,499
./partial_match/56/0xe3085D1c23242A7c4DbE54774452eb8763664906/sources/MasterChef.sol
Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _SHUFPerBlock) public onlyOwner { massUpdatePools(); SHUFPerBlock = _SHUFPerBlock; }
11,091,028
// SPDX-License-Identifier: MIT pragma solidity 0.5.5; /* * @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 de...
burn erc721 (vaultId) mint erc721 (vaultId)
function buyRiskyVault(uint256 vaultID) external { require(vaultExistence[vaultID], "Vault does not exist"); require(stabilityPool==address(0) || msg.sender == stabilityPool, "buyRiskyVault disabled for public"); (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralPro...
1,191,884
pragma solidity ^0.4.23; /** https://zethr.io https://zethr.io https://zethr.io https://zethr.io https://zethr.io ███████╗███████╗████████╗██╗ ██╗██████╗ ╚══███╔╝██╔════╝╚══██╔══╝██║ ██║██╔══██╗ ███╔╝ █████╗ ██║ ███████║████...
Divide the average dividned rate by magnitude Remainder doesn&39;t matter because of the below logic Should be impossible
function getTier(uint divRate) internal pure returns (uint){ uint actualDiv = divRate / magnitude; if (actualDiv >= 30){ return 7; } else if (actualDiv >= 25){ return 6; } else if (actualDiv >= 20){ return 5; } ...
15,147,264
pragma solidity ^0.6.0; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; contract Farm is Ownable { using SafeMath for uint; IERC20 public STBU; IERC20 public LPtoken; struct stakeHolder { uint256 calcBlock; uint256 totalClaimed; } bool public active;...
Activating the staking with start block. Can only be called by the current owner./
function activate() public onlyOwner returns (bool){ startBlock = block.number; endBlock = startBlock.add(totalBlocks); rewardAllocation = defaultStakePerBlock.mul(totalBlocks); active = true; return true; }
11,920,580
./partial_match/42/0xc2B28F1dE060c379F5687C8f675be4883508AfEC/sources/EtherCollateralpUSD.sol
Add ETH collateral to an open loan Require loanLiquidationOpen to be false or we are in liquidation phase Get the loan from storage Check loan exists and is open Tell the Dapps collateral was added to loan
function depositCollateral(address account, uint256 loanID) external payable notPaused { require(msg.value > 0, "Deposit amount must be greater than 0"); systemStatus().requireIssuanceActive(); require(loanLiquidationOpen == false, "Loans are now being liquidated"); PynthLoanStruc...
3,482,074
// File @openzeppelin/contracts/utils/Context.sol@v4.2.0 // SPDX-License-Identifier: MIT 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 shoul...
Make tokens & edition
function mintBatchEdition( SaleType _saleType, uint16 _editionSize, uint128 _startDate, uint128 _basePrice, uint128 _stepPrice, string calldata _uri, uint256 _merkleIndex, bytes32[] calldata _merkleProof, address _deployedRoyaltiesHandler )...
5,998,718
// SPDX-License-Identifier: AGPL-3.0-only /* Nodes.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin @author Dmytro Stebaiev @author Vadim Yavorsky SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
Returns random position in range [`place`, size] with probability proportional to value stored at this position. If all element in range are 0 returns 0 Requirements: - `place` must be in range [1, size]/ go left go right
function getRandomNonZeroElementFromPlaceToLast( Tree storage self, uint place, IRandom.RandomGenerator memory randomGenerator ) external view returns (uint) { require(_correctPlace(self, place), "Incorrect place"); uint vertex = 1; ui...
9,841,141
pragma solidity 0.6.12; /** * @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); /** * @dev Returns the amount of tokens owned by `account`. ...
Custom logic in here for how much the vault allows to be borrowed Sets minimum required on-hand to keep small withdrawals cheap
function available() public view returns (uint) { return token.balanceOf(address(this)).mul(availableMin).div(MAX); }
314,355
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/IRarities.sol"; import "../commons//OwnableInitializable.sol"; import "../commons//NativeMetaTransaction.sol"; import "../tokens/...
Set allowed account to manage items. _managers - Address allowed to manage items _values - Whether is allowed or not/
function setManagers(address[] calldata _managers, bool[] calldata _values) external onlyCreator { require( _managers.length == _values.length, "setManagers: LENGTH_MISMATCH" ); for (uint256 i = 0; i < _managers.length; i++) { address ...
12,976,034
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/math/Encoded.sol
Internal function to decode a bytes32 sample into a bool using an offset This function can overflow encoded The encoded value offset The offset return boolean The decoded value as a bool/
function decodeBool(bytes32 encoded, uint256 offset) internal pure returns (bool boolean) { assembly { boolean := and(shr(offset, encoded), MASK_UINT1) } }
7,117,598
./full_match/1/0xb68c8ce82BADe6455d220C90428ECc7A4798a1a8/sources/contracts/ArtongNFT.sol
Override isApprovedForAll to whitelist Artong contracts to enable gas-less listings.
function isApprovedForAll(address owner, address operator) override public view returns (bool) { if (marketplace == operator) { return true; } return super.isApprovedForAll(owner, operator); }
9,618,258
pragma solidity 0.4.24; contract ExecutionTarget { uint256 public counter; function execute() public { counter += 1; emit Executed(counter); } function setCounter(uint256 x) public { counter = x; } event Executed(uint256 x); } pragma solidity 0.4.24; import "@arago...
NOTE: this should NEVER be used for authentication This is only intended to be used as a sanity check that an address is actually a contract, RATHER THAN an address not being a contract./
function getRecoveryVault() public view returns (address); } pragma solidity ^0.4.24; } pragma solidity ^0.4.24; } pragma solidity ^0.4.24; function isContract(address _target) internal view returns (bool) { if (_target == address(0)) { return false; } uint256 si...
13,453,620
./full_match/56/0x34F33e7bBB05fb59352a5B6d3ac61DEd2274af94/sources/project_/contracts/DistributedRewardsPot/DistributedRewardsPot.sol
&& only the marketpalace admin, should authorize using marketplace contract
function withdrawUnclaimedRewards( uint256 month, address admin, TokenType tokenType ) external onlyOwner { if (_shouldUpdateCurrentMonth()) _updateCurrentMonth(); Statistics storage statistics = statisticsFor[month][tokenType]; require(_theMonthIsValid[month],...
3,234,617
import "DB.sol"; import "String.sol"; contract DBTest { event readResult(bytes32 name, int item_id, bytes32 item_name); event insertResult(int count); event updateResult(int count); event removeResult(int count); function create() public { DBFactory df = DBFactory(0x1001); df.c...
condition.EQ("name", name);
function read(string name) public constant returns(bytes32[], int[], bytes32[]){ DBFactory df = DBFactory(0x1001); DB db = df.openDB("t_test"); Condition condition = db.newCondition(); Entries entries = db.select(name, condition); bytes32[] memory user_name_...
15,864,745
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.7.0; import './Trib.sol'; import './Genesis.sol'; import './interfaces/IVault.sol'; import './utils/MathUtils.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/cont...
Calculates the amount of tokens in exchange for reserve after applying the 10% tax. reserveAmount Reserve value in wei to use in the conversion. return Token amount in wei after the 10% tax has been applied.
function getReserveToTokensTaxed(uint256 reserveAmount) external view returns (uint256) { if (reserveAmount == 0) { return 0; } uint256 fee = reserveAmount.div(TAX); uint256 totalTokens = getReserveToTokens(reserveAmount); uint256 taxedTokens = getReserveToTokens(fee); return totalTokens...
12,688,594
./full_match/43113/0xe2Cd6d9947720966298Da8537c919c000841Bd72/sources/doggesRouter.sol
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'DoggesLibrary: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'DoggesLibrary: INSUFFICIENT_LIQUIDITY'); amountB = amountA.mul(reserveB) / reserveA; }
13,150,265
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/utils/Address.sol"; import "./interfaces/IGovernance.sol"; import "./Prop...
Requires a proposal is dequeued and removes it if expired. proposalId The ID of the proposal. return The proposal storage struct and stage corresponding to `proposalId`./
function requireDequeuedAndDeleteExpired(uint256 proposalId, uint256 index) private returns (Proposals.Proposal storage, Proposals.Stage) { Proposals.Proposal storage proposal = proposals[proposalId]; require(_isDequeuedProposal(proposal, proposalId, index), "Proposal not dequeued"); Proposals.S...
5,455,350
/** */ /* */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory);...
withdraws dividents of sender
function ClaimETH() public { claimToken(msg.sender ,address(this),0); }
14,526,631
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {OracleInterface} from "./opyn/interfaces/OracleInterface.sol"; import {OpynPricerInterface} from "./opyn/interfaces/OpynPricerInterface.sol"; /// @title Better Oracle /// @author Amethyst C. /// @notice Better Oracle pulls data from more than one source a...
Add a pricer _asset asset's address _pricer pricer's address/
function addPricer( address _asset, address _pricer, uint16 _weight ) external onlyAdmin { Pricer memory newPricer; newPricer.source = _pricer; newPricer.weight = _weight; pricers[_asset].push(newPricer); emit PricerAdded(_asset, _pricer, _weight)...
12,872,873
pragma solidity ^0.5.17; // solhint-disable-next-line compiler-version /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * externa...
operator can add a relayer to the whitelist./
function addRelayer(address _relayer) external onlyOperator nonReentrant { relayerWhitelist[_relayer] = true; emit RelayerUpdate(_relayer, relayerWhitelist[_relayer]); }
6,782,027
./partial_match/3/0x7659D781dD67018828b1F0b7147326B6638C45e1/sources/RamenToken.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "RAMEN::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return...
5,262,261
./full_match/97/0x24791e69e9227d3789107D01F9424D9A2E959ABa/sources/project_/contracts/strf-token-staker/STRFStaker.sol
Total withdrawable staked/stakedAndLocked/staked+stakedAndLocked balance for an account.
function withdrawableBalance(address user, bool staked, bool stakedAndLocked) view public returns (uint256 amount) { if (staked) { amount += balances[user].staked; } if (stakedAndLocked) { LockedBalance[] storage locks = userLocks[user]; for (uint i = 0; ...
5,022,360
./full_match/43113/0xCbA2aCdFa248BB50Ed83d8C4f14a2C88221B2730/sources/HarmoNYAN.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "HARMONYAN::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { re...
7,123,171
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.7; /* ██████ ██████ ██ ██ ███ ██ ██████ ██ ██ ██ ██ ██ ████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██████ ██ ████ ██████ */ import {IERC2981Upgr...
Compute the amount available for withdrawing from this edition. Set the amount withdrawn to the amount deposited. Send the amount that was remaining for the edition, to the funding recipient.
function withdrawFunds(uint256 _editionId) external { uint256 remainingForEdition = depositedForEdition[_editionId] - withdrawnForEdition[_editionId]; withdrawnForEdition[_editionId] = depositedForEdition[_editionId]; _sendFunds(editions[_editionId].fundingRecipient, remainingForEdition); ...
5,724,330
./full_match/1/0x6c138e85cCb4Ac8036Ae51322F495770e4162065/sources/contracts/PercentSplitETH.sol
Returns a tuple with the terms of this split. return shares The list of recipients and their share of the payment for this split./
function getShares() external view returns (Share[] memory shares) { shares = new Share[](_shares.length); for (uint256 i = 0; i < shares.length; ) { unchecked { ++i; } } }
16,489,323
./partial_match/3/0xA5221B24D9065135E196949ea25Fb15a90528239/sources/SwanStake.sol
_amount - the amount user wants to stake allows the user to stake the initial $2000 worth of SWAN tokens Lists the user as a valid Staker.(by adding True in the isStaker mapping) User can earn comparatively more interest on Future stakes by calling this function/
function stake(uint256 _amount) external whenNotPaused returns(bool){ require(!isStaker[msg.sender],"Previous Staked Amount is not Withdrawn yet"); require (_amount >= currentPrice.mul(2000 ether),"Staking Amount is Less Than $2000"); require(ERC20(swanTokenAddress).transferFrom(msg.sender,address(...
5,320,858
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "./interfaces/IPunkCrushers.sol"; /** * @title PunkCrushers NFTs * @...
Internal function called in {_mint}. transfers funds to {owner} and {dev}. Emits a {FundsTransferred} event indicating transfer of funds. _value - ether price paid for token minting./
function _transferFunds(uint256 _value) internal { address payable _owner = payable(owner()); uint256 _ownerShare = (_value * 70) / 100; Address.sendValue(_owner, _ownerShare); emit FundsTransferred(_owner, _ownerShare); address payable _dev = payable(dev); uint256 _...
1,494,199
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./BaseUpgradeablePausable.sol"; import "./ConfigHelper.sol"; import "./Accountant.sol"; import "./CreditLine.sol"; import "./CreditLineFactory.sol"; /** * @title Goldfinch's CreditDesk contract * @notice ...
This resets lastFullPaymentBlock. These conditions assure that they have indeed paid off all their interest and they have a real nextDueBlock. (ie. creditline isn't pre-drawdown) If interest was fully paid off, then set the last full payment as the previous due block
function updateCreditLineAccounting( CreditLine cl, uint256 balance, uint256 interestOwed, uint256 principalOwed ) internal nonReentrant { subtractClFromTotalLoansOutstanding(cl); cl.setBalance(balance); cl.setInterestOwed(interestOwed); cl.setPrincipalOwed(principalOwed); if (...
969,502
/** * 资金方控制器 */ pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; import "./role/Role.sol"; import "./utils/Ownable.sol"; import "./utils/LibString.sol"; import "./service/FinancingProcessStorage.sol"; contract FinancingFundController is Ownable, Role { using LibString for string; FinancingProcessS...
资金方审核放货拒绝 _processId 流程id _user_id 操作用户id/
function confirmAuditReject(string _processId, string _user_id) external onlyOwner returns(bool){ onlyZJRole(_user_id); _log(_processId.empty(), "FinancingFundController fundConfirmAudit: _processId is empty"); require(!_processId.empty(), "FinancingFundController fundConfirmAudit: _processI...
1,752,015
./full_match/5/0xCB3577567d47bcB5891e732993A37a9bcc8Cf1f0/sources/Flyz.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./ Overflows are incredibly unrealistic. `balance` and `numberMinted` have a maximum limit of 264. `tokenId` has a maximum limit of 2256. Update...
function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); unchecked { ...
1,880,829
./full_match/1/0x7d0C7372f38958d9CF5aE6DA2b0794337045559b/sources/contracts/Controller.sol
Allows an existing strategy to be removed from the Spool system. Emits a {StrategyRemoved} event indicating the removed strategy. Requirements: - the strategy must already exist in the contract - the provided strategies array must be vaild or empty strategy the strategy to remove from the system skipDisable flag to ...
function _removeStrategy( address strategy, bool skipDisable, address[] calldata allStrategies ) private validStrategiesOrEmpty(allStrategies) { require( validStrategy[strategy], "Controller::removeStrategy: Strategy is not registered" ...
9,716,454
/** *Submitted for verification at Etherscan.io on 2021-08-11 */ pragma solidity 0.7.6; // SPDX-License-Identifier: MIT /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function ...
ZOS upgradable contract initialization method. It is called at the time of contract creation to invoke parent class initializers and initialize the contract's state variables./ deviationThreshold = 0.05e18 = 5e16
function initialize( address owner_, IUFragments uFrags_ ) public initializer { Ownable.initialize(owner_); deviationThreshold = 5 * 10**(DECIMALS - 2); rebaseLag = 3; minRebaseTimeIntervalSec = 1 days; rebaseWindowLengthSec = 15 minutes; lastReb...
10,522,622
./partial_match/42220/0xCdE5039e3AcB3483aEebEBd59Cf6936056c455D4/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/governance/Election.sol
Returns the total votes made for `group`. group The address of the validator group. return The total votes made for `group`./
function getTotalVotesForGroup(address group) public view returns (uint256) { return votes.pending.forGroup[group].total.add(votes.active.forGroup[group].total); }
3,496,800
/** *Submitted for verification at Etherscan.io on 2021-05-26 */ // File: openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol pragma solidity ^0.5.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * a...
Burns amount of a given token id _from The address to burn tokens from _id Token ID to burn _quantity Amount to burn/
function burn( address _from, uint256 _id, uint256 _quantity ) public { _supply[_id] = _supply[_id].sub(_quantity); _burn(_from, _id, _quantity); }
6,668,219
./full_match/84531/0x1FE6cAf7C5A873F74B5693a32C1C95B52F287993/sources/src/token/ERC721/base/ERC721ABase.sol
@inheritdoc IERC721ABase/
function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transferFrom(from, to, tokenId); }
11,529,798
./full_match/43113/0x79e6aaCD8986c9797B3f8AfbeAE04130Da184Cd4/sources/contracts/Oracle.sol
this is used so users do not have to delegate someone else to monitor the contract 24/7 86400 is seconds in a day, and 3600 is seconds in an hour restricts contract submission to between 5am-8pm in summer, 6am-9pm in winter
function hourOfDay() public view returns (uint hour1) { hour1 = (block.timestamp - 7600) % 86400 / 3600; }
7,168,395
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol"; import "./GoodAaveStakingV2.sol"; import "../../Interfaces.sol"; /** * @title Staking contract that donates earned interest to the DAO * allowing stakers to deposit Token * or withdraw...
Calculates worth of given amount of iToken in Token _amount Amount of token to calculate worth in Token return Worth of given amount of token in Token/
function iTokenWorthInToken(uint256 _amount) internal view override returns (uint256) { }
1,307,125
./partial_match/4/0x1F75b29F849185e8B57E24Fe6fAb09c176583942/sources/ChickenChef.sol
Withdraw LP tokens from MasterChef. require(_amount > 0, "amount should be greater than 0");
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accChickenPe...
8,562,354
// SPDX-License-Identifier: AGPL // File: contracts/interfaces/IITR.sol pragma solidity ^0.8.0; interface IITR { function claim(address to) external; } // File: contracts/interfaces/ISRC20.sol pragma solidity ^0.8.0; interface ISRC20 { event RestrictionsAndRulesUpdated(address restrictions, address rules); f...
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requirem...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; }
6,152,382
./full_match/5/0xE2074D1cc079223D073303A42eDb1b5b7D865c74/sources/project_/contracts/SettlerNFT.sol
If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token."); string memory _tokenURI = _tokenURIs[tokenId]; ...
7,037,329
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../src/active/ERC20Token.sol"; contract ERC20TokenTest { // truffle test ./test/ERC20Token.test.sol function testInitialBalanceUsingDeployedContract() public { ERC20Tok...
truffle test ./test/ERC20Token.test.sol --network test
function testInitialBalanceWithNewERC20Token() public { ERC20Token meta = new ERC20Token(); meta.__ERC20Token_init("Nhan Cao", "nhancv", 18, 777999777); uint expected = 777999777000000000000000000; Assert.equal( meta.balanceOf(meta.owner()), expected, "Owner should have 77799977700...
13,065,705
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf...
Creates a new promo Car with the given name, with given _price and assignes it to an address.
function createPromoCar(address _owner, string _name, uint256 _price) public onlyCOO { require(promoCreatedCount < PROMO_CREATION_LIMIT); address carOwner = _owner; if (carOwner == address(0)) { carOwner = cooAddress; } if (_price <= 0) { _price = startingPrice; } promoCreat...
6,857,264
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Helper to execute a call to an integration Avoids stack-too-deep error
function __executeCoI( address _vaultProxy, bytes memory _callArgs, bytes memory _encodedAssetTransferArgs ) private { ( address adapter, bytes4 selector, bytes memory integrationData ) = __decodeCallOnIntegrationArgs(_callArgs); ...
1,697,454
pragma solidity 0.5.12; /** * (c) 2021 Akiva Capital Holdings, LLC. All Rights Reserved. * * For LICENSE details, please visit: * https://github.com/akiva-capital-holdings/pairwyse-smart-contracts/blob/master/LICENSE * */ import "./McdAddressesR17main.sol"; import "../interfaces/IMcd.sol"; import "../interfac...
inject(wipe) some amount of dai to cdp from agreement (pay off some amount of dai to cdp) cdp cdp ID wad amount of dai tokens/
function _injectToCdpFromDsr(uint cdp, uint wad) internal returns(uint injectionWad) { injectionWad = _unlockDai(wad); DSProxyLike(proxyAddress).execute( proxyLib, abi.encodeWithSignature( "wipe(address,address,uint256,uint256)", cdpManagerAddr...
14,070,107
// File: contracts/interface/ICoFiXV2Factory.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.12; interface ICoFiXV2Factory { // All pairs: {ETH <-> ERC20 Token} event PairCreated(address indexed token, address pair, uint256); event NewGovernance(address _new); event NewController...
(uint256 ethAmount, uint256 erc20Amount, uint256 avg, int128 vola, uint256 bn) = INestQuery(oracle).queryPriceAvgVola{value: msg.value}(token, address(this));
function getLatestPriceAndAvgVola(address token) public override payable returns (uint256, uint256, uint256, uint256) { require(callerAllowed[msg.sender], "CoFiXCtrl: caller not allowed"); uint256 _balanceBefore = address(this).balance; ( uint256 bn, uint256 erc20A...
1,314,599
./full_match/41/0xc64B2b83178eAcE66D774023a6a15d062C780DBf/sources/contracts/IceCreamZombies.sol
Returns all NFTs (NFTInfo struct: owner, tokenId, amountStaked, vestingStart, vestingEnd) owned by owner/
function nftsOf(address owner) public view returns (NftInfo[] memory) { uint256 amountOwned = ERC721.balanceOf(owner); NftInfo[] memory nfts = new NftInfo[](amountOwned); for (uint256 i = 0; i < amountOwned; i++) { uint256 tokenId = ERC721Enumerable.tokenOfOwnerByIndex(owner, i);...
16,374,256
/** *Submitted for verification at Etherscan.io on 2021-04-14 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; interface IPairXCore { // 取回指定的Token资产及奖励 function claim( address token ) external returns (uint amount) ; // 提取PairX的挖矿奖励,可以提取当前已解锁的份额 function...
function depositInfo( address sender , address token ) external view returns ( uint depositBalance ,uint depositTotal , uint leftDays , uint lockedReward , uint freeReward , uint gottedReward ) ;
interface IPairX { function MinToken0Deposit() external view returns( uint256 ) ; function MinToken1Deposit() external view returns( uint256 ) ; function RewardToken() external view returns( address ) ; function RewardAmount() external view returns( uint256 ) ; function RewardBeginTime() exte...
10,822,059
./full_match/69/0x8EB5A8B9732022F20ab4d3128DDf3a50a6dAa7A2/sources/contracts/OptionMarket.sol
Initialize the contract. _globals LyraGlobals address _liquidityPool LiquidityPool address _optionPricer OptionMarketPricer address _greekCache OptionGreekCache address _quoteAsset Quote asset address _baseAsset Base asset address/
function init( LyraGlobals _globals, LiquidityPool _liquidityPool, OptionMarketPricer _optionPricer, OptionGreekCache _greekCache, ShortCollateral _shortCollateral, OptionToken _optionToken, IERC20 _quoteAsset, IERC20 _baseAsset, string[] memory _errorMessages ) external { re...
13,238,254
pragma solidity ^0.4.21; /*** * ,------. * | .---' ,--,--. ,--.--. ,--,--,--. * | `--, ' ,-. | | .--' | | * | |` \ '-' | | | | | | | * `--' `--`--' `--' `--`--`--' * * v 1.1.0 * "With help, wealth grows..." * * Ethereum Commo...
Get dividends of my crop./
function myCropDividends(bool _includeReferralBonus) external view returns (uint256) { return Hourglass(eWLTHAddress).dividendsOf(crops[msg.sender], _includeReferralBonus); }
12,724,451
/* Copyright 2018 Set Labs Inc. 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...
Internal function that Withdraws a quantity of tokens from the vault. _token The address of the ERC20 token _quantity The number of tokens to withdraw/ Declare interface variavle for vault Call Vault contract to deattribute tokens to user Call Vault to withdraw tokens from Vault to user
function withdrawInternal( address _token, uint256 _quantity ) internal { IVault vault = IVault(state.vault); vault.decrementTokenOwner( _token, msg.sender, _quantity ); vault.withdrawTo( _token, ...
7,211,982
pragma solidity 0.6.12; import "./IMarketplaceSettings.sol"; import "openzeppelin-solidity-solc6/contracts/math/SafeMath.sol"; import "openzeppelin-solidity-solc6/contracts/access/Ownable.sol"; import "openzeppelin-solidity-solc6/contracts/access/AccessControl.sol"; /** * @title MarketplaceSettings Settings governin...
- `_percentage` must be <= 100. _percentage uint8 percentage fee./
function setMarketplaceFeePercentage(uint8 _percentage) external onlyOwner { require( _percentage <= 100, "setMarketplaceFeePercentage::_percentage must be <= 100" ); marketplaceFeePercentage = _percentage; }
2,578,924
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; interface TradeBotCommanderV2Interface { // events event ADDEDACCOUNT705(address account); //inject NONSTANDARD NAMING event REMOVEDACCOUNT677(address account); //inject NONSTANDARD...
inject NONSTANDARD NAMING
function REMOVEACCOUNT427(address account) external override ONLYOWNER726 {
12,831,818
./partial_match/40/0xF5282616a1F9CffFE24122a1A76B0bf2ce087357/sources/contracts/WagPool.sol
Set DURATION_FACTOR_OVERDUE Only callable by the contract admin./
function setDurationFactorOverdue(uint256 _durationFactorOverdue) external onlyAdmin { require( _durationFactorOverdue > 0, "DURATION_FACTOR_OVERDUE cannot be zero" ); DURATION_FACTOR_OVERDUE = _durationFactorOverdue; emit NewDurationFactor...
8,827,096
./full_match/1/0xe3aF60f1F08e489503d9827210c73E468400c7ec/sources/browser/Untitled.sol
mints a new ERC1155 token the tokens are minted in per-interval batches, this is to allow profit share calculations receiver - the address that will control the minted token(s).
function mint(address receiver) external payable { require(msg.sender == minterAddress); require(msg.value > 0); if (now >= currentIntervalSec + 7 days && (415*supplyPerInterval[currentIntervalNo] >= supplyPerInterval[currentIntervalNo-1])){ currentIntervalNo++; curre...
9,724,295
/** *Submitted for verification at Etherscan.io on 2021-05-05 */ /* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;...
Function to change the implementation address, which can be called only by the owner newImplementation New address of the implementation/
function setImplementation(address newImplementation) external onlyOwner { implementation = newImplementation; emit ImplementationChanged(newImplementation); }
21,589
./full_match/1/0xd2E73E3254B1f9A1215cB1F1aE73b9B079B5E697/sources/contracts/Helpers/Signers.sol
Verifies that a message is signed by a quorum among the signers The sigs must be sorted by signer addresses in ascending order. _msg signed message _sigs list of signatures sorted by signer addresses _signers sorted list of current signers _powers powers of current signers/ require(ssHash == h, "Mismatch current si...
function verifySigs(bytes memory _msg, bytes[] calldata _sigs, address[] calldata _signers, uint256[] calldata _powers) public view override { bytes32 h = keccak256(abi.encodePacked(_signers, _powers)); _verifySignedPowers(keccak256(_msg).toEthSignedMessageHash(), _sigs, _signers, _powers); }
3,122,769
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import './Context.sol'; import './Strings.sol'; import './ERC165.sol'; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { function hasRole(bytes32 role, address account) external view ...
Set the parameters defining the function from timestamp to epoch number. interval The length of an epoch, in seconds. offset The start of epoch zero, in seconds./
function setEpochParameters( uint256 interval, uint256 offset ) external onlyRole(CONFIG_UPDATER_ROLE) nonReentrant { _setEpochParameters(interval, offset); }
1,681,969