file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/97/0x670cbE8C92cEddc985F8cB4eacd57Abfc6BbA471/sources/project_/contracts/diamond/libraries/LibTrading.sol
slippage = (OiLong + qty) price / depthAboveUsd slippage = (OiLong + qty) price / depthBelowUsd
function _slippagePrice(address pairBase, uint256 marketPrice, uint256 qty, bool isLong, LibPairsManager.SlippageConfig memory sc) private view returns (uint256) { if (isLong) { uint slippage = sc.slippageLongP; if (sc.slippageType == IPairsManager.SlippageType.ONE_PERCENT_DEPTH) { ...
3,270,370
./partial_match/1/0xcc3C54B95f3f1867A43009B80ed4DD930E3cE2F7/sources/lib/solidity-utils/src/contracts/create3/Create3.sol
Computes the resulting address of a contract deployed using address(this) and the given `_salt` salt Salt of the contract creation, resulting address will be derivated from this value only return address of the deployed contract, reverts on error The address creation formula is: keccak256(rlp([keccak256(0xff ++ addre...
function addressOf(bytes32 salt) internal view returns (address) { return addressOfWithPreDeployedFactory(salt, address(this)); }
2,800,848
./full_match/1/0x025030BdAa159f281cAe63873E68313a703725A5/sources/contracts/gelato_actions/gnosis/ActionPlaceOrderBatchExchange.sol
Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut => do not use for _actionData encoding
function execWithDataFlowInAndOut( bytes calldata _actionData, bytes calldata _inFlowData ) external payable virtual override returns (bytes memory) { (address sellToken, uint128 sellAmount) = _handleInFlowData(_inFlowData); (address or...
9,651,432
pragma solidity 0.5.10; contract Context { constructor () internal { } function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING return msg.sender; } function _MSGDATA330() ...
inject NONSTANDARD NAMING
function TEMPORARYREFUNDABLECOLLATERAL760(bytes32 loan) external view returns (uint256) {
1,784,168
./full_match/5/0x8cc4E47adB9D01070c6aC41420355F33FA543b59/sources/contracts/upgrades/GraphProxyAdmin.sol
Returns the pending implementation of a proxy. This is needed because only the proxy admin can query it. return The address of the pending implementation of the proxy./ We need to manually run the static call since the getter cannot be flagged as view bytes4(keccak256("pendingImplementation()")) == 0x396f7b23
function getProxyPendingImplementation(IGraphProxy _proxy) public view returns (address) { (bool success, bytes memory returndata) = address(_proxy).staticcall(hex"396f7b23"); require(success); return abi.decode(returndata, (address)); }
1,895,924
./full_match/80001/0x2d3B52Ab8233f29c7F189B6AAbD4AF8de3036cC4/sources/contracts/mixins/MixinKeys.sol
Modify the expirationTimestamp of a key by a given amount. _tokenId The ID of the key to modify. _deltaT The amount of time in seconds by which to modify the keys expirationTimestamp _addTime Choose whether to increase or decrease expirationTimestamp (false == decrease, true == increase) Throws if owner does not ha...
function _timeMachine( uint _tokenId, uint256 _deltaT, bool _addTime ) internal { _isKey(_tokenId); uint formerTimestamp = _keys[_tokenId].expirationTimestamp; if (_addTime) { if (formerTimestamp > block.timestamp) { _keys[_tokenId].expirationTimestamp = formerTimestamp + _de...
9,435,274
pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract IAuthCenter { function getAccountManager() public returns (address) ; function getAuthManager() public returns (address); //用于调用方鉴权, callee is externalAccount function check(address caller, address callee, bytes key) public view retu...
用于调用方鉴权, callee is externalAccount用于调用方鉴权, callee is UserAccount.getData()管理方管理key权限
{ function getAccountManager() public returns (address) ; function getAuthManager() public returns (address); function check(address caller, address callee, bytes key) public view returns (bool); function checkWithSign(address callee, bytes key, bytes args, bytes32[4] sign) public view returns (addre...
2,543,375
pragma solidity ^0.6.0; // import ownable import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; // import safemath import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol"; contract MunicipalityWasteTaxes is Ownable { ...
create a function that can be called by individual citizen in order to pay the initial deposit. to do so, it will need to be external and payable the amount will be sent to this contract that is owned by the municipality {potentially expand it so that one citizen can pay the deposit of another citizen} make sure that t...
function payDeposit() external payable isCitizenCanPay(msg.sender){ if(msg.value >= deposit){ citizens[msg.sender].paidDeposit = true; revert(); } }
12,979,057
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IE...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721...
6,935,794
./full_match/84531/0x5a9195d9b4B3a09945545F942B41080FDeCe4F7a/sources/contracts/coretime.sol
2x of remaining days pricePerDay
function getCurrentPriceETH(uint256 _tokenId) public view returns (uint256) { TokenInfo storage token = tokenInfo[_tokenId]; if ( totalSupply() == 0 || token.expirationTimestamp == 0 || block.timestamp > token.expirationTimestamp ...
11,512,762
pragma solidity ^0.4.24; /** * @title -FoMo-3D v0.7.1 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * ...
ends the round. manages paying out winner/splitting up pot/ setup local rID grab our winning player and team id's grab our pot amount calculate our winner share, community rewards, gen share, p3d share, and amount reserved for next pot calculate ppt for round mask
function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _rID = rID_; uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; uint256 _pot = round_[_rID].pot; ...
1,181,144
pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { /...
Tries to returns the value associated with `key`. O(1). Does not revert if `key` is not in the map. _Available since v3.4._/
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); }
16,027
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol
Reads the uint96 at `cdPtr` in calldata.
function readUint96( CalldataPointer cdPtr ) internal pure returns (uint96 value) { assembly { value := calldataload(cdPtr) } }
3,218,276
./full_match/1/0x864a1CBB53b9Dea3691a6974B456088C2771DcAd/sources/browser/Bar.sol
Internal function that buys back BOOGIE with the amount of ETH specified
function _buyBoogie(uint256 _amount) internal returns (uint256 boogieBought) { uint256 ethBalance = address(this).balance; if (_amount > ethBalance) _amount = ethBalance; if (_amount > 0) { uint256 deadline = block.timestamp + 5 minutes; address[] memory boogiePath = ...
4,927,192
// SPDX-License-Identifier: Apache-2.0 /****************************************************************************** * Copyright 2020 IEXEC BLOCKCHAIN TECH * * * * Licensed under the Apache License, Ve...
Prediction methods - Public /
function estimateDepositEthSent (uint256 eth ) external view override returns (uint256 token) { return router.getAmountsOut(eth, _eth2token())[1]; }
15,845,470
pragma solidity 0.4.18; /** * Math operations with safety checks */ contract BaseSafeMath { /* standard uint256 functions */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function...
_owner The address of the account owning tokens _spender The address of the account able to transfer the tokens return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
7,947,539
./full_match/5/0x88313c8AbF9c3e2B67D8a8C90203184F0CF86b77/sources/contracts/ThirdwebRentableERC721A.sol
We make it so that anyone can mint tokens that have already been lazy minted./ check permissions check to make sure there are lazy minted tokens to be minted
function mintTo(address _to, string memory _tokenURI) public virtual { require(hasRole(MINTER_ROLE, msg.sender),"must have minter role to mint"); uint256 quantity = 1; require( _nextTokenId() + quantity <= nextTokenIdToLazyMint, "Not enough lazy minted tokens." ...
11,623,282
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** *...
decrease old representative increase new representative
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].v...
17,066
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title RestrictedToken * @dev An ERC20 token that can only be transferred to whiteliste...
Whitelist functions Check if an account is whitelisted for transfers account The address to check return true if the account is whitelisted/
function isWhitelisted(address account) public view returns (bool) { return _whitelist[account]; }
7,276,699
./full_match/8453/0x33d34437238A91c18242715a523c2F0A4d74C904/sources/contracts/CorePair.sol
this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) { uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); require(amount...
11,558,416
./full_match/4/0x171126e37E7C3d8E92325388C97899aD43C13768/sources/browser/Untitled1.sol
.div(15) - 1 eth block is mine every ~15 sec, rewardRatePerBlock scaled by 1e18, and 100 is %
function calcReward(uint amount) public view returns (uint) { uint duration = withdrawStart.sub(stakingEnd); uint rewardAmount = amount.mul(rewardRatePerBlock).mul(duration).div(15).div(1e18).div(100); return rewardAmount; }
701,423
./full_match/4/0xFf079e56d957284C5F622e9537aD8879236eCa4F/sources/FineCore.sol
set Randomizer/
function setRandom(address rand) external onlyRole(DEFAULT_ADMIN_ROLE) { entropySource = RandomizerInt(rand); }
654,466
//Address: 0x87dde390e9d458dca2692c29facaa33b7636f7fa //Contract name: ERC223Token //Balance: 0 Ether //Verification Date: 2/9/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.19; interface ERC223ReceivingContract { function tokenFallback(address _from, uint _value, bytes _data) public; } l...
Transfer the specified amount of tokens to the specified address. Invokes the `tokenFallback` function if the recipient is a contract. The token transfer fails if the recipient is a contract but does not implement the `tokenFallback` function or the fallback function to receive funds. _to Receiv...
function transfer(address _to, uint _value, bytes _data) public returns (bool ok) { uint codeLength; require (_to != 0x0); assembly { codeLength := extcodesize(_to) } require(balances[msg.sender]>=_value); balances[msg.sender] = balances[msg.sender].sub(_v...
5,500,297
pragma solidity ^0.4.24; /** * @title It holds the storage variables related to ERC20DividendCheckpoint module */ contract ERC20DividendCheckpointStorage { // Mapping to token address for each dividend mapping (uint256 => address) public dividendTokens; } /** * @title Holds the storage varia...
Changes the string into bytes32 _source String that need to convert into bytes32/ Notice - Maximum Length for _source will be 32 chars otherwise returned bytes32 value will have lossy value.
function stringToBytes32(string memory _source) internal pure returns (bytes32) { return bytesToBytes32(bytes(_source), 0); }
926,209
./partial_match/1/0x9C3AFDDEa87a726891A44C037242393D524CAcFE/sources/contracts/PancakeV3Factory.sol
@inheritdoc IPancakeV3Factory tick spacing is capped at 16384 to prevent the situation where tickSpacing is so large that TickBitmapnextInitializedTickWithinOneWord overflows int24 container from a valid tick 16384 ticks represents a >5x price change with ticks of 1 bips
function enableFeeAmount(uint24 fee, int24 tickSpacing) public override onlyOwner { require(fee < 1000000); require(tickSpacing > 0 && tickSpacing < 16384); require(feeAmountTickSpacing[fee] == 0); feeAmountTickSpacing[fee] = tickSpacing; emit FeeAmountEnabled(fee, tickSpaci...
2,749,026
./full_match/4/0x1Ca18a09c59ee102070399D37bc3aEa54Fa102Cc/sources/browser/myERC20.sol
Reclaim all ERC20Basic compatible tokens token ERC20B The address of the token contract/
function reclaimToken(ERC20 token) external onlyOwner { uint256 balance = token.balanceOf(address(this)); token.transfer(owner, balance); }
12,432,399
pragma solidity >=0.4.0 <0.6.0; pragma experimental ABIEncoderV2; import "remix_tests.sol"; // this import is automatically injected by Remix. import "./AccessRightManager.sol"; // file name has to end with '_test.sol' contract test_1 { AccessRightsManagement arm; function beforeAll() public { // here should ins...
arm = new AccessRightsManagement(); bool result = arm.proceedWelcome("bla","Please let me in bro");Assert.equal(result, false, "user should not be able to requesst accoutn generation again"); Assert.equal(true, arm.getUser("bla").hasAccessRight[2] == 2, "user should have assigned access right");Assert.equal(true, arm.g...
function check1() public { string memory message = arm.getCreationRequest("test"); Assert.equal(true, (bytes(message).length > 0), "user message should be there"); int8[4] memory a; a[2] = 2; Assert.equal(true, arm.getQueue().length == 1, "Queue should have 1 element now"); arm.handleCreat...
12,994,123
./partial_match/3/0x76cbFEFe70214372e43643052c32d0ca9e428CFB/sources/cmtFoundingToken.sol
usdt to governancetoken to spenderuint share = _amount.div(2);transferFrom(governance, msg.sender, share);
function swapUSDT(uint _amount) public { require(isOpenSwap == 1, "!isOpenSwap"); require(_amount >=min_unit, "!min _amount "); uint maxShares = balanceOfGOV(); require(_amount <=maxShares, "!max _amount "); token.safeApprove(msg.sender, _amount); token.safeTransferF...
5,208,364
pragma solidity ^0.4.24; contract F4Devents { event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, bytes32 affiliateName, uint256 amo...
calculates unmasked earnings (just calculates, does not update mask) return earnings in wei format/
function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256) { return( ( ( (round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys) ) / (1000000000000000000) ).sub(plyrRn...
10,117,711
/* Implements EIP918 draft token standard: https://github.com/0xbitcoin/ERC541-Spec/blob/master/contracts/EIP541.sol .*/ pragma solidity ^0.4.18; import "./EIP20Interface.sol"; import "./AbstractERC918.sol"; import "./SafeMath.sol"; import "./ExtendedMath.sol"; import "./Owned.sol"; /** * _0xBitcoinBase Implementat...
this is a recent ethereum block hash, used to prevent pre-mining future blocks
function getChallengeNumber() public constant returns (bytes32) { return challengeNumber; }
951,764
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "./erc677/IERC677Receiver.sol"; import "./access/HasCrunchParent.sol"; import "./CrunchToken.sol"; /** * DataCrunch Staking contract for the CRUNCH token. * * To start staking, use the {CrunchStaking-deposit(address)} method, but this require an allowa...
Returns the sum of the specified `addr` staked amount. addr address to check. return the total staked of the holder./
function totalStakedOf(address addr) external view returns (uint256) { return holders[addr].totalStaked; }
1,587,787
./full_match/3/0xa14B709162AE27F9c832f45469db83980c801931/sources/contracts/NounsToken.sol
Mint a Noun to the caller/ if (_currentNounId <= 1820 && _currentNounId % 10 == 0) { _mintTo(noundersDAO, _currentNounId++); }
function mint() public override returns (uint256) { return _mintTo(msg.sender, _currentNounId++); }
14,253,984
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./interfaces/IERC20.sol"; import "./libraries/SafeERC20.sol"; import "./libraries/ERC20.sol"; import "./libraries/EnumerableSet.sol"; import "./libraries/SafeMath.sol"; import "./libraries/Ownable.sol"; import "./xLessToken.sol"; interface IMigratorChef...
notice Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), ...
411,646
pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { // assert(b > 0); // Solidity...
Allows to replace an owner with a new owner. Transaction has to be sent by wallet. owner Address of owner to be replaced. owner Address of new owner.
function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) { for (uint i=0; i<owners.length; i++) { if (owners[i] == owner) { owners[i] = newOwner; break; ...
7,874,051
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./Badger.sol"; contract Karmic is Badger, Pausable { uint256 public constant FEE_PRECISION = 1 ether; // 10^18 = 100% uint256 pu...
updates transferability for a given token id (tier) tokenId tokenId for which transferability should be updated transferable determines whether tokens from tier should be transferable or not/
function updateTransferableStatus(uint256 tokenId, bool transferable) public onlyOwner isTier(tokenId) { tokenTiers[tokenId].transferable = transferable; emit TierChange(tokenId, tokenTiers[tokenId].uriId, transferable); }
10,039,462
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asser...
Add child TAO _taoId The TAO ID to be added to _childId The ID to be added to as child TAO/ If _taoId's Advocate == _childId's Advocate, then the child is automatically approved and connected Otherwise, child TAO needs parent TAO approval
function addChild(address _taoId, address _childId) public isTAO(_taoId) isTAO(_childId) onlyFactory returns (bool) { require (!isChild(_taoId, _childId)); Family storage _family = families[_taoId]; require (_family.childInternalIdLookup[_childId] == 0); _family.childInternalId++; _family.childInter...
10,007,400
//Address: 0x239c7175a43c500255c4d3849c2ab2973d4384d5 //Contract name: Token //Balance: 0 Ether //Verification Date: 12/14/2017 //Transacion Count: 0 // CODE STARTS HERE pragma solidity ^0.4.15; /** * assert(2 + 2 is 4 - 1 thats 3) Quick Mafs */ library QuickMafs { function mul(uint256 _a, uint256 _b) internal...
Function to stop minting tokens irreversable/
function finishMinting() public onlyOwner returns (bool) { mintingFinished = true; MintFinished(); return true; }
2,492,944
pragma solidity ^0.4.23; /*************************************************** Externally copied contracts and interfaces. Source: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/ERC20Basic.sol ***************************************************/ /**** ERC20Basic.sol ****/ /** ...
Transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(isTransferEnabled); require(_to != address(0)); require(_value <= getNonVestedBalanceOf(msg.sender)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_va...
74,456
/* A simple Ethereum Virtual Machine Database (EVMDB). // // Used for creating/managing DBs on the EVM. // // Provides insert, update, delete and search functions. // The search is only exact search at the moment. // // Further developments may include type checking, "select" search, // complicated DB structues etc. //...
inserts data to a new row in the DB _DB_id id of the DB _data data to insert return id of newly created rowarray extension is manual
function insert(uint256 _DB_id, bytes32[] _data) external returns (uint256) { if (_DB_id < DBs.length && msg.sender == DBs[_DB_id].owner && _data.length == DBs[_DB_id].header.length) { uint256 row_id = DBs[_DB_id].data.length; uint256 i; ...
6,387,010
./partial_match/42/0xd9153c72a6e1f6F362B13b6891B840e99AD46561/sources/NoFiPartyStarter.sol
Calculates if user's share of wETH in the pool is creater than their deposit amts (used for potential earnings) Accounting updates
function withdrawEarnings(address memberAddress, uint256 amount) external nonReentrant { uint256 initialTotalSharesAndLoot = totalShares.add(totalLoot); Member storage member = members[memberAddress]; uint256 sharesM = member.shares; uint256 lootM = member.loot; uint...
8,839,402
// 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...
Submit request for undelegation _target - address of service provider to undelegate stake from _amount - amount in wei to undelegate return Updated total amount delegated to the service provider by delegator/ Confirm no pending delegation request Ensure valid bounds Submit updated request for sender, with target sp, ...
function requestUndelegateStake( address _target, uint256 _amount ) external returns (uint256) { _requireIsInitialized(); _requireClaimsManagerAddressIsSet(); require( _amount > 0, "DelegateManager: Requested undelegate stake amount must be gr...
1,231,938
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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...
Burns `amount` of agToken on behalf of another account without redeeming collateral back account Account to burn on behalf of amount Amount to burn poolManager Reference to the `PoolManager` contract for which the `stocksUsers` will need to be updated When calling this function, people should specify the `poolManag...
interface ISanToken { function burnNoRedeem(uint256 amount) external; }
1,288,373
pragma ton-solidity >= 0.38.2; /// @title LiquiSOR\DEXPool /// @author laugan /// @notice Contract for providing liquidity and trading. In the same time it's a root contract for TIP-3 Liquidity token pragma AbiHeader time; pragma AbiHeader expire; pragma AbiHeader pubkey; import "../std/lib/TVM.sol"; import "../tip3...
Calculates wallet address with defined public key (responsible)
function callWalletAddress(int8 workchainId, uint256 walletPubkey, address walletOwner) override external responsible view returns (address) { }
12,809,336
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. ...
set the state of WhitelistSale
function setpauseWhitelistSale(bool _state) public onlyOwner { pauseWhitelistSale = _state; }
11,908,281
pragma solidity >=0.5.16; // SPDX-License-Identifier: MIT import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol"; /************************************************** */ /* no1s1 App Smart Contract */ /************************************************** */ contract no1s1App {...
function triggered by back-end shortly after access() function with sensor feedback Pass address of function caller to data contract to enable role modifier/
function checkActivity(bool _pressureDetected, bytes32 _key) external requireBackend { no1s1Data.checkActivity(_pressureDetected, _key); }
12,788,234
./partial_match/1/0x27865916b3E6208b54EB7B3C481b3157e0Ac1B0E/sources/Pile.sol
drip updates the chi of the rate category by compounding the interest and updates the total debt
function drip(uint rate) public { if (now >= rates[rate].lastUpdated) { (uint chi, uint deltaInterest) = compounding(rates[rate].chi, rates[rate].ratePerSecond, rates[rate].lastUpdated, rates[rate].pie); rates[rate].chi = chi; rates[rate].lastUpdated = uint48(now); ...
4,433,273
// SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <=0.7.0; contract Ballot { //Information about a voter struct Voter { uint weight; //weight is amount of vote the voter can have bool voted; //true implies voter already voted } //Candidate type for a single candidate struct Candidate { bytes32 na...
This is a helper function which converts string to bytes32 {string memory} sourcestring data typereturn {bytes32} resultresult in bytes32/
function stringToBytes32(string memory source) public pure returns(bytes32 result) { assembly { result := mload(add(source, 32)) } }
6,377,367
./full_match/42/0xb397fc77aC18DDD3Ead391a3Ca64892817De881C/sources/browser/flatten.sol
Increase rawCollateral by a fee-adjusted collateralToRemove amount. Fee adjustment scales up collateralToRemove by dividing it by cumulativeFeeMutliplier. There is potential for this quotient to be floored, therefore rawCollateral is increased by less than expected. Because this method is usually called in conjunction ...
function _addCollateral(FixedPoint.Unsigned storage rawCollateral, FixedPoint.Unsigned memory collateralToAdd) internal returns (FixedPoint.Unsigned memory addedCollateral) { FixedPoint.Unsigned memory initialBalance = _getCollateral(rawCollateral); FixedPoint.Unsigned memory adj...
16,255,885
./partial_match/1/0x000000000000f968845afB0B8Cf134Ec196D38D4/sources/contracts/controller/ArrngController.sol
setOracleAddress: set a new oracle address oracle_: the new oracle address/
function setOracleAddress(address payable oracle_) external onlyOwner { require(oracle_ != address(0), "Oracle address cannot be address(0)"); oracleAddress = oracle_; emit OracleAddressSet(oracle_); }
15,927,252
./full_match/40/0x110dE362cc436D7f54210f96b8C7652C2617887D/sources/contracts/LiquidityManager.sol
Get or create a pool for (tokenX/tokenY/fee) if not exists. tokenX tokenX of swap pool tokenY tokenY of swap pool fee fee amount of swap pool initialPoint initial point if need to create a new pool return corresponding pool address
function createPool(address tokenX, address tokenY, uint24 fee, int24 initialPoint) external returns (address) { require(tokenX < tokenY, "x<y"); address pool = IiZiSwapFactory(factory).pool(tokenX, tokenY, fee); if (pool == address(0)) { pool = IiZiSwapFactory(factory).newPool(t...
9,551,876
./partial_match/1/0xEC233143B85892dd6A6E2dc48D7F73aF728d7164/sources/alch.sol
See {IERC20-balanceOf}./
function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; }
2,622,269
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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; } functi...
Transfer the balance from owner&39;s account to another account
function transfer(address _to, uint256 _amount) public returns (bool success) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); Transfer(m...
7,903,221
/** *Submitted for verification at Etherscan.io on 2021-07-19 */ // SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amou...
Flash loan DXDY amount desired is how much we are willing for position to change
function doDyDxFlashLoan(bool deficit, uint256 amountDesired) internal returns (uint256) { if(amountDesired == 0){ return 0; } uint256 amount = amountDesired; ISoloMargin solo = ISoloMargin(SOLO); if (amountInSolo < amount) { amount = amountI...
2,276,789
pragma solidity 0.4.25; interface FSForwarderInterface { function deposit() external payable returns(bool); } /// @title Contract for managing player names and affiliate payments. /// @notice This contract manages player names and affiliate payments /// from registered games. Players can buy multiple names and ...
make sure name fees paid set up address fire event
function registerAffiliate() external payable isHuman() { require (msg.value >= affiliateFee_, "umm..... you have to pay the name fee"); address _addr = msg.sender; uint256 _pID = pIDxAddr_[_addr]; require (_pID > 0, "you need to be registered"); ...
417,040
./partial_match/4/0x60Ae6FC8AF7e4B5b4dE2112078fDdACfb37E99aF/sources/SendMaMoney.sol
------------------------------------------------------------------------ Function to mint tokens _to The address that will receive the minted tokens. _value The amount of tokens to mint. A boolean that indicates if the operation was successful. ------------------------------------------------------------------------
function mint(address _to, uint256 _value) onlyOwner public returns (bool) { require(_to != address(0)); require(_value > 0); _totalSupply = _totalSupply.add(_value); balances[_to] = balances[_to].add(_value); emit Mint(_to, _value); emit Transfer(address(0),...
8,745,048
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "../external/FreeCollateralExternal.sol"; import "../internal/valuation/ExchangeRate.sol"; import "../internal/markets/CashGroup.sol"; import "../internal/markets/AssetRate.sol"; import "../internal/nToken/nTokenHandler.sol"; i...
Returns a currency and its corresponding asset rate and ETH exchange rates. Note that this does not recalculate cToken interest rates, it only retrieves the latest stored rate.
function getCurrencyAndRates(uint16 currencyId) external view override returns ( Token memory assetToken, Token memory underlyingToken, ETHRate memory ethRate, AssetRateParameters memory assetRate ) { _checkValidCurr...
5,901,869
./partial_match/1/0x9C1b2F065CE61904F15C0F7d86b66b57B3745d09/sources/BBC.sol
Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = _tTotal*maxTxAmount/100; require (_maxTxAmount >= _tTotal/100 ,"Max Tx must be more than 1%"); }
16,034,045
pragma solidity ^0.5.3; pragma experimental ABIEncoderV2; import "./IPoMain.sol"; import "./IPoTypes.sol"; import "./IErc20.sol"; import "./IPoStorage.sol"; import "./IProductStorage.sol"; import "./IBusinessPartnerStorage.sol"; import "./IFunding.sol"; import "./IWalletBuyer.sol"; import "./IWalletSeller.sol"; import...
writes a snapshot of the PO to event log, for debugging
function writePoToEventLog(uint64 ethPoNumber) external { IPoTypes.Po memory po = poStorage.getPoByEthPoNumber(ethPoNumber); emit PurchaseOrderSnapshotLog(po.buyerSysId, po.sellerSysId, po.ethPurchaseOrderNumber, po); }
12,594,554
pragma solidity ^0.5.1; import "../../lib/lifecycle/Destructible.sol"; import "../../lib/ownership/Upgradable.sol"; import "../../lib/ERC20.sol"; import "../database/DatabaseInterface.sol"; import "./currentCost/CurrentCostInterface.sol"; import "./BondageInterface.sol"; import "../../hardhat/console.sol"; contract Bo...
Calculate quantity of tokens required for specified amount of dots for endpoint defined by endpoint and data provider defined by oracleAddress
function calcZapForDots( address oracleAddress, bytes32 endpoint, uint256 numDots ) external view returns (uint256 numZap) { uint256 issued = getDotsIssued(oracleAddress, endpoint); return currentCost._costOfNDots(oracleAddress, endpoint, issue...
6,387,855
/** *Submitted for verification at Etherscan.io on 2022-01-22 */ // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; ...
Pause Contract presaleWL only owner
function presaleWLPaused() public onlyOwner { _presaleWLPaused = !_presaleWLPaused; }
14,966,410
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; // interface IERC20 { function TOTALSUPPLY709()...
inject NONSTANDARD NAMING
function TOTALSUPPLY709() public view override returns (uint256) {
12,852,107
pragma solidity ^0.6.0; interface CHIInterface { function mint(uint256 value) external; function free(uint256 value) external returns (uint256); function balanceOf(address) external view returns (uint); function approve(address, uint256) external; } contract ChiHelpers { /** * @dev CHI token...
CHI token Address/
function getCHIAddress() internal pure returns (address) { return 0x0000000000004946c0e9F43F4Dee607b0eF1fA1c; }
576,658
./partial_match/1/0x0176A80CcCA7514eD1C32ba1866b8EC497bbF040/sources/StoryOfShiba.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Story Of Shiba", "SOS") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair =...
2,740,860
./partial_match/1/0xc40CdBf22a74757819769cA2208E3fB2C7aEC5de/sources/CompliantCrowdsale.sol
approve buy tokens request nonce request recorded at this particular nonce/
function approveMint(uint256 nonce) external onlyValidator { require(_approveMint(nonce)); }
3,699,407
./full_match/5/0x3655A0FfF28034894A5750168e0069a2f6d8aE43/sources/contracts/333Updated.sol
Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` ref...
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { ...
1,850,717
// 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"; ...
The arbitrator rejects a dispute as being invalid. Reject a dispute with ID `_disputeID` _disputeID ID of the dispute to be rejected/ Handle conflicting dispute if any Burn the fisherman's deposit
function rejectDispute(bytes32 _disputeID) external override onlyArbitrator { Dispute memory dispute = _resolveDispute(_disputeID); require( !_isDisputeInConflict(dispute), "Dispute for conflicting attestation, must accept the related ID to reject" ); if (di...
908,970
./full_match/4/0xD10fEd0e71Cfd4728b48eC7bdea0bEDD6075Cb78/sources/sellSwap.sol
/ value = orderIdValue[bytes16(keccak256(abi.encodePacked(seller, chainIdAdapterIdAssetIdPrice, foreignAddress)))];
function getOrderValue(address seller, bytes32 chainIdAdapterIdAssetIdPrice, bytes32 foreignAddress) view external returns (uint256 value) { }
12,460,095
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /* f_1 - 274287 - 99825 - 48525 f_2 - 148063 - 103637 - 52337 f_3 - 274959 - 99835 - 48535 */ // uint8 storage and setter contract Library_1 { address[] owners; mapping(address=>uint256) ownerBalances; function SplitFunds() public payable { ...
this should have checks, using this to just illustrate a point
function addOwner() public { owners.push(msg.sender); }
15,844,579
./full_match/97/0xce50445Fade594dd26312Ef3980cE0D1415950c8/sources/contracts/malamaca.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 bnbAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, marketingWallet, block.timestamp ); }
5,041,057
./full_match/43114/0x14cb5e12624E59346723924316410829B6f5Bb19/sources/thenamasterchef.sol
View function to see pending THENA on frontend.
function pendingThena(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accThenaPerShare = pool.accThenaPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
4,504,301
./full_match/137/0xf39dD76825dc5e4599832514B5a451F25B80828D/sources/contracts/MainV2Beta.sol
amountIn should be in terms of the token from which we are swapping
function swapExactInputSingle( address _returnBaseToken, address _tokenIn, uint256 _amountIn ) internal returns (uint256 amountOut) { uint256 amountOutMin = getAmountOutMin( _tokenIn, _returnBaseToken, _amountIn ); ISwapRouter.E...
3,766,895
./partial_match/1/0x8b90bF500ef68C98B33f5CbE82821fC75c60534b/sources/src/Senator.sol
Consumes a nonce. Returns the current value and increments nonce./ For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be decremented or reset. This guarantees that the nonce never overflows. It is important to do x++ and not ++x here.
function _useNonce(address owner) internal virtual returns (uint256) { unchecked { return _nonces[owner]++; } }
9,245,221
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "hardhat/console.sol"; enum FeeExemption { NO_EXEMPTIONS, SENDER_EXEMPT, SENDER_AND_RECEIVER_EXEMPT, REDEEM_EXEMPT_AND_SENDER_EXEMPT, REDEEM_EXEMPT_AND_SENDER_AND_RECEIVER_EXEMPT, RECEIVER_EXEMPT, REDEEM_EXEMPT_AND_RECEIVER_EXEMPT, REDEEM_E...
Returns the address where a contract will be stored if deployed via {deploy}. Any change in the `bytecode` or `salt` will result in a new destination address./
function computeAddress(bytes32 salt, bytes memory bytecode) internal view returns (address) { return computeAddress(salt, bytecode, address(this)); }
12,902,535
// "SPDX-License-Identifier: Apache-2.0" pragma solidity ^0.6.11; pragma experimental ABIEncoderV2; import "../../Core/Core.sol"; import "./ICERTFEngine.sol"; import "./CERTFSTF.sol"; import "./CERTFPOF.sol"; /** * @title CERTFEngine * @notice Inherits from BaseEngine by implementing STFs, POFs according to the AC...
Implements abstract method which is defined in BaseEngine. Computes the payoff for an event under the current state of the contract. The inheriting Engine contract has to map the events type to the designated POF. terms terms of the contract state current state of the contract _event event for which the payoff shoul...
function payoffFunction( CERTFTerms memory terms, State memory state, bytes32 _event, bytes32 externalData ) internal pure returns (int256) { (EventType eventType, uint256 scheduleTime) = decodeEvent(_event); if (eventType == EventType...
13,051,747
./partial_match/1/0x6a5e41B9532fBd02CBc4f40830976D09CB0D2d35/sources/Hummingbird.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Hummingbird", "Colibri") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair ...
15,540,446
./full_match/1/0xF4c47dacFda99bE38793181af9Fd1A2Ec7576bBF/sources/lib/pt-v5-draw-auction/lib/remote-owner/lib/erc5164-interfaces/src/libraries/ExecutorParserLib.sol
Parses the message ID from `msg.data`. return The bytes32 message ID uniquely identifying the message that was executed
function messageId() internal pure returns (bytes32) { bytes32 _messageId; if (msg.data.length >= 84) { assembly { _messageId := calldataload(sub(calldatasize(), 84)) } } return _messageId; }
3,145,182
// SPDX-License-Identifier: GPL-3.0 // File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library versio...
This allows the devs to receive kind donations
function withdraw(uint256 amt) external onlyOwner { require(sent, "omni mosquitoes: Failed to withdraw Ether"); }
14,902,568
./full_match/44787/0xC4d41D0E0253B60B85Bc35C3b6C042689fC33E55/sources/contracts/governor/PACTDelegate.sol
Function used to propose a new proposal. Sender must have delegates above the proposal threshold. _targets Target addresses for proposal calls. _values Eth values for proposal calls. _signatures Function signatures for proposal calls. _calldatas Calldatas for proposal calls. _description String description of the ...
function propose( address[] memory _targets, uint256[] memory _values, string[] memory _signatures, bytes[] memory _calldatas, string memory _description ) public returns (uint256) { require( getPriorVotes(msg.sender, sub256(block.number, 1)) > proposa...
13,252,130
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_99(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,453,812
// SPDX-License-Identifier: MIT pragma solidity >0.7.5; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract AtomicSwap { using SafeERC20 for IERC20; /** * @openValue The amount that seller wants to sell * @openTrader T...
outcome of this method might be subject to transaction ordering, check expire() Transfer the closing funds from the closing trader to the opening trader. Transfer the opening funds from opening trader to the closing trader.
function close( bytes32 _swapID ) public onlyOpenSwaps(_swapID) onlyCloseTrader(_swapID) { Swap memory swap = swaps[_swapID]; swapStates[_swapID] = States.CLOSED; IERC20(swap.closeContractAddress).safeTransferFrom(swap.closeTrader, swap.openTrader, s...
2,564,799
pragma solidity ^0.4.18; /** ---------------------------------------------------------------------------------------------- * Power_Token by Power Limited. */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; a...
SafeMath.sub will throw if there is not enough balance.
function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) public returns (bool) { for (uint256 i = 0; i < _addresses.length; i++) { require(_addresses[i] != address(0)); require(_amounts[i] <= balances[msg.sender]); require(_amounts[i] > 0); balances[msg.sender] = bala...
2,427,560
./partial_match/42/0x85411Ecd16C94e964a698Dc6B09bA74896EE9d87/sources/CollateralEth.sol
https:docs.synthetix.io/contracts/source/interfaces/iexchangerates Structs
interface IExchangeRates { function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume); function requireSystemActive() external view; function requireIssuanceActive() external view; function requireExchangeActive() external view; function requ...
3,321,007
/** *Submitted for verification at Etherscan.io on 2021-10-05 */ //SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.6; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virt...
To withdraw any ERC20 tokens that mistakenly get sent to the contract address.
function sendTokenTo(IERC20 token, address recipient, uint256 amount) external onlyOwner() { token.transfer(recipient, amount); }
6,700,744
pragma solidity >=0.4.22 <0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; contract TokenConversionManager is Ownable, ReentrancyGuard { ...
builds a prefixed hash to mimic the behavior of ethSign.
function prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); }
13,139,182
./partial_match/1/0xFac1098E6090aB52D06B8bA44c9b4C104D9CD670/sources/SafeMath.sol
Divides two numbers and returns the remainder (unsigned integer modulo), reverts when dividing by zero.
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "MOD_ERROR"); return a % b; }
2,720,346
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.6; interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner...
Pending rewards will be changed. See class comments.
function setReward( address _pair, address _token, bool _isSupply, uint _points ) external onlyOwner { uint pid = _getPid(_pair, _token, _isSupply); accruePool(pid); totalPoints = totalPoints - pools[pid].points + _points; pools[pid].points = _points; emit PoolUpdate(pid...
1,792,263
/******************************************************************************\ file: Math.sol ver: 0.5.0 updated:25-10-2017 author: Darryl Morris (o0ragman0o) email: o0ragman0o AT gmail.com unit256 and uint64 Safe maths libraries. --- pragma solidity ^0.4.13; import "Math.sol" contract K{ using MathU f...
Safe cast from uint to uint8
function to8(uint a) internal pure returns (uint8 b) { b = uint8(a); assert(uint(b) == a); }
12,755,850
./partial_match/1/0x44d97D22B3d37d837cE4b22773aAd9d1566055D9/sources/contracts/governance/fork/NounsDAOForkEscrow.sol
Escrows nouns tokens Can only be called by the Nouns token contract, and initiated by the DAO contract operator The address which called the `safeTransferFrom` function, can only be the DAO contract from The address which previously owned the token tokenId The id of the token being escrowed/
function onERC721Received( address operator, address from, uint256 tokenId, bytes memory ) public override returns (bytes4) { if (msg.sender != address(nounsToken)) revert OnlyNounsToken(); if (operator != dao) revert OnlyDAO(); escrowedTokensByForkId[for...
4,079,054
// SPDX-License-Identifier: MIT pragma solidity >=0.8.6; import "./question.sol"; contract QuizContract { address student; address owner; bool closed; uint16 questionsCount; uint256 award; mapping(uint16 => Question) questions; mapping(uint16 => uint16) studentAnswers; uint16 score; ...
Removes an aswer list for question s: - questionId ID of question to modify - answerIndex Index of answer to remove
function removeAnswer(uint16 questionId, uint16 answerIndex) public notClosed ownerOnly { questions[questionId].answers[answerIndex] = 0x0; }
6,487,362
pragma solidity 0.5.9; import "../Land.sol"; import "../contracts_common/Interfaces/ERC20.sol"; import "../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol"; /** * @title Land Sale contract * @notice This contract mananges the sale of our lands */ contract LandSale is MetaTransactionReceiver { ui...
buy Land using the merkle proof associated with it buyer address that perform the payment to address that will own the purchased Land reserved the reserved address (if any) x x coordinate of the Land y y coordinate of the Land size size of the pack of Land to purchase price amount of Sand to purchase that Land ...
function buyLandWithSand( address buyer, address to, address reserved, uint256 x, uint256 y, uint256 size, uint256 price, bytes32 salt, bytes32[] calldata proof ) external { require(block.timestamp < _expiryTime, "sale is over"); ...
12,759,805
pragma solidity ^0.8.6; // SPDX-License-Identifier: MIT import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/access/AccessControlEnumerable.sol'; contract SmileToken is Ownable, ERC721Enumerable, AccessCont...
Set the token minter. Only callable by the owner when not locked./
function setMinter(address _minter) external onlyOwner { minter = _minter; _setupRole(DEFAULT_ADMIN_ROLE, minter); _grantRole(DEFAULT_ADMIN_ROLE, minter); }
1,516,970
./partial_match/1/0xD1C833b46266CcF6060e90B69161FCEe9C66E826/sources/src/NightWatchVendor.sol
Withdraws the ERC20 funds from the contract. Revert if there are no funds Limit the amount to the contract balance.
function withdrawERC20( uint256 amount, ERC20 token ) external onlyOwner nonReentrant { uint256 balance = token.balanceOf(address(this)); if (balance == 0) { revert NoFunds(); } if (amount > balance) { amount = balance; } ...
15,944,987
// File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuin...
Return the number of minted tokens during the presales for a wallet address/
function getNbrOfMintedToken(address wallet, bool asFree) external view returns (uint16) { if (asFree){ return _WalletFreeMintCounter[wallet]; return _WalletMintCounter[wallet]; } }
6,891,973
/** *Submitted for verification at Etherscan.io on 2020-07-03 */ pragma solidity ^0.5.5; /* BASIC ERC20 Crowdsale ICO ERC20 Token */ library SafeMath{ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; ...
creates all tokens 5 million this address will hold all tokens all community contrubutions coins will be taken from this address
function createTokens() internal { uint256 total = 10000000*10**18; balances[address(this)] = total; totalSupply = total; }
2,556,389
// SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2018 Rain <rainbreak@riseup.net>, Centrifuge pragma solidity >=0.6.12; import "./math/Interest.sol"; // ## Interest Group based Pile // The following is one implementation of a debt module. It keeps track of different buckets of interest rates and is optimiz...
set rate loanRates for a loan rate category has to be initiated
function setRate(uint loan, uint rate) external { require(pie[loan] == 0, "non-zero-debt"); require(rates[rate].chi != 0, "rate-group-not-set"); loanRates[loan] = rate; emit SetRate(loan, rate); }
5,436,983
./full_match/4/0xCAAe76A04dDe0c0F354e2Fb95560bEc757CDF59b/sources/contracts/STAKING.sol
require (block.timestamp >= stakingDetails[msg.sender][stakenum].locktime + levels[level],"not yet");uint level = stakingDetails[msg.sender][stakenum].stakeLevel;
function unStake (uint stakenum , uint amt) public { require(!stakingDetails[msg.sender][stakenum].unstaked,"Already unstaked"); uint level = stakingDetails[msg.sender][stakenum].stakeLevel; require ( amt <= stakingDetails[msg.sender][stakenum].stakedAmount,"not enough funds"); ...
12,351,025
pragma solidity ^0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // An utility erc20 contract that has a fancy method contract TestERC20Utility is ERC20 { event __CronosSendToAccount(address recipient, uint256 amount); event __CronosSendToEthereum(address recipient, uint256 amount, uint256 bridge_fee)...
send to ethereum through gravity bridge
function send_to_ethereum(address recipient, uint256 amount, uint256 bridge_fee) external { uint256 total = amount + bridge_fee; require(total >= amount, "safe-math-add-overflow"); _burn(msg.sender, total); emit __CronosSendToEthereum(recipient, amount, bridge_fee); }
12,950,851
./full_match/1/0xBADa4B9bdc249B788A6247e4a8a9158eD0b3e504/sources/contracts/deployer/FunWalletFactory.sol
unlock the stake, in order to withdraw it. The paymaster can't serve requests once unlocked, until it calls addStake again/
function unlockStakeFromEntryPoint() external { require(msg.sender == address(deployer), "FW017"); entryPoint.unlockStake(); }
17,067,468
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /// @title Uint32 length 8 array functions /// @dev Fits in one storage slot library Uint32L8ArrayLib { using Uint32L8ArrayLib for uint32[8]; uint8 constant LENGTH = 8; error U32L8_IllegalElement(uint32 element); error U32L8_NoSpaceLeftToInsert...
Returns the index of the element in the array array Array to perform search on element Element to search return index if exists or LENGTH otherwise
function indexOf(uint32[8] storage array, uint32 element) internal view returns (uint8) { for (uint8 i; i < LENGTH; i++) { if (array[i] == element) { return i; } } }
15,859,390
./full_match/5/0xE62C789CFA0575B735C5E37Fd8aEB3a8B106FBB1/sources/project_/contracts/QtumFactory.sol
address proxy = predictDeployAddress(j, _initCodeMem);
function split(bytes memory _initCodeMem, uint256 from, uint256 instanceAmount, uint256 amount) external payable { for(uint256 j = from; j < from + instanceAmount; j++){ address proxy = createProxy(j, _initCodeMem); require(success, "Forwarding funds failed"); ...
1,952,208