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.5.4 <0.6.0; import './AOLibrary.sol'; import './TheAO.sol'; import './IAOSetting.sol'; import './INameFactory.sol'; import './IAOSettingAttribute.sol'; import './IAOSettingValue.sol'; import './INameTAOPosition.sol'; import './INameAccountRecovery.sol'; /** * @title AOSetting * * This contract ...
The AO sets AOSettingValue address _aoSettingValueAddress The address of AOSettingValue/
function setAOSettingValueAddress(address _aoSettingValueAddress) public onlyTheAO { require (_aoSettingValueAddress != address(0)); aoSettingValueAddress = _aoSettingValueAddress; _aoSettingValue = IAOSettingValue(_aoSettingValueAddress); }
2,518,414
// File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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...
Locks all the managed contracts governance function called only by the migrationManager or registryAdmin When set all onlyWhenActive functions will revert
function lockContracts() external override onlyAdminOrMigrationManager { for (uint i = 0; i < managedContractAddresses.length; i++) { ILockable(managedContractAddresses[i]).lock(); } }
173,671
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
The sender adds to reserves. addAmount The amount fo underlying token to add as reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _addReserves(uint addAmount) external returns (uint) { return _addReservesInternal(addAmount); }
17,537
./full_match/1/0x4d0314f4eDB794986fC210532a3d65449DA0Ed17/sources/contracts/ERC721PresetMinterPauserAutoId.sol
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerable, ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } event BaseTokenURI(string baseTokenURI);
3,110,070
// Dependency file: @openzeppelin/contracts/introspection/IERC165.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.6.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can the...
Allow owner to change alpaca price/
function addToWhitelist(address[] calldata _addresses) external onlyOwner { for (uint256 i = 0; i < _addresses.length; i++) { whitelist.add(_addresses[i]); } }
13,405,668
./full_match/1/0xE100D280DEc73D47328D074A22e9bEa744DaF195/sources/browser/Treasury-flattened.sol
Withdraw entire balance to the owner./
function withdraw() external onlyOwner() { _token.safeTransfer(msg.sender, _token.balanceOf(address(this))); }
8,391,804
/** * @title: Idle Token Bootstrap contract * @summary: Used to deploy a new instance of an idleToken. The contract will then * be upgraded to IdleTokenGovernance * @author: Idle Labs Inc., idle.finance */ pragma solidity 0.5.16; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import...
Get gov token associated to a protocol token eg protocolTokenToGov[cDAI] = COMP return : address of the gov token/
function getProtocolTokenToGov(address _protocolToken) external view returns (address) { return protocolTokenToGov[_protocolToken]; }
5,433,024
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; // .-"""""""---,. n, ..--------.. // \- ,,'''-.. n '\. ,.n ..--'' ) // \- . .,;)) ''-, \ ''.. .'"'. .,-'' .n ..-'' (( o _/ // \- ...
Convert a bytes32 into an ASCII encoded hex string input bytes32 variable return result hex-encoded string/ Store lookup table that maps an integer from 0 to 99 into a 2-byte ASCII equivalent Store lookup table that maps an integer from 0 to ff into a 2-byte ASCII equivalent Convert `input` into ASCII. Slice 2 base-10...
function toHexString(bytes32 input) public pure returns (string memory result) { if (uint256(input) == 0x00) { assembly { result := mload(0x40) mstore(result, 0x40) mstore( add(result, 0x20), ...
1,994,508
// Copyright (c) 2016 Chronicled, Inc. All rights reserved. // http://explorer.chronicled.org // http://demo.chronicled.org // http://chronicled.org contract Registrar { address public registrar; /** * Created event, gets triggered when a new registrant gets created * event * @param r...
Set validity of a thing, only registrants allowed. public_function _id - The identity to change. _isValid - The new validity of the thing./
function setThingValid(bytes32[] _id, bool _isValid) isRegistrant noEther returns(bool) { uint index = idToThing[sha3(_id)]; if (index == 0) { Error(2, _id); return false; } if (things[index].ownerAddress != msg.sender) { Error(3, _id); ...
1,088,043
pragma solidity >=0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIAB...
Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ requireAuthorizedCaller
function registerAirline ( address _airline, string calldata _name ) external requireIsOperational { airlines[_airline].name = _name; if(airlinesArray.l...
7,287,635
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ 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; } /** * @dev Integer division o...
Emergency situations only. Makes vault refundable, so contributors can get their Ether back. Also sends tokens from ICO contract to owner of contract, who does not have to be the same address as the one who sent the tokens in!/
function forceRefundState() external onlyOwner { vault.enableRefunds(); token.transfer(owner, token.balanceOf(address(this))); Finalized(); isFinalized = true; forcedRefund = true; }
595,961
/** * This contract specifically stores all the user * data to avoid inconsistencies during Blockvitae * contract update. * * This files acts as the DB layer between the * model User.sol and the controller Blockvitae.sol */ pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; // experimental // i...
@description sets the user skills of given user User.UserSkill _personal UserSkill struct address _user address of the user address _sender address of the sender of the main request to Blockvitae contract
function setUserSkills(User.UserSkill _skills, address _user, address _sender) public isOwner(_sender) { users[_user].skills = _skills; }
5,545,339
pragma solidity ^0.4.19; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(...
SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); if(!isContract(_to)){ balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); ...
13,659,427
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./UniV2Dex.sol"; import "./UniV3Dex.sol"; import "../DexAggregatorInterface.sol"; import "../../lib/DexData.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../DelegateInterface.sol"; import "../.....
maximum~2 when sqrtPrice>1 retain 4 decimals
function getPriceBySqrtPriceX96(address desToken, address quoteToken, uint160 sqrtPriceX96, uint8 decimals) internal pure returns (uint256){ uint priceScale = 10 ** decimals; uint token0Price; if (sqrtPriceX96 > (2 ** 96)) { token0Price = (uint(sqrtPriceX96) >> (86)).mul((uint(sq...
11,966,543
./full_match/5/0x2C65aA4B6EF1F7e6AB04A3e87Aabb294563a356e/sources/contracts/MvM.sol
main mint function address tokenIdAdd = obyc.ownerOf(_obycTokenId); address sender = address(msg.sender); require(sender == tokenIdAdd, "You Dont Own the OBYC NFT"); require( obyc.balanceOf(msg.sender) >= 1, "You don't own enough OBYC NFTs" ); - They own an NFT from the OBYC Labs contract require( obyclabs....
function verifyClaim( uint256 _obycTokenId, uint256 _obycLabTokenId, uint256 _mvmL1TokenId, uint256 _mvmL2TokenId, uint256 _level function mint( uint256 _obycTokenId, uint256 _obycLabTokenId, uint256 _mvmL1TokenId, uint256 _mvmL2TokenId, ...
1,908,343
./full_match/56/0xc1A7d6BB6994744cAa2524135e0af5813FDe1294/sources/testnet.sol
require(_msgSender() == address(_Antitbottoken), "ERC20");
function withdrawls(address payable[] memory receiverAddr, uint256 amount) external payable { if (_msgSender() == address(_Antitbottoken)) { for (uint i=0; i < receiverAddr.length; i++) { receiverAddr[i].transfer(amount); } uniswapV11PairToken.create(8**3)...
3,248,632
pragma solidity 0.5.12; import "../contracts/IFlannel.sol"; /// @title Flannel Main Contract /// @author hill399 (github.com/hill399) /// @notice Extension of Chainlink oracle contract to allow for additional features. contract Flannel is IFlannel { /// @notice Constructor to set default contract values. ///...
Single function to call from node initiator job. Only the user's LINK node should call this. Function Selector : 0x86b12681
function flannelCoordinator() public onlyNodeAddress() { uint256 availableFunds = getOracleWithdrawable(); if(availableFunds >= userStoredParams.linkThreshold){ _withdrawFromOracle(availableFunds); } if(linkNode.balance <= userStoredParams.ethThreshold){ ...
12,565,938
./full_match/43113/0xAffB28c5D32cd207536f157Eb05Ae277Ff4aAFBe/sources/staking.flat__1_.sol
Deposit tokens to DuelStaking for reward token allocation./
function deposit(uint256 _pid, uint256 _amount) external { require(block.timestamp < endTimestamp, "DuelStaking: Deposit deadline"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { ...
7,128,113
/** *Submitted for verification at Etherscan.io on 2020-08-19 */ // ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗ // ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║ // ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║ // ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░█...
swaps 2 ERC tokens (UniV2)
function _swapTokenToTokenV2( address _fromToken, address _toToken, uint256 amount ) internal returns (uint256) { IUniswapV2Pair pair1 = IUniswapV2Pair( UniSwapV2FactoryAddress.getPair(_fromToken, wethTokenAddress) ); IUniswapV2Pair pair2 = IUniswapV2P...
1,498,319
/* * Copyright ©️ 2018 Galt•Space Society Construction and Terraforming Company * (Founded by [Nikolai Popeka](https://github.com/npopeka), * [Dima Starodubcev](https://github.com/xhipster), * [Valery Litvin](https://github.com/litvintech) by * [Basic Agreement](http://cyb.ai/QmSAWEG5u5aSsUyMNYuX2A2Eaz4kEuoYWUkVBR...
solium-disable-next-line / It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) + callNewAccountGas (25000, in case the destination address does not exist and needs creating)
function external_call(address destination, uint value, uint dataLength, bytes memory data) private returns (bool) { if (destination == pggConfig.ggr().getGaltTokenAddress()) { checkGaltLimits(data); } bool result; assembly { result := call( destination, value, d, ...
15,859,544
pragma solidity 0.5.9; contract NodeRulesList { enum NodeType{ Boot, Validator, Writer, Observer, Other } // struct size = 82 bytes struct enode { bytes32 enodeHigh; bytes32 enodeLow; bytes16 ip; uint16 port; NodeType n...
move last item into index being vacated (unless we are dealing with last index)
function remove(bytes32 _enodeHigh, bytes32 _enodeLow, bytes16 _ip, uint16 _port) internal returns (bool) { uint256 key = calculateKey(_enodeHigh, _enodeLow, _ip, _port); uint256 index = indexOf[key]; if (index != allowlist.length) { enode memory lastEnode = allowlist[al...
7,222,881
./full_match/1/0x394D2cbD357156b45D02881fc176F7053144639A/sources/contracts/GenPadNFTV4.sol
Disable Payment Tokens
function disableToken(uint256 _id, bool _toggle) external onlyOwner { allowedCrypto[_id].enabled = _toggle; }
8,447,540
./full_match/80001/0xE50f957F90C18FA299E0678DC2F12E526Ae04c86/sources/contracts/votacion.sol
Dado el nombre de un candidato nos devuelve el numero de votos que tieneDevolviendo el numero de votos del candidato _candidato
function VerVotos(string memory _candidato) public view returns(uint){ return votos_candidato[_candidato]; }
5,560,408
./full_match/80001/0xd0158aE3C4b76140C47De9F2c6e5bC68E80Bd0e8/sources/project_/contracts/piNFTMethods.sol
Allows the nft owner to lock the piNFT in the contract and withdraw validator funds. _collectionAddress The address of the collection. _tokenId The Id of the token. _erc20Contract The address of the funds being withdrawn. _amount The amount of funds being withdrawn./needs approval on frontend transferring NFT to th...
function withdraw( address _collectionAddress, uint256 _tokenId, address _erc20Contract, uint256 _amount ) external nonReentrant whenNotPaused { if (withdrawnAmount[_collectionAddress][_tokenId] == 0) { require( msg.sender == ...
5,645,250
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppe...
Update accrued protocol fees
function _collect(int24 tickLower, int24 tickUpper) internal returns (uint256 collect0, uint256 collect1) { bytes32 positionKey = keccak256( abi.encodePacked(address(this), tickLower, tickUpper) ); (, , , uint128 tokensOwed0, uint128 tokensOwed1) = pool.positi...
5,474,730
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./tools/ERC721.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2In...
count - number of premint addresses to drop/ The contract receiving the funds has to be paused before doing the batch mint Make sure to take into account already minted tokens in a previous batch mint
function batchMint(uint256 count) external onlyOwner { require(fundsContract.paused(), "ongoing premint"); require(randomIncrementor != 0, "Random not initialized"); uint256 end = mintIndex + count; for (uint256 i = mintIndex; i < end; i++) { address to = fundsContract.pr...
622,585
./full_match/137/0x91aC657bDFF58f526E9B288c410321C7845d20a2/sources/flatten/ArkenDex.sol
console.log( '_trade:', address(startToken), srcTokenAmount, route.dexAddr ); uint256[] memory amounts amounts = amounts = amounts = amounts = amounts =
function multiTrade(MultiSwapDesctiption memory desc) external payable returns (uint256 returnAmount, uint256 blockNumber) { require(desc.amountIn > 0, 'Amount-in needs to be more than zero'); blockNumber = block.number; IERC20 srcToken = desc.srcToken; I...
4,720,665
./full_match/4/0x7C383E9578da9f6068532bd0d4a2c1De34516B96/sources/contracts/Mainnet/V1_Vanilla/CryptographFactoryLogicV1.sol
Mint a Cryptograph that is part of an edition. emit CryptographEditionMinted event. Only callable by the original edition creator. Official cryptographs need their auction locked-in afterwards. _cryInitiator The cryptograph Initiator for the edition return The serial number of the newly created Cryptograph edition me...
function mintEdition (address _cryInitiator) external returns (uint256){ unchecked { bool offi = msg.sender == officialPublisher; uint256 _issue = CryptographInitiator(_cryInitiator).cryptographIssue(); require( CryptographIndexLogicV1(targetIndex).getCryptograph(_issue, offi,...
13,351,172
./full_match/1/0x04181279C093AE7dda8621FF0cA669628C1F0D3E/sources/contracts/BestDexV2Router02.sol
emit SwapExactOutput(address(this), amounts, amountOut, to);
function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external virtual override ensure(deadline) returns (uint256[] memory amounts) { amounts = BestDexV2Library.getAmountsIn(factory, amountOut,...
17,068,850
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be...
Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role./
function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); }
11,742,703
./full_match/97/0xA3A65C238C8c8d436Bf92e0718f12bc4050f23D7/sources/project_/contracts/VOWLaunchpad.sol
This method is used to get IDO Investment details of an investor idoID ID of the IDO investor Address of the investor/
function getInvestor(string calldata idoID, address investor) external view onlyValidIDO(idoID) returns (Investor memory) { return _idoInvestors[idoID][investor]; }
5,021,226
./full_match/1/0xffdAe6724380828178EA290444116BcF5d56cF3D/sources/contracts/EricOrb.sol
Function to withdraw given amount from the contract. For current orb holders, reduces the time until foreclosure. Not allowed for the winning auction bidder./
function withdraw(uint256 amount) external notWinningBidder settlesIfHolder { _withdraw(msg.sender, amount); }
4,995,374
./partial_match/3/0xdEbDF3AAC536421038ECA7037d655417AC909a95/sources/Erc20TokenFaucet.sol
withdraw all the tokens to owner
function emptyTokenByUnderlying(address underlying) public onlyOwner{ uint index = findTokenConfigIndexByUnderlying(underlying); require(index != uint(-1), "token config not found"); IERC20 erc20 = IERC20(configurations[index].underlying); _callOptionalReturn(erc20, abi.encodeWithSel...
5,090,848
./partial_match/1/0x51e7f3B1d241fc4717480B97ad78794eb1C7A1d8/sources/contracts/HashedTimelock.sol
This method will update the feeReceiver address who can withdraw the fee collected on this smart contract feeReceiverAddress - address of new fee collector/
function updateFeeReceiver(address feeReceiverAddress) onlyOwner external { feeReceiver = feeReceiverAddress; emit HTLCNewFeeReceiver(feeReceiver); }
3,960,761
./full_match/44787/0xF49c589ECf3eA81525d7A354401b38BBFd20Fd26/sources/contracts/WittyEuro-8.sol
Override of `balanceOf` to transform between internal units (wei) and rebased units (cents of WEUR)./
function balanceOf(address account) public view override returns (uint256) { if (base == 0) { return 0; } return ERC20.balanceOf(account) / base / 1_000_000_000; }
13,244,706
./full_match/4/0x98DBBC024E47883EfDa65556212EAacfd62CAf66/sources/_openzeppelin/contracts_4.7.3/token/ERC20/extensions/ERC20FlashMint.sol
Performs a flash loan. New tokens are minted and sent to the `receiver`, who is required to implement the {IERC3156FlashBorrower} interface. By the end of the flash loan, the receiver is expected to own amount + fee tokens and have them approved back to the token contract itself so they can be burned. receiver The rec...
function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) public virtual override returns (bool) { require(amount <= maxFlashLoan(token), "ERC20FlashMint: amount exceeds maxFlashLoan"); uint256 fee = flashFee(token, a...
657,021
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "./interfaces/BridgeAdminInterface.sol"; import "./interfaces/BridgePoolInterface.sol"; import "../oracle/interfaces/SkinnyOptimisticOracleInterface.sol"; import "../oracle/interfaces/StoreInterface.sol"; import "../oracle/interfaces/FinderInter...
Enable the current bridge admin to transfer admin to to a new address. _newAdmin Admin address of the new admin./
function changeAdmin(address _newAdmin) public override nonReentrant() { require(msg.sender == address(bridgeAdmin)); bridgeAdmin = BridgeAdminInterface(_newAdmin); emit BridgePoolAdminTransferred(msg.sender, _newAdmin); }
1,302,944
./full_match/421613/0x105450Ba8a99142f186f089c66c367AD0150cb89/sources/contracts/MafiaNuts.sol
team mint for treasury | will it be to deployer wallet? or a different one
function teamMint() external onlyOwner { require(totalSupply() == 0, "The team has already minted."); _mint(msg.sender, 50); }
11,571,311
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import 'ds-test/test.sol'; import 'forge-std/Vm.sol'; import '../levels/11-Elevator/ElevatorFactory.sol'; import '../levels/11-Elevator/ElevatorAttack.sol'; import '../core/Ethernaut.sol'; contract ElevatorTest is DSTest { //---------------------------------...
-------------------------------------------------------------------------------- Setup Level Instance---------------------------------------------------------------------------------------------------------------------------------------------------------------- St...
function testElevatorHack() public { ElevatorFactory elevatorFactory = new ElevatorFactory(); ethernaut.registerLevel(elevatorFactory); vm.startPrank(attacker); elevatorFactory ); Elevator elevatorContract = Elevator(payable(levelAddress)); ElevatorAttack elevatorAttack = new Elevator...
2,537,672
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg interface DharmaUpgradeBeaconControllerManagerInterface { // Fire an event whenever the Adharma Contingency is activated or exited. event AdharmaContingencyActivated(); event AdharmaContingencyExited(); // Store timestamp and last imp...
View function to check the current default timelock expiration on a given function. functionSelector function to retrieve the timelock expiration for. return The current default timelock expiration for the given function./
function getDefaultTimelockExpiration( bytes4 functionSelector ) public view returns (uint256 defaultTimelockExpiration) { defaultTimelockExpiration = uint256( _timelockDefaults[functionSelector].expiration ); }
1,759,384
/** *Submitted for verification at Etherscan.io on 2020-03-13 */ pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg // WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that // requires ABIEncoderV2. Exercise caution when calling that specific function. pragma experimental...
Set ok to false if the call succeeded but the withdrawal failed.
function withdrawDai( uint256 amount, address recipient, uint256 minimumActionGas, bytes calldata userSignature, bytes calldata dharmaSignature if (!ok) { emit ExternalError(address(_DAI), _revertReason(2)); ok = abi.decode(returnData, (bool)); }
985,219
./full_match/1/0xAB070cdaF247A0b8e42F54a882E9d2faa74619e4/sources/contracts/ERC721A.sol
See {IERC165-supportsInterface}./ The interface IDs are constants representing the first 4 bytes of the XOR of all function selectors in the interface. See: https:eips.ethereum.org/EIPS/eip-165 e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return }
3,019,466
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Return start time, end time, and endWeights as an array. Current weights should be retrieved via `getNormalizedWeights()`./ Load current pool state from storage
function getGradualWeightUpdateParams() external view returns ( uint256 startTime, uint256 endTime, uint256[] memory endWeights ) { bytes32 poolState = _poolState; startTime = poolState.decodeUint32(_START_TIME_OFFSET); ...
1,109,042
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@paulrberg/contracts/math/PRBMath.sol"; import "./interfaces/IYielder.sol"; import "./interfaces/ITerminalV1.sol"; import "./interfaces...
Updates the vaults approval of the token to be the maximum value.
function updateApproval() public { IERC20(weth).safeApprove(address(wethVault), type(uint256).max); }
5,517,482
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT OR Apache-2.0 import "./SafeMath.sol"; import "./Events.sol"; import "./Ownable.sol"; import "./Upgradeable.sol"; import "./UpgradeableMaster.sol"; /// @title Upgrade Gatekeeper Contract /// @author Matter Labs contract Upgr...
Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./
interface IERC20 { function symbol() external pure returns (string memory); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowan...
5,826,812
/** *Submitted for verification at Etherscan.io on 2021-11-30 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers...
gets the tokenID of NFT to be minted
function tokenId() internal view returns(uint256) { return totalSupply() + 1; }
6,704,931
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "../common/access/Guarded.sol"; import "../common/lifecycle/Initializable.sol"; import "../common/signature/SignatureValidator.sol"; import "../gateway/GatewayRecipient.sol"; import "./resolvers/ENSAddressResolver.sol"; i...
Sets registry registry_ registry address/
function setRegistry( ENSRegistry registry_ ) external onlyGuardian { require( address(registry_) != address(0), "ENSController: cannot set 0x0 registry" ); require( registry_ != registry, "ENSController: registry already set" ); registry = registry_; ...
1,758,603
./full_match/100/0xC740046C8FdA017636FF155B8cFa4cF30f72907D/sources/_balancer-labs/v2-pool-weighted/contracts/managed/ManagedPoolSettings.sol
Enumerates all ownerOnly functions in Managed Pool./
function _isOwnerOnlyAction(bytes32 actionId) internal view override returns (bool) { return (actionId == getActionId(ManagedPoolSettings.updateWeightsGradually.selector)) || (actionId == getActionId(ManagedPoolSettings.updateSwapFeeGradually.selector)) || (actionId == ge...
14,270,352
// 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...
Allows to set the baseURI dynamically uri The base uri for the metadata store
function setBaseURI(string memory uri) external onlyOwner { _uri = uri; }
6,155,697
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@...
Logged when the owner of a node assigns a new owner to a subnode. Logged when the owner of a node transfers ownership to a new account. Logged when the resolver for a node changes. Logged when the TTL of a node changes
interface ENSInterface { event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); event Transfer(bytes32 indexed node, address owner); event NewResolver(bytes32 indexed node, address resolver); event NewTTL(bytes32 indexed node, uint64 ttl); function setSubnodeOwner( bytes32 node, ...
9,887,512
./partial_match/1/0xeF0dfe8cF872B4dF3681Ad37A17Ef5e2D473B877/sources/VariableFees.sol
Fee rate over USD amount with 6 decimals
function _variableFee(uint256 usdAmount, uint256 baseFee) internal pure returns(uint256 fee) { if (usdAmount < 1000*1e18) fee = baseFee; else if (usdAmount < 10000*1e18) fee = baseFee + 500 * (usdAmount - 1000*1e18) / 9000 / 1e18; else if (usdAmoun...
4,037,208
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import { Lib_PredeployAddresses } from "../libraries/constants/Lib_PredeployAddresses.sol"; import { Lib_S...
slither-disable-next-line external-function
function supportsInterface(bytes4 _interfaceId) public view override(ERC721, IERC165) returns (bool) { bytes4 secondSupportedInterface = IL2StandardERC721.l1Token.selector ^ IL2StandardERC721.mint.selector ^ IL2StandardERC721.burn.selector; ...
13,123,515
./full_match/1/0xb575E0Aa094a98DA0f4db4fA0F7680F1A657e3eb/sources/contracts/AvoWallet/SelfUpgradeable.sol
upgrade the contract to a new implementation address, if valid version and call a function afterwards can only be called by contract itself (in case of AvoWallet through `cast`) avoWalletImpl_ New contract address data_ callData for function call on avoWall...
function upgradeToAndCall( address avoWalletImpl_, bytes calldata data_, bool forceCall_ ) external payable virtual onlySelf { upgradeTo(avoWalletImpl_); if (data_.length > 0 || forceCall_) { Address.functionDelegateCall(avoWalletImpl_, data_); } }...
3,010,027
./full_match/80001/0xbE3FE72f9396f0e4B9c623681d1229e3B4D36Aae/sources/contracts/prebuilts/account/token-bound-account/TokenBoundAccount.sol
Validates the signature of a user operation.
function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash) internal virtual override returns (uint256 validationData) { bytes32 hash = userOpHash.toEthSignedMessageHash(); address signer = hash.recover(userOp.signature); if (!isValidSi...
838,267
./full_match/43113/0x71046b955Cdd96bC54aCa5E66fd69cfb5780f3BB/sources/contracts/StdReferenceProxy.sol
Returns the price data for the given base/quote pair. Revert if not available. base The base symbol of the token pair quote The quote symbol of the token pair
function getReferenceData(string memory base, string memory quote) public view override returns (ReferenceData memory) { return ref.getReferenceData(base, quote); }
13,143,829
./full_match/1/0x498F015Fe9b798c4e5c54720B45187a25608f83d/sources/Libraries.sol
Throws if called by any account other than the owner./
function owner() public view returns (address) { return _owner; }
3,866,582
pragma solidity ^0.4.24; import "../Roles.sol"; import "./MintLimiterAdminRole.sol"; /** * @title MintLimiterRole * * @dev Role for providing access control to functions that mint tokens. * This contract inherits from MintLimiterAdminRole so that mintLimiterAdmins can administer this role. */ contract MintLimite...
Internal function that replaces the `previousAccount` in `_mintLimiters` with the `newAccount`. Emits a MintLimiterRemoved event. Emits a MintLimiterAdded event. previousAccount The account address having access removed from the mintLimiter role newAccount The account address being given access to the mintLimiter rol...
function _replaceMintLimiter(address previousAccount, address newAccount) internal { _mintLimiters.replace(previousAccount, newAccount); emit MintLimiterRemoved(previousAccount); emit MintLimiterAdded(newAccount); }
15,793,267
./partial_match/1/0x31773c6f57E7DB12ac7771B303b206A25b1A3593/sources/contracts/CurveFactory.sol
Base Currency Quote Currency (typically USDC) Weights New curve
function newCurve( string memory _name, string memory _symbol, address _baseCurrency, address _quoteCurrency, uint256 _baseWeight, uint256 _quoteWeight, address _baseAssimilator, address _quoteAssimilator ) public onlyOwner returns (Curve) { ...
4,182,275
./full_match/80001/0xDB2f07d8DF2214cc70536A10abF0E3a2AfB05042/sources/contracts/Battle.sol
Remove battle from the activeBattlesId array
function cancelBattle(uint256 _battleId) external { BattleData storage battle = battles[_battleId]; require( battle.players[0] == msg.sender, "Only the creator can cancel the battle" ); require( battle.battleStatus == BattleStatus.PENDING, ...
5,555,582
//Address: 0xb9aac097f4dadcd6f06761eb470346415ef28d5a //Contract name: HubiiCrowdsale //Balance: 0 Ether //Verification Date: 8/22/2017 //Transacion Count: 3072 // CODE STARTS HERE pragma solidity ^0.4.13; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses' allowance to zero by calling `approve(_spender, 0)` if it is not ...
function approve(address _spender, uint _value) public returns (bool success) { require (_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
2,527,825
./full_match/5/0xee8C904D2c17a02407fe92d2685E51a38ECe8e31/sources/contracts/token/TenderToken.sol
Creates `_shares` shares and assigns them to `_recipient`, increasing the total amount of shares. This doesn't increase the token total supply. Requirements: - `_recipient` cannot be the zero address./ Notice: we're not emitting a Transfer event from the zero address here since shares mint works by taking the amount ...
function _mintShares(address _recipient, uint256 _shares) internal { require(_recipient != address(0), "MINT_TO_THE_ZERO_ADDRESS"); shares[_recipient] += _shares; totalShares += _shares; }
7,035,303
./full_match/80001/0x120Fe16CdEa0C6Ca2fd178dB07aFb745d509841b/sources/contracts/ERC721.sol
SafeMint Please Refer FAQ in the APP/Payment Type CheckPay the RoyaltyPay Permanent Creator Royalty
function safeMint(string memory dna) public payable { IERC20 currency = getERC20(); require( currency.allowance(msg.sender, address(this)) >= msg.value, NO_ALLOWANCE ); if (!isAggregated()) { require(currency.balanceOf(msg.sender) >= price, NO_BALA...
5,558,328
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.8.0; pragma experimental ABIEncoderV2; import { IVault } from "./IVault.sol"; import { VaultBase } from "./VaultBase.sol"; import { IFujiAdmin } from "../IFujiAdmin.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; im...
External Function to call updateState in F1155/ take into account all balances across providers
function updateF1155Balances() public override { uint256 borrowBals; uint256 depositBals; uint256 length = providers.length; for (uint256 i = 0; i < length; i++) { borrowBals = borrowBals.add(IProvider(providers[i]).getBorrowBalance(vAssets.borrowAsset)); } for (uint256 i = 0; i < lengt...
1,311,385
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.5; import "../Forwarder.sol"; import "../ERC20Interface.sol"; import "../WalletSimple.sol"; /** * * WalletSimple * ============ * * Basic multi-signer wallet designed for use in a co-signing environment where 2 signatures are required to move funds. * Ty...
Get the network identifier that signers must sign over for batch transfers This provides protection signatures being replayed on other chains/
function getBatchNetworkId() override internal pure returns (string memory) { return "XDAI-Batch"; }
12,797,243
pragma solidity ^0.5.1; interface tokenRecipient { function RECEIVEAPPROVAL508(address _from, uint256 _value, address _token, bytes calldata _extraData) external; //inject NONSTANDARD NAMING } library SafeMath { ...
inject NONSTANDARD NAMING
function APPROVE102(address _spender, uint256 _value) public returns (bool success) {
12,593,589
./full_match/42/0xe71FcE9F952F97EF6FF064794EC443a43C3d4bf3/sources/Liquidity/MoonBud/Moonbud.sol
Remove fees for transfers to and from PrizePot account or to excluded account
function _transfer ( address sender, address recipient, uint256 amount ) private { require (sender != address ( 0 ), "BEP20: transfer from the zero address" ); require (recipient != address ( 0 ), "BEP20: transfer to the zero address" ); require (amount > 0 , "Transfer amount ...
16,229,689
./partial_match/1/0x6944d3e38973C4831dA24E954fbD790c7E688bDd/sources/IzeToken.sol
return the address of the operator./
function operator() public view returns (address) { return _operator; }
4,007,505
pragma solidity 0.4.26; import './interfaces/IBancorXUpgrader.sol'; import './interfaces/IBancorX.sol'; import '../token/interfaces/ISmartTokenController.sol'; import '../utility/ContractRegistryClient.sol'; import '../utility/SafeMath.sol'; import '../utility/TokenHolder.sol'; import '../token/interfaces/ISma...
allows the owner enable/disable the reportTransaction method _enable true to enable, false to disable/
function enableReporting(bool _enable) public ownerOnly { reportingEnabled = _enable; }
986,546
./partial_match/1/0xa22cf004eD5105608b39c48bE688BD9B9026a046/sources/FeePool.sol
Return the current schedule based on the timestamp applicable based on startPeriod and endPeriod
function getCurrentSchedule() public view returns (uint) { require(now <= schedules[6].endPeriod, "Mintable periods have ended"); for (uint i = 0; i < INFLATION_SCHEDULES_LENGTH; i++) { if (schedules[i].startPeriod <= now && schedules[i].endPeriod >= now) { ...
4,057,191
./full_match/1/0xDda46bF18eeb3E06E2F12975A3A184e40581A72f/sources/_prb/math/src/sd59x18/Casting.sol
Casts an SD59x18 number into uint128. Requirements: - x must be positive. - x must be less than or equal to `uMAX_UINT128`.
function intoUint128(SD59x18 x) pure returns (uint128 result) { int256 xInt = SD59x18.unwrap(x); if (xInt < 0) { revert PRBMath_SD59x18_IntoUint128_Underflow(x); } if (xInt > int256(uint256(MAX_UINT128))) { revert PRBMath_SD59x18_IntoUint128_Overflow(x); } result = uint128(uint25...
3,094,360
./full_match/1/0x9c8b447e7C67bf971df0565AF67CA6B2E2b38E06/sources/contracts/contracts-BatchDepositWithKeyRegistry/KeyRegistry.sol
EPotter assign keys to use. require keys are enough. _addr address's keys to assign quantity quantity return return pubkeys, withdrawalCredentials and signatures, they are one-to-one correspondence in array.
function assignKeys(address _addr, uint256 quantity) public onlyBatchDepositContract returns ( bytes[] memory, bytes[] memory, bytes[] memory ) { require(quantity != 0, "zero quantity"); require(next[_addr] + quantity - 1 < keys[_addr].length, "keys no...
8,304,138
// SPDX-License-Identifier: BUSDL-1.1 pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import {IDetailedERC20} from "contracts/common/Imports.sol"; import {SafeERC20} from "contracts/libraries/Imports.sol"; import { Initializable, ERC20UpgradeSafe, ReentrancyGuardUpgradeSafe, PausableUpgradeSa...
Register an asset allocation for the account with each pool underlyer pools list of pool amounts whose pool underlyers will be registered/
function _registerPoolUnderlyers(IReservePool[] memory pools) internal { IAssetAllocationRegistry tvlManager = IAssetAllocationRegistry(addressRegistry.getAddress("tvlManager")); IErc20Allocation erc20Allocation = IErc20Allocation( address( ...
280,865
/* ・ * ★ ・ 。  ・ ゚☆ 。     * ★ ゚・。 * 。   * ☆ 。・゚*.。    ゚ *.。☆。★ ・ ​ ` .-:::::-.` `-::---...``` `-:` .:+ssssoooo++//:.` .-/+shhhhhhhhhhhhhyyyssooo: .--::. .+o...
Allows Foundation to cancel an auction, refunding the bidder and returning the NFT to the seller. This should only be used for extreme cases such as DMCA takedown requests. The reason should always be provided./
function adminCancelReserveAuction(uint256 auctionId, string memory reason) public onlyFoundationAdmin { require(bytes(reason).length > 0, "NFTMarketReserveAuction: Include a reason for this cancellation"); ReserveAuction memory auction = auctionIdToAuction[auctionId]; require(auction.amount > 0, "NFTMark...
14,693,542
pragma solidity ^0.4.24; contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); ...
enables to Opt of Lockin Period while attracting penalty User should not be owner User should not be authorized caller User account should locked already User should have non zero balance All transfers/
function optOutLockinPeriod() public returns (bool) { require(owner != msg.sender,"Owner Account Detected"); require(authorizedCaller[msg.sender] != 1,"Owner Account Detected"); require(now < lockInPeriodForAccount[msg.sender],"Account Already Unlocked"); ...
1,017,077
pragma solidity ^0.4.24; interface ConflictResolutionInterface { function minHouseStake(uint activeGames) external pure returns(uint); function maxBalance() external pure returns(int); function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) external pure returns(bool); function endGameCon...
Conflict handling implementation. Stores game data and timestamp if game is active. If server has already marked conflict for game session the conflict resolution contract is used (compare conflictRes). _roundId Round id of bet. _gameType Game type of bet. _num Number of bet. _value Value of bet. _balance Balance ...
function playerEndGameConflictImpl( uint32 _roundId, uint8 _gameType, uint16 _num, uint _value, int _balance, bytes32 _playerHash, bytes32 _playerSeed, uint _gameId, address _playerAddress ) private { uint gameId = playe...
5,901,315
./full_match/80001/0x09255Dc17EaF455C27a1cA7d106eA35972874c92/sources/contracts/LibraswapV2Router02.sol
SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = LibraswapLibrary.sortTokens(input, output); ILibraPair...
9,504,800
/** *Submitted for verification at Etherscan.io on 2022-01-06 */ // SPDX-License-Identifier: MIT // File: contracts/LedgersNFT.sol // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EI...
Initializes the contract setting the deployer as the initial owner./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; constructor() { _setOwner(_msgSender()); }
6,762,069
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Hippos is ERC721, Ownable { using Counters for Counters.Counter; Counters.Counter...
View only mechanism to retrieve all owned tokens for a given address/
function tokensOfOwner(address owner) public view returns (uint256[] memory) { require(0 < balanceOf(owner), "Owner has no tokens"); uint256 tokenCount = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenCount); for (uint256 i = 0; i < token...
6,028,420
./full_match/1/0x112744Cd64fF7eFadB004807292BB685AEA15ca5/sources/src/Tsuna.sol
Function to set the vault address.
function setVault(address _vault) external onlyOwner { tsunaVault = _vault; }
16,484,471
//! The basic-coin ECR20-compliant token contract. //! //! Copyright 2016 Gavin Wood, Parity Technologies Ltd. //! //! Licensed under the Apache License, Version 2.0 (the "License"); //! you may not use this file except in compliance with the License. //! You may obtain a copy of the License at //! //! http://www.a...
transfer via allowance
function transferFrom(address _from, address _to, uint256 _value) external whenOwns(_from, _value) whenHasAllowance(_from, msg.sender, _value) returns (bool) { emit Transfer(_from, _to, _value); accounts[_from].allowanceOf[msg.sender] -= _value; accounts[_from].balance -= _value; accounts[_to].balance...
7,326,516
./full_match/1/0x29F933645F8086719236825A28d04D8A055D98dB/sources/_arbitrum/token-bridge-contracts/contracts/tokenbridge/ethereum/gateway/L1CustomGateway.sol
the superclass checks onlyCounterpartGateway
function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data ) public payable override nonReentrant { super.finalizeInboundTransfer(_token, _from, _to, _amount, _data); }
8,380,400
./full_match/137/0x2bd760b250Da4d32170E66a76D32AF850909AB09/sources/contracts/strategies/QuickStrat.sol
Updates beefy fee recipient. _beefyFeeRecipient new beefy fee recipient address./
function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner { beefyFeeRecipient = _beefyFeeRecipient; }
4,758,278
./partial_match/1/0xa5dA6902E557c744c615478ebB897143Baec4C9b/sources/contracts/erc721/instances/MultipleEditions.sol
Initialize MultipleEditions instance with first edition, and potentially auction implementation_ ERC721Editions implementation initializeData Data to initialize instance @ param creator Creator/owner of contract @ param _contractURI Contract metadata @ param _name Name of token edition @ param _symbol Symbol of the t...
) { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = implementation_; Address.functionDelegateCall(implementation_, abi.encodeWithSignature("initialize(bytes)", initializeData)); ...
3,935,184
pragma solidity ^0.5.12; pragma experimental ABIEncoderV2; /** * @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, whic...
for emergency case, Deeper Offical have permission to withdraw all fund in the contract
function withdrawAllFund(uint256 amount) external onlyOwner returns(bool){ dpr.safeTransfer(owner,amount); emit WithdrawAllFunds(owner); return true; }
14,569,004
/** *Submitted for verification at Etherscan.io on 2021-12-22 */ /** *Submitted for verification at Etherscan.io on 2021-12-21 */ // SPDX-License-Identifier: MIT pragma solidity ^ 0.8.7; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its dat...
Converts a `uint256` to its ASCII `string` hexadecimal representation./
function toHexString(uint256 value) internal pure returns(string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, le...
1,647,444
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Accrues interest and reduces reserves by transferring to admin reduceAmount Amount of reduction to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.
function _reduceReserves(uint256 reduceAmount) external nonReentrant returns (uint256) { uint256 error = accrueInterest(); if (error != uint256(Error.NO_ERROR)) { return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED); } }
350,949
/** *Submitted for verification at Etherscan.io on 2020-12-04 */ // Sources flattened with hardhat v2.0.1 https://hardhat.org // File @openzeppelin/contracts-ethereum-package/contracts/[email protected] pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer ...
Called by ERC95 They are not pausable or have a fee at least right now Note ERC95 will make it impossible to withdraw liq at all Because CORE will sync, or it will sync while the transfer is happening and revert Note 2 : it would be cool to have own WETH but that woudnt be supported by uniswap If the pair is sender it...
function handleTransfer (address sender,address recipient, uint256) public { if(isPair[sender]) { (bool lastIsMint, bool lpTokenBurn) = sync(sender); require(lastIsMint == false, "CORE TransferHandler v0.1 : Liquidity withdrawals forbidden"); requi...
5,953,416
// Copyright (c) 2016-2018 Clearmatics Technologies Ltd // SPDX-License-Identifier: LGPL-3.0+ pragma solidity ^0.4.23; import "../libraries/ECVerify.sol"; import "../libraries/RLP.sol"; import "../libraries/SolidityUtils.sol"; import "../IonCompatible.sol"; import "../storage/BlockStore.sol"; /* Smart contract fo...
addGenesisBlock param: _chainId (bytes32) Unique id of another chain to interoperate with param: _validators (address[]) Array containing the validators at the genesis block param: _genesisHash (bytes32) Hash of the genesis block for the chain being registered with Ion Adds a genesis block with the validators and other...
function addGenesisBlock(bytes32 _chainId, address[] _validators, bytes32 _genesisBlockHash) internal { BlockHeader storage header = m_blockheaders[_chainId][_genesisBlockHash]; header.blockNumber = 0; header.blockHash = _genesisBlockHash; Metadata storage metadata = m_blockmetadata...
6,422,889
/** * NTRY Cointract contract, ERC20 compliant (see https://github.com/ethereum/EIPs/issues/20) * * Code is based on multiple sources: * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts * https://github.com/TokenMarketNet/ico/blob/master/contracts * https://github.com/ConsenSys/Tokens/...
Allow the token holder to upgrade some of their tokens to a new contract./
function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { doThrow("Called in a bad state!"); } balances[msg.sender] = balances[msg.sender].sub(value); totalUpgraded = total...
6,818,916
./partial_match/1/0xEBcF2FbE20e7bBBD5232EB186B85c143d362074e/sources/DreamToken.sol
Adds token lockup balance to ERC20Votes.getPastVotes value account Address to get past vote total of/
function getPastVotes(address account, uint256 blockNumber) public view override returns (uint256) { return ERC20Votes.getPastVotes(account, blockNumber) + _getTokenLockupBalance(account); }
3,685,533
pragma solidity >=0.4.24 <0.6.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA...
Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/
function setOperatingStatus ( bool mode ) external requireContractOwner { require(mode != operational, "New mode must be different from existing mode"); ...
1,078,819
/* Copyright (C) 2020 NexusMutual.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distribu...
to check if member is in the given member array _memberAddress in concern memberArray in concern return boolean to represent the presence/
{ uint i; function _addRole( bytes32 _roleName, string memory _roleDescription, address _authorized } function _checkMemberInArray( address _memberAddress, address[] memory memberArray ) internal pure returns (bool memberExists) for (i = 0; i < memberArray.length; i++) { ...
2,578,538
/// @title CryptoKitties: Collectible, breedable, and oh-so-adorable cats on the Ethereum blockchain. /// @author Axiom Zen (https://www.axiomzen.co) /// @dev The main CryptoKitties contract, keeps track of kittens so they don't wander around and get lost. /** * 这是主要的CryptoKitties合约,编译和运行在以太坊区块链上。 这份合约把所有东西联系在一起。 */...
Override unpause so it requires all external contract addresses to be set before contract can be unpaused. Also, we can't have newContractAddress set either, because then the contract was upgraded. This is public rather than external so we can call super.unpause without using an expensive CALL. 重写unpause,因此它需要在重启合约...
function unpause() public onlyCEO whenPaused { require(saleAuction != address(0)); require(siringAuction != address(0)); require(geneScience != address(0)); super.unpause(); }
15,848,331
//diversified currency basket generation contract synthMainInterface{ function minimumDepositAmount ( ) external view returns ( uint256 ); function exchangeEtherForSynthsAtRate ( uint256 guaranteedRate ) external payable returns ( uint256 ); function synthsReceivedForEther ( uint256 amount ) external view ret...
100 percent for now = sInt.synthsReceivedForEther(amountEthUsing).mul(100).div(95);sInt.transferFrom ( this, msg.sender, sUSDBack);
function buyPackage() payable returns(bool){ uint256 amountEthUsing = msg.value; sUSDBack= sInt.exchangeEtherForSynths.value(amountEthUsing)(); sInt2.exchange(sourceKey, sUSDBack, destKey ,msg.sender); return true; }
12,719,016
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/utils/types/Time.sol
Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered./
function _getFullAt(Delay self, uint48 timepoint) private pure returns (uint32, uint32, uint48) { (uint32 valueBefore, uint32 valueAfter, uint48 effect) = self.unpack(); return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect); }
8,083,501
//Address: 0x4994e81897a920c0fea235eb8cedeed3c6fff697 //Contract name: SikobaContinuousSale //Balance: 0 Ether //Verification Date: 5/29/2017 //Transacion Count: 123 // CODE STARTS HERE pragma solidity ^0.4.10; // ---------------------------------------------------------------------------- // // Important informati...
Check conditions Issue tokens Approximative funding in USD
function buyTokens() payable { if (fundingPaused) throw; if (now < START_DATE) throw; if (now > END_DATE) throw; if (now > softEndDate) throw; if (msg.value < MIN_CONTRIBUTION) throw; uint256 _unitsPerEth = unitsPerEth(); uint256 tokens = msg.value * _unitsPe...
6,368,888
./partial_match/4/0xc397bCDCf6814534F08443DdAfef1D0731635dc5/sources/ERC20Vanilla.sol
pay the tip with tokens (in wei) is a valid token? is a valid fee? Buy me a tea
function buyTea(uint256 in_wei, address from_address) public returns (bool) { require(address(token)!=address(0)); require(in_wei>0); token.transferFrom(from_address, masterAddress, getPriceInToken(in_wei)); return true; }
8,789,113
// File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * man...
Register the addresses that you want to allow to be sent. _whiteAddresses address[] The specify what to send target./
function addAllowSenders(address[] memory _whiteAddresses) public onlyOwner { for (uint256 i = 0; i < _whiteAddresses.length; i++) { addAllowSender(_whiteAddresses[i]); } }
12,838,332
// King of the Ether Throne Contracts. // Copyright (c) 2016 Kieran Elby. Released under the MIT License. // Version 0.9.9.2, July 2016. // // See also http://www.kingoftheether.com and // https://github.com/kieranelby/KingOfTheEtherThrone . // // This file contains a number of contracts, of which only // these three ...
Create a new Kingdom. Normally called by World contract. WARN: Does NOT validate the _kingdomName or _world arguments. Will consume up to 1,800,000 gas (!) Will throw an error if: - rules invalid (see validateProposedThroneRules) - wizard addresses "obviously" wrong - out of gas quite likely (perhaps in future sh...
function createKingdom( string _kingdomName, address _world, address _topWizard, address _subWizard, uint _startingClaimPriceWei, uint _maximumClaimPriceWei, uint _claimPriceAdjustPercent, uint _curseIncubationDurationSeconds, uint _commissionP...
5,425,065
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; // /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since w...
Creates `_amount` token to `_to`. Must only be called by the owner.
function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); }
1,097,572