file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2019-01-31
*/
pragma solidity >0.4.99 <0.6.0;
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);
... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function decreaseApproval(
address _spender,
uint256 _subtractedValue
) public returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = oldValue.s... | 12,572,782 |
./full_match/1/0x79edee4fd2D844775AedA9f2e6753A4d2761775A/sources/contracts/oracle/UniswapV2Oracle.sol | overflow is desired Ensure that at least one full period has passed since the last update Overflow is desired, casting never truncates Cumulative price is in (uq112x112 price seconds) units so we simply wrap it after division by time elapsed | function update() external {
(
uint256 price0Cumulative,
uint256 price1Cumulative,
uint32 blockTimestamp
) = UniswapV2OracleLibrary.currentCumulativePrices(address(pair));
uint256 timeElapsed = blockTimestamp > blockTimestampLast
? blockTimest... | 4,879,141 |
./full_match/1/0x4B8092CdF0FF8473f7CAB01b267208Eb565943AD/sources/contracts/swaps/SwapRewards.sol | Called by the owner to set the _helixToken | function setHelixToken(address _helixToken)
external
onlyOwner
onlyValidAddress(_helixToken)
{
helixToken = IHelixToken(_helixToken);
emit SetHelixToken(msg.sender, _helixToken);
}
| 4,846,142 |
./full_match/1/0x247dB0eb865aC065dE0993eadE7254aA1bcD4c91/sources/contracts/TaskChainPresaleV2.sol | If it's not the first stage, move the remaining tokens to the next stage | function switchStage() external onlyOwner {
require(
uint256(stage) >= 0 && uint256(stage) <= 10,
"Invalid stage transition."
);
require(isDataTransfferedFromV1, "Transfer data from V1");
if (uint256(stage) >= 0 && uint256(stage) <= 9) {
uint256 ... | 8,470,428 |
pragma solidity ^0.4.24;
contract RSEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | ============================================================================== _|_ _ _ | _ . | (_)(_)|_\ .============================================================================== receives name/player info from names contract/ | function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff)
external
{
require (msg.sender == address(ChivesBook), "only ChivesBook can call this function");
if (pIDxAddr_[_addr] != _pID)
pIDxAddr_[_addr] = _pID;
if (pIDxName_[_name] != _pID)... | 338,441 |
// SPDX-License-Identifier: UNLICENSED
// Copyright 2021 Arran Schlosberg (@divergencearran / @divergence_art)
pragma solidity >=0.8.0 <0.9.0;
import "./MetaPurse.sol";
import "./SignatureRegistry.sol";
import "@divergencetech/ethier/contracts/erc721/ERC721Common.sol";
import "@divergencetech/ethier/contracts/sales/F... | Remove an address from the set of allowed signature sources. | function removeSigner(address signer) external onlyOwner {
_signers.remove(signer);
}
| 944,552 |
./full_match/80001/0xB307a0261B8f0f52756c840Ec91C18A62594B694/sources/contracts/token.sol | time to cover is in days. As such, first calculate end-time. 86400 = 1 day, lets put 1 day at 1% of balance | function buyProtection(uint time) external onlyActive {
uint endTime = block.timestamp + 86400*time;
require(ingameBalances[msg.sender] > time/100);
protectionTime[msg.sender] = endTime;
ingameBalances[msg.sender] -= ingameBalances[msg.sender]*time/100;
}
| 9,489,857 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/vault/TBTCVault.sol | Mints the given `amount` of TBTC to the caller previously transferring `amount / SATOSHI_MULTIPLIER` of the Bank balance from caller to TBTC Vault. If `amount` is not divisible by SATOSHI_MULTIPLIER, the remainder is left on the caller's Bank balance. TBTC Vault must have an allowance f... | function mint(uint256 amount) external {
(uint256 convertibleAmount, , uint256 satoshis) = amountToSatoshis(
amount
);
require(
bank.balanceOf(msg.sender) >= satoshis,
"Amount exceeds balance in the bank"
);
_mint(msg.sender, convertibleAm... | 4,856,416 |
pragma solidity >=0.4.22;
contract Puzzle {
string internal constant INSUFFICIENT_FUND_MESSAGE = "Insufficient Fund";
string internal constant RESTRICTED_MESSAGE = "Unauthorized Access";
string internal constant NOT_IN_GAME = "Player is not in an active game";
string internal constant INCORRECT_LEVEL ... | Resets the current session of net player/ | function resetPlayer(address player) public restricted {
delete playerLevel[player];
delete playerInGame[player];
delete playerStake[player];
delete playerSet[player];
}
| 12,783,373 |
./partial_match/3/0xBBC7f7A6AADAc103769C66CBC69AB720f7F9Eae3/sources/BBTToken.sol | / if the sending account is in the unrestricted transfer whitelist the shop whitelist or is the owner account they can transfer any amount | This function determines if the sending address has no transfer limits
function isUnrestrictedTransfer(address from)
public
view
returns (bool)
{
if (addressWhitelists[from] == UNRESTRICTED_TRANSFER_WHITELIST ||
addressWhitelists[from] == SUMMED_SENDER_WHITELIST ||
... | 16,616,030 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Get Downtime structure by delegatecall/ | {
bytes32 memoryAddress = delegateGetData(
_target, this.getPastDowntime.selector, 2, _staker, bytes32(_index));
function delegateGetPastDowntime(address _target, bytes32 _staker, uint256 _index)
internal returns (Downtime memory result)
assembly {
result := memor... | 1,393,172 |
//
// "Here's to the crazy ones..." the degens, the chads, the farmers.
//
// Welcome to SwapShip RTC. You know this game. Read This Contract (RTC)!
// If you don't know what RTC is, join the Telegram:
// > https://t.me/ReadThisContract
//
// Stake your Uniswap UNI-V2 LP tokens OR SushiSwap SLP tokens!! Farm SWSH.
// A... | Perform LP token migration from legacy UniswapV2 to SwapShip. Take the current LP token address and return the new LP token address. Migrator should have full access to the caller's LP token. Return the new LP token address. XXX Migrator must have allowance access to UniswapV2 LP tokens. SwapShip must mint EXACTLY the ... | interface IMigratorCaptain {
function migrate(IERC20 token) external returns (IERC20);
}
| 1,481,189 |
./full_match/1/0x5Ec09Dc83080A17De87aE0bd22097F360e078cf7/sources/src/strategies/BasePulseStrategy.sol | checks mutable params according to strategy restrictions params mutable parameters to be checked | function checkMutableParams(MutableParams memory params) public pure {
require(params.maxDeviationForVaultPool > 0, ExceptionsLibrary.LIMIT_UNDERFLOW);
require(params.timespanForAverageTick > 0, ExceptionsLibrary.VALUE_ZERO);
require(params.timespanForAverageTick < 7 * 24 * 60 * 60, Exceptio... | 4,887,510 |
./partial_match/1/0xC62b8c58984a7f9E15933bC9E20159D240Ab0D8D/sources/contracts/protocol/libraries/configuration/UserConfiguration.sol | Checks if a user has not been using any reserve for borrowing or supply self The configuration object return True if the user has not been borrowing or supplying any reserve, false otherwise/ | function isEmpty(
DataTypes.UserConfigurationMap memory self
) internal pure returns (bool) {
return self.data == 0;
}
| 2,784,067 |
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
pragma solidity >0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns ... | Returns the timestamp when the question can first be answered question_id The ID of the question | function getOpeningTS(bytes32 question_id)
public view returns(uint32) {
return questions[question_id].opening_ts;
}
| 1,537,609 |
// pragma solidity ^0.5.0;
//pragma solidity >=0.4.21 <0.7.0; // version 6 is required for truffle build
import "./Users.sol";
contract MedicalRecords {
Users userContract;
//constructor for usercontract
constructor(Users usersAddress) public {
userContract = usersAddress;
}
// medical re... | function for verifying doctor to whistleblow | function doctorReport(uint256 medicalRecordId)
public
isDoctorAddress()
blacklistedAddress()
notSameDoctor(medicalRecordId)
{
require(
doctorVerifications[userContract.getDoctorId(msg.sender)][
medicalRecords[medicalRecordId].doctorInCharge
... | 1,831,660 |
pragma solidity ^0.4.24;
import "../common/Owned.sol";
import "../common/Versioned.sol";
import "./IVendorManager.sol";
/**@dev
The main manager for platform. Stores vendor's addresses.
Contains refrence to factory contract that creates Vendors and Products */
contract VendorManager is IVendorManager, Owned, Versio... | Changes valid vendor state / | function setValidVendor(address vendor, bool state) public ownerOnly {
validVendor[vendor] = state;
}
| 1,083,704 |
pragma solidity ^0.4.15;
import "./Offchain.sol";
import "./Onchain.sol";
import "./Alu.sol";
/**
* @title VM Interpreter
* @author Sami Mäkelä
*/
contract CommonOnchain is Onchain, ALU {
/**
* @dev get a pointer for the place we want to perform a read from, based on the opcode
*
* @param hint the opc... | get a pointer to where we want to write to based on the opcode hint the opcode return returns a pointer to where to write to/ | function writePosition(uint hint) internal view returns (uint) {
assert(hint > 0);
if (hint == 2) return getStackPtr()-getReg1();
else if (hint == 3) return getStackPtr();
else if (hint == 4) return getStackPtr()-1;
else if (hint == 5) return getReg1()+getReg2();
else... | 2,563,856 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@unification-com/xfund-router/contracts/lib/ConsumerBase.sol";
import "./interfa... | 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 safeMod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
| 1,496,178 |
// 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/GSN/Context.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/utils/Create2.sol";
//imp... | return {address} location where a contract will be stored if deployed via {deploy} and this contract was the deployer Any change to `bytecodeHash` or `salt` will result in a new, unique destination address | function _computeAddress(
bytes32 bytecodeHash,
bytes32 salt
)internal view returns(
address
){
return Create2.computeAddress(
salt,
bytecodeHash,
address(this)
);
}
| 12,552,816 |
./full_match/80001/0x47b84277E3EF7A769A03d5c6057B17D637Dd0FcE/sources/contracts/Contract.sol | Function to allocate a quantity of product to a brand Check that the caller is the owner Check that the quantity is positive Check that the quantity is not greater than the available quantity Update the total quantity and the allocation for the brand Emit an allocation event | function allocate(address brand, uint quantity) public {
require(msg.sender == owner, "Only the owner can allocate product.");
require(quantity > 0, "Quantity must be positive.");
require(quantity <= totalQuantity, "Not enough product available.");
totalQuantity = totalQuantity.su... | 5,697,808 |
./full_match/43113/0x1371314364F0E998f2E9667dF1a0702DEAA73E66/sources/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol | Reverts if unsupported index is passed return _activeFtso FTSO contract for provided index/ | function getFtso(uint256 _assetIndex) external view override
returns(IIFtso _activeFtso)
{
return _getFtso(_assetIndex);
}
| 7,109,246 |
./full_match/4/0x4369A13396d59756E5370C6970784a065EA18F8D/sources/github/teller-protocol/teller-protocol-v1/contracts/domains/nft/NiftyNFT.sol | It mints a new token for a Tier index. tierIndex Tier to mint token on. owner The owner of the new token. Requirements: - Caller must be an authorized minter/ Get the new token ID Mint and set the token to the tier index Set owner | function mint(uint256 tierIndex, address owner)
external
override
onlyMinter
{
uint256 tokenId = _tokenCounter.current();
_tokenCounter.increment();
_safeMint(owner, tokenId);
_tokenTier[tokenId] = tierIndex;
_setOwner(owner, tokenId);
}
| 693,061 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libraries/UniversalERC20.sol";
import "./interfaces/IGroupSwap.sol";
import "./interfaces/IPredaDex.sol";
import "hardhat/console.sol";
contract GroupSwap is IGroupSwap {
using UniversalERC20 for IERC20;
address internal _owner;
address in... | TODO: To call this off-chain, you would query The Graph to get the token pair for a given group Then call this function with the group's data TODO: Params TODO: lowlevel call | function estimateGasRequirements(
IERC20 fromToken,
IERC20 destToken,
uint256 amount
) external override view returns (uint256 gasRequired) {
( , , uint256 estimateGasAmount) = predaDex.quoteAndDistribute(
fromToken,
destToken,
amount,
... | 5,429,219 |
./full_match/137/0x0594FEe490F57f4eD3BDDDA0C3372480Aea6aD96/sources/contracts/CharacterMinter.sol | converts a struct to a 256 bit hash to check for uniqueness s the struct to pack into a hash return the 256 bit hash of the struct/ | function structToHash(Character memory s) internal pure returns (uint256) {
return uint256(bytes32(
abi.encodePacked(
s.base,
s.eyes,
s.hair,
s.cloth,
s.boots,
s.hat,
s.beard,
s.shield,
s.weapon
)
));
}
| 3,760,613 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
interface ICoolCats... | Let Admin mint out 100 pets for giveaways and collabs | function reservedMint() external onlyOwner {
uint256 currentPetId = _currentPetId;
uint256 reserved = _reserved;
require(_publicMintStatus == EPublicMintStatus.RESERVED_MINT, "CP: Reserved mint closed");
require(reserved > 0, "CP: No more reserve mints left");
for (uint256 i; i < 20; i++) {
... | 1,290,282 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/TokenTimelock.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
im... | Transfers tokens held by timelock to founder address./ | function releaseFounderFund() external returns (bool) {
founderTimelock.release();
return true;
}
| 1,070,426 |
./partial_match/80001/0x219d2d484Fb4296f4615A18aF0e668554552339A/sources/PlotXToken.sol | Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred/ | function transferFrom(
address from,
address to,
uint256 value
) public override returns (bool) {
super.transferFrom(from, to, value);
return true;
}
| 8,811,598 |
./partial_match/11297108109/0x4B75bA193755A52F5b6398466CB3e9458610CBaf/sources/contracts/libs/LibBytes.sol | Reads a bytes32 value from a position in a byte array. b Byte array containing a bytes32 value. index Index in byte array of bytes32 value. return result bytes32 value from byte array. Read the bytes32 from array memory | function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
if (b.length < index + 32) {
revert('LIB BYTES: length greater than or equals thirty two required');
}
assembly {
result :=... | 16,952,552 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/interfaces/AggregatorV3Interface.sol";
contract CrowdFundContract is Ownable {
// user structure, it encapsu... | public view to check if end time to request funds already passed | function crowdFundEnded() public view returns(bool) {
return endTimeCrowdFund;
}
| 14,106,794 |
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises a... | See `GSNRecipient._approveRelayedCall`. This overload forwards `context` to _preRelayedCall and _postRelayedCall./ | function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) {
return (RELAYED_CALL_ACCEPTED, context);
}
| 1,014,297 |
./partial_match/44787/0x76Eb2820207313AFf098478A64996ca38C6052ff/sources/contracts/CarbonPathAdmin.sol | Creates a new NFT for `to`. Additionally sets URI/metadata and geoJSON for the NFT. This also handles airdropping of tokens to set recipients CPCO2 Tokens will be received by the following addresses cpFeeAddress will receive advanceAmount cpFeePercentage operatorAddress will receive advanceAmount (1 - cpFeePercentage... | function mint(
address to,
uint256 advanceAmount,
uint256 cpFeePercentage,
uint256 bufferAmount,
address operatorAddress,
string memory tokenUri,
string memory metadata,
string memory geoJson
) external onlyMinter nonZeroAddress(to) nonZeroAddress(operatorAddress) {
require(cpFee... | 16,956,768 |
pragma solidity ^0.5.7;
import "../storage/IANSStorage.sol";
import "../lib/Ownable.sol";
import "../lib/Utils.sol";
/// @title Address Name Service contract
contract ANS is Ownable {
using Utils for bytes;
using Utils for string;
uint8 constant internal NAME_MIN_LIMIT = 1;
uint8 constant internal NA... | Changes the storage owner. Changing it will remove the permissions from this contract. The new owner should be another ANS contract. ONLY FOR PURPOSES OF UPGRADING THE ANS CONTRACT! newOwner New owner of the storage contract. return True if changing ownership succeeds. | function transferStorageOwnership(
address newOwner)
external
onlyOwner
validStorageAddress
returns (bool success)
{
IANSStorage(_storageAddress).transferOwnership(newOwner);
return true;
}
| 12,794,621 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./StableSwap.sol";
import "../interface/IMetaPool.sol";
abstract contract MetaPool is StableSwap, IMetaPool {
uint256 private immutable MAX_COIN;
uint256 private immutable BASE_N_COINS;
// Token corresponding to the pool is always the last... | Calculate addition or reduction in token supply from a deposit or withdrawal This calculation accounts for slippage, but not fees. Needed to prevent front-running, not for precise calculations! amounts Amount of each coin being deposited isDeposit set True for deposits, False for withdrawals return Expected amo... | function calcTokenAmount(uint256[] memory amounts, bool isDeposit) external view override returns (uint256) {
uint256 amp = _A();
uint256 vpRate = _vpRateRo();
uint256[] memory _balances = _storedBalances;
uint256 D0 = getDMem(vpRate, _balances, amp);
for (uint256 i = 0; i < ... | 14,038,622 |
./full_match/1/0x25e3C9dBAC271a2500071f9eea9993155836E9a0/sources/contracts/TroveHandler.sol | Borrow LUSD _collateral Amount of ETH denominated in Wei _maxFee Maximum borrowing fee return lusdBorrowed Amount of LUSD borrowed. tbMinted = amount of TB to mint = (debtIncrease [LUSD] / debtBefore [LUSD]) tbTotalSupply debtIncrease = debtAfter - debtBefore In case no redistribution took place (TB/LUSD = 1) then d... | function _borrow(uint256 _collateral, uint64 _maxFee) internal returns (uint256 lusdBorrowed) {
ITroveManager troveManagerMem = troveManager;
(uint256 debtBefore, , , ) = troveManagerMem.getEntireDebtAndColl(address(this));
(address upperHint, address lowerHint) = _getHints();
_... | 16,486,128 |
./full_match/40/0x28462F0898120Db3138e5dbbE83f2f6206624722/sources/contracts/ElkV2FarmManager_flattened.sol | Emitted on staking Emitted on withdrawal (including exit) Emitted on token recovery | interface IStaking {
function stakingToken() external returns (IERC20);
function totalSupply() external returns (uint256);
function balances(address _account) external returns (uint256);
function stake(uint256 _amount) external;
function withdraw(uint256 _amount) external;
function exit() e... | 9,547,641 |
//Address: 0xcc992b0bb9789e4e323bef8b7241ffe85487c2a6
//Contract name: DCAssetBackend
//Balance: 0 Ether
//Verification Date: 9/15/2016
//Transacion Count: 65
// CODE STARTS HERE
contract Assertive {
function assert(bool assertion) {
if (!assertion) throw;
}
}
contract TokenRecipient {
function receiveApp... | Sets allow transactions to `allow` allow Allow or disallow transactions/ | function voteAllowTransactions(bool allow) multisig(sha3(msg.data)) {
assert(allow != allowTransactions);
allowTransactions = allow;
}
| 1,030,495 |
//Address: 0xA3d3F829adfeBceaEb7f439ADF9157043929a6Ed
//Contract name: InRiddimCrowdsale
//Balance: 0 Ether
//Verification Date: 11/28/2017
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.15;
// ERC20 token interface
contract InRiddimCrowdsale {
// InRiddim Crowdsale
function InRiddimCrowd... | Available at any phase. | function withdrawEther() public
onlyTokenManager
{
require(escrow != 0x0);
if (this.balance > 0) {
escrow.transfer(this.balance);
}
}
| 15,831,772 |
./full_match/5/0xF8ce606dCCD356a39842Bbb55F0A52b5dED5B0C6/sources/UniswapV2Library.sol | calculates the CREATE2 address for a pair without making any external calls | function pairFor(address factory, address tokenA, address tokenB) public pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encode... | 1,898,672 |
// SPDX-License-Identifier: AGPL
// File: contracts/interfaces/IITR.sol
pragma solidity ^0.8.0;
interface IITR {
function claim(address to) external;
}
// File: contracts/interfaces/ISRC20.sol
pragma solidity ^0.8.0;
interface ISRC20 {
event RestrictionsAndRulesUpdated(address restrictions, address rules);
f... | Returns the 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);
}
}
| 6,152,374 |
pragma solidity ^0.4.24;
import "../common/Active.sol";
import "../common/SafeMathLib.sol";
import "../common/Manageable.sol";
import "../token/IERC20Token.sol";
import "../common/EtherHolder.sol";
import "./IProductStorage.sol";
import "./IEscrow.sol";
import "./IFeePolicy.sol";
import "./IPurchaseHandler.sol";
impor... | withdraws multiple pending payments / | function withdrawPendingPayments(uint256[] productIds, uint256[] purchaseIds)
public
activeOnly
{
require(productIds.length == purchaseIds.length);
address customer;
uint256 fee;
uint256 profit;
uint256 timestamp;
uint256 totalProfit = 0;
... | 12,636,929 |
./partial_match/1/0xd66e17Aa4D70694464B00568Dc23Ad54E2ef5bBf/sources/DSGuard.sol | deploys a new proxy instance sets custom owner of proxy | function build(address owner) public returns (address payable proxy) {
proxy = address(new DSProxy(address(cache)));
emit Created(msg.sender, owner, address(proxy), address(cache));
DSProxy(proxy).setOwner(owner);
proxies[owner] = proxy;
}
| 3,712,998 |
pragma solidity ^0.5.7;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath
{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
... | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
| 12,571,360 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
pragma abicoder v2;
import "../AbstractMangrove.sol";
import "../MgvLib.sol";
import "hardhat/console.sol";
import "./Toolbox/TestUtils.sol";
import "./Agents/TestToken.sol";
import "./Agents/TestMaker.sol";
import "./Agents/TestMoriartyMaker.sol";
impor... | since we check calldata, execute must be internal test flashloan | function makerExecute(ML.SingleOrder calldata order)
external
override
returns (bytes32 ret)
{
uint num_args = 9;
uint selector_bytes = 4;
uint length = selector_bytes + num_args * 32;
TestEvents.eq(
msg.data.length,
length,
"calldata length in execute is incorrect"
... | 6,442,680 |
./full_match/84531/0xd7149865d07cCfdfB10f858AFAb297A8251882Cc/sources/contracts/stores/PoolStore.sol | Set pool withdrawal fee Only callable by governance asset Pool asset, e.g. address(0) for ETH bps Withdrawal fee in bps | function setWithdrawalFee(address asset, uint256 bps) external onlyGov {
require(bps <= MAX_POOL_WITHDRAWAL_FEE, '!pool-withdrawal-fee');
withdrawalFees[asset] = bps;
}
| 11,525,477 |
./full_match/5/0x5911a979e00C4847B2BE34F733e59cF6885fC48A/sources/contracts/claim/factory/AdvancedDistributor.sol | Set the total to distribute | function setTotal(uint256 _total) external virtual onlyOwner {
_setTotal(_total);
}
| 1,891,630 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
import {DataTypes} from '../libraries/DataTypes.sol';
/**
* @title IFollowNFT
* @author Lens Protocol
*
* @notice This is the interface for the FollowNFT contract, which is cloned upon the first follow for any profile.
*/
interface IFollowNFT {
... | IFollowNFT Lens Protocol This is the interface for the FollowNFT contract, which is cloned upon the first follow for any profile./ | interface IFollowNFT {
function initialize(
uint256 profileId,
string calldata name,
string calldata symbol
) external;
function mint(address to) external;
function delegate(address delegatee) external;
function delegateBySig(
address delegator,
address del... | 1,808,333 |
./full_match/1/0x2C5e00ec69b27740CB8155736390ee7e74d279DB/sources/contracts/strategies/HStrategy.sol | draining all assets from uniV3 restrictions the restrictions of the amount of tokens to be transferred erc20Vault_ ERC20 vault of the strategy uniV3Vault_ UniswapV3 vault of the strategy uniV3Nft the nft of the position from position manager tokens_ the addresses of the tokens managed by the strategy return draine... | function _drainPosition(
RebalanceTokenAmounts memory restrictions,
IIntegrationVault erc20Vault_,
IUniV3Vault uniV3Vault_,
uint256 uniV3Nft,
address[] memory tokens_
) internal returns (uint256[] memory drainedTokens) {
drainedTokens = uniV3Vault_.liquidityToToke... | 16,590,870 |
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol | Returns the current `TemporarilyPausable` configuration that will be applied to Pools created by this factory. `pauseWindowDuration` will decrease over time until it reaches zero, at which point both it and `bufferPeriodDuration` will be zero forever, meaning deployed Pools will not be pausable./ The buffer period is a... | function getPauseConfiguration() public view returns (uint256 pauseWindowDuration, uint256 bufferPeriodDuration) {
uint256 currentTime = block.timestamp;
if (currentTime < _poolsPauseWindowEndTime) {
bufferPeriodDuration = _bufferPeriodDuration;
pauseWindowDuration = 0;
... | 16,352,648 |
./full_match/1/0x1278601db4230d26Ac07de0b0F3F2d68bd433311/sources/browser/Bonded.sol | claim reserve tokens from the contract balance. Can be used only by an owner or from reserveAddress. Tokens will be send to reserveAddress./6 months of vestiong period Avoid overflow when releasing 5% each month | function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
... | 17,187,265 |
pragma solidity ^0.4.23;
import "./library/SaferMath.sol";
/** @title Bounty Collector. */
contract BountyCollector {
using SaferMath for uint;
/* Enums and Structs */
enum DisputeStatus { None, Reviewable, Declined, Accepted, Withdrawn }
enum ProposalStatus { Reviewable, Declined, Accepted }
en... | Fallback function/ | function()
external
payable {
revert();
}
| 12,687,106 |
/**
*Submitted for verification at Etherscan.io on 2021-02-23
*/
pragma solidity 0.6.12;
interface marketManagerInterface {
function setBreakerTable(address _target, bool _status) external returns (bool);
function getCircuitBreaker() external view returns (bool);
function setCircuitBreaker(bool _emergency) exte... | Update the (SI) rewards for a user userAddr The address of the user callerID The handler ID return true (TODO: validate results)/ | function rewardUpdateOfInAction(address payable userAddr, uint256 callerID) external override returns (bool)
{
HandlerInfo memory handlerInfo;
(handlerInfo.support, handlerInfo.addr) = dataStorageInstance.getTokenHandlerInfo(callerID);
if (handlerInfo.support)
{
proxyContractInterface tokenHandler;
toke... | 6,491,327 |
pragma solidity ^0.4.21;
import "./Xcert.sol";
contract ChainableXcert is Xcert {
/*
* @dev This emits when additional proof is chained.
*/
event ChainedProof(uint256 indexed tokenId, uint256 proofIndex);
constructor(string _name,
string _symbol)
Xcert(_name, _symbol)
public
{
... | Gets the count of all proofs for a Xcert. _tokenId Id of the Xcert we want to get proof of./ | function tokenProofCount(uint256 _tokenId)
validNFToken(_tokenId)
external
view
returns (uint256)
{
return idToProof[_tokenId].length;
}
| 5,361,148 |
./partial_match/1/0x91d42CB9883AFCaef2ed79637291dFe30Dea431f/sources/contracts/pendle/PendleStakingBaseUpg.sol | This function adds a fee to the magpie protocol _value the initial value for that fee _to the address or contract that receives the fee _isMPENDLE true if the fee is sent as MPENDLE, otherwise it will be PENDLE _isAddress true if the receiver is an address, otherwise it's a BaseRewarder | function addPendleFee(
uint256 _value,
address _to,
bool _isMPENDLE,
bool _isAddress
) external onlyOwner {
if (_value >= DENOMINATOR) revert InvalidFee();
pendleFeeInfos.push(
Fees({
value: _value,
to: _to,
... | 4,002,265 |
./full_match/84531/0x76fFb8B75c37aC3C3849C8b3603aF8A1AA9245f5/sources/contracts/V2UniversalChainsONFT721.sol | Convert an old ONFT to a new ONFT tokenId the old ONFT tokenId | function oldOnftToNew(uint256 tokenId) external {
amountMinted++;
uint newId = nextMintId;
nextMintId++;
IERC721(onftOld).transferFrom(_msgSender(), address(this), tokenId);
_safeMint(_msgSender(), newId);
emit OldToNewConversion(_msgSender(), tokenId, newId);
}... | 14,315,212 |
./partial_match/1/0x47414A04F29930C8e1c10F0B4791a9DDF3836EfD/sources/EthLottery.sol | the callback function is called by Oraclize when the result is ready the oraclize_randomDS_proofVerify modifier prevents an invalid proof to execute this function code: the proof validity is fully verified on-chain the oracle proof verification has passed this is the highest uint we want to get. It should never be grea... | function __callback(bytes32 queryId, string result, bytes proof) public {
require(msg.sender == oraclize_cbAddress());
require(oraclize_randomDS_proofVerify__returnCode(queryId, result, proof) == 0);
uint randomNumber = uint(sha3(result)) % lotteries[lotteryId].numTickets;
... | 4,360,244 |
/**
*Submitted for verification at Etherscan.io on 2021-09-07
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
// Part: Base64
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
bytes internal constant TABLE... | Internal function for creating a new gem kind | function _create(
string memory gemName,
string memory color,
uint difficulty,
uint gemsPerMine,
uint multiplier,
address crafter,
address manager
) internal returns (uint) {
uint kind = gemCount++;
gems[kind] = Gem({
name: gemName,
color: color,
entropy: bytes3... | 2,119,551 |
./partial_match/4/0xDdEec44aea5E650428F82179951C6046a7a531c8/sources/Arbitrage.sol | Uniswap more expensive uniswap is cheaper buy from uniswap and sell at sushiswap uniswap is more expensive buy from uniswap and sell at sushiswap | function arb(address tokenAddress) public {
uint uniswapOutput = shitcoinPrice(tokenAddress, "uniswap");
uint sushiswapOutput = shitcoinPrice(tokenAddress, "sushiswap");
uint256 oneEth = 1000000000000000000;
if (uniswapOutput > sushiswapOutput) {
uint percentageDiff = 10... | 8,671,283 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: migrations/Migration_Alphard.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blo... | Obtain the next schedule entry that will vest for a given user. return A pair of uints: (timestamp, synthetix quantity). / | function getNextVestingEntry(address account) public view returns (uint[2] memory) {
uint index = getNextVestingIndex(account);
if (index == _numVestingEntries(account)) {
return [uint(0), 0];
}
return getVestingScheduleEntry(account, index);
}
| 1,300,334 |
// File: REMIX_FILE_SYNC/openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.4.21;
/**
* @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) intern... | Get the word stored at memory address 'addr' as a 'bytes32'. | function toBytes32(uint addr) internal pure returns (bytes32 bts) {
assembly {
bts := mload(addr)
}
}
| 890,365 |
./full_match/4/0x310060e9EC03EaBedfbb3807c815a9a601a49f22/sources/contracts/JBController.sol | / Can't send to the zero address. There should be tokens to mint. If the message sender is not a terminal delegate, the current funding cycle must not be paused. Subtract the total weighted amount from the tracker so the full reserved token amount can be printed later. The unreserved token count that will be minted for... | function mintTokensOf(
uint256 _projectId,
uint256 _tokenCount,
address _beneficiary,
string calldata _memo,
bool _preferClaimedTokens,
uint256 _reservedRate
)
external
override
nonReentrant
requirePermissionAllowingOverride(
projects.ownerOf(_projectId),
_project... | 12,272,670 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
// SPDX-License-Identifier: UNLICENCED
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defin... | Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ... | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeBEP20: low-level call failed");
require(abi.decode(returndata, (bool)), "SafeBEP20: BEP20 operation did not succeed");
}
| 10,983,109 |
pragma solidity ^0.4.8;
contract Lottery{
address owner;
mapping (uint8 => address[]) playersByNumber ;
function Lottery() public {
owner = msg.sender;
state = LotteryState.Accepting;
}
enum LotteryState { Accepting, Finished }
LotteryState state;
function enter(uint8 nu... | Return list of players | function getPlayers() public view returns(address[]) {
return playersByNumber;
}
| 12,673,846 |
./full_match/1/0x1A6e6FB35Fe17aF41A942c5750DAFb65C86551D4/sources/browser/GatewayERC721.sol | Get the price to pay according to the user/ | function _calculateCertificatePrice() internal view returns(uint){
uint priceToPay;
uint role = corporate.getRole(msg.sender);
if (role == ROLE_ANGEL || role == ROLE_ANGEL_PREMIUM || role == ROLE_ANGEL_PREMIUM_PRO) {
priceToPay = price.memberPrice;
priceToPay... | 4,907,566 |
pragma solidity ^0.4.24;
import "./KydyBase.sol";
import "./ERC721Standard/ERC721TokenReceiver.sol";
import "./lib/Strings.sol";
contract KydyOwnership is KydyBase {
using Strings for string;
string private constant _name = "Dyverse";
string private constant _symbol = "KYDY";
// Base Server Address ... | Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the t... | function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
_approve(tokenId, to);
emit Approval(owner, to, tokenId);
}
| 12,915,318 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Helper to validate an aggregator by checking its return values for the expected interface | function __validateAggregator(address _aggregator) private view {
(, int256 answer, , uint256 updatedAt, ) = IChainlinkAggregator(_aggregator)
.latestRoundData();
require(answer > 0, "__validateAggregator: No rate detected");
__validateRateIsNotStale(updatedAt);
}
| 1,406,557 |
./full_match/5/0x6531A1c8d380106d7f68d48fF6E5549f9970a9e0/sources/contracts/Eventer.sol | Only encrypt letters | function Encrypt(string memory _message, string memory _key)
public pure returns (string memory) {
bytes memory message = bytes(_message);
bytes memory key = bytes(_key);
uint keyIndex = 0;
for (uint i = 0; i < message.length; i++) {
uint8 letter = uint8(message[i])... | 1,908,292 |
./partial_match/1/0x059CFc571225Bc618d22a7cfD7b107D9a5E892F9/sources/TricKoreTreat.sol | Triggers on every transfer Gets balance of sender, makes sure value being sent is <= their balancerequire(amount <= _balances[sender]);require(amount <= _allowances[sender][_msgSender()]); Checks that it's not the burn address Deployer Transaction (So that transactions made my deployer don't get tricked / treated) Subt... | function _transfer(address sender, address recipient, uint256 amount) internal requestGas
{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (_isWhitelisted(sender, recipient))
{
... | 4,402,347 |
./full_match/106/0x940Bb2B0508F3Cb50889f7F08CB6Adf3DeEAEA7C/sources/contracts/dnsregistrar/DNSRegistrar.sol | Submits proofs to the DNSSEC oracle, then claims a name using those proofs. name The name to claim, in DNS wire format. input The data to be passed to the Oracle's `submitProofs` function. The last proof must be the TXT record required by the registrar. proof The proof record for the first element in input./ | function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {
proof = oracle.submitRRSets(input, proof);
claim(name, proof);
}
| 7,099,161 |
pragma solidity ^0.4.11;
import "../Oracles/Oracle.sol";
import "../Events/EventFactory.sol";
import "../Markets/MarketFactory.sol";
/// @title Futarchy oracle contract - Allows to create an oracle based on market behaviour
/// @author Stefan George - <stefan@gnosis.pm>
contract FutarchyOracle is Oracle {
using M... | Public functions/ Constructor creates events and markets for futarchy oracle _creator Oracle creator eventFactory Event factory contract collateralToken Tokens used as collateral in exchange for outcome tokens oracle Oracle contract used to resolve the event outcomeCount Number of event outcomes lowerBound Lower... | function FutarchyOracle(
address _creator,
EventFactory eventFactory,
Token collateralToken,
Oracle oracle,
uint8 outcomeCount,
int lowerBound,
int upperBound,
MarketFactory marketFactory,
MarketMaker marketMaker,
uint24 fee,
ui... | 6,364,850 |
./full_match/77/0x7F56aA5496a83331D0aa218eF5B77f60AEf6DEd2/sources/contracts/access/AbstractTimestampedAccessControl.sol | Standard call for OZ access control, followed by timestamping @inheritdoc AccessControl set the timestamp | function _grantRole(bytes32 role, address account) internal virtual override(AccessControl) {
AccessControl._grantRole(role, account);
Timestamp storage chop = watchkeeper[account][role];
require(chop.granted == 0, 'timestamp/previously-granted');
chop.granted = uint128(block.timest... | 5,047,938 |
/**
*Submitted for verification at Etherscan.io on 2020-10-12
*/
// File: contracts/libraries/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, ui... | called once by the factory at time of deployment | function initialize(address _token0, address _token1) external override {
token0 = _token0;
token1 = _token1;
}
| 1,802,994 |
// SPDX-License-Identifier: MIT
// VISHNU - Vishnu: BEP20 token contract
// Telegram: https://t.me/VishnuToken
// Website: https://vishnutoken.net
// Twitter: https://twitter.com/vishnutoken?s=09
// Instagram: https://instagram.com/vishnutoken
// Github Repository: https://github.com/CarlosVishnuDev/Vishnu-Token-Contr... | Hook that is called before any transfer of tokens./ Returns the total sum of fees to be processed in each transaction./ A delegate which should return true if the given address is the V2 Pair and false otherwise/ Redistributes the specified amount among the current holders via the reflect.finance algorithm, i.e. by ... | function _beforeTokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) internal virtual;
function _getSumOfFees(address sender, uint256 amount)
internal
view
virtual
returns (uint256);
function _isV2Pair(address... | 14,093,362 |
/**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the... | Creates a new reward. Rewards are only paid out to holders who have at least "one token" at time of creation. The reward is a multiplier, representing how many reward tokens (e.g., WBTC) should be paid out for one governance token. reward eligibility is only updated in state in two cases: 1) When a reward is being... | function createReward(uint256 multiplier, string calldata reason) external {
require(_status == RE_NOT_ENTERED);
_status = RE_ENTERED;
require(msg.sender == _owner, "Not owner");
require(_governanceStage >= STAGE_DAO_INITIATED, "DAO not initiated");
require... | 2,001,957 |
/*
website: http://wtron.finance
This project was forked from SUSHI and YUNO projects.
Unless those projects have severe vulnerabilities, this contract will be fine
SPDX-License-Identifier: MIT
*/
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender ... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accWTRXPerShar... | 15,152,936 |
./partial_match/3/0x1C1CF91E0f028aad2bf835f6F209382B2E3210bA/sources/PigeonswapV2Pair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'PigeonswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 !=... | 5,110,428 |
./partial_match/1/0xEf2f9b48d7EC80440Ab4573dF1A2aBDBE06D3f60/sources/contracts/core/libraries/SmardexLibrary.sol | compute the firstTradeAmountIn so that the price reach the price Average _param contain all params required from struct GetAmountParameters return firstAmountIn_ the first amount of in-token if the trade is going in the direction that the price will never reach the priceAverage, or if _amountIn is not big enough to r... | function computeFirstTradeQtyIn(GetAmountParameters memory _param) internal pure returns (uint256 firstAmountIn_) {
firstAmountIn_ = _param.amount;
if (_param.fictiveReserveOut * _param.priceAverageIn > _param.fictiveReserveIn * _param.priceAverageOut) {
uint256 _toSub = _param.fictiveR... | 16,169,656 |
./partial_match/1/0x67EB98B24925d57E2Cd0D7A2Fc98166708318aaF/sources/MINU.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Monkey Inu", "MINU") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IU... | 4,371,462 |
./full_match/137/0xbC7896282f81AE1618D0422672c6D54f68b28941/sources/farming.sol | Sets the samoz per second to be distributed. Can only be called by the owner. _samozPerSecond The amount of Samoz to be distributed per second. | function setSamozPerSecond(uint256 _samozPerSecond) public onlyOwner {
samozPerSecond = _samozPerSecond;
emit LogSamozPerSecond(_samozPerSecond);
}
| 4,743,253 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2019-2020, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
... | Convert data[startOffset:startOffset + dataLength] into an Arbitrum bytestack value The bytestack object is a series of nested 2 tuples terminating in an empty tuple, ex. (size, (data1, (data2, (data3, ())))) data Data object containing a superset of the data we want to serialize startOffset Offset in data where the... | function bytesToBytestack(
bytes memory data,
uint256 startOffset,
uint256 dataLength
) internal pure returns (Value.Data memory) {
uint256 wholeChunkCount = dataLength / 32;
Value.Data memory stack = Value.newEmptyTuple();
Value.Data[] memory vals = new Value.Da... | 12,691,362 |
./full_match/43114/0x12d42fDf0020ee4902484E2cf3469ECafc32C1a8/sources/contracts/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 4,535,412 |
./partial_match/137/0x725A581c9fC882f0C66c112B1CFf2AeAF502AA36/sources/ArgusRootAuthorizer.sol | Run all pre checks and record auth results. Only save success results. Temporary data for post checker to collect hint. | function _preExecCheck(
TransactionData calldata transaction
) internal override returns (AuthorizerReturnData memory authData) {
if (transaction.hint.length > 0) {
return _preExecCheckWithHint(transaction);
}
authData.result = AuthResult.FAILED;
bytes32[] me... | 3,527,766 |
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/ocr/OCR2Base.sol | sets offchain reporting protocol configuration incl. participating oracles _signers addresses with which oracles sign the reports _transmitters addresses oracles use to transmit the reports _f number of faulty oracles the system can tolerate _onchainConfig encoded on-chain contract configuration _offchainConfigVer... | function setConfig(
address[] memory _signers,
address[] memory _transmitters,
uint8 _f,
bytes memory _onchainConfig,
uint64 _offchainConfigVersion,
bytes memory _offchainConfig
) external override checkConfigValid(_signers.length, _transmitters.length, _f) onlyOwner {
SetConfigArgs memo... | 4,322,720 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it... | deposit user ePower into the pool (therefore the user is immediately eligible for rewards)1.1. refBonus for Parent (layer 2)send remaining value of ETH back to user; | function mint(uint256 _parentTokenID, bool _wannaVIP) public override payable whenNotPaused(){
require(!isContract(msg.sender), "Contract calls are not available");
require(totalSupply() <= settings[10], "No more cards allowed");
require(balanceOf(msg.sender) == 0, "NFTs Club Card already mi... | 10,593,065 |
// SPDX-License-Identifier: MIT
// 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 distributed in ... | takes raw tgbp amount, transfers it in, calculates corresponding numeraire amount and returns it | function intakeRawAndGetBalance(uint256 _amount) external override returns (int128 amount_, int128 balance_) {
bool _transferSuccess = tgbp.transferFrom(msg.sender, address(this), _amount);
require(_transferSuccess, "Curve/TGBP-transfer-from-failed");
uint256 _balance = tgbp.balanceOf(addr... | 11,891,115 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Companies Contract
* @dev The contract used to save companies data.
*/
contract Companies {
using SafeMath for uint256;
struct Company {
uint256[] suppliers;
uint256[] imported... | Upload information about emissions return An uint256 with the emission id/ | function upload(
uint256[] memory _suppliers,
uint256[] memory _importedEmissions,
uint256[] memory _emissionsReports,
bytes32 _name)
public returns(uint256) {
company.push(Company(_suppliers, _importedEmissions, _emissionsReports, _name));
totalCompanies = to... | 12,964,754 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.2;
import './ERC721UpgradeableWrapper.sol';
import '../Collection/CollectionWrapper.sol';
import '../Collection/ERC721SingleBoxWrapper.sol';
/// @title ERC721SingleCollectionUpgradeable contract
contract ERC721SingleCollectionUpgradeable is ERC721Upgradeabl... | pay the ERC20 token. mint a NFT if the sale is open. to receiver of the token. tokenId id of the token. return value erc20 token value | function mint(address to, uint256 tokenId) external returns (uint256 value) {
require(isOpen(), 'ERC721SingleCollectionUpgradeable: collection is not open');
value = valueOf(1);
IERC20 payToken = payToken();
if (value > 0) {
payToken.safeTransferFrom(msg.sender, address(this), value);
_depositPool(payTok... | 1,074,505 |
//Address: 0x8017f24a47c889b1ee80501ff84beb3c017edf0b
//Contract name: Grove
//Balance: 0 Ether
//Verification Date: 5/23/2017
//Transacion Count: 4
// CODE STARTS HERE
// Grove v0.2
/// @title GroveLib - Library for queriable indexed ordered data.
/// @author PiperMerriam - <pipermerriam@gmail.com>
library GroveL... | Retrieve the left child id of the node. nodeId The id for the node | function getNodeLeftChild(bytes32 nodeId) constant returns (bytes32) {
return GroveLib.getNodeLeftChild(index_lookup[node_to_index[nodeId]], nodeId);
}
| 5,546,040 |
./partial_match/1/0xBFD8CC2D30c2f2Db71f853D47c6E6ea4fe33D53F/sources/MTFinance.sol | This function withdraws ETH from the contract./ | function withdraw() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
| 9,150,831 |
./full_match/42/0x7d290F6fFEcC5b13146fEd440B56ceE588AB2a6b/sources/STBL.sol | Check that the calling account has the admin role | function grantMinterRole(address _to) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Caller is not the default admin");
require(!hasRole(MINTER_ROLE, _to), "Address already has minter role");
grantRole(MINTER_ROLE, _to);
}
| 9,574,245 |
/**
*Submitted for verification at Etherscan.io on 2020-07-12
*/
// File: contracts/lib/Types.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
library Types {
enum RStatus {ONE, ABOVE_ONE, BELOW_ONE}
enum EnterStatus {... | handle penalty, penalty may exceed amount settlement | function withdrawAllBaseTo(address to) public preventReentrant returns (uint256) {
uint256 withdrawAmount = getLpBaseBalance(msg.sender);
uint256 capital = getBaseCapitalBalanceOf(msg.sender);
uint256 penalty = getWithdrawBasePenalty(withdrawAmount);
require(penalty <= withdrawAmoun... | 6,388,864 |
./partial_match/1/0x6B83c4f3a6729Fb7D5e19b720092162DF439f567/sources/src/VeFxsVotingDelegation.sol | The ```delegate``` function delegates votes from signer to ```delegatee``` at the next epoch delegatee Address to delegate to | function delegate(address delegatee) external {
}
| 4,454,509 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_477(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,190 |
pragma solidity ^0.4.19;
contract ERC20Events {
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
}
import "./ERC20.sol";
contract TimelyResource {
enum Status {
FREE, APPROVED, CONFIRMED, COMPLETED, REFUNDED
... | You can only pay before the start time./ | function completeInterval(uint _startIndex, address _requester) public {
uint start = list.head + (_startIndex * list.blocksPerUnit);
require(block.number > start);
require(msg.sender == provider || msg.sender == _requester);
Interval storage ivl = list.intervals[start];
requ... | 1,072,849 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./ILayerZeroReceiver.sol";
import "./ILayerZeroEndpoint.sol";
import "./LayerZeroStorage.s... | Bridge zkl to other chain from the account burned from receiver the destination receiver address amount the amount to bridge params lz params ===Checks=== ===Interactions=== send LayerZero message solhint-disable-next-line check-send-result | function bridgeZKL(
address from,
bytes calldata receiver,
uint256 amount,
LzBridgeParams calldata params
) external nonReentrant payable {
uint16 _dstChainId = params.dstChainId;
bytes memory trustedRemote = checkDstChainId(_dstChainId);
uint8 destAddres... | 12,573,808 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Importación de los Smart Contract: ERC721.sol y Ownable.sol
import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "../node_modules/@openzeppelin/contracts/utils/math... | Actualización del precio del Token NFT | function updateFee(uint256 _fee) external onlyOwner {
fee = _fee;
}
| 6,476,388 |
./partial_match/1/0x859eEE9f759493884b081C76ec4755cF07f0c342/sources/StakedPlayProtocol.sol | Returns balance of an address who Address of who to get balance from | function balanceOf(
address who
) public view override(IERC20, ERC20) returns (uint256) {
return _gonBalances[who] / _gonsPerFragment;
}
| 2,729,563 |
./full_match/1/0x85A44587136C551c7FDF1f3e99dC68BDe1BA3A2b/sources/contracts/Metavaders.sol | Withdraw ETH to owner addresss | function withdrawAll() public payable onlyOwner returns (uint256) {
uint256 balance = address(this).balance;
require(payable(owner()).send(balance));
return balance;
}
| 2,946,204 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./MixinResolver.sol";
import "./MixinSystemSettings.sol";
import "./interfaces/ILiquidator.sol";
// Libraries
import "./SafeDecimalMath.sol";
// Internal references
import "./interfaces/IERC20.sol";
import "./interfaces/ISynthetix.sol";
import "./... | r = target issuance ratio D = debt balance V = Collateral P = liquidation penalty Calculates amount of synths = (D - V r) / (1 - (1 + P) r)/ | function calculateAmountToFixCollateral(
uint debtBalance,
uint collateral,
uint penalty
) external view returns (uint) {
uint ratio = getIssuanceRatio();
uint unit = SafeDecimalMath.unit();
uint dividend = debtBalance.sub(collateral.multiplyDecimal(ratio));
... | 12,578,126 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | This function will add users to presale listing | function addToPresaleListing(address[] calldata _addresses)
external
onlyOwner
{
for (uint256 index = 0; index < _addresses.length; index++) {
require(_addresses[index] != address(0),"Can't add a zero address");
if (_presaleList[_addresses[index]] ... | 2,417,597 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.