file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity 0.6.5; pragma experimental ABIEncoderV2; import "./Interfaces/AssetToken.sol"; import "./common/BaseWithStorage/Admin.sol"; import "./Catalyst/CatalystValue.sol"; contract CatalystRegistry is Admin, CatalystValue { event Minter(address indexed newMinter); event CatalystApplied(uint256 indexed...
Set the Minter that will be the only address able to create Estate minter address of the minter
function setMinter(address minter) external { require(msg.sender == _admin, "NOT_AUTHORIZED_ADMIN"); require(minter != _minter, "INVALID_MINTER_SAME_ALREADY_SET"); _minter = minter; emit Minter(minter); }
964,969
pragma solidity ^0.4.13; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed pre...
Хранилище, куда будут собираться средства, делается для того, чтобы гарантировать возвраты/ Мапа адрес инвестора - был ли совершен возврат среств / Создаем от контракта продаж новое хранилище, доступ к нему имеет только контракт продаж При успешном завершении продаж, все собранные средства поступят на _destinationMulti...
function RefundableAllocatedCappedCrowdsale(uint _currentEtherRateInCents, address _token, address _destinationMultisigWallet, uint _firstStageStartsAt, uint _firstStageEndsAt, uint _secondStageStartsAt, uint _secondStageEndsAt, address _advisorsAccount, address _marketingAccount, address _supportAccount, address _...
13,009,180
./partial_match/42/0x48405e823B181BB63d3cD8b947ffD00c7AA712E4/sources/XConfig.sol
XPToken Swap Referral Pool Data Pool Managment
interface IXPool { event Approval(address indexed src, address indexed dst, uint256 amt); event Transfer(address indexed src, address indexed dst, uint256 amt); function totalSupply() external view returns (uint256); function balanceOf(address whom) external view returns (uint256); function allow...
8,944,526
/* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,. ';;;;;;;;'. .';;;;;;;;;;;;;;;;;;...
Expected amount of minted Curve.fi yDAI/yUSDC/yUSDT/yTUSD tokens. Can be used to control slippage Called in flush() function currencyAmount amount to calculate for return expected amount minted given currency amount/ prettier-ignore
function calcTokenAmount(uint256 currencyAmount) public view returns (uint256) { uint256 yTokenAmount = currencyAmount.mul(1e18).div( _curvePool.coins(TUSD_INDEX).getPricePerFullShare()); uint256[N_TOKENS] memory yAmounts = [0, 0, 0, yTokenAmount]; return _curvePool.curve().calc_...
399,500
// SPDX-License-Identifier: MIT pragma solidity ^0.8.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); /** * @dev Returns the amount o...
Random Number Generator Interface Provides an interface for requesting random numbers from 3rd-party RNG services (Chainlink VRF, Starkware VDF, etc..)
interface RNGInterface { event RandomNumberRequested(uint32 indexed requestId, address indexed sender); event RandomNumberCompleted(uint32 indexed requestId, uint256 randomNumber); function getLastRequestId() external view returns (uint32 requestId); function getRequestFee() external view returns (address f...
623,619
./partial_match/42/0x3987e4C91F8F3Cdc9Cb93775C7E09f4d41aff7b3/sources/Synthetix.sol
Once off function for SIP-60 to migrate SNX balances in the RewardEscrow contract To the new RewardEscrowV2 contract/ Record balanceOf(RewardEscrow) contract transfer all of RewardEscrow's balance to RewardEscrowV2 _internalTransfer emits the transfer event
function migrateEscrowBalanceToRewardEscrowV2() external onlyOwner { uint rewardEscrowBalance = tokenState.balanceOf(address(rewardEscrow())); _internalTransfer(address(rewardEscrow()), address(rewardEscrowV2()), rewardEscrowBalance); } address indexed account, bytes32 fromCurr...
3,314,318
/** *Submitted for verification at Etherscan.io on 2022-03-05 */ // Verified using https://dapp.tools // hevm: flattened sources of /nix/store/l2548a1amqr89zavda6lcs6z6cbdhizf-h2o-rrfm-calculators/dapp/h2o-rrfm-calculators/src/calculator/PRawPerSecondCalculator.sol pragma solidity =0.6.7 >=0.6.7 <0.7.0; ////// /nix...
@notify Modify an int256 parameter parameter The name of the parameter to change val The new value for the parameter/
function modifyParameters(bytes32 parameter, int256 val) external isAuthority { if (parameter == "folb") { require(both(val < 0, val >= -int(NEGATIVE_RATE_LIMIT)), "PRawPerSecondCalculator/invalid-folb"); feedbackOutputLowerBound = val; } else if (parameter == "sg") { ...
2,357,748
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) { if (a == 0) { return 0; } c =...
Sanity check. This could be removed in the future. Consider adding a conditional check for the last token in order to save GAS.
function _burn(address _owner, uint256 _tokenId) internal { super._burn(_owner, _tokenId); assert(tokens.length > 0); uint256 tokenIndex = idToIndex[_tokenId]; assert(tokens[tokenIndex] == _tokenId); uint256 lastTokenIndex = tokens.length - 1; uint256 lastToken = tok...
2,405,803
./full_match/80001/0x2a6bDdd481Ae14915Dc1e164a8bc5022D76baB7b/sources/deploy/contracts/core/Deployer.sol
Deploy a new self minting derivative contract selfMintingDerVersion Version of the self minting derivative contract selfMintingDerParamsData Input params of self minting derivative constructor return selfMintingDerivative Self minting derivative contract deployed/
function deploySelfMintingDerivative( uint8 selfMintingDerVersion, bytes calldata selfMintingDerParamsData ) external override onlyMaintainer nonReentrant returns (ISynthereumDeployment selfMintingDerivative) { ISynthereumFactoryVersioning factoryVersioning = getFactoryVersioning()...
9,527,548
./partial_match/42/0xC31518D4fbA20E3618F6e7B24D1Bada43837Ed45/sources/GebProxyDebtAuctionActions.sol
Modify a SAFE's collateralization ratio while keeping the generated COIN or collateral freed in the SAFE handler address. manager address - Safe Manager safe uint - Safe Id deltaCollateral - int deltaDebt - int
function modifySAFECollateralization( address manager, uint safe, int deltaCollateral, int deltaDebt ) public { ManagerLike(manager).modifySAFECollateralization(safe, deltaCollateral, deltaDebt); }
3,338,801
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import { Initializable } from "@openzeppelin/contracts/proxy/Initializable.sol"; interface IERC20 { function transfer(address recipient, uint256 amount) external returns (bool); function balanceOf(address owner) external vie...
throw if delegatecall failed
function spell(address _target, bytes memory _data) external isOwner { require(_target != address(0), "target-invalid"); assembly { let succeeded := delegatecall(gas(), _target, add(_data, 0x20), mload(_data), 0, 0) switch iszero(succeeded) case 1 { let size := returndatasize(...
11,764,063
./full_match/4/0xF758321A83c7d38B2fE2Ba436C89D65C32b4d51e/sources/StableMath.sol
Calculated maximum of two numbers x Left hand input y Right hand input return Maximum of the two inputs/
function max(uint256 x, uint256 y) internal pure returns (uint256) { return x > y ? x : y; }
12,305,020
pragma solidity ^0.5.0; import "./interfaces/ICrossChainService.sol"; import "./FromChain.sol"; import "./ToChain.sol"; import "../../request-verification-layer/permission-module/Protected.sol"; import "../../common/libraries/SafeMath.sol"; /** * @title Cross chain transfer service */ contract CrossChainService is IC...
Return list of the suppored chains/
function getSupportedChains() external view returns (bytes32[] memory) { return chains; }
5,382,172
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.6; pragma abicoder v2; import { StakedToken } from "./StakedToken.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title StakedTo...
_questMaster account that can sign user quests as completed _questSignerArg account that can sign user quests as completed/
function initialize(address _questMaster, address _questSignerArg) external initializer { startTime = SafeCast.toUint32(block.timestamp); questMaster = _questMaster; _questSigner = _questSignerArg; }
1,746,293
pragma solidity 0.4.23; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md // ---------------------------------------------------------------------------- contract ERC20Interface { functio...
------------------------------------------------------------------------ Returns the token balance of user ------------------------------------------------------------------------
function balanceOf(address _tokenHolder) public view returns (uint balance) { return balances[_tokenHolder]; }
2,157,481
./partial_match/1/0xD22a61e8503Bea5842e5e0126ca9fFC4dd492084/sources/StrawberryElephant.sol
Detect overflow when multiplying MIN_INT256 with -1
function mul(int256 a, int256 b) internal pure returns(int256) { int256 c = a * b; require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; }
11,027,052
// SPDX-License-Identifier: AGPL-3.0-only /** * DepositBoxEth.sol - SKALE Interchain Messaging Agent * Copyright (C) 2019-Present SKALE Labs * @author Artem Payvin * * SKALE IMA is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as publ...
Allows Schain owner to return each user their ETH. Requirements: - Amount of ETH on schain should be equal or more than transferred amount. - Receiver address must not be null. - msg.sender should be an owner of schain - IMA transfers Mainnet <-> schain should be killed/
function getFunds(string calldata schainName, address payable receiver, uint amount) external override onlySchainOwner(schainName) whenKilled(keccak256(abi.encodePacked(schainName))) { require(receiver != address(0), "Receiver address has to be set"); bytes32 scha...
1,152,475
./full_match/80001/0xb6c7467A5703D070D973A496C5c0f18c0092107d/sources/masterchef.sol
Sets call fee Only callable by the contract admin./
function setCallFee(uint256 _callFee) external onlyAdmin { require(_callFee <= MAX_CALL_FEE, "callFee cannot be more than MAX_CALL_FEE"); callFee = _callFee; }
859,068
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.7.0; pragma experimental ABIEncoderV2; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol"; import "https://github.com/vigilance91/solidarity/contracts/token/MutableSupplyTokenABC.sol"; import "https:...
sender.emitMembershipForfeited();
function forfeitMembership( )external payable isCurrentHolder { _revoke(msg.sender); }
5,542,803
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; // First import some OpenZeppelin Contracts. import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "hardhat/console.sol"; // Inherit the contract we imported. This means...
Get the current tokenId, this starts at 0. Actually mint the NFT to the sender using msg.sender. Set the NFTs data. Increment the counter for when the next NFT is minted.
function makeAnEpicNFT(string memory _url, address _receiverPublicAddress) public returns (uint256) { uint256 newItemId = _tokenIds.current(); _safeMint(_receiverPublicAddress, newItemId); _setTokenURI(newItemId, _url); _tokenIds.increment(); return newItemId; }
14,053,182
// SPDX-License-Identifier: MIT pragma solidity ^0.7.1; pragma experimental ABIEncoderV2; /** * @title The Primitive House -> Manages collateral, leverages liquidity. * @author Primitive */ // Open Zeppelin import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {IERC20} from "@openz...
Transfers `wrappedToken` with `wrappedId` from this contract to the `msg.sender`. The `msg.sender` should always be the `_VENUE`, since this can only be called `inExec`. wrappedToken The ERC1155 token contract to call to. wrappedId The ERC1155 token id to transfer from `msg.sender` to this contract. amoun...
function removeCollateral( address wrappedToken, uint256 wrappedId, uint256 amount ) public isExec returns (bool) { console.log("house: internal removal"); bool success = _removeCollateral(wrappedToken, wrappedId, amount); console.log("house: safetransferfrom this...
6,417,581
pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
Register a future flight for insuring. Only airline that paid the fee/
function registerFlight( string flight, uint timestamp, uint8 statusCode ) external onlyAuthorizedAirline() onlyAuthorizedCaller() { bytes32 key = getFlightKey(tx.origin, flight, timestamp); require(!flights[key].isRegistered, "Flight registered"); flights[key] = Flight(true...
12,684,316
/** *Submitted for verification at Etherscan.io on 2021-11-23 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assum...
ERC721 token receiver interface Interface for any contract that wants to support safeTransfers from ERC721 asset contracts./
interface IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } }
1,983,487
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Calls a specified action on an Extension _extension The Extension contract to call (e.g., FeeManager) _actionId An ID representing the action to take on the extension (see extension) _callArgs The encoded data for the call Used to route arbitrary calls, so that msg.sender is the ComptrollerProxy (for access control...
function callOnExtension( address _extension, uint256 _actionId, bytes calldata _callArgs ) external override locksReentrance allowsPermissionedVaultAction { require( _extension == getFeeManager() || _extension == getIntegrationManager() || ...
122,327
/** *Submitted for verification at Etherscan.io on 2020-09-16 */ /** *Submitted for verification at Etherscan.io on 2020-09-15 */ pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT licen...
Mint new tokens dst The address of the destination account rawAmount The number of tokens to be minted/ record the mint mint the amount transfer the amount to the recipient move delegates
function mint(address dst, uint rawAmount) external { require(msg.sender == minter, "DOS::mint: only the minter can mint"); require(block.timestamp >= mintingAllowedAfter, "DOS::mint: minting not allowed yet"); require(dst != address(0), "DOS::mint: cannot transfer to the zero address"); ...
6,013,714
//SPDX-License-Identifier: MIT pragma solidity 0.8.10; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; /** * @title L2OutputOracle * @notice The L2 state is committed to in this contract * The payable keyword is used on appendL2Output to save gas ...
Computes the block number of the next L2 block that needs to be checkpointed./
function nextBlockNumber() public view returns (uint256) { return latestBlockNumber + SUBMISSION_INTERVAL; }
12,755,882
pragma solidity ^0.4.18; /** * @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) { if (a == 0) { return 0; } uint...
Get corrected total BP of the address.
function getCorrectedTotalBPOfAddress(address _address) external view returns (uint32) { var _balance = heroContract.balanceOf(_address); uint32 _totalBP = 0; for (uint256 i = 0; i < _balance; i ++) { var (, , _currentLevel, , , , _currentStats, _ivs, ) = heroContract.getHeroInfo(heroCon...
1,143,322
./full_match/1/0x020E452b463568f55BAc6Dc5aFC8F0B62Ea5f0f3/sources/src/contracts/AaveCLRobotOperator.sol
@inheritdoc IAaveCLRobotOperator
function getKeeperInfo(uint256 id) external view returns (KeeperInfo memory) { return _keepers[id]; }
3,162,096
/** *Submitted for verification at Etherscan.io on 2021-04-05 */ // Sources flattened with hardhat v2.1.2 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/[email protected] // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as define...
Destroys `amount` tokens of token type `id` from `account` Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens of token type `id`./
function _burn( address account, uint256 id, uint256 amount ) internal virtual { require(account != address(0), "RNFT: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer( operator, account, add...
2,335,182
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/util...
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, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; } pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; } pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; } pragma solidity ^0.8.0; function isContract(addre...
14,658,241
./full_match/80001/0x3f38a652A1aA1c4fa5792BDe843ed45ed6B25092/sources/project_/contracts/ERC1155Auction.sol
Reset all bid related parameters for an NFT. This effectively sets an NFT as having no active bids/
function _resetBids( address _nftContractAddress, uint256 _tokenId ) internal { auctions[_nftContractAddress][_tokenId].nftHighestBidder = address(0); auctions[_nftContractAddress][_tokenId].nftHighestBid = 0; auctions[_nftContractAddress][_tokenId].nftRecipient = address...
9,535,025
pragma solidity >=0.4.0; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) library FixedPoint { // range: [0, 2**112 - 1] // resolution: 1 / 2**112 struct uq112x112 { uint224 _x; } // range: [0, 2**144 - 1] // resolution: 1 / 2**112 ...
Just a wrapper for the uniswap call This can fail (revert) in two scenarios 1. (path.length == 2 && insufficient reserves) 2. (path.length > 2 and an intermediate pair has an output amount of 0)
function unsafeGetAmountsOut( uint256 _amountIn, address[] memory _path, uint256 _i ) public view override returns (uint256[] memory result) { result = ROUTERS[_i].getAmountsOut(_amountIn, _path); }
6,081,096
./full_match/3/0x6165744662Ec03C05cA19aCb6a398Ec4309e1258/sources/Kyc.sol
Remove KYC request for the customer data {bytes32} customerName The user name of the customer for whom the request is made {bytes32} customerDataHash The hash of the data or identification documents provided by the Customer returns {uint8} Returns 1 if the execution is successful, 0 otherwise/ Remove KYC request fro...
function removeKycRequest(bytes32 customerName, bytes32 customerDataHash) public isBankValid returns (uint8) { require( kycRequests[customerDataHash].userName == customerName, "This customer's KYC request doesn't exists" ); delete kycReque...
8,244,775
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.2; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IFeesCollector { function sendProfit(uint256 amount, IERC20 token) external; } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.2; pragma experi...
Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub(uint168 a, uint168 b, string memory errorMessage) internal pure returns (uint168) { require(b <= a, errorMessage); uint168 c = a - b; return c; }
5,865,846
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.6.6; import "./BToken.sol"; import "./BMath.sol"; // Core contract; can't be changed. So disable solhint (reminder for v2) /* solhint-disable func-order */ /* solhint-disable event-name-camelcase */ contract BPool is BBronze, BToken, BMath { struct...
Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_s...
function decimals() external pure returns (uint8) { return DECIMALS; }
303,194
pragma solidity ^0.6.7; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface...
Liquidates an underwater safe and settles the auction right away - no slippage control It will revert for protected SAFEs (those that have saviours). Protected SAFEs need to be liquidated through the LiquidationEngine safe A SAFE's ID return auction The auction ID
function liquidateAndSettleSAFE(address safe) public returns (uint auction) { if (liquidationEngine.safeSaviours(liquidationEngine.chosenSAFESaviour(collateralType, safe)) == 1) { require (liquidationEngine.chosenSAFESaviour(collateralType, safe) == address(0), "safe-is-protected.");...
6,020,947
pragma solidity ^0.4.24; contract MajorityGameFactory { address[] public deployedGames; address[] public endedGames; address[] public tempArray; address public adminAddress; mapping(address => uint) private gameAddressIdMap; uint public gameCount = 0; uint public endedGameC...
force to end the game/
function forceEndGame(address targetAddress) public adminOnly { uint targetGameIndex = gameAddressIdMap[address(targetAddress)]; endedGameCount++; endedGames.push(targetAddress); deployedGames[targetGameIndex-1] = deployedGames[deployedGames.length-1]; gameAddressIdMap[deplo...
5,412,884
//Address: 0x897c6cf1996edfb2126703dcecf038df646298fa //Contract name: TradersWallet //Balance: 0.03 Ether //Verification Date: 8/22/2017 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.15; contract etherDelta { function deposit() payable; function withdraw(uint amount); function depositT...
get ether delta token balance from token address
function EtherDeltaTokenBalance(address tokenAddress) constant returns (uint) { return ethDelta.balanceOf(tokenAddress, this); }
12,686,161
//Address: 0x80616F35Df2ef0CB42280a629761e0350FaFd679 //Contract name: Lotto //Balance: 0 Ether //Verification Date: 3/7/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.8; /** * Very basic owned/mortal boilerplate. Used for basically everything, for * security/access control purposes. */ con...
Creates a new lottery contract. initialGameLogic The starting game logic./
function Lotto(address initialGameLogic) { gameLogic = LotteryGameLogicInterface(initialGameLogic); }
1,766,045
/** *Submitted for verification at Etherscan.io on 2021-11-17 */ pragma solidity ^0.8.5; // SPDX-License-Identifier: MIT interface IERC20 { /** * @dev Returns the total tokens supply */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens ow...
set's charity fee percentage/
function setCharityFeePercent(uint256 Fee) external onlyOwner { _charityFee = Fee; _totalDeductableFee = _liquidityFee.add(_charityFee); }
6,719,389
./partial_match/1/0xD7FbFF0fd48dE02901E19b192cc59b1c31198526/sources/MintPassDummy.sol
Returns an URI for a given token ID Throws if the token ID does not exist. May return an empty string. _tokenId uint256 ID of the token to query/
function tokenURI(uint256 _tokenId) public view virtual returns (string memory) { require(exists(_tokenId), "Asset does not exist"); return string(abi.encodePacked(baseTokenURI, _tokenId.toString())); }
15,630,725
pragma solidity ^0.4.23; import "./ERC20Interface.sol"; import "./Withdrawable.sol"; import "./KyberIEOInterface.sol"; import "./zeppelin/SafeMath.sol"; interface KyberNetwork { function trade( ERC20 src, uint srcAmount, ERC20 dest, address destAddress, uint maxDestAmount...
emit event here where we still have valid "change" valueif not all tokens were taken by network approve value is not zereod. must zero it so next time will not revert.
function contribute(ContributeData data) internal returns(bool) { uint weiCap = data.kyberIEO.getContributorRemainingCap(data.userId); if (data.maxDestAmountWei < weiCap) weiCap = data.maxDestAmountWei; require(weiCap > 0); uint initialTokenBalance = data.token.balanceOf(this); ...
7,295,493
./full_match/3/0x062976559996F532d802b8cBF054Cf74d87a8D4f/sources/contracts/STOA.sol
新增貸款資料,輸入範例: OA123456,test,A123456789,800000,6,CAR123 檢查權限 新增貸款 另存一份到陣列(用來查詢)
function addOAID(string memory OAID, string memory name, string memory idNo, uint amt, uint avg, string memory car) public{ require(authManager.isAdmin(msg.sender), "Permission denied."); require(address(loanMap[OAID]) == address(0x0), "OAID can't be repeated."); require(bytes(OAID).length >...
14,136,126
pragma solidity ^0.4.24; interface MilAuthInterface { function requiredSignatures() external view returns(uint256); function requiredDevSignatures() external view returns(uint256); function adminCount() external view returns(uint256); function devCount() external view returns(uint256); funct...
returns player info based on address _addr address of the player you want to lookup return player ID return player eth balance return player MFCoin return general vault return affiliate vault/
function getPlayerAccount(address _addr) public isActivated() view returns(uint256, uint256, uint256, uint256, uint256) { uint256 genAmount = calcUnMaskedEarnings(_addr); return ( plyr_[_addr].playerID, plyr_[_addr].eth.add(genAmount), ...
909,854
/* Author: Victor Mezrin victor@mezrin.com */ pragma solidity ^0.4.24; /** * @title CommonModifiersInterface * @dev Base contract which contains common checks. */ contract CommonModifiersInterface { /** * @dev Assemble the given address bytecode. If bytecode exists then the _addr is a contract....
Function to revoke permission of the manager _manager address Existing manager _permissionName string Revoked permission name/
function revokeManagerPermission( address _manager, string _permissionName ) external onlyOwner onlyValidManagerAddress(_manager) onlyValidPermissionName(_permissionName) { require(managerPermissions[_manager][_permissionName] == true); managerPermissions[_manager][_permissionName] = ...
1,064,144
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol"; /** * @title CappedWhitelistedCrowdsale * @dev Crowdsale with a limit for total contributions and per-beneficiary caps. * Combination of CappedCrowdsale and IndividuallyCappedCrowdsale */ contract TieredPriceCrowdsale is ...
Calculate current rate with bonus
function _getbonusRate() internal view returns (uint256) { if(_tier2Start > block.timestamp){ return(_baseRate * 6 / 5); } else if(_tier3Start > block.timestamp){ return(_baseRate * 11 / 10); } else if(_tier4Start > block.timestamp){ ...
5,498,494
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @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 ...
low level token purchase function calculate token amount to be created update state
function buyTokens(address beneficiary) public payable { require(beneficiary != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(rate); weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, b...
10,434,509
./full_match/1/0x48deE19C0e44c147934702c12dc98963CA831009/sources/contracts_common/src/Libraries/ObjectLib32.sol
update the balance of a type provided in binBalances binBalances Uint256 containing the balances of objects index Index of the object in the provided bin amount Value to update the type balance operation Which operation to conduct : Operations.REPLACE : Replace type balance with amount Operations.ADD : ...
function updateTokenBalance( uint256 binBalances, uint256 index, uint256 amount, Operations operation ) internal pure returns (uint256 newBinBalance) { uint256 objectBalance = 0; if (operation == Operations.ADD) { objectBalance = getValueInBin(binBalan...
4,919,270
./full_match/43114/0xd32a045cB772eb15C88A8b62c27A5454FdFb5852/sources/Earthdapp.sol
Returns the integer division of two unsigned integers. Reverts with custom message on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns(uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; }
4,519,104
/** *Submitted for verification at Etherscan.io on 2021-10-02 */ pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure the...
LCD allows token holders to set a custom URI of their choosing if curator has enabled feature See LootVanGogh project for example use case, where rarity/properties are returned statically via getProps but user can modify custom URI interpretation of those props Example of _customURI prop would be an IPFS url _affiliate...
function setCustomURI( address _project, uint256 _tokenId, string memory _customURI, address _affiliate ) public payable nonReentrant { require(projectRegistry[_project].isCustomURIEnabled, "Disabled"); require(msg.sender == LCDProject(_project).ownerOf(_tokenI...
2,218,567
// //___ ___ _ _____ _ //| \/ | | | | __ \ | | //| . . | ___| |_ __ _| | \/ __ _| | __ ___ ___ _ //| |\/| |/ _ \ __/ _` | | __ / _` | |/ _` \ \/ / | | | //| | | | __/ || (_| | |_\ \ (_| | | (_| |> <| |_| | //\_| |_/\___|\__\__,_|\____/\__,_|_...
exclude from paying fees or having max transaction amount
constructor() ERC20("MetaGalaxy", "MetaGalaxy") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IU...
13,615,817
./full_match/8453/0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19/sources/src/dex/v2/LeetSwapV2Pair.sol
force reserves to match balances
function sync() external lock { _update( IERC20Metadata(token0).balanceOf(address(this)), IERC20Metadata(token1).balanceOf(address(this)), reserve0, reserve1 ); }
11,542,454
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Convert signed 64.64 fixed point number into unsigned 64-bit integer number rounding down. Revert on underflow. x signed 64.64-bit fixed point number return unsigned 64-bit integer number/
function toUInt(int128 x) internal pure returns (uint64) { require(x >= 0); return uint64(x >> 64); }
1,686,917
./partial_match/42220/0xa35AB0173DEA0941b8472A49Ae3A94bd40bbcD99/sources/project_/contracts/ubi/UBIScheme.sol
start early cycle if we can increase the daily UBI pool
function estimateNextDailyUBI() public view returns (uint256) { uint256 currentBalance = nativeToken().balanceOf(address(this)); bool shouldStartEarlyCycle = currentBalance / cycleLength > dailyCyclePool; uint256 _dailyCyclePool = dailyCyclePool; uint256 _dailyUbi; if ( currentDayInCycle() >= currentCycl...
3,496,437
pragma solidity 0.5.17; Import Import Import Import Import contract Swap is OwnerPausable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using MathUtils for uint256; using SwapUtils for SwapUtils.Swap; SwapUtils.Swap public swapStorage; IAllowlist public allowlis...
Burn LP tokens to remove liquidity from the pool. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply. Liquidity can always be removed, even when the pool is paused. amount the amount of LP tokens to burn minAmounts the minimum amounts of each token in the pool acceptable fo...
function removeLiquidity(uint256 amount, uint256[] calldata minAmounts, uint256 deadline) external nonReentrant deadlineCheck(deadline) { return swapStorage.removeLiquidity(amount, minAmounts); }
2,549,450
./full_match/5/0xf5dd22881A2bEac0ec5e5EE6CE8a9964c7afCEE5/sources/contracts/OGX.sol
Function to set the merkle root
function addWhitelist( uint256 season, bytes32 newMerkleRoot ) external onlyOwner { seasonWhitelist[season].season = season; seasonWhitelist[season].merkleRoot = newMerkleRoot; emit WhitelistAdded(season, newMerkleRoot); }
1,898,838
./full_match/5/0x09021d75b1e8f5F078A751fB6AbdfB9b80861Dd3/sources/project_/contracts/CCXClaim.sol
Set new claimed token _token address of the new claimed token/
function setToken(address _token) external onlyOwner { require( _token != address(0), "CCXClaim - Token address cannot be the zero address" ); s_token = IERC20Upgradeable(_token); }
7,077,465
./full_match/80001/0xA7f1B8e063C878F8799D4d164478dB1c35491f9e/sources/project_/contracts/token/DerpfiToken.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, uint256 blockNumber) external view returns (uint256) { require(blockNumber < block.number, "Derpfi::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } i...
851,045
./partial_match/1/0xB48077d89fa302B257f56aA01C7F86dd279B79F3/sources/contracts/GhostERC721Upgradeable/GERC721Upgradeable.sol
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previouss owner
function _transfer(address from, address to, uint256 tokenId) internal virtual { require(GERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); ...
16,182,968
pragma solidity ^0.4.21; /** * @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...
called by the owner to pause, triggers stopped state/
function pause() onlyOwner whenNotPaused public returns (bool) { paused = true; emit Pause(); return true; }
1,167,728
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } contract Ownable is Co...
if a user has zero balance, just regular rewardCycleBlock will be applied
function topUpClaimCycleAfterTransfer(address recipient, uint256 amount) private { uint256 currentRecipientBalance = balanceOf(recipient); uint256 additionalBlock = 0; if (nextAvailableClaimDate[recipient] + rewardCycleBlock < block.timestamp) nextAvailableClaimDate[recipient] = block.timest...
10,135,086
./full_match/100/0x010dA9cb0468e86E8b68E34cAb180BD9c8953800/sources/github/ice09/circles-contracts/contracts/Hub.sol
used internally in both the trust function and signup user the user to be trusted limit the amount this user is trusted, as a percentage of 100
function _trust(address user, uint limit) internal { limits[msg.sender][user] = limit; emit Trust(msg.sender, user, limit); }
14,278,532
./partial_match/1/0x7F346F1eB7a65fF83f51B3FD76dCc70979e6DF38/sources/contracts/ArrakisV2.sol
will send manager fees to manager anyone can call this function
function withdrawManagerBalance() external nonReentrant { _withdrawManagerBalance(); }
2,715,459
./full_match/43114/0x84e450F230343506623DB729592e5b754706a6ED/sources/reflector.sol
Add/remove any number of addresses whose funds get reflected reflectCuts ReflectCut[]
function reflectCut( SLib.ReflectCut_[] calldata reflectCuts ) external { require(msg.sender == owner, "not owner"); bool changesMade = false; for (uint i = 0; i < reflectCuts.length; i++) { SLib.ReflectCut_ memory reflectCut_ = reflectCuts[i]; if (reflect...
4,570,249
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.10; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol"; import "../OwnedInitializable.sol"; import "../interfaces/IUniswapV2Router.sol"; contract Base is OwnedInitializable, ERC20PermitUpgradeable { add...
helper function to pack address and fee into one storage slot/
function packBeneficiary(address _beneficiary, uint256 _fee) public pure virtual returns (uint256) { require(_fee <= 10000, "INVALID_FEE"); uint256 storedBeneficiary = uint256(uint160(_beneficiary)); storedBeneficiary |= _fee << 160; return storedBeneficiary; }
2,549,661
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./interfaces/IERC20.sol"; import "./interfaces/ILockManager.sol"; import "./lib/SafeMath.sol"; import "./lib/SafeERC20.sol"; /** * @title Vault * @dev Contract for locking up tokens for set periods of time * + option...
Get all active token locks for receiver receiver The address that has locked balances return the locks/ Get number of active locks Populate result array
function activeLocks(address receiver) external view returns(Lock[] memory){ uint256 activeCount; uint256[] memory receiverLockIds = lockIds[receiver]; for (uint256 i; i < receiverLockIds.length; i++) { Lock memory lock = tokenLocks[receiverLockIds[i]]; if(lock.amoun...
6,484,987
./full_match/62320/0x787145dc5D7201e05FDD2cd7926fe383D3C81e28/sources/lib/mento-core/contracts/ValueDeltaBreaker.sol
Configures rate feed to reference value pairs. rateFeedIDs Collection of the addresses rate feeds. _referenceValues Collection of referance values./
function setReferenceValues(address[] calldata rateFeedIDs, uint256[] calldata _referenceValues) external onlyOwner { require(rateFeedIDs.length == _referenceValues.length, "array length missmatch"); for (uint256 i = 0; i < rateFeedIDs.length; i++) { require(rateFeedIDs[i] != address(0), "rate feed inva...
3,225,639
./partial_match/1/0x1c1B3cdc3588eb96f228fb2C39c5613414c313Ff/sources/Crowdsale.sol
Calculate amount of tokens to recieve for a given amount of wei weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/
function getTokenAmount(uint256 weiAmount) public view returns(uint256) { return weiAmount.mul(_currentETHPrice).div(1 ether).mul(_rate); }
2,774,586
./partial_match/1/0x581E27c21ce60A946F0E866436a025bc89F3fB26/sources/contracts/TokenLockup.sol
Retrieves unclaimed unlocked tokens for msg.sender/
function claim() external { require(block.timestamp > startTime + claimDelay, "Claiming is not available yet"); uint256 claimable = _totalUnlockedOf(msg.sender) - totalClaimed[msg.sender]; totalClaimed[msg.sender] += claimable; require(IERC20(token).transfer(msg.sender, claimable));...
3,660,594
./partial_match/4/0x748d2AC32B0A5efE67Bd13D3B9657716aCedbffa/sources/ToshimonMinter.sol
Convert uint256 to string _i Unsigned integer to convert to string/ Get number of bytes Get each individual ASCII
function _uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return '0'; } uint256 j = _i; uint256 ii = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len ...
8,524,313
./full_match/83/0xFda7f199909Cb2F31637F74f7A16d046bcd064f1/sources/contracts/CToken/CToken.sol
User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supply return (uint, uint) An error code (0=success, otherwise a fai...
function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) { uint256 allowed = IComptroller(comptroller).mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { Error.COMPTROLLER_REJECTION.failOpaque(FailureInfo.MINT_COMPTROLLER_REJECTION, allowed); } ...
9,560,758
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "../utils/MinterGuard.sol"; import "../interfaces/IDG4610.sol"; import "../interfaces/IDG721BatchReceiver.sol"; import "./ERC4610.sol"; /** * @dev An DG4610Simple token for God...
Batch version of burnFrom function/
function burnFromBatch(address account, uint256[] calldata tokenIds) external override { for (uint256 index = 0; index < tokenIds.length; ++index) { require(ERC4610.ownerOf(tokenIds[index]) == account, "not token owner"); require(_isApprovedOrOwner(_msgSender(), tokenIds[index]), "ER...
12,968,121
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; ...
solhint-disable-next-line avoid-low-level-calls, avoid-call-value
function withdraw(uint256 amount) public onlyOwner { require(address(this).balance >= amount, "Address: insufficient balance"); require(success, "Unable to send value"); }
1,127,855
./full_match/1/0x0303C9298CEaf4D467ba80A37aE2b5Abc94D2566/sources/contracts/ThePaintedSatoshis.sol
changes the Genesis supply to be equal to the total supply
function burnRemainingTokens() public onlyOwner { GENESIS_SUPPLY = totalSupply(); }
3,058,814
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2022 // DeadTownZeds | 2022 pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC721Enumerable.sol"; contract DeadTownZeds is ERC721Enumerable, Ownable { string public baseURI; uint256 public cost = 0....
See {IERC721Enumerable-tokenByIndex}./
function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < _owners.length, "ERC721Enumerable: global index out of bounds"); return index + 1; }
5,711,295
pragma solidity ^0.5.8; /// @title A facet of TitleToken that manages special access privileges. /// @author Matt Girdler (github.com/mattgirdler) contract TitleAccessControl { address public issuerAddress; address public burnerAddress; /// @dev Access modifier for issuer-only functionality modifier...
Returns true if the message sender is the burner
function isBurner() external view returns (bool) { return msg.sender == burnerAddress; }
12,850,835
./full_match/1/0x8DCD98dAcb82313dd1A0A9B4D30B2373184d4591/sources/browser/StableFund_flat.sol
to The address to mint tokens to./
function mint(address to, uint256 value) public onlyValueHolder { uint256 gonValue = value.mul(_gonsPerFragment); _gonBalances[to] = _gonBalances[to].add(gonValue); _totalGons = _totalGons.add(gonValue); _totalSupply = _totalSupply.add(value); emit Transfer(address(0), to, v...
4,829,237
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20Snapshot.sol"; contract Myobu is ERC20Snapshot { address public override DAO; // solhint-disable-line address public override myobuSwap; bool private antiLiqBot; constructor(address payable addr1) MyobuBase(addr1) { setFe...
router refunds to this address, refund all back to sender
function noFeeAddLiquidityETH(LiquidityETHParams calldata params) external payable override onlySupportedPair(params.pair) checkDeadline(params.deadline) onlyMyobuswapOnAntiLiq lockTheSwap returns ( uint256 amountToken, uint256 ...
9,932,052
./partial_match/1/0x7D5256D3e0c340FaBa6d6Ecd27E7B9e07f76aa94/sources/Proxy.sol
solium-disable-next-line security/no-inline-assembly
function isContract(address addr) internal view returns (bool) { uint256 size; return size > 0; }
4,273,497
./full_match/97/0x86D915757955E8ba9A5Cd9177A9184851B59bB7f/sources/src/LiquidityReserves/remote/AssetReserves.sol
------------------------SETTERS------------------------ Adds an asset to the whitelist asset The address of the asset to add/
function addWhiteListedAsset(address asset) external onlyOwner { whiteListedAsset[asset] = true; emit AssetAddedToWhitelist(asset); }
3,275,516
./full_match/43114/0x02941a0Ffa0Bb0E41D9d96314488d2E7652EDEa6/sources/Masterchef.sol
View function to see pending EXPs on frontend.
function pendingEXP(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accEXPPerShare = pool.accEXPPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(th...
4,596,598
./full_match/97/0xfD77CC4b5f5A745481747e93167C9B114dA5d539/sources/project_/contracts/ForzaPresale.sol
Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } }
3,284,180
./full_match/80001/0x384acAD9ABE419A30CB3Fd232370fCe79920c1aC/sources/contracts-link/StakeManager.sol
@inheritdoc IStakeManager
function withdrawStake(address relayManager) external override relayOwnerOnly(relayManager) { StakeInfo storage info = stakes[relayManager]; require(info.withdrawTime > 0, "Withdrawal is not scheduled"); require(info.withdrawTime <= block.timestamp, "Withdrawal is not due"); uint256 ...
5,678,575
/** * This contract acts as a controller for front-end * requests. The DB file is separate incase, solidity adds * functionality to return structs. In that case, only * this contract needs to be redeployed and data migration * will not be needed as the data is stored in DB.sol * contract. */ pragma solidity ^0.4...
@description deletes the project for the given index and address uint _index index of the project to be deleted
function deleteUserProject(uint _index) public addressNotZero userExists isWhitelisted { dbDelete.deleteProject(_index, msg.sender); }
943,662
// SPDX-License-Identifier: MIT 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 functions. * * By default, the owner account will be the on...
Sets the isRevealed variable to true/
function revealDrop() external onlyOwner { isRevealed = true; }
14,831,000
./full_match/420666/0x36d4Fec597d673a37f26a7346EF3793cfAb95D9f/sources/FrogSwapRouter.sol
performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'FrogSwapLibrary: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i = path.len...
16,368,699
./full_match/1/0xedfC811990B8E3F57424B50c1AbbF6F700de1Cc1/sources/project_/contracts/SigTransfer.sol
Encodes the transaction data for the given parameters. return The EIP-712 encoded transaction data./
function encodeTransactionData( address token, address from, address to, uint256 value, uint256 nonce, uint256 deadline ) internal view returns (bytes32) { return keccak256( abi.encodePacked( bytes1(0x19), bytes1(0x01), domainSeparator(), keccak256( abi.encode( SI...
3,850,966
pragma solidity 0.5.11; pragma experimental ABIEncoderV2; import "./ParameterStore.sol"; import "./IDonationReceiver.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; contract Gatekeeper { // EVENTS event PermissionRequested( ...
/ Mark the slate as accepted Record the incumbent
function acceptSlate(uint slateID) private { Slate storage s = slates[slateID]; s.status = SlateStatus.Accepted; if (incumbent[s.resource] != s.recommender) { incumbent[s.resource] = s.recommender; } for (uint i = 0; i < requestIDs.length; i++) { uin...
927,899
./full_match/80001/0x54Bb7202A05fB694b2A7a19Bb17e4f22faA1a58c/sources/NftStaking.sol
make sure the user has atleast 1 token before withdrawingwallet must own the token they are trying withdrawupdate rewards for this user as the amount of reward decreases with less tokensfind the index of this token id in the stakedTokens array
function withdraw(uint256 _tokenId) external nonReentrant{ require(stakers[msg.sender].amountStaked > 0,"You have no tokens staked"); require(stakerAddress[_tokenId] == msg.sender,"You don't own this token"); uint256 rewards = calculateRewards(msg.sender); stakers[msg.sender].unclaimedRewards += rewar...
9,483,304
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/Estate/EstateBaseToken.sol
create an Estate from a quad (a group of land forming a square on a specific grid in the Land contract) sender address perforing the operation that will create an Estate from its land token to the estate will belong to that address size edge size of the quad, 3, 6, 12 or 24 x top left corner position of the quad y...
function createFromQuad( address sender, address to, uint256 size, uint256 x, uint256 y ) external returns (uint256) { require(to != address(0), "DESTINATION_ZERO_ADDRESS"); require(to != address(this), "DESTINATION_ESTATE_CONTRACT"); _check_create...
8,434,829
./full_match/3/0x1eD638e95aEF368b7C882B4C740ba666A41DCeBb/sources/OpenXcellBlockchainTasks/ERC20.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
8,142,190
./full_match/1/0x18B22d8494851AF627710e38476cE03dBb9B7B9D/sources/Arb.sol
note, ganache by default uses a block number ~10 higher? which is different than mainnet where this will be the actual block being mined require(false, uint2str(tokens));
function fastSwapOneGst2(uint blockNumber, uint amountIn, address fromErc20Address, ExpectedAmounts calldata expectedAmounts, uint gasDecr) external { require(payable(msg.sender) == owner); require(block.number == blockNumber, "e1"); uint256 gasStart = gasleft(); (bool success, byt...
9,609,658
./full_match/1/0x8d6467faa693BB1E1ff0CbbCCeE9C79D19740718/sources/node_modules/frax-standard-solidity/src/access-control/v2/Timelock2Step.sol
The ```_requireIsTimelock``` function reverts if _address is not current timelock address _address The address to check against the timelock
function _requireIsTimelock(address _address) internal view { if (!_isTimelock(_address)) revert AddressIsNotTimelock(timelockAddress, _address); }
3,063,016
pragma solidity ^0.5.4; contract Account { // The implementation of the proxy address public implementation; // Logic manager address public manager; // The enabled static calls mapping (bytes4 => address) public enabled; event EnabledStaticCall(address indexed module, bytes4 indexe...
called from 'enter'
function cancelDelay(address payable _account, bytes4 _actionId) external allowSelfCallsOnly { accountStorage.clearDelayData(_account, _actionId); emit CancelDelay(_account, _actionId); }
15,075,313
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity ^0.6.12; import "./Interfaces/LiquidityMathModelInterface.sol"; import "./MToken.sol"; import "./Utils/ErrorReporter.sol"; import "./Utils/ExponentialNoError.sol"; import "./Utils/AssetHelpers.sol"; import "./Moartroller.sol"; import "./...
Constructor for MProtection contract copMappingAddress The address of data mapper for C-OP moartrollerAddress The address of the Moartroller/
function initialize(address copMappingAddress, address moartrollerAddress) public initializer { __Ownable_init(); __ERC721_init("c-uUNN OC-Protection", "c-uUNN"); _copMappingAddress = copMappingAddress; _moartrollerAddress = moartrollerAddress; }
11,818,355
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol...
See {IERC1155MetadataURI-uri}. This implementation returns a fully-built URL Clients calling this function must replace the `\{id\}` substring with the actual token type ID./
function uri(uint256 tokenHash) public view virtual override returns (string memory) { return string(abi.encodePacked(_uri, tokenHash.toString())); }
1,159,109
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @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 con...
Deposit incoming token and mint pool token i.e. shares.
function _deposit(uint256 _amount) internal virtual { _claimRewards(_msgSender()); uint256 _shares = _calculateShares(_amount); _beforeMinting(_amount); _mint(_msgSender(), _shares); _afterMinting(_amount); emit Deposit(_msgSender(), _shares, _amount); }
269,113
./full_match/1/0x44472e63C7C17761806DA1EE07e3abe1937b1961/sources/browser/StrategyCurveCcrvV1.sol
DAI USDC USDT sUSD DAI
function getMostPremium() public view returns (address, uint256) { uint256[] memory balances = new uint256[](4); balances[0] = ICurveFi_4(curve).balances(0); balances[1] = ICurveFi_4(curve).balances(1).mul(10 ** 12); balances[2] = ICurveFi_4(curve).balances(2).mul(10 ...
3,117,341
pragma solidity ^0.5.0; // File: contracts\open-zeppelin-contracts\token\ERC20\IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see ERC20Detailed. */ interface IERC20 { /** * @dev Returns the amo...
Unlock 500k for marketing each time called, until the whole 11,500,000 is spent. return bool../
function unlockMarketing() public returns (bool) { require(msg.sender ==_tokenOwnerAddress, "Only owner can call this"); require( marketing < 23 , "Already unlocked."); _burn(address(this), (500000 * _decs )); _mint(_tokenOwnerAddress, (500000 * _decs )); marketing++; return true...
1,644,815
pragma solidity >=0.4.18 <0.7.0; import '../solidity-lib/openzeppelin-solidity-112/contracts/lifecycle/TokenDestructible.sol'; import '../solidity-lib/openzeppelin-solidity-112/contracts/token/ERC20/ERC20.sol'; import '../solidity-lib/openzeppelin-solidity-112/contracts/math/SafeMath.sol'; import './OwnerContract.sol...
change the default withdraw wallet address binding to the deposit contract address _oldWallet the previous default withdraw wallet _newWallet the new default withdraw wallet/ WithdrawWallet[] storage withdrawWalletList = depositRepos[deposit].withdrawWallets; withdrawWalletList[0].walletAddr = _newWallet;
function changeDefaultWithdraw(address payable _oldWallet, address payable _newWallet) onlyOwner public returns(bool) { require(_oldWallet != address(0)); require(_newWallet != address(0)); address payable deposit = walletStorage.walletDeposits(_oldWallet); DepositWithdraw deposWithdr = DepositWithdr...
6,415,878