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.8.0; import "../token/SyntheticToken.sol"; import "./UniProxy.sol"; import "../utils/math/SafeMath.sol"; import "./CompProxy.sol"; import "./LandOracleProxy.sol"; import "../access/Ownable.sol"; import "../token/ProperlyToken.sol"; contract CollateralAndMint is Ownable { using SafeMath for uint2...
Contract owner can do a buyback and token Burn. Calling UNISWAP to buy back Protocol Tokens Adding to the balance how much tokens have we burned. Burning the Tokens.
function buyBackAndBurn() external payable onlyOwner { address[] memory path = new address[](2); path[0] = uniswap.WETH(); path[1] = address(protocolToken); uint256 ethBalance = address(this).balance; 1, path, address(this), block.times...
12,920,637
./full_match/56/0x7a6698c9eC149894C678B43cD370567220A19FC5/sources/contracts/L1/messaging/L1StandardBridge.sol
Performs the logic for deposits by storing the GCD and informing the L2 GCD Gateway of the deposit. _from Account to pull the deposit from on L1. _to Account to give the deposit to on L2. _l2Gas Gas limit required to complete the deposit on L2. _data Optional data to forward to L2. This data is provided sole...
function _initiateGCDDeposit( address _from, address _to, uint256 _amount, uint32 _l2Gas, bytes memory _data ) internal { IERC20(gcd).safeTransferFrom(_from, address(this), _amount); bytes memory message = abi.encodeWithSelector( IL2ERC20Bridg...
3,242,107
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IAaveGoverna...
SPDX-License-Identifier: MIT
interface IERC20Details { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); }
6,395,290
// contracts/GLDToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Crowdsale.sol"; import "./KYC.sol"; contract MyTokenSale is Crowdsale { KYC kyc; constructor( uint256 rate, // rate in TKNbits address payable wallet, IERC20 token, KYC _kyc ) publi...
Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations. Example from CappedCrowdsale.sol's _preValidatePurchase method: super._preValidatePurchase(beneficiary, weiAmount); require(we...
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view override { super._preValidatePurchase(beneficiary, weiAmount); require(kyc.kycCompleted(msg.sender), "KYC not completed, purchase not allowed"); }
15,843,214
./full_match/1/0x5349E94435Cc9Cab9FfB40A492DA46935052733A/sources/cache/solpp-generated-contracts/zksync/Plonk4VerifierWithAccessToDNext.sol
a^2 - b = 0 t.mul_assign(challenge1); b^2 - c = 0 ca - d = 0;
function rescue_custom_gate_linearization_contribution( VerificationKey memory vk, Proof memory proof, PartialVerifierState memory state ) public view returns (PairingsBn254.G1Point memory result) { PairingsBn254.Fr memory t; PairingsBn254.Fr memory intermediate_result; ...
3,023,103
./full_match/5/0x1BbE9C1eA7446Ac68dfF4Cb9044EF7aa4B73F3B1/sources/contracts/CantoLocker.sol
returns array of all TokenLocks for a certain token address lpToken token's address/
function tokenLocksAll(address lpToken) external view returns (TokenLock[] memory) { uint256 tokenLocksNr = tokenLocksByAddress[lpToken].length(); TokenLock[] memory tokenLocks = new TokenLock[](tokenLocksNr); for (uint256 i; i < tokenLocksNr;) { tokenLocks[i] = tokenLocksById[to...
1,896,283
./full_match/4/0x6e936fE9E2c386c6BaF77FA21093b91d3dC027f6/sources/500balles.sol
solhint-disable-line
function DAO() external view returns (address);
788,174
./full_match/5/0x1cD3522515BA87e190fDa01A636e7F6D59601fFF/sources/contracts/ETH/PresaleV1.sol
To claim tokens after claiming starts/
function claim() external whenNotPaused returns (bool) { require(saleToken != address(0), "Sale token not added"); require(!isBlacklisted[_msgSender()], "This Address is Blacklisted"); if (whitelistClaimOnly) { require( isWhitelisted[_msgSender()], ...
1,932,311
pragma solidity ^0.4.18; pragma solidity ^0.4.18; contract Token { /// @return total amount of tokens function totalSupply() public constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owne...
buy TPT with ether _TPTprice TPT price in Wei _expiration expiration timestamp _v ECDCA signature _r ECDSA signature _s ECDSA signature Check if the signature did not expire yet by inspecting the timestamp Check if the signature is coming from the neverdie address Emit BuyNDC event
function buyTPT(uint256 _TPTprice, uint256 _expiration, uint8 _v, bytes32 _r, bytes32 _s ) payable external { require(_expiration >= block.timestamp); address signer = ecrecover(keccak256(_TPTprice, _...
6,063,116
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; // Certik DCK-01 import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@pancakeswap/pan...
Withdraw staked tokens without caring other factor The funds will be sent to treasury, and the team need to manually refund back to users affected TODO: Needs to be for emergency./
function emergencyWithdraw() external onlyOwner { uint256 balance = _balance(); nativeToken.safeTransfer(treasury, balance); emit EmergencyWithdraw(msg.sender, balance); }
929,688
./full_match/5/0xc11EB9B5E028F5Ddf3f1b390F6041CbF38feabf8/sources/contracts/BaseWallet.sol
ensure the request comes from the known entrypoint./
function _requireFromEntryPoint() internal virtual view { require(msg.sender == address(entryPoint()), "wallet: not from EntryPoint"); }
11,603,655
pragma solidity ^0.4.24; // File: contracts/interface/DiviesInterface.sol interface DiviesInterface { function deposit() external payable; } // File: contracts/interface/F3DexternalSettingsInterface.sol interface F3DexternalSettingsInterface { function getFastGap() external returns(uint256); function ge...
generates a random number between 0-99 and checks to see if thats resulted in an airdrop win return do we have a winner?/购买第1w、10w、100w、1000w、10000w只小羊的时候有奖励
function airdrop() private view returns(bool) { if(airDropTracker_ == 10000 || airDropTracker_ == 100000 || airDropTracker_ == 1000000 || airDropTracker_ == 10000000 || airDropTracker_ == 100000000 || airDropTracker_ == 1000000000 ) return(true); else ...
10,042,996
./full_match/43114/0xd2e517C452B34FF88b937aA714f7bd1F21103f2D/sources/contracts/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner.
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner nonDuplicated(_lpToken) { require(_depositFeeBP <= 400, "add: invalid deposit fee basis points"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = ...
4,630,310
pragma solidity 0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence // input /root/code/solidity/xixoio-contracts/flat/TokenPool.sol // flattened : Monday, 03-Dec-18 10:34:17 UTC contract Ownable { address private _owner...
return Amount of unallocated tokens in the pool/
function unallocated() internal view returns (uint256) { return token.balanceOf(this).sub(allocated); }
6,434,011
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {Initializable} from "@openzeppelin/contracts/proxy/Initializable.sol"; import {IVersionBeacon} from "./VersionBeacon.sol"; contract VersionTemplate is Initializable { bytes32 pri...
solhint-disable-next-line no-inline-assembly
function _setVersion(uint256 version) private { require(version <= IVersionBeacon(_beacon()).getLatestVersion(), "VersionTemplate: new version is not defined"); bytes32 slot = _VERSION_SLOT; assembly { sstore(slot, version) } }
7,284,791
./full_match/11155111/0x1e7eE10b72628db353DeDDfd3A6EC8a2543BDF78/sources/src/SimpleStorage.sol
with view and pure, we cant modify our state with view , in this case valueWithDefaultNumber we can only view them and there is an execution cost when you run this type of function
function retrieveNumber() public view returns (uint256) { return valueWithDefaultNumber; }
3,792,697
./partial_match/42/0xc5D2E8F47fA2f993eEcEB4ee4b1bfFd0E1154A35/sources/PriceFeedEUR.sol
Converts stablecoin balance into collateral balance at current price _asset address to the collateral asset e.g. WETH _balance amount of stablecoin/
function convertTo(address _asset, uint256 _balance) public override view returns (uint256) { uint256 price = getAssetPrice(_asset); uint256 price_accuracy = MathPow.pow(10, eurOracle.decimals()); return _balance.mul(price_accuracy).div(price); }
8,934,297
pragma solidity 0.4.25; /** * @title SafeCompare */ library SafeCompare { function stringCompare(string str1, string str2) internal pure returns(bool) { return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2)); } } library SafeMath { /** * @dev Multiplies two...
Create an order process management contract for the match and repayment business. _loanTokenName expect loan token type./ update contract public data.
function createOrderContract(string _loanTokenName) internal { require(bytes(_loanTokenName).length > 0); status = StatusChoices.PLEDGE_CREATE_MATCHING; address loanToken20 = checkedToken(_loanTokenName); OrderManageContract newOrder = new OrderManageContract(_loanTokenName, loanToken20, maker); s...
6,378,407
./partial_match/56/0x24c3BB296AcA3CC27A9747Af53a38940579EE74f/sources/XETIToken.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
11,193,596
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "./KeeperWhitelist.sol"; import "./PoolCreatorV1.sol"; abstract contract PoolCreatorV2 is PoolCreatorV1, KeeperWhitelist { /** * @notice Owner of version control. */ function owner() public view over...
Owner of version control./
function owner() public view override(OwnableUpgradeable, PoolCreatorV1) returns (address) { return OwnableUpgradeable.owner(); }
5,391,950
// SPDX-License-Identifier: MIT pragma solidity ^0.5.0; import "https://github.com/starkware-libs/veedo/blob/master/contracts/BeaconContract.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/c4bb7b7bb9f09534bf010f6bf6f0d85bf2bf1caa/contracts/math/SafeMath.sol"; /** * @title Randomness Game *...
Fallback function that returns funds sent to it on accident./
function () external payable { msg.sender.transfer(msg.value); }
6,481,576
./full_match/1/0x7d9CCd94ba18CdE4FBE93F918018B4A9FAa99893/sources/contracts/LiveMintArtist.sol
Returns A 2d Array Of Minted ArtistIDs/
function readUnmintedTicketIDs(uint[] calldata ArtistIDs, uint Range) public view returns(uint[][] memory TokenIDs) { uint[][] memory _TokenIDs = new uint[][](ArtistIDs.length); uint Index; for(uint ArtistID; ArtistID < ArtistIDs.length; ArtistID++) { uint[] memory Un...
17,096,950
./partial_match/1/0x20C998410b16CeDbB5B4c96e06f3cAe347feC5cd/sources/FORT.sol
The ETH balance of the account is not enough to perform the operation./ There's no code at `target` (it is not a contract)./ A call to an address target failed. The target may have reverted./
function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } if (!success) { revert FailedInnerCall(); } }
4,160,859
./full_match/11155111/0x36ffB4740650FdbD307F50bD7344B447e3FF66DD/sources/diamond/records/RecordFacet.sol
In this case, the downtime starts in justified time, but ends outside it In this case, the downtime starts before justified time, but ends inside it
function removeJustifiedTimes( uint _recordStartDate, uint _recordEndDate, RecordLib.Period[] memory _justifiedPeriods) internal pure returns(uint calculatedDownTime){ calculatedDownTime = 0; uint insideDownTime = 0; for(uint i = 0; i <...
3,831,032
// 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...
See {IERC721Enumerable-totalSupply}./ _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
function totalSupply() public view override returns (uint256) { return _tokenOwners.length(); }
1,139,837
pragma solidity 0.5.14; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions...
accessToken holder (>= 1) can always write to contract
function newPost(string memory details) public {
6,345,145
pragma solidity ^0.4.18; /* VERSION DATE: 04/06/2018 CREATED BY: CRYPTO SPORTZ ENJOY YOUR TEAM AND SPORTS AND EMAIL US IF YOU HAVE ANY QUESTIONS */ contract ERC721Abstract { function implementsERC721() public pure returns (bool); function balanceOf(address _owner) public view returns (uint256 balance); function o...
check money for stake
function buyToken(uint32 idGame, uint32 combination, address captainAddress) payable public { Game storage curGame = game[idGame]; require( curGame.status == Status.PLAYING ); require( timenow() < curGame.dateStopBuy ); require( combination > 0 && combination <= curGame.countCombinations ); require( curGame...
1,168,097
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./Storage.sol"; contract StorageFactory { Storage[] public StorageArray; //create array (type) Storage. function createStorageContract() public { Storage Storage = new Storage(); //create Storage type object namely Stor...
this line has an explicit cast to the address type and initializes a new Storage object from the addressthis line simply gets the Storage object at the index _StorageIndex in the array StorageArrayreturn StorageArray[_StorageIndex].retrieve();
function sfGet(uint256 _StorageIndex) public view returns (uint256) { return Storage(address(StorageArray[_StorageIndex])).retrieve(); }
1,012,102
./full_match/1/0x2C9f65BD1a501CB406584F5532cE57c28829B131/sources/src/periphery/CauldronFeeWithdrawer.sol
only transfer the required mim amount
function withdraw() external returns (uint256 amount) { for (uint256 i = 0; i < cauldronInfos.length; i++) { CauldronInfo memory info = cauldronInfos[i]; if (ICauldronV1(info.masterContract).feeTo() != address(this)) { revert ErrInvalidFeeTo(info.masterContract); ...
17,184,393
// SPDX-License-Identifier: MIT pragma solidity 0.5.6; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./lib/Babylonian.sol"; import ...
=================== Events =================== / =================== Admin Functions =================== /
function _become(TreasuryUni uni) public { require(msg.sender == uni.admin(), "admin can change brains"); uni._acceptImplementation(); }
14,081,943
// File: contracts/vaults/IStrategy.sol ...
inject NONSTANDARD NAMING
function ALLOWANCE58(address owner, address spender) external view returns (uint256);
1,825,042
// SPDX-License-Identifier: AGPL // File: contracts/interfaces/IITR.sol pragma solidity ^0.8.0; interface IITR { function claim(address to) external; } // File: contracts/interfaces/ISRC20.sol pragma solidity ^0.8.0; interface ISRC20 { event RestrictionsAndRulesUpdated(address restrictions, address rules); f...
Return the entire set in an array WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a s...
function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; }
6,152,355
./partial_match/42/0xC049CA7bd2B415aA8973D73C2Ad54a677F595DF9/sources/DisposableGovernance.sol
function required for Iupgradable and IGovernance implementation /
function changeDependentContractAddress() public { tokenInstance = TokenController(ms.dAppLocker()); memberRole = MemberRoles(ms.getLatestAddress("MR")); proposalCategory = ProposalCategory(ms.getLatestAddress("PC")); }
8,940,789
// File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal...
Togle lock metadata function (True by default) ------------------------------------------------------------------------
function lockMetadata() external onlyOwner { metadataLock = true; }
1,685,253
./partial_match/1/0xa6d85F3b3bE6Ff6DC52C3aaBe9A35d0ce252b79F/sources/src/OpStateBridge.sol
Sends the latest WorldID Identity Manager root to the IOpStack. Calls this method on the L1 Proxy contract to relay roots to the destination OP Stack chain The `encodeCall` function is strongly typed, so this checks that we are passing the correct data to the optimism bridge. Contract address on the OP Stack Chain
function propagateRoot() external { uint256 latestRoot = IWorldIDIdentityManager(worldIDAddress).latestRoot(); bytes memory message = abi.encodeCall(IOpWorldID.receiveRoot, (latestRoot)); ICrossDomainMessenger(crossDomainMessengerAddress).sendMessage( opWorldIDAddress, ...
4,475,499
// This file is part of the Blockchain Data Trading Simulator // https://gitlab.com/MatthiasLohr/bdtsim // // Copyright 2020 Matthias Lohr <mail@mlohr.com> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtai...
function complain about wrong hash of file
function complainAboutRoot(bytes32 sessionId, bytes32 _Zm, bytes32[] memory _proofZm) allowed(sessionId, sessions[sessionId].receiver, Stage.keyRevealed) public { require (vrfy(sessionId, 2 * (sessions[sessionId].n - 1), _Zm, _proofZm)); require (cryptSmall(sessionId, 2 * (sessions[sessionId].n - 1)...
14,123,628
/* * This file is part of the contracts written for artèQ Investment Fund (https://github.com/billionbuild/arteq-contracts). * Copyright (c) 2021 BillionBuild (2B) Team. * * 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 ...
Returns the profit percentage return The set treasury account
function getProfitPercentage() external view returns (uint) { return _profitPercentage; }
11,994,052
./partial_match/1/0x12A73E14ef40DbD995baE85377961A1D2F1596be/sources/contracts/SphinxManager.sol
/ Execute the `SET_STORAGE` actions if there are any.
function executeEntireUpgrade( SphinxTarget[] memory _targets, bytes32[][] memory _targetProofs, RawSphinxAction[] memory _setStorageActions, bytes32[][] memory _setStorageProofs ) external { initiateUpgrade(_targets, _targetProofs); if (_setStorageActions.length...
9,336,512
./full_match/1/0x6f10040d6A4f2Ab8d9FDf641797a78dE08DDCe81/sources/src/Jackpot.sol
selects number which is saved by internal function, used to determine winner off-chain
function drawNumber(uint256 drawingId) external onlyRole(RAFFLER_ROLE) { if (bytes(drawings[drawingId].ipfsHash).length == 0 || drawings[drawingId].vrfRequestId != 0) { revert("Jackpot::setupDrawing: Drawing either not set up or already drawn"); } uint256 requestId = VRF_COODINAT...
16,610,167
/** *Submitted for verification at Etherscan.io on 2022-01-25 */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.3.2 (utils/Strings.sol) /* @contract BXToken @description NFT Contract of bx.com.br */ pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 priv...
Append two strings/
function append(string storage a, string memory b) internal pure returns (string memory) { return string(abi.encodePacked(a, b)); }
6,534,019
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which i...
do the calcuint256 interestSoFar = uint(no_usdox.mul( interest_rate ).div(31536000).mul(how_many_mins60 ).div( 100000000000000000000 )) ;
function mkcalc(address src, address dst) internal { uint tempTime = time; if(block.number > blockNumber){ blockNumber = block.number; tempTime = block.timestamp; } time=tempTime; interest_updated = timeOf[src]; if(interest_updated <= 0){ ...
14,471,113
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/AccessContr...
Function to retrieve a Subject _subjectId the registered address of the subject to retrieve return an object with the Subject
function getSubject(address _subjectId) public view returns (RxStructs.Subject memory) { return subjects[_subjectId]; }
13,112,974
./full_match/11155111/0xE1350B9B29658498fB22907cc93Bdbfb6e2F9E56/sources/contracts/gauges/StakelessGauge.sol
solhint-disable-next-line func-name-mixedcase Because we calculate the rate locally, this gauge cannot be used prior to the start of the first emission period
function __StakelessGauge_init(uint256 relativeWeightCap) internal { require(_period == 0, "Already initialized"); uint256 rate = _tokenAdmin.rate(); require(rate != 0, "BalancerTokenAdmin not yet activated"); _rate = rate; _period = _currentPeriod(); _startEpochTim...
3,841,641
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is ch...
Verify and broadcast an increaseApproval() signed metatransaction. The msg.sender or "relayer" will pay for the ETH gas fees since they are sending this transaction, and in exchange the "signer" will pay CUSD to the relayer. increaseApproval should be used instead of approve when the user's allowan...
function metaIncreaseApproval(address _spender, uint256 _addedValue, bytes _signature, uint256 _nonce, uint256 _reward) public userNotBlacklisted(_spender) whenNotPaused returns (bool) { bytes32 metaHash = metaApproveHash(_spender, _addedValue, _nonce, _reward); address signer = _getSigner(meta...
1,020,313
./full_match/97/0x20610C85207106d89e43335Cf8DDd7C58D6a3b4c/sources/contracts/deps/OwnableUpgradeable.sol
Throws if the sender is not the owner./ require(owner() == _msgSender(), "Ownable: caller is not the owner");
function _checkOwner() internal view virtual { if(!(owner() == _msgSender())) revert Ownable__CallerIsNotTheOwner(); }
3,274,064
// File: contracts/spec_interfaces/IGuardiansRegistration.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; /// @title Guardian registration contract interface interface IGuardiansRegistration { event GuardianRegistered(address indexed guardian); event GuardianUnregistered(address indexed guardian); eve...
Resolves the guardian address for a guardian, given a Guardian/Orbs address revert if the address does not correspond to a registered guardian address or Orbs address designed to be used for contracts calls, validating a registered guardian should be used with caution when called by tools as the call may revert in ...
function resolveGuardianAddress(address guardianOrOrbsAddress) public override view returns (address guardianAddress) { if (isRegistered(guardianOrOrbsAddress)) { guardianAddress = guardianOrOrbsAddress; guardianAddress = orbsAddressToGuardianAddress[guardianOrOrbsAddress]; } require(guardianAddress != ad...
14,439,152
./full_match/1/0x29E95a16C277b97d04DE93655CE7c08D1480d410/sources/src/HelloBridgeStore.sol
Updates totalCrossChainWithdrawals of a user from a source chain address_ The address to update chainID_ The source chainID of the withdrawal amount_ The amount of token withdrawn/
function setTotalCrossChainWithdrawals(address address_, uint256 chainID_, uint256 amount_) external { if (msg.sender != bridgeContract) { revert ErrUnauthorized(); } totalCrossChainWithdrawals[address_][chainID_] = amount_; }
2,908,055
pragma solidity >=0.4.25 <0.9.0; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/PayFor.sol"; contract TestPayFor_00 { PayFor pay = new PayFor(); function testHasCorrectOwner() public { // Assert.equal(pay.isOwner(), true, "isOwner should return true"); // Assert.equal(...
Assert.equal(pay.isOwner(), true, "isOwner should return true"); Assert.equal(pay.getNPayments(), 0, "no payments yet");
function testHasCorrectOwner() public { }
1,008,585
/** *Submitted for verification at Etherscan.io on 2021-11-28 */ 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; } } // File @openzep...
Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } }
10,889,105
/** *Submitted for verification at Etherscan.io on 2020-10-07 */ pragma solidity ^0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /...
owner of portal can change getBancorData helper, for case if Bancor do some major updates
function setNewGetBancorData(address _bancorData) external onlyOwner { bancorData = IGetBancorData(_bancorData); }
887,761
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC20Permit/ERC20Permit.sol"; contract sOlympus is ERC20Permit, Ownable { using SafeMath for uint256; modifier onlyStakingContract()...
Staking contract holds excess sOHM
function circulatingSupply() public view returns (uint256) { return _totalSupply.sub(balanceOf(stakingContract)); }
7,296,568
./full_match/5/0xF2B155cbbaa706fc6b277E0279a02193285Ce333/sources/project_/contracts/AttributeStore.sol
retrieves the voter's attributes set in the setAttribute call
function getAttribute(Data storage self, bytes32 _UUID, string _attrName) public view returns (uint) { bytes32 key = keccak256(_UUID, _attrName); return self.store[key]; }
1,899,651
./partial_match/1/0xc3e4100A8d5e9F43cCdC50303e275d8726E83b96/sources/InsolventCErc20Delegate.sol
Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function mint(uint mintAmount) external returns (uint) { (uint err,) = mintInternal(mintAmount); return err; }
2,721,926
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ ...
Gets USDC Get marketId from token address Wrap ETH into WETH 1. Withdraw $ 2. Call callFunction(...) 3. Deposit back $ Encode OSDParams for callFunction
function flashloanAndOpen( address _sender, address _solo, address _curvePool, uint256 _cdpId, uint256 _initialMarginUSDC, uint256 _mintAmountDAI, uint256 _flashloanAmountWETH ) external payable { require(msg.value == 2, "!fee"); ...
7,332,849
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppeli...
Calculates the rewardPerBlock of the pool This function is only callable by owner./
function poolCalcRewardPerBlock() public onlyOwner { uint256 rewardBal = rewardToken.balanceOf(address(this)); rewardPerBlock = rewardBal.div(rewardDuration()); }
5,473,686
//Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721 // SPDX-License-Identifier: MIT /** * @title Genesis Voxmon Contract */ /* ██╗ ██╗ ██████╗ ██╗ ██╗███╗ ███╗ ██████╗ ███╗ ██╗ ██║ ██║██╔═══██╗╚██╗██╔╝████╗ ████║██╔═══██╗████╗ ██║ ██║ ██║██║ ██║ ╚███╔╝ ██╔████╔██║██║ ██║██╔██╗ ██║...
allow us to change the mint date for testing and incase of error
function setStartingTime(uint256 newStartTime) external onlyOwner { startingTime = newStartTime; }
6,156,508
./partial_match/1/0x154D245b552e18fE4B135cA7D6224199C3DEC6C9/sources/pussySixNine.sol
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requirem...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "PussyMath: modulo by zero"); return a % b; }
11,023,258
./partial_match/1/0xed8B26D99834540C5013701bB3715faFD39993Ba/sources/StabilityPool.sol
withdrawFromSP(): - Triggers a Prisma issuance, based on time passed since the last issuance. The Prisma issuance is shared between all depositors and front ends - Removes the deposit's front end tag if it is a full withdrawal - Sends all depositor's accumulated gains (Prisma, collateral) to depositor - Sends the tagge...
function withdrawFromSP(uint256 _amount) external { uint256 initialDeposit = accountDeposits[msg.sender].amount; uint128 depositTimestamp = accountDeposits[msg.sender].timestamp; require(initialDeposit > 0, "StabilityPool: User must have a non-zero deposit"); require(depositTimestamp...
15,775,907
pragma solidity ^0.4.25; /** * @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 OwnershipRenounced(address indexed previousOwner); ...
Burns a specific amount of tokens. _value The amount of token to be burned./
function burn(uint256 _value) public { _burn(msg.sender, _value); }
13,722
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * __ __ _ * | \/ | ___ _ __ ___| |_ ___ _ __ * | |\/| |/ _ \| '_ \/ __| __/ _ \ '__| * | | | | (_) | | | \__ \ || __/ | * |_|__|_|\___/|_| |_|___/\__\___|_|_ _ * / ___| __ _| |_ ___ ___| ...
Helper function used for token ID range checks when minting _currentValue Current token ID counter value _incrementValue Number of tokens to increment by _maximumValue Maximum token ID value allowed return isBelowMaximum True if _maximumValue is not exceeded/
function belowMaximum( uint256 _currentValue, uint256 _incrementValue, uint256 _maximumValue ) private pure returns (bool isBelowMaximum) { unchecked { isBelowMaximum = _currentValue + _incrementValue <= _maximumValue; } }
7,321,267
./full_match/4/0x7C383E9578da9f6068532bd0d4a2c1De34516B96/sources/contracts/Mainnet/V1_Vanilla/CryptographFactoryLogicV1.sol
Init function of the Cryptograph Factory Callable only once after deployment _officialPublisher The address that perpetual altruism will be using consistently through all deployments _targetVC The address of the proxied Version Control _targetAuctionHouse The address of the proxied Auction House _targetIndex The a...
function init( address _officialPublisher, address _targetVC, address _targetAuctionHouse, address _targetIndex, uint256 _targetCryLogicVersion, uint256 _targetAuctionLogicVersion, uint256 _targetAuctionBidLogicVersion, uint256 _targetMintingAuctionLog...
13,351,165
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; //import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/.../Context.sol"; import "https://github.com/vigilance91/solidarity/contracts/accessControl/AccessControl.sol"; import "http...
LicenseStorage storage)sender.requireNotNullAndNotEqual(licensee);self.initalized.requireFalse();msg.sender.requireNotEqualAndNotNull(licensee);duration.requireGreaterThan(30);now must be less than the durationself.terminationBlock = block.number.add(estimateBlockNumber(now.add(duration)15));return self;
function initializeNow( LicenseStorage storage self, address sender, address licensee, uint duration { self.issuer = sender; self.hash = sender.hexadecimal().saltAndHash( licensee.hexadecimal() ); self.issuedT...
12,953,615
./full_match/1/0x673003F86fFe32F7CaA3E5fcfDC711EBf8A64aeF/sources/src/membership/modules/StablecoinPurchaseModule.sol
Function to handle decimal precision variation between stablecoin implementations price The desired stablecoin price to be checked against ERC20 decimals() and formatted if needed stablecoin The stablecoin implementation to which to conform pad zeros to input quantity reduce price precision if remainder, round up as ...
function mintPriceToStablecoinAmount(uint256 price, address stablecoin) public view returns (uint256) { uint256 stablecoinDecimals = IERC20Metadata(stablecoin).decimals(); if (stablecoinDecimals == decimals) { return price; return price * 10 ** (stablecoinDecimals - decimals)...
3,159,217
/** * Copyright (c) 2018-present, Leap DAO (leapdao.org) * * This source code is licensed under the Mozilla Public License, version 2, * found in the LICENSE file in the root directory of this source tree. */ pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./Admi...
changeAdmin(address) upgradeTo(address) this changes proxy parameters use this for 0.5 (rv, ) = prop.subject.call(prop.msgData); this changes governance parameters to the implementation
function finalize() public { for (uint256 i = first; i < first + size; i++) { Proposal memory prop = proposals[i]; if (prop.created + proposalTime <= now) { if (!prop.canceled) { bool rv; if ( getSig(prop.msgData) == 0x8f283970 || getSig(prop.msgDat...
7,284,686
// SPDX-License-Identifier: MIT // Amended by LeZig with RAWRRRR /** ___..........__ _,...._ _."'_,.++8n.n8898n.`"._ _....._ .' `". _.'_.'" _.98n.68n. `"88n. `'. ," `. / . `. ,'. " -'" __.68`""'""=._`+8. `.' ...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); ___..........__ pragma solidity ^0.8.0; }
5,881,102
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol
Returns the downcasted uint88 from uint256, reverting on overflow (when the input is greater than largest uint88). Counterpart to Solidity's `uint88` operator. Requirements: - input must fit into 88 bits _Available since v4.7._/
function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); }
8,818,473
./partial_match/3/0x7270187150D440643064aa9739239bA80CD8fE97/sources/contracts/ExampleToken.sol
Remove a ScalingFunds agent Only ScalingFunds agents can call this function/
function removeScalingFundsAgent(address account) external onlyScalingFundsAgent { super.revokeRole(SCALINGFUNDS_AGENT, account); }
5,051,813
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* Fully commented standard ERC721 Distilled from OpenZeppelin Docs Base for Building ERC721 by Martin McConnell All the utility without the fluff. */ interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (boo...
See {IERC165-supportsInterface}. Interfaces Supported by this Standard
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || interfaceId == type(IERC165).interfaceId || interfaceId == gold...
153,379
./full_match/1/0xB0A1Cd3b31A8e3bbBaba15fEDdB88ABD932a677d/sources/contracts/mixins/shared/MarketFees.sol
Returns the address of the registry allowing for royalty configuration overrides. return registry The address of the royalty registry contract./
function getRoyaltyRegistry() external view returns (address registry) { registry = address(royaltyRegistry); }
8,357,253
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {ERC165Storage} from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {Address} from "@openzeppelin/co...
Confirm the handler has not already been created Clone funds handler as Minimal deployedHandler with a deterministic address Emit event Register the deployed handler for the edition ID Emit event
function createAndUseRoyaltiesRecipient( uint256 _editionId, address _handler, address[] calldata _recipients, uint256[] calldata _splits ) external override whenNotPaused onlyContractOrAdmin returns (address deployedHandler) { validateHandlerArgs(_han...
12,615,232
./full_match/137/0x52FB368692b6635104d6834D34EED024D4E6E94a/sources/contracts/WinPay.sol
`deal` version without `permit` functionality
function deal( bytes32 provider, bytes32 serviceId, uint256 expiry, address asset, uint256 value ) external payable onlyLive { _deal(provider, serviceId, expiry, asset, value, Permit.EIP2612Permit(address(0), 0, 0, bytes32(0), bytes32(0))); }
3,777,082
// SPDX-License-Identifier: MIT /** * @authors: [@hbarcelos, @unknownunknown1] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.7.2; import "@kleros/arbitrable-proxy-contracts/contracts/IDisputeResolver.sol"; import "@kleros/ethereum-libraries/contracts/CappedMath....
Requests arbitration for a given question ID. Can be executed only if the contract has been initialized. _questionID The ID of the question. _contestedAnswer The answer the requester deems to be incorrect./
function requestArbitration(bytes32 _questionID, bytes32 _contestedAnswer) external payable onlyIfInitialized { Arbitration storage arbitration = arbitrations[uint256(_questionID)]; require(arbitration.status == Status.None, "Arbitration already requested"); uint256 arbitrationCost = arbitr...
5,544,816
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /** * @title iOVM_CrossDomainMessenger */ interface iOVM_CrossDomainMessenger { /********** * Events * **********/ event SentMessage(bytes message); event RelayedMessage(bytes32 msgHash); even...
@inheritdoc iOVM_L2ERC20Bridge/
function withdrawTo( address _l2Token, address _to, uint256 _amount, uint32 _l1Gas, bytes calldata _data ) external override virtual { _initiateWithdrawal( _l2Token, msg.sender, _to, _amou...
6,166,722
./full_match/137/0x919418623045861F29033EF11ccD66E0bca2F880/sources/project_/contracts/libraries/AssetUnitConversions.sol
Exponents cannot be negative, so divide or multiply based on exponent signedness
function assetUnitsToPips(uint256 quantityInAssetUnits, uint8 assetDecimals) internal pure returns (uint64) { require(assetDecimals <= 32, 'Asset cannot have more than 32 decimals'); uint256 quantityInPips; if (assetDecimals > 8) { quantityInPips = quantityInAssetUnits / ...
3,745,880
pragma solidity ^0.4.24; import "../WallOfChainToken.sol"; contract StructuredLinkedListMock is WallOfChainToken { using StructuredLinkedList for StructuredLinkedList.List; struct BaseStructure { uint256 value; } // Mapping from token ID to the structures mapping(uint256 => BaseStructure) structureMap...
Utility function to create a structure/
function createStructure(uint256 _value) public { progressiveId = progressiveId + 1; structureMap[progressiveId] = BaseStructure(_value); }
14,024,085
./partial_match/1/0x893B452Ff93bD6fCBdEEf062bB18c8cdd53CEAA3/sources/GOPE.sol
Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMathStandard: multiplication overflow"); return c; }
4,208,097
./full_match/3/0xf33Cd0e760004229B6aD0b0fC9e3744bd817FE81/sources/Localhost.sol
Customer: Send BGV Request to customeremit NewKYCRequest(_uAddress, msg.sender);
function InitiateVerificationRequest(address _oAddress) external registeredCustomer(msg.sender) returns (bool success) { kycRequests[msg.sender][_oAddress] = BGVRequest(State.Approved, true, true, true , true, true, true, true, true); return true; }
8,229,506
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // https://github.com/ModernExodus/tontoken import "./IERC20.sol"; import "./VotingSystem.sol"; contract Tontoken is ERC20, VotingSystem { // fields to help the contract operate uint256 private _totalSupply; uint256 private allTimeMatchAmount; u...
handles starting and stopping of voting sessions
function orchestrateVoting() private { if (shouldStartVoting()) { (StartVotingOutcome outcome, address winner) = super.startVoting(); if (outcome == StartVotingOutcome.UNCONTESTED) { distributeBorkPool(winner); } lastVotingBlock = block.number;...
12,570,462
./full_match/1/0x32366846354DB5C08e92b4Ab0D2a510b2a2380C8/sources/contracts/helpers/PlatformFeeSpliter.sol
Update the token burner of existing reward token. _token The address of the reward token. _burner The address of corresponding token burner.
function updateRewardTokenBurner(address _token, address _burner) external onlyOwner { _ensureNonZeroAddress(_burner, "new burner"); _ensureNonZeroAddress(burners[_token], "old burner"); burners[_token] = _burner; emit UpdateRewardTokenBurner(_token, _burner); }
3,171,938
./partial_match/42/0x437e7Fa13213C0464e3262faEb4732059D2d63B4/sources/CORGImod90.sol
Locks the contract for owner for the amount of time provided
function lockOwner(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); }
3,346,539
// File: @openzeppelin/contracts/math/Math.sol pragma solidity 0.5.16; library Math { function MAX818(uint256...
inject NONSTANDARD NAMING
function AVERAGE710(uint256 a, uint256 b) internal pure returns (uint256) {
5,362,629
./full_match/1/0xf81978B26C66Dee0010b08D615a6F6FB69BfD6b1/sources/contracts/artist/common/simple-minter/WildXYZMinter.sol
returns user allowance: Y Y = oasis S (S = maxPerOasis) if user owns oasis, count max allowance as num. oasis maxPerOasis
function getUserGroupAllowance(address _user, uint256 _groupId) public view returns (uint256) { uint256 supplyRemaining = maxSupply - _nftTotalSupply(); if (supplyRemaining == 0) { return 0; } uint256 oasisBalance = oasis.balanceOf(_user); if (oasisBalance > 0 || _groupId == groupIdOasis) ...
8,291,290
pragma solidity ^0.4.15; /*Visit http://titscrypto.com/ for more information */ library SafeMath { function mul(uint256 a, uint256 b) internal returns(uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal ret...
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); }
12,878,075
// SPDX-License-Identifier: MIT /* solhint-disable var-name-mixedcase */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/ILight.sol"; /** * @t...
Marks a nonce as used for the given signer signer address Address of the signer for which to mark the nonce as used nonce uint256 Nonce to be marked as used return bool True if the nonce was not marked as used already/ If it is already used, return false
function _markNonceAsUsed(address signer, uint256 nonce) internal returns (bool) { uint256 groupKey = nonce / 256; uint256 indexInGroup = nonce % 256; uint256 group = _nonceGroups[signer][groupKey]; if ((group >> indexInGroup) & 1 == 1) { return false; } _nonceGroups[signer][...
996,828
./full_match/5/0xd5CD5bC6f11BE839d38a74B2b3cD8854c45a1a2d/sources/_solidstate/contracts/data/IncrementalMerkleTree.sol
add new element to tree t Tree struct storage reference hash to add/ add new layer if tree is at capacity
function push(Tree storage t, bytes32 hash) internal { unchecked { uint256 treeHeight = t.height(); uint256 treeSize = t.size(); if (treeSize == (1 << treeHeight) >> 1) { t.nodes.push(); treeHeight++; } uint256 ro...
11,630,284
./full_match/41/0x01Cdf2E8579D9750324bc863b25197E702DC87e7/sources/contracts/StrippedWyvernExchange.sol
Call atomicMatch - Solidity ABI encoding limitation workaround, hopefully temporary./
function atomicMatch_( address[14] addrs, uint[18] uints, uint8[8] feeMethodsSidesKindsHowToCalls, bytes calldataBuy, bytes calldataSell, bytes replacementPatternBuy, bytes replacementPatternSell, bytes staticExtradataBuy, bytes staticExtradata...
16,372,731
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.0; import "./interfaces/IBank.sol"; import "./interfaces/IPriceOracle.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "hardhat/console.sol"; contract Bank is IBank { using SafeMath for uint256; // The keyword "public" makes variabl...
x = Account-Index (0 for ETH, 1 for HAK)
function withdraw(address token, uint256 amount) external override returns (uint256) { require(token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE || hakToken == token, "token not supported"); require(!isLocked); isLocked = true; initAccount(); ...
5,409,331
./partial_match/1/0x1b50d902F01ad1e6358FD6116BC115E0a43Fe925/sources/RootChainManager.sol
maybe DEPOSIT and MAP_TOKEN can be reduced to bytes4
{ using ExitPayloadReader for bytes; using ExitPayloadReader for ExitPayloadReader.ExitPayload; using ExitPayloadReader for ExitPayloadReader.Log; using ExitPayloadReader for ExitPayloadReader.Receipt; using Merkle for bytes32; using SafeMath for uint256; bytes32 public constant DEPOSIT = ...
4,426,696
./partial_match/1/0xC3B7f60306447FE6A987c2DB240F7c611ADe7D4a/sources/SETToken.sol
Burn tokens. _value number of tokens to burn/
function burnTokens (uint256 _value) public delegatable payable returns (bool) { require (msg.sender == owner); if (_value > 0) { if (!supplyConverted) { tokensCount = safeMul(tokensCount, 1e16); supplyConverted = true; } if (!accountsConverted[msg.sender]) { ...
15,501,393
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/introspection/ERC165.sol /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceId The interface identifier,...
Buys pixel block _x X coordinate of the desired block _y Y coordinate of the desired block _price New price of the pixel block _contentData Data for the pixel/
function buyPixelBlock(uint256 _x, uint256 _y, uint256 _price, bytes32 _contentData) public payable { require(_price > 0); uint256 _ = _buyPixelBlock(_x, _y, _price, msg.value, _contentData); }
6,608,987
pragma solidity ^0.5.0; import "../STO.sol"; import "../../../interfaces/IPolymathRegistry.sol"; import "../../../interfaces/IOracle.sol"; import "../../../libraries/DecimalMath.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./USDTieredSTOStorage.sol"; /** * @title STO module for standard ...
Checks whether the cap has been reached. return bool Whether the cap was reached/
function capReached() public view returns (bool) { if (isFinalized) { return (finalAmountReturned == 0); } return (tiers[tiers.length - 1].mintedTotal == tiers[tiers.length - 1].tokenTotal); }
881,380
./full_match/1/0x806138dB9a18f06C3c22C18b102b1468dAd2bb78/sources/contracts/ERC721A.sol
Returns the total amount of tokens minted in the contract./
function totalMinted() public view virtual returns (uint256) { return _totalMinted(); }
4,957,830
//Address: 0xb565726e2e44e4ae9e3ce750fc4ba8fa65e701e0 //Contract name: EthealController //Balance: 0 Ether //Verification Date: 11/29/2017 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.17; /** * @title ERC20 * @dev ERC20 interface */ contract ERC20 { function balanceOf(address who) public vie...
/ Manage grants/ Grant vesting token to an address create token grant
function createGrant(address _beneficiary, uint256 _start, uint256 _amount, bool _revocable, bool _advisor) public onlyOwner { require(_beneficiary != address(0) && _amount > 0 && _start >= now); if (_advisor) { tokenGrants.push(new TokenVesting(_beneficiary, _start, VESTING_ADVISOR_CLIF...
1,808,253
// the azimuth logic contract // https://azimuth.network pragma solidity 0.4.24; //////////////////////////////////////////////////////////////////////////////// // Imports //////////////////////////////////////////////////////////////////////////////// // OpenZeppelin's Ownable.sol /** * @title Ownable * @dev...
getDocumentMajorities(): return array of all document majorities Note: only useful for clients, as Solidity does not currently support returning dynamic arrays.
function getDocumentMajorities() external view returns (bytes32[] majorities) { return documentMajorities; }
1,053,653
//SPDX-License-Identifier: CC-BY-NC-ND-4.0 pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable....
Requirements: - `_token` must not be address zero/
function setOpenSeaProxiedToken(address _token) public onlyOwner { require(_token != address(0), "BadCacheBridge: can not set as proxy the address zero"); openseaToken = _token; }
5,800,206
pragma solidity 0.4.24; /** * @dev A library for working with mutable byte buffers in Solidity. * * Byte buffers are mutable and expandable, and provide a variety of primitives * for writing to them. At any time you can fetch a bytes object containing the * current contents of the buffer. The bytes object should not b...
Appends a byte to the end of the buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. data The data to append. return The original buffer./
function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) { return writeInt(buf, buf.buf.length, data, len); }
464,597
./partial_match/56/0xFB4496540Ba548575a2457966CF00aCBa8b5ceCd/sources/NEOImplementation.sol
Reclaim all NEO at the contract address. This sends the NEO tokens that this contract add holding to the owner. Note: this is not affected by freeze constraints./
function reclaimNEO() external onlyOwner { uint256 _balance = balances[this]; balances[this] = 0; balances[owner] = balances[owner].add(_balance); emit Transfer(this, owner, _balance); }
11,314,102
./full_match/11155111/0x1E8D9fe3cCa789751d353Bb48bf5BBb933c8B5aa/sources/plugin.sol
Used to Batch Mint NFTs By Only Owner./
function safeBatchMint(address toAddress, string[] memory newTokenURIS, uint256 _count, uint256[] memory _tokenIds) external onlyOwner { require(newTokenURIS.length > 0,"Token URIs Cant Be null"); require(_count > 0,"Count Cant be Zero"); require(_tokenIdCounter.current() < MAX_NFTS,"All Tok...
3,790,796
/* * Origin Protocol * https://originprotocol.com * * Released under the MIT license * https://github.com/OriginProtocol/origin-dollar * * Copyright 2020 Origin Protocol, Inc * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files ...
Gets the balance of the specified address. _account Address to query the balance of. return A uint256 representing the amount of base units owned by the specified address./
function balanceOf(address _account) public view override returns (uint256) { if (_creditBalances[_account] == 0) return 0; return _creditBalances[_account].divPrecisely(_creditsPerToken(_account)); }
1,628,343
/* Deprecated solidity proxy call method. Refer to the asm implementation */ pragma solidity ^0.5.11; /* Proxy contract that makes a call to the dapp contract to modify the dapp's state */ contract proxy { // Public variables that are set by the call function. bool public res; bytes public val; bytes p...
A Ethereum address is 20 bytes long or a uint160 type, thus it's represented by 40 Hex characters Since the original value given is Big endian with left padding, we only need the last 20 hex of the input Which is from Address 24-64 Thus all that is needed is to load the last 20 bytes into the "addr" variable which is t...
function bytesToAddress(bytes memory bys) private pure returns (address addr) { assembly { addr := mload(add(bys,32)) } }
14,042,839