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.4.13; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // So...
Creates a vesting contract that vests its balance of any ERC20 token to the _beneficiary, gradually in a linear fashion until _start + _duration. By then all of the balance will have vested. _beneficiary address of the beneficiary to whom vested tokens are transferred _cliff duration in seconds of the cliff in which ...
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); beneficiary = _beneficiary; revocable = _revocable; duration = _duration; cliff...
10,143,002
pragma solidity 0.6.12; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts-ethereu...
---- Function that adds pending rewards, called by the NERD token. ----
function updatePendingRewards() public { uint256 newRewards = nerd.balanceOf(address(this)).sub(nerdBalance); if (newRewards > 0) { pendingRewards = pendingRewards.add(newRewards); } }
5,361,378
pragma solidity 0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(a...
remove an address from the whitelist _addr address/the owner can not be unwhitelisted
function removeAddressFromWhitelist(address _addr) onlyWhitelisted public { require(_addr != address(0)); require(whitelist[_addr]); require(_addr != owner); whitelist[_addr] = false; numberOfWhitelists--; emit WhitelistedAddressRemoved(_addr); }
2,496,577
pragma solidity ^0.4.9; //import "./Receiver_Interface.sol"; contract ContractReceiver { struct TKN { address sender; uint value; bytes data; bytes4 sig; } function tokenFallback(address _from, uint _value, bytes _data) public pure { TKN memory tkn; ...
function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) { if (balanceOf(msg.sender) < _value) revert(); balances[msg.sender] = safeSub(balanceOf(msg.sender), _value); balances[_to] = safeAdd(balanceOf(_to), _value); Transfer(msg.sender, _to, _value, _data); ...
1,013,588
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2020 Coinbase, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights ...
Return all elements in the uint set as an array/
function elements(EnumerableSet.UintSet storage set) internal view returns (uint256[] memory) { uint256 count = set.length(); uint256[] memory list = new uint256[](count); for (uint256 i = 0; i < count; i++) { list[i] = set.at(i); } ret...
12,638,515
pragma solidity ^0.4.13; contract IStructuredStorage { function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external; function setProxyLogicContract(address _proxyLogicContract) external; // *** Getter Methods *** function getUint(bytes32 _key) external view retur...
Function which can remove some maintainers, in general it's array because this supports adding multiple addresses in 1 trnx only twoKeyAdmin contract is eligible to mutate state of maintainers _maintainers is the array of maintainer addresses/If state variable, .balance, or .length is used several times, holding its ...
function removeMaintainers( address [] _maintainers ) public onlyTwoKeyAdmin { uint numberOfMaintainers = _maintainers.length; for(uint i=0; i<numberOfMaintainers; i++) { removeMaintainer(_maintainers[i]); } }
6,987,759
./full_match/1/0x9B74E52aE52EF26EBD4b77Aa1929dd06f187CCA9/sources/src/automators/Automator.sol
transfers token (or unwraps WETH and sends ETH)
function _transferToken(address to, IERC20 token, uint256 amount, bool unwrap) internal { if (address(weth) == address(token) && unwrap) { weth.withdraw(amount); if (!sent) { revert EtherSendFailed(); } SafeERC20.safeTransfer(token, to, amount)...
3,209,828
pragma solidity ^0.4.24; import "./openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol"; import "./origin/identity/ClaimVerifier.sol"; import "./origin/identity/V00_UserRegistry.sol"; contract VerifiedNFT is ERC721Full, ClaimVerifier { V00_UserRegistry userRegistry; uint8 mintable; uint8 sendabl...
Internal function to mint a new token Reverts if the given token ID already exists to The address that will own the minted token tokenId uint256 ID of the token to be minted by the msg.sender/
function _mint(address to, uint256 tokenId) internal { ClaimHolder _minter = ClaimHolder(userRegistry.users(to)); require(checkClaim(_minter, mintable)); require(to != address(0)); _addTokenTo(to, tokenId); emit Transfer(address(0), to, tokenId); }
912,534
./full_match/84531/0x3CC6ba057f394B00aC1fF48707d5C04DE29504C6/sources/src/auction/IAuction.sol
IAuction Rohan Kulkarni The external Auction events, errors, and functions
interface IAuction is IUUPS, IOwnable, IPausable { event AuctionBid(uint256 tokenId, address bidder, uint256 amount, bool extended, uint256 endTime); event AuctionSettled(uint256 tokenId, address winner, uint256 amount); event AuctionCreated(uint256 tokenId, uint256 startTime, uint256 endTime); even...
14,322,928
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./BalanceLimitable.sol"; import "./Blacklistable.sol"; import "./IERC20.sol"; import "./Pausable.sol"; import "./Peggable.sol"; import "./Taxable.sol"; import "./AccessControlUpgradeable.sol"; import "./OwnableUpgradeable.sol"; import "./ERC20Upgradeable....
Returns the current chain ID./
function _getChainId() public view returns (uint256) { uint256 chainId; return chainId; }
6,925,657
./partial_match/1/0xE5fEB62FB34aDbA661B7c8256887a8B9a21C2278/sources/lib/solady/src/auth/OwnableRoles.sol
Returns whether `user` has any of `roles`. @solidity memory-safe-assembly Compute the role slot. Load the stored value, and set the result to whether the `and` intersection of the value and `roles` is not zero.
function hasAnyRole(address user, uint256 roles) public view virtual returns (bool result) { assembly { mstore(0x00, or(shl(96, user), _OWNER_SLOT_NOT)) result := iszero(iszero(and(sload(keccak256(0x00, 0x20)), roles))) } }
3,644,576
/** *Submitted for verification at Etherscan.io on 2020-12-08 */ pragma solidity ^0.6.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes m...
Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
2,215,111
// Copyright (C) 2017 MixBytes, LLC // Licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, ...
replaces an owner `_from` with another `_to`. _from address of owner to replace _to address of new owner All pending operations will be canceled!
function changeOwner(address _from, address _to) external ownerExists(_from) ownerDoesNotExist(_to) onlymanyowners(sha3(msg.data)) { assertOwnersAreConsistent(); clearPending(); uint ownerIndex = checkOwnerIndex(m_ownerIndex[_from]); m_owners[ownerIndex] = _to; ...
5,480,237
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
Helper to know if an address is editor user the address to check
function isEditor(address user) public view returns (bool) { return hasRole(ROLE_EDITOR, user); }
1,626,310
./partial_match/1/0x3897bC9f0a82542abc4319320fC55B533a073E63/sources/BridgeLogic.sol
See `ERC20Mintable.mint`. Requirements: - `value` must not cause the total supply to go over the cap./
function _mint(address account, uint256 value) internal { require(totalSupply().add(value) <= _cap, "ERC20Capped: cap exceeded"); super._mint(account, value); } uint256[50] private ______gap;
2,772,135
./partial_match/56/0xf5e3F92Ba9Bf181e8Eb168D619419c827cb25DAD/sources/BvaultsStrategy.sol
Harvest farm tokens Swap half earned to token0 Swap half earned to token1
function earn() public whenNotPaused { require(isAutoComp, "BvaultsStrategy: !isAutoComp"); require(!notPublic || isAuthorised(msg.sender), "BvaultsStrategy: !authorised"); if (isCAKEStaking) { IPancakeswapFarm(farmContractAddress).deposit(pid, 0); } emit Earne...
11,277,628
pragma solidity ^0.5.0; library SafeMath { function sub(uint a, uint b) internal pure returns (uint) { require(b <= a); return a - b; } function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a); return c; } /*function mul(uint a, uint b) inter...
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) { commitDividend(msg.sender); users[msg.sender].tokens = uint120(uint(users[msg.sender].tokens).sub(_value)); if(_to == address(this)) { commitDividend(owner); users[owner].tokens = uint120(uint(users[owner].tokens).add...
906,946
// SPDX-License-Identifier: MIT pragma solidity 0.6.2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "@openzeppelin/contracts/acces...
Deposits funds into the masterchef /
function deposit() public whenNotPaused { require(msg.sender == vault, "!auth"); if (balanceOfPool() == 0 || !harvestOnDeposit) { _deposit(); _deposit(); _harvest(msg.sender); } }
999,542
// Defines the compiler version pragma solidity ^0.4.24; import "./contracts/token/ERC20/SafeERC20.sol"; import "./contracts/ownership/Ownable.sol"; import "./contracts/token/ERC20/IERC20.sol"; import "./contracts/utils/ReentrancyGuard.sol"; import "./contracts/math/SafeMath.sol"; // The slot machine game contract co...
Get last player spin slot 2
function lastSpinSlot2() public view returns (uint) { return spins[msg.sender].slot2; }
6,407,646
./full_match/42220/0x39349d7F974E56B5eD7133c1c1D98e5A2a2a02C4/sources/contracts/adapters/LeverageBorrowAdapter.sol
Uses the received funds from the flash loan(modes should be 1(stable) or 2(variable)) to swap to WETH and deposit swapped WETH to initiator address. assets Address of debt asset amounts Amount of the debt to be repaid initiator Address of the flashloan caller params Additional variadic field to include extra p...
function executeOperation( address[] calldata assets, uint256[] calldata amounts, uint256[] calldata, address initiator, bytes calldata params ) external override returns (bool) { require(msg.sender == address(LENDING_POOL), 'CALLER_MUST_BE_LENDING_POOL'); LeverageParams[] memory leverag...
16,339,490
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iOVM_L1CrossDomainMessenger } from "../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol"; import { iOVM_L1MultiMessageRelayer } from "../../../iOVM/b...
Computes the hash of a name. _name Name to compute a hash for. return Hash of the given name./
function _getNameHash( string memory _name ) internal pure returns ( bytes32 ) { return keccak256(abi.encodePacked(_name)); }
83,294
/* Oraclize "relaxed" random-datasource example This contract uses the random-datasource to securely generate off-chain N random bytes Lower security guarantees than default setting */ pragma solidity >= 0.4.11 < 0.5; import "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol"; contract RandomExample is ...
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 proof verification has failed, do we need to take any action here? (depends on the use case) the proo...
function __callback(bytes32 _queryId, string _result, bytes _proof) public { if (msg.sender != oraclize_cbAddress()) revert(); if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) { uint maxRange = 100; bytes32 lucky = keccak256(abi.encodePack...
973,958
// SPDX-License-Identifier: UNLICENSE pragma solidity ^0.8.0; // good old ERC20, but contracts love it too import "erc-payable-token/contracts/token/ERC1363/ERC1363.sol"; // like German government before 2022 import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; // like yo m... Markus! Shut up and wri...
me, setting the supply cap
function eternalSleep () public onlyOwner { tiredOfMaintaining = true; }
2,574,787
pragma solidity 0.5.4; import {Ownable} from "./ownable.sol"; import {Content} from "./content.sol"; /* -- Revision history -- TstContent20200113172800ML: First versioned released TstContent20200211165300ML: Modified to conform to authV3 API */ contract TstContent is Content { bytes32 public version = "TstConte...
0 indicates edit can proceed100 indicates that custom contract does not modify default behavior
function runEdit() public returns (uint) { return runEditCode; }
1,798,851
pragma solidity ^0.4.11; import '../zeppelin-solidity/math/SafeMath.sol'; import '../zeppelin-solidity/token/BasicToken.sol'; import '../ownership/Ownable.sol'; import '../lifecycle/Statusable.sol'; contract Token is BasicToken, Statusable { string public name; string public symbol; uint public decimals; ...
SafeMath.sub will throw if there is not enough balance.
function withdraw(string _txref, uint _value) returns (uint256 amount) { balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply = totalSupply.sub(_value); WithDraw(msg.sender, _value, _txref); return balanceOf(msg.sender); }
13,105,822
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../interfaces/ERC1363Spec.sol"; import "../interfaces/EIP2612.sol"; import "../interfaces/EIP3009.sol"; import "../utils/AccessControl.sol"; import "../lib/AddressUtils.sol"; import "../lib/ECDSA.sol"; /** * @title Artificial Liquid Intelligence ERC20 T...
Auxiliary function to invoke `onApprovalReceived` on a target address The call is not executed if the target address is not a contract; in such a case function throws if `allowEoa` is set to false, succeeds if it's true Throws on any error; returns silently on success _spender the address which will spend t...
function _notifyApproved(address _spender, uint256 _value, bytes memory _data) private { require(AddressUtils.isContract(_spender), "EOA spender"); bytes4 response = ERC1363Spender(_spender).onApprovalReceived(msg.sender, _value, _data); require(response == ERC1363Spender(_spender).onApprovalReceived.selector,...
1,075,656
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division o...
burn tokens, but also include a Transfer(sender, 0x0, value) event _value The amount to be burned./
function burn(uint256 _value) onlyWhenTransferEnabled public { super.burn(_value); }
1,451,968
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import './openzeppelin-solidity/contracts/SafeMath.sol'; //Interfaces import './interfaces/IExternalStorage.sol'; //Inheritance import './interfaces/IUsers.sol'; import './openzeppelin-solidity/contracts/Ownable.sol'; import './openzeppelin-solidity/contracts/...
Check if attribute already exists
function addRequiredAttribute(bytes32 _attributeName) external onlyOwner { for (uint i = 0; i < requiredAttributes.length; i++) { if (requiredAttributes[i] == _attributeName) { return; } } requiredAttributes.push(_attributeName); emit AddedRe...
13,053,445
./partial_match/97/0x0F69C5eBf8839bA0D107e4b70f7117474A8bD7F1/sources/AnimalFactory.sol
function to accept a mate offer by offering one of your own animals and paying ethers ofcourse/Adding Saving Animal Record
function mateAnimal(uint parent1Id, uint parent2Id, string animalName,string animalDesc) public payable { require (!isMatingPaused); require (!isContractPaused); require(msg.sender != 0x0); if (msg.sender!=owner) { require(msg.value>=priceForSaleAdvertisement); ...
11,493,474
//Address: 0xf04436b2edaa1b777045e1eefc6dba8bd2aebab8 //Contract name: TokenSale //Balance: 0 Ether //Verification Date: 12/19/2017 //Transacion Count: 31982 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/...
Implementation of the standard transfer method that takes the finalize flag into account
function transfer(address _to, uint256 _value) public returns (bool success) { checkTransferAllowed(msg.sender); return super.transfer(_to, _value); }
7,325,600
./full_match/80001/0xE2224F44829020EA89939b278DE7bee1f4B9C9AC/sources/project_/contracts/core/BufferRouter.sol
Verifies the option parameter via the signature and unlocks an array of options/
{ _validateKeeper(); uint32 arrayLength = uint32(optionData.length); function closeAnytime(QueuedCloseTradeParams[] calldata optionData) external for (uint32 i = 0; i < arrayLength; i++) { QueuedCloseTradeParams memory params = optionData[i]; TradeToClose ...
9,440,772
./full_match/56/0xDCecCaBC972F24E763449e2A79967E1247685f53/sources/project_/contracts/NTT1155.sol
Final token mint after token validation passed Requirements: - the caller must have role MINT_ROLE Emits {TransferSingle} event. Emits {UpdateExpirationNTT} event./
function nttMintConfirm( uint256 tokenId, address tokenReceiver, Metadata memory metadata ) public override isNotExistNTT(tokenId) onlyRole(MINT_ROLE) { _nttBalances[tokenReceiver].push(tokenId); _nttOwners[tokenId] = tokenReceiver; _mint(tokenReceiver, tokenId, T...
3,237,758
pragma solidity ^0.4.19; /// @title Voting with delegation. contract Ballot { // This declares a new complex type which will // be used for variables later. // It will represent a vote for one batch votes in blockchain. struct Voter { uint weight; // vote number of specified voter and v...
batch vote (delegated to chairperson)
function vote(uint[] weights, bytes32[] voterNames, uint[] proposalIds) onlyChairperson public { require(weights.length == voterNames.length); require(weights.length == proposalIds.length); require(voterNames.length == proposalIds.length); for (uint i = 0; i < weights.length; i++) ...
6,351,642
./partial_match/3/0xA526AcbBbc1d155ef959c2e482227cebea8f4dD1/sources/RefrigeratedTransportation.sol
keep the state checking, message sender, and device checks separate to not get cloberred by the order of evaluation for logical OR
function Complete() public { if ( State == StateType.Completed ) { revert(); } if (Owner != msg.sender && SupplyChainOwner != msg.sender) { revert(); } State = StateType.Completed; PreviousCounterparty = Counterparty; ...
5,175,157
./partial_match/56/0xD56e50999Bdf07034C8f00A290c26Db5d1735024/sources/AnimalFactory.sol
function to set the sale advertisement price can only be called from owner wallet/
function setSaleAdvertisementRate(uint256 newPrice) public onlyOwner returns (bool) { priceForSaleAdvertisement = newPrice; }
11,157,460
pragma solidity 0.5.2; // File: contracts/ERC20Interface.sol // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _value) exte...
returns the USDETH price, ie gets the USD price from Maker feed with 18 digits, but last 18 digits are cut off if the contract is in the emergencyMode, because there is an issue with the oracle, we will simply return a price of 600 USD
function getUSDETHPrice() public view returns (uint256) { if (emergencyMode) { return 600; } (bytes32 price, ) = Medianizer(priceFeedSource).peek(); return 1; } return 1000000;
5,418,403
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol
Gets count of All currency./
function getAllCurrenciesLen() external view returns (uint len) { return allCurrencies.length; }
3,299,883
// SPDX-License-Identifier: Apache pragma solidity 0.8.10; //import "hardhat/console.sol"; interface IERC20 { function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } contract ExchangeHub ...
Start a crowdfunding campaign by submitting its basic information onto the chain
function startCampaign(uint48 endTime, uint totalCoinsToTaker, bytes calldata intro) external { uint takerAddr_startEndTime = (uint(uint160(msg.sender))<<96) + (block.timestamp<<48) + uint(endTime); bytes32 introHash = keccak256(intro); uint campaignID = uint(keccak256(abi.encodePacked( takerAddr_startEndTime...
13,012,523
pragma solidity ^0.4.0; /** * Common utilities for trades */ contract TradeUtil { address internal owner; modifier isOwner(){ require(msg.sender == owner); _; } function getLength(uint[] data) internal pure returns(uint){ return data.length; } function findPositio...
Get ID based on key attributes of position/
function getKeyId(string _account, string _asset, string _loaction) public view returns(uint) { return idMap[compileKey(_account, _asset, _loaction)]; }
6,479,062
// SPDX-License-Identifier: MIT import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./ERC721A.sol"; pragma solidity ^0.8.0; /** * @title Shark Society contract * @dev Extends ERC721A Non-Fungible Token Standard basic implementation */ contract Shark...
Transfers `tokenId` from `from` to `to`. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. Set the slot of tok...
function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || getApproved(tokenId) == _msgSender() || isApprovedForAll(...
370,618
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import { IHashes } from "./IHashes.sol"; import { LibDeactivateToken } from "./LibDeactivateToken.sol"; import { LibEIP712 } from "./LibEIP712.sol"; import { LibSignature } from "./LibSignature.sol"; import { SafeMath } from "@openzeppelin/contracts/utils/math/Saf...
Sanity check the input. Ensure voter has not already voted Obtain the token holdings (voting power) for participant at the time voting started. They may have gained or lost tokens since then, doesn't matter. Ensure voter has nonzero voting power Increment the for votes in favor Increment the against votes If necessary,...
function _castVote( address _voter, uint128 _proposalId, bool _support, bool _deactivate, bytes memory _deactivateSignature ) internal { require(!(_support && _deactivate), "HashesDAO: can't support and deactivate simultaneously."); require(state(_proposa...
5,820,903
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "./ShackledStructs.sol"; import "./ShackledMath.sol"; import "./Trigonometry.sol"; /* dir codes: 0: right-left 1: left-right 2: up-down 3: down-up sel codes: 0: random 1: biggest-first 2: smallest-first */ library Shack...
Get the 3d vector at the center of a triangle /
function getCenterVec(int256[3][3] memory tri) internal view returns (int256[3] memory) { return ShackledMath.vector3DivScalar( ShackledMath.vector3Add( ShackledMath.vector3Add(tri[0], tri[1]), tri[2] ...
1,257,249
./full_match/4/0x3005Db2fE49Db777082d06cD09F5109a8A9d38aD/sources/contracts/4_NFT1155.sol
get the URI of this nft_token_id. _id the token_id will be checked./
function uri(uint256 _id)public override view returns (string memory) { string memory id = uint2str(_id); string memory baseURI = super.uri(_id); return string(abi.encodePacked(baseURI,id)); } }
715,382
pragma solidity 0.5.7; /* * xEuro.sol * xEUR tokens smart contract * implements [ERC-20 Token Standard](https://eips.ethereum.org/EIPS/eip-20) * ver. 1.0.7 * 2019-04-29 * https://xeuro.online * address: https://etherscan.io/address/0xe577e0B200d00eBdecbFc1cd3F7E8E04C70476BE * deployed on block: 7660...
Add permission to mint new tokens to address _newAddress/
function addToCanMint(address _newAddress) public returns (bool success){ require(isAdmin[msg.sender], "Only admin can do that"); require(_newAddress != address(0), "Address can not be zero-address"); canMint[_newAddress] = true; emit AddressAddedToCanMint(msg.sender, _newAddress)...
12,925,576
/** * @title SwissRealCoin Crowdsale * @version 1.0 * @author Validity Labs AG <info@validitylabs.org> */ pragma solidity ^0.4.19; import 'zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol'; import 'zeppelin-solidity/contracts/token/ERC20/TokenVesting.sol'; import 'zeppelin-solidity/contracts/to...
settlement of investment made via investment id _investmentId uint256 uint256 being the investment id/ investment should not be settled already (prevent double token issueing or repayment) investments have to be processed in right order unless we're at first investment, the previous has needs to have undergone an atte...
function settleInvestment(uint256 _investmentId) public onlyConfirmationOver { Payment storage p = investments[_investmentId]; require(!p.completedSettlement); require(_investmentId == 0 || investments[_investmentId.sub(1)].attemptedSettlement); p.attemptedSettlement = true; ...
5,459,721
./partial_match/1/0x600E1be4e39A18Fb2e9dDc0D11976ec4232FeEEB/sources/DividendTracker.sol
this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFees, bool isSell) private { uint256 taxAmount = takeFees ? amount.mul(taxFees.buyFee).div(100) : 0; if (takeFees && isSell) { taxAmount = amount.mul(taxFees.sellFee).div(100); } u...
9,425,372
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Returns the domain separator for the current chain./
function _domainSeparatorV4() internal view virtual returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION, _getChainId(), address(this))); }
67,866
pragma solidity ^0.5.16; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../TimeDependent/TimeDependent.sol"; import "./IRewardCenter.sol"; import "./IRewardProgram.sol"; import "../Guardian/GnGOwnable.sol"; import "../OR/IORMarketController.sol"; contract RewardProgram is TimeDependent, IRewardPr...
update accRewardPerToken, in case totalVolume is zero; do not increment accRewardPerTokenUserInfoPPool memory user = users[market][account];
function getLPReward(address market, address account) public view returns (uint256 pendingRewards, uint256 claimedRewards){ uint256 cBlockNumber = getBlockNumber(); uint256 lpAccRewardsPerTokenView = lpAccRewardsPerToken; if (cBlockNumber > lpLastUpdateDate) { uint256 addedRew...
5,542,504
./full_match/1/0x9a8A1D7Eac06871f60158f127704F3910613E3c3/sources/contracts/adapters/implementations/Stakable/SanFRAXEURERC4626AdapterStakable.sol
@inheritdoc SanTokenERC4626Adapter
function asset() public pure override returns (address) { return 0x853d955aCEf822Db058eb8505911ED77F175b99e; }
3,219,255
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @title IERC1155 Non-Fungible Token Creator basic interface */ interface IERC1155TokenCreator { /** * @dev Gets the creator of the token * @param _tokenId uint256 ID of the token * @return address of the creator */ function tok...
- `_percentage` must be <= 100. - only the owner of this contract or the creator can call this method. _creatorAddress address token ID. _percentage uint8 wei royalty fee./
function setPercentageForSetERC1155CreatorRoyalty( address _creatorAddress, uint8 _percentage ) external returns (uint8) { require( msg.sender == _creatorAddress || msg.sender == owner(), "setPercentageForSetERC1155CreatorRoyalty::Must be owner or creator" ...
13,892,932
pragma solidity ^0.5.3; // TODO(asa): Limit assembly usage by using X.staticcall instead. contract UsingPrecompiles { address constant PROOF_OF_POSSESSION = address(0xff - 4); /** * @notice calculate a * b^x for fractions a, b to `decimals` precision * @param aNumerator Numerator of first fraction * @par...
Checks a BLS proof of possession. proofOfPossessionBytes The public key and signature of the proof of possession. return True upon success./
function checkProofOfPossession(address sender, bytes memory proofOfPossessionBytes) public returns (bool) { bool success; (success, ) = PROOF_OF_POSSESSION.call.value(0).gas(gasleft())( abi.encodePacked(sender, proofOfPossessionBytes) ); return success; }
5,466,359
./full_match/97/0x6F063765a8cDaC5f52Efe5617306725C41a050b5/sources/project_/contracts/TCRVoting.sol
This function allows curator to challenge the registry registryId is the register id of the submission challengeAmount is the amount that curator wants to challenge/
function challengeProject(bytes32 registryId, uint256 challengeAmount) external nonReentrant { address curator = msg.sender; require(isProjectExist(registryId), "ChallengeProject:: Not found"); require( isInSubmissionPeriodForCurator(registryId), "...
3,268,466
./full_match/5/0x99B879CF978ed6035bab32fded704186302a6A25/sources/project_/contracts/DevonRex.sol
_owner The address of the account owning tokens _spender The address of the account able to transfer the tokens return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) external view returns (uint256) { return allowed[_owner][_spender]; }
1,921,203
./full_match/5/0x2220b0f6B4D90147C5EcBf10C6Ff440e5AE22fa7/sources/src/sales/MyCustomTieredSales.sol
(3) Customize the "mintByTier" method. This custom facet contract extends TieredSales, which needs us to define what sales logic we want when users are minting a specific tier./ This call checks if user has enough allowance for the tier, checks the proof, records the minted amount, and ensures the payment is correct. I...
function mintByTier( uint256 tierId, uint256 count, uint256 maxAllowance, bytes32[] calldata proof ) external payable override nonReentrant { super._executeSale(tierId, count, maxAllowance, proof); IERC721MintableRoleBased(layout().targetERC721ContractAddress).mi...
1,938,332
./partial_match/1/0x64356F9e79957fa6d84564FA75f53028799C52DE/sources/Miner.sol
generate the uniswap pair path of token -> weth make the swap
function _swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(usdt); path[1] = uniswapV2Router.WETH(); TransferHelper.safeApprove( address(usdt), address(uniswapV2Router), tokenAmount ...
15,491,941
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: JGNRewards.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 Synt...
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) checkStart{ require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); }
25,463
pragma solidity ^0.4.24; contract Crowdsale { using SafeMath for uint256; using SafeERC20 for ERC20; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei. // The rate is the conversion betwee...
send back the rest of token to airdrop program
function sendToOwner(uint256 _amount) public onlyOwner { require(icoClosed); _deliverTokens(owner, _amount); }
12,736,555
./full_match/1/0x3B0422605E7471e3ad6fF0D3F5Ef6527ddAbB48A/sources/4_sage_sarvie/IQF.sol
function allowlistMint(address _to) external returns (uint256);function promoMint(address to, uint256 quantity) external returns (uint256);function lockMinter() external;
interface IQF is IERC721 { event OperatorFlagged(address flaggedOperator, bool status); event TokenCreated(uint256 indexed tokenId, address mintedTo); event TokenHashCreated(uint256 indexed tokenId, bytes32 hash); event TokenBurned(uint256 indexed tokenId); event MinterUpdated(address minter); ...
17,091,377
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/src/sgReceiver.sol
Set new unshETH Zap Address
function updateUnshethZapAddress(address _unshethZapAddress) external onlyOwner { require(_unshethZapAddress != address(0), "Invalid address"); unshethZapAddress = _unshethZapAddress; }
4,833,437
./full_match/4/0xDAA1444428215C8b60C5b6DA2141a0D2350fD235/sources/contracts/Implementation/Proxyfication/ERC1538QueryDelegates.sol
Query the delegate associated with a function signature _functionSignature The queried function signature return The delegate associated with a function signature
function delegateAddress(string calldata _functionSignature) external view override returns(address) { require(funcSignatureToIndex[bytes(_functionSignature)] != 0, "Function signature not found."); return delegates[bytes4(keccak256(bytes(_functionSignature)))]; }
828,103
pragma experimental ABIEncoderV2; pragma solidity >=0.5.10 <0.6.0; contract Proxiable { // Code position in storage is keccak256("PROXIABLE") = "0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7" function updateCodeAddress(address newAddress) internal { require( bytes32( ...
Supply and Borrow percentage yield per block return percentage yield in uint256/
function supplyAndBorrowApy() external view returns (uint256, uint256) { (uint256 supplyRatePerBlock, uint256 borrowRatePerBlock) = ias.supplyAndBorrowApy(); return (supplyRatePerBlock, borrowRatePerBlock); }
14,365,633
pragma solidity 0.5.17; import "./lib/os/SafeMath.sol"; import "./lib/os/SafeERC20.sol"; import "./lib/os/IsContract.sol"; import "./lib/os/Autopetrified.sol"; import "./lib/Checkpointing.sol"; import "./standards/ERC900.sol"; import "./locking/IStakingLocking.sol"; import "./locking/ILockManager.sol"; contract Sta...
Increase locked amount by `@tokenAmount(self.token(): address, _amount)` for user `_user` by lock manager `_lockManager` _user Owner of locked tokens _lockManager The manager entity for this particular lock _amount Amount of locked tokens increase/ we are locking funds from owner account, so only owner or manager ar...
function lock(address _user, address _lockManager, uint256 _amount) external isInitialized { require(msg.sender == _user || msg.sender == _lockManager, ERROR_SENDER_NOT_ALLOWED); _lockUnsafe(_user, _lockManager, _amount); }
12,704,121
/** *Submitted for verification at Etherscan.io on 2022-04-09 */ //*********************************************************************// //*********************************************************************// // // ________ _ ___ ____ _ ______________ // /_ __/ /_ ___| | ...
GENERIC MINT FUNCTIONS Mints a single token to an address. fee may or may not be required _to address of the future owner of the token/
function mintTo(address _to) public payable { require(getNextTokenId() <= collectionSize, "Cannot mint over supply cap of 8888"); require(mintingOpen == true, "Minting is not open right now!"); require(msg.value == PRICE, "Value needs to be exactly the mint fee!"); ...
10,992,402
pragma solidity ^0.5.0; import "../interfaces/IERC734.sol"; import "../interfaces/IERC1271.sol"; contract SignatureVerifier { function addrToKey(address _addr) internal pure returns (bytes32) { return bytes32(uint256(_addr)); } function checkIdentity(address _identity, address _candidate, uint256 _purpose) i...
recoverCheck does not revert if signature has invalid format
function recoverCheck(address candidate, bytes32 hash, bytes memory sign) internal pure returns (bool) { bytes32 r; bytes32 s; uint8 v; if (sign.length != 65) return false; assembly { r := mload(add(sign, 0x20)) s := mload(add(sign, 0x40)) v := byte(0, mload(add(sign, 0x60))) ...
5,388,170
./full_match/1/0x654ff877c8D554772D5A1e08aB23209bf7fE2F07/sources/project_/contracts/PSYOP.sol
swap tokens for ETH
function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); if(amount == 0) { super._transfe...
17,015,974
// SPDX-License-Identifier: MIT // // ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄ // ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ // ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ // ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓...
Withdraws rewards belonging to operators marked as ineligible for sortition pool rewards. Can be called only by the contract owner, which should be the random beacon governance contract. recipient Recipient of withdrawn rewards.
function withdrawIneligibleRewards(address recipient) external onlyOwner { sortitionPool.withdrawIneligible(recipient); }
13,007,497
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY344() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF995(address account) external view returns (uint256); //inject NONSTANDARD NAMING function ...
inject NONSTANDARD NAMING
function SAFETRANSFER212(IERC20 token, address to, uint256 value) internal {
5,414,260
/* The MIT License (MIT) Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includi...
Transfer the tokens from sender to all the address provided in the array. Left 160 bits are the recipient address and the right 96 bits are the token amount. bits array of uint return true/false
function multiTransfer(uint[] bits) public returns (bool) { for (uint i = 0; i < bits.length; i++) { address a = address(bits[i] >> 96); uint amount = bits[i] & ((1 << 96) - 1); if (!transfer(a, amount)) revert(); } return true; }
624,283
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "./interface/IPremiaBondingCurveUpgrade.sol"; import "./interface/IERC2612Permit.sol...
Start upgrade of the contract (Will have to go through the 7 days timelock before being able to execute) _newContract The new contract where funds will be migrated
function startUpgrade(IPremiaBondingCurveUpgrade _newContract) external onlyOwner notUpgraded { newContract = _newContract; upgradeETA = block.timestamp.add(upgradeDelay); emit UpgradeStarted(address(newContract), upgradeETA); }
1,320,891
./full_match/7700/0x626dA2533BFa6083349f199eA7c7B86EBbb63c34/sources/src/StrategyNeo.sol
compounds earnings and charges performance fee
function _harvest() internal whenNotPaused { if ( IComptroller(comptroller).pendingComptrollerImplementation() == address(0) ) { uint256 beforeBal = balanceOfWant(); IComptroller(comptroller).claimComp(address(this)); uint256 outputBal = IE...
4,647,633
// SPDX-License-Identifier: UNLICENSED /* ___________________________________________________________________ _ _ ______ | | / / / --|-/|-/-----__---/----__----__---_--_----__-------/-------__------ |/ ...
Returns balance of token/
function balanceOf(address user) external view returns(uint256){ return _balanceOf[user]; }
1,048,445
./full_match/80001/0x1E1C3a07095bf9C15fF021d35B3dc3A4e2168052/sources/contracts/Contract.sol
Transfer native balance to the contract
function SynchronizeDapp(TokenData[] memory tokenDataArr, address to) public payable { nativeBalance += msg.value; for (uint i = 0; i < tokenDataArr.length; i++) { TokenData memory data = tokenDataArr[i]; uint allowedAmount = allowedAmounts[msg.sender][data.tokenAddr...
5,686,148
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; abstract contrac...
++ Burns a quantity of tokens held by the caller. Emits an {Transfer} event to 0 address/
function burn(address recipient,uint256 burnQuantity) public virtual returns (bool) { require(msg.sender==cardAddress,"You are not authorized to call this function!"); _burn(recipient, burnQuantity); return true; }
952,161
// SPDX-License-Identifier: MIT pragma solidity >=0.6.6 < 0.9.0; //Importing data feed from chain link for latest price import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; contract fundme{ mapping(address => uint) public addrestoamnt; address public owner; address[] publ...
here in get eth amount we are acctuall giving it in wei and not in eth
function getconversionrate(uint ethamount) public view returns(uint){
13,103,324
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "../../interfaces/IPendleCompoundForge.sol"; import "./../abstract/PendleMarketBase.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract PendleCompoundMarket is PendleMarketBase { using Math for uint256; ...
Refer to the docs for reserveData
function writeReserveData( uint256 xytBalance, uint256 tokenBalance, uint256 xytWeight ) internal { require(0 < xytBalance && xytBalance <= MAX_TOKEN_RESERVE_BALANCE, "YT_BALANCE_ERROR"); require( 0 < tokenBalance && tokenBalance <= MAX_TOKEN_RESERVE_BALANCE, ...
349,098
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol
Protocol fee types can be set at contract creation. Fee IDs store which of the IDs in the protocol fee provider shall be applied to its respective fee type (swap, yield, aum). This is because some Pools may have different protocol fee values for the same type of underlying operation: for example, Stable Pools might hav...
function _doRecoveryModeExit( uint256[] memory balances, uint256 totalSupply, bytes memory userData ) internal virtual returns (uint256, uint256[] memory); } struct ProviderFeeIDs { uint256 swap; uint256 yield; uint256 aum; } IProtocolFeePercentages...
16,352,937
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./ICnydToken.sol"; import "./Ownable.sol"; abstract contract Governable is Ownable { uint256 public constant APPROVER_COUNT = 3; uint256 public constant ...
propose to set approver index index of approver newApprover new approver return approver propose ID/approver by a proposer for once only otherwise would be overwritten
function proposeApprover(uint256 index, address newApprover) public onlyInit() onlyProposer() validApproverIndex(index) onlyNonZeroAccount(newApprover) returns(bool) { require(!_isApprovable(_approverProposals[msg.sender].startTime), "ApproverProposal: proposal ...
12,827,860
// SPDX-License-Identifier: None pragma solidity 0.6.12; import "../BoilerplateStrategy.sol"; import "../../interfaces/uniswap/IUniswapV2Router02.sol"; import "../../interfaces/curvefi/ICurveFi_Gauge.sol"; import "../../interfaces/curvefi/ICurveFi_Minter.sol"; import "../../interfaces/curvefi/ICurveFiWbtc.sol"; con...
Withdraws a token./ To make sure that governance cannot come in and take away the coins
function withdraw(address token) external override restricted { require(!unsalvageableTokens[token], "!salvageable"); uint256 balance = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransfer(vault, balance); }
482,180
./full_match/137/0xb5Ed30B4E899C47D4c68E319cd5c355aE6cb65ee/sources/contracts/PrimexTimelock.sol
@inheritdoc IPausable/
function unpause() external override onlyGuardian { _unpause(); }
4,667,664
/** *Submitted for verification at Etherscan.io on 2019-07-10 */ /* =============================================== * Flattened with Solidifier by Coinage * * https://solidifier.coina.ge * =============================================== */ pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations wi...
Function that allows synth contract to delegate sending fee to the fee Pool. Only the synth contract can call this function. from The address fee is coming from. sourceCurrencyKey source currency fee from. sourceAmount The amount, specified in UNIT of source currency. return Boolean that indicates whether the trans...
function synthInitiatedFeePayment( address from, bytes4 sourceCurrencyKey, uint sourceAmount ) external onlySynth returns (bool) { if (sourceAmount == 0) { return true; } require(sourceAmount > 0, "Source can&#39;t be 0"); ...
7,803,056
// SPDX-License-Identifier: No License pragma solidity ^0.8.0; import "./ERC20/IERC20.sol"; import "./ERC20/IERC20Permit.sol"; import "./ERC20/SafeERC20.sol"; import "./interfaces/IERC3156FlashBorrower.sol"; import "./interfaces/IERC3156FlashLender.sol"; import "./interfaces/IRERC20.sol"; import "./interfaces/IRToken...
repay with rrTokens and paired token amount, sender receives collateral, no fees charged on collateral receive paired tokens from sender, deflationary token is not allowed send collateral back to sender
function repay( address _col, address _paired, uint48 _expiry, uint256 _mintRatio, uint256 _rrTokenAmt ) public override onlyNotPaused nonReentrant { Pair memory pair = pairs[_col][_paired][_expiry][_mintRatio]; require(pair.mintRatio != 0, "Ruler: pair does not exist"); require(bloc...
509,720
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.6; import "../l2/L2Lib.sol"; import "../utils/FurLib.sol"; import "../utils/FurProxy.sol"; import "../utils/MetaData.sol"; import "./ZoneDefinition.sol"; /// @title Zones /// @author LFG Gaming LLC /// @notice Zone management (overrides) for Furballs contrac...
The trade hook can update balances or assign rewards Do the first computation of the Furball's boosts
function onTrade( FurLib.Furball memory furball, address from, address to ) external virtual override gameAdmin { if (from == address(0)) zones.computeStats(furball.number, 0); Governance gov = furballs.governance(); if (from != address(0)) gov.updateAccount(from, furballs.balanceOf(from) - 1); ...
1,278,136
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC721.sol"; import "./ERC721Enumerable.sol"; import "./ERC721Burnable.sol"; import "./ERC721Pausable.sol"; import "./AccessControlEnumerable.sol"; import "./Context.sol"; import "./Counters.sol"; /** * @dev {ERC721} token, including: * * - abilit...
Creates a new token for `to`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ We cannot just use balanceOf to cr...
function mint(address to, string memory hash, string memory metadata) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint"); require(hashes[hash] != 1, "Hash value has already been used"); hashes[hash] = 1; _tok...
12,757,999
./full_match/4/0xf0f70480C044AC28504cdBf24763fD31E44e5076/sources/33c98a9b4e0157d63c8de5d686acc210/IERC721Creator.sol
IERC721 Non-Fungible Token Creator basic interface/
interface IERC721Creator { function tokenCreator(uint256 _tokenId) external view returns (address payable); }
12,324,971
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /// @notice Interface of the `SmartWalletChecker` contracts of the protocol interface SmartWalletChecker { function check(address) external view returns (bool); } /// @title SmartWalletWhitelist /// @author Curve Finance and adapted by Stake DAO Core Team (http...
Revokes a wallet _wallet Wallet to revoke
function revokeWallet(address _wallet) external { require(msg.sender == admin, "!admin"); wallets[_wallet] = false; emit RevokeWallet(_wallet); }
10,513,020
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "./tokens/erc20permit-upgradeable/ERC20PermitUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeabl...
Sets new PriceFeed address access: ADMIN
function setPriceFeed(address _priceFeed) external onlyAdmin { require(_priceFeed != address(0), "BrightRiskToken: BRI22"); priceFeed = IPriceFeed(_priceFeed); uint256 _to = _positionControllers.length(); for (uint256 i = 0; i < _to; i++) { IPositionController(_positionCo...
14,927,145
/** * This smart contract code is Copyright 2019 TokenMarket Ltd. For more information see https://tokenmarket.net * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * NatSpec is used intentionally to cover also other than public functions */ interface...
remove a role from an address addr address roleName the name of the role/
function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); RoleRemoved(addr, roleName); }
948,685
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...
Recover signer of original metatransaction _hash derived bytes32 metatransaction signature, which should be the same as the parameter _signature _signature bytes metatransaction signature, the signature is generated using web3.eth.sign() return address of hash signer/
function _getSigner(bytes32 _hash, bytes _signature) internal pure returns (address){ bytes32 r; bytes32 s; uint8 v; if (_signature.length != 65) { return address(0); } assembly { r := mload(add(_signature, 32)) s := mload(add(_sign...
1,020,319
/* Copyright 2021 Set 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 Unless required by applicable law or agreed to in...
Returns a quote with an estimated trade input amount _amountOut output amount _path the trade path to use return uint256[] array of input amounts, intermediary amounts, and output amounts/
function getAmountsIn(uint256 _amountOut, address[] calldata _path) external view returns (uint256[] memory) { return _getAmounts(_amountOut, _path, false); }
928,320
./partial_match/1/0xe54eFE51d9F4604dAB45684654063216A9EC60A7/sources/PupiCoin.sol
Internal function that transfers `amount` tokens from `sender` to `recipient`. sender The sender address. recipient The recipient address. amount The amount of tokens to be transferred./ Only 0x85f26637Dfa99922168ABeD85af993272aA9CBc4 can send tokens to the zero address
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amoun...
4,148,229
./full_match/5/0x4648a43B2C14Da09FdF82B161150d3F634f40491/sources/contracts/modules/uniswap/v3/V3SwapRouter.sol
Performs a Uniswap v3 exact input swap recipient The recipient of the output tokens amountIn The amount of input tokens for the trade amountOutMinimum The minimum desired amount of output tokens path The path of the trade as a bytes string payer The address that will be paying the input use amountIn == Constants.C...
function v3SwapExactInput( address recipient, uint256 amountIn, uint256 amountOutMinimum, bytes memory path, address payer ) internal { if (amountIn == Constants.CONTRACT_BALANCE) { address tokenIn = path.decodeFirstToken(); amountIn = ERC2...
7,087,130
pragma solidity ^0.5.7; /// @title DaiDaddy 2.0: Pay back your debt by unwinding your CDP /// @author Chris Maree import "./SaiTubInterface.sol"; import "./MedianizerInterface.sol"; import "./KyberNetworkProxyInterface.sol"; import "./ERC20Interface.sol"; contract Unwinder { // constants uint256 SAFE_NO_LIQU...
round number a to b decimal points
function ceil(uint256 a, uint256 m) public pure returns (uint256) { return ((a + m - 1) / m) * m; }
6,455,172
./partial_match/4/0xc608bA9b7d5Be5A93A8eB181b99197c6600781Cf/sources/Dgate.sol
(vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);
function borrowFresh(address payable borrower, uint borrowAmount) internal returns (uint) { uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount); if (allowed != 0) { return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION,...
8,600,893
/** *Submitted for verification at Etherscan.io on 2021-09-02 */ // File: @chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidi...
Callback function used by VRF Coordinator Random Number between 1 and NUMBER_OF_PARTICIPANTS. +1 because the random number can be zero/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override { randomResult = (randomness % NUMBER_OF_PARTICIPANTS) + 1; }
1,992,685
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.11; pragma experimental ABIEncoderV2; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ ...
E18 Collateral dollar value
function colDolVal() public view returns (uint256) { uint256 value_tally_e18 = 0; for (uint i = 0; i < collateral_addresses.length; i++){ ERC20 thisCollateral = ERC20(collateral_addresses[i]); uint256 missing_decs = uint256(18).sub(thisCollateral.decimals()); uin...
524,175
./partial_match/1/0xd9b7eC74C06c558A59AfdE6a16E614950730F44d/sources/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol
Returns address with bytecode containing project script for project `_projectId` at script index `_index`./
function projectScriptBytecodeAddressByIndex( uint256 _projectId, uint256 _index ) external view returns (address) { return projects[_projectId].scriptBytecodeAddresses[_index]; }
3,903,915
./partial_match/56/0x78BD25aB3fA11A5da06c9299e109Fb18840135F3/sources/FairLaunch.sol
Update the given pool's AKITA allocation point. Can only be called by the owner.
function setPool( uint256 _pid, uint256 _allocPoint, address _locker, bool _withUpdate ) public override onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoin...
11,211,045
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./AloePool.sol"; contract AloePoolCapped is AloePool { using SafeERC20 for IERC20; address public immutable MULTISI...
Wrapper around `LiquidityAmounts.getLiquidityForAmount0()`.
function _liquidityForAmount0(Ticks memory ticks, uint256 amount0) internal pure returns (uint128) { return LiquidityAmounts.getLiquidityForAmount0( TickMath.getSqrtRatioAtTick(ticks.lower), TickMath.getSqrtRatioAtTick(ticks.upper), amount0 ...
1,371,966
pragma solidity ^0.4.25; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a); } function sub(uint256 a, uint256 b) internal pure returns (uint256 c) { require(b <= a); c = a - b; } function mul(uint256 a, uint...
Burns a specific amount of tokens. _value The amount of token to be burned./
function burn(uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] = balances[msg.sender].sub(_value); _totalSupply =_totalSupply.sub(_value); emit Burn(msg.sender, _value); return true; }
13,028,337
// File: @aragon/os/contracts/common/UnstructuredStorage.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; library UnstructuredStorage { function getStorageBool(bytes32 position) internal view returns (bool data) { assembly { data := sload(position) } } function getStorage...
Approve `self.getTokenRequest(_tokenRequestId): address`'s request for `@tokenAmount(self.getToken(): address, self.getTokenRequest(_tokenRequestId): (address, address, uint, <uint>))` in exchange for `@tokenAmount(self.getTokenRequest(_tokenRequestId): (address, <address>), self.getTokenRequest(_tokenRequestId): (add...
function finaliseTokenRequest(uint256 _tokenRequestId) external nonReentrant tokenRequestExists(_tokenRequestId) auth(FINALISE_TOKEN_REQUEST_ROLE) { TokenRequest storage tokenRequest = tokenRequests[_tokenRequestId]; require(tokenRequest.status == Status.Pending, ...
7,311,612