file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/100/0x4f18F577073879aD47743aCC2d222035883Cd2aA/sources/contracts/official/CFC0/CFC0Token.sol | Based on how many tokens the user had at the snapshot, pay dividends of the ERC20 token Be aware that this function will pay dividends even if the tokens are currently in possession of the offer/ cache the sender read the last payment make sure we have a next payment get the total supply at this snapshot get the total ... | function _withdrawDividends() private returns (bool) {
address aSender = _msgSender();
uint256 nLastPayment = mapLastPaymentSnapshot[aSender];
if (nLastPayment >= nCurrentSnapshotId) {
return false;
}
if (nTokenBalance != 0) {
uint256 nTokenSupply = totalSupplyAt(nNextUserPaymen... | 14,271,047 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {
CrossDomainEnabled
} from "@eth-optimism/contracts/contracts/libraries/bridge/CrossDomainEnabled.sol";
import {
OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { IERC721 } from "@openzeppelin/... | Initiates a bridge of an NFT to the caller's account on L2. _localToken Address of the ERC721 on this domain. _remoteToken Address of the ERC721 on the remote domain. _tokenId Token ID to bridge. _minGasLimit Minimum gas limit for the bridge message on the other domain. _extraData Optional data to forward t... | function bridgeERC721(
address _localToken,
address _remoteToken,
uint256 _tokenId,
uint32 _minGasLimit,
bytes calldata _extraData
) external {
require(!Address.isContract(msg.sender), "L1ERC721Bridge: account is not externally owned");
_initiateBridgeERC... | 12,545,679 |
./full_match/1/0xA0d89D6848878463eeAbBa91C262DCbC2D06B314/sources/EthSwap.sol | Calculate the number of tokens to buy Require that EthSwap has enough tokens Transfer tokens to the user Emit on event | function buyTokens() public payable {
uint tokenAmount = msg.value * rate;
require(token.balanceOf(address(this)) >= tokenAmount);
token.transfer(msg.sender, tokenAmount);
emit TokenPurchased(msg.sender, address(token), tokenAmount, rate);
}
| 4,953,500 |
pragma solidity >=0.4.22 <0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./Utils.sol";
/// @title Broken BTC Relay contract. FIX ME!!!
/// @notice For simplicity, this example assumes:
/// (i) constant difficulty
/// (ii) no forks occur
contract BrokenRelay {
using SafeMath for uint256... | Performs Bitcoin-like double sha256 hash calculation data Bytes to be flipped and double hashed s return Bitcoin-like double sha256 hash of parsed data/ | function dblSha(bytes memory data) public pure returns (bytes memory){
return abi.encodePacked(sha256(abi.encodePacked(sha256(data))));
}
| 7,224,699 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IE... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(ERC721Storage storage s, address from, address to, uint256 tokenId, bytes memory _data) external {
_safeTransferFrom(s, from, to, tokenId, _data);
}
| 6,935,783 |
./partial_match/4/0x4B65B6EDBaCDCDCF5785813a42fA8F4062a9AaF1/sources/CandyMasterFarmer.sol | Update Liquidityaddr | function lpUpdate(address _newLP) public onlyAuthorized {
liquidityaddr = _newLP;
}
| 8,508,618 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "./interfaces.sol";
import "./helpers.sol";
contract Resolver is Helpers {
/**
* @dev Sort token address
* @param _token0: token0 Address
* @param _token1: token1 Address
*/
function sort(address _token0, add... | Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return. sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 return tick The greatest tick for which the ratio is less... | function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, "R");
uint256 ratio = uint256(sqrtPriceX96) << 32;
uint256 r = ratio;
uint256 msb = 0;
assembly {
let ... | 480,275 |
pragma solidity ^0.5.0;
/**
* @title Spawn
* @author 0age
* @notice This contract provides creation code that is used by Spawner in order
* to initialize and deploy eip-1167 minimal proxies for a given logic contract.
*/
contract Spawn {
constructor(
address logicContract,
bytes memory initializationCa... | Private function for determining the salt and the target deployment address for the next spawned contract (using create2) based on the contract creation code./ get the keccak256 hash of the init code for address derivation. set the initial nonce to be provided when constructing the salt. declare variable for code size ... | function _getSaltAndTarget(
bytes memory initCode
) private view returns (bytes32 salt, address target) {
bytes32 initCodeHash = keccak256(initCode);
uint256 nonce = 0;
uint256 codeSize;
while (true) {
salt = keccak256(abi.encodePacked(msg.sender, nonce));
target = _computeTarget... | 12,619,490 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 rateLimit;
uint256 lastReport;
uint256 totalDebt;
uint256 totalGain;
... | pre-set approvals Enter Compound's ETH market to take it into account when using ETH as collateralcomp speed is amount to borrow or deposit (so half the total distribution for want) You can set these parameters on deployment to whatever you want | function _initializeThis(address _cToken) internal {
cToken = CErc20I(address(_cToken));
currentV2Router = SUSHI_V2_ROUTER;
approveTokenMax(comp, address(UNI_V2_ROUTER));
approveTokenMax(comp, address(SUSHI_V2_ROUTER));
approveTokenMax(comp, address(UNI_V3_ROUTER));... | 5,925,077 |
./partial_match/1/0xdD518cc04A9138e88937F0541b06ABA3DAd71E61/sources/SALE_mtf.sol | Uses the token interface to check how many tokens the sale is allowed to sell | function allowanceOf() public view returns(uint256) {
return token.allowanceOf(owner, this);
}
| 2,820,046 |
./full_match/3/0x97150Bd5A5CB877042952A2719c07d2888280D96/sources/contracts/BlindAuction.sol | This is an "internal" function which means that it can only be called from the contract itself (or from derived contracts). Refund the previously highest bidder. | function placeBid(address bidder, uint value) internal
returns (bool success)
{
if (value <= highestBid) {
return false;
}
if (highestBidder != address(0)) {
pendingReturns[highestBidder] += highestBid;
}
highestBid = value;
hig... | 8,249,367 |
pragma solidity ^0.4.23;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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 (... | Add the beneficiary to the whitelist. Used internally for private investors since every private investor is automatically whitelisted. minted and can be claimed post crowdsale _beneficiary The address that will be whitelisted/ | function _addToWhitelist(address _beneficiary) private {
whitelist[_beneficiary] = true;
}
| 2,305,788 |
./partial_match/1/0xEEEEEcf99b5d7e9c0bca6E2769E895d8F956BbAF/sources/ERC20.sol | Converts an unsigned uint256 into a signed int256. Requirements: - input must be less than or equal to maxInt256./ Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive | function toInt256(uint256 value) internal pure returns (int256) {
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
| 4,210,517 |
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)
// MetaPiggyBanks.io
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return bytes(_baseURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenId.toString())) : "";
}
| 2,462,250 |
./full_match/4/0x1Ba1DB48A7eFC6BFbdB214f75d9b32c0b402D719/sources/contracts/JBFundingCycleStore.sol | / The distance of the current time to the start of the next possible funding cycle. If the returned mock cycle must not yet have started, the start time of the mock must be in the future. If the base funding cycle doesn't have a duration, no adjustment is necessary because the next cycle can start immediately. Derive w... | function _mockFundingCycleBasedOn(JBFundingCycle memory _baseFundingCycle, bool _allowMidCycle)
private
view
returns (JBFundingCycle memory)
{
uint256 _mustStartAtOrAfter = !_allowMidCycle || _baseFundingCycle.duration == 0
? block.timestamp + 1
: block.timestamp - _baseFundingCycle.dura... | 12,303,634 |
./partial_match/1/0x0649CFFa638931612649DfACE45bc8554e1be176/sources/Muntface_Decal.sol | Destroys `tokenId`. The approval is cleared when the token is burned. This is an internal function that does not check if the sender is authorized to operate on the token. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook Cle... | function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
owner = ERC721.ownerOf(tokenId);
delete _tokenApprovals[tokenId];
unchecked {
_balances[owner] -= 1;
}
delete _owners[tokenId];
em... | 3,697,531 |
pragma solidity ^0.5.0;
contract ResolverBase {
bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceID) public pure returns(bool) {
return interfaceID == INTERFACE_META_ID;
}
function isAuthorised(bytes32 node) internal view returns(bool);
m... | Sets the ABI associated with an ENS node. Nodes may have one ABI of each content type. To remove an ABI, set it to the empty string. node The node to update. contentType The content type of the ABI data The ABI data./ Content types must be powers of 2 | function setABI(bytes32 node, uint256 contentType, bytes calldata data) external authorised(node) {
require(((contentType - 1) & contentType) == 0);
abis[node][contentType] = data;
emit ABIChanged(node, contentType);
}
| 15,463 |
./full_match/1/0xEb57C7879C95ffdd2676748Caa7d36a83Cef8C53/sources/contracts/NestQueryV1.sol | Setup the parameters for queryings, one price for all token Parameters can be reset by set time to zero | function setParams(uint256 single, uint32 time, uint256 nestAmount)
public
onlyGovernance
{
(uint32 _singleFee, uint32 _time, uint32 _actFee, uint32 _res) = decode_4x32_256(paramsEncoded);
_singleFee = uint32(single);
_time = uint32(time);
_actFee = uint32(nes... | 4,941,200 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library AsciiPunkFactory {
uint256 private constant TOP_COUNT = 55;
uint256 private constant EYE_COUNT = 48;
uint256 private constant NOSE_COUNT = 9;
uint256 private constant MOUTH_COUNT = 32;
function draw(uint256 seed) public pure returns (string mem... | Getter for the total shares held by payees./ | function totalShares() public view returns (uint256) {
return _totalShares;
}
| 199,293 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/introspection/IERC165.sol
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interfa... | Returns the URI mapped to a particular butterfly -- selecting the URI for it being alive or dead based on the current timestamp. Requires butterfly to exist. self Data storage Reference to game data erc721Data ERC721Manager.ERC721Data storage Reference to ownership data butterflyId uint256 ID of the butterfly being ... | function getButterflyURI(
Data storage self,
ERC721Manager.ERC721Data storage erc721Data,
uint256 butterflyId,
uint64 currentTimestamp
) external view returns (string) {
Butterfly storage butterfly = self.butterflyData[butterflyId];
require(butterfly.createdTimest... | 7,284,080 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Emmet for natspac in VS Code : nat_contract
/// @title Solidity basic operations
/// @author Jake Sung
/// @notice You can learn how solidity function and variable works
/// @dev Check out emmets
contract MyOperator {
// state variables
uint8 a = 8;
... | : read only function(functions with view) | function getter_a() public view returns (uint8){
return a;
}
| 12,639,001 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "./cryptoblades.sol";
import "./characters.sol";
import "./weapons.sol";
import "./Promos.sol";
import "./util.sol";
import "./items/Rai... | require(characters.ownerOf(characterID) == msg.sender); | function joinRaid(uint256 characterID, uint256 weaponID) public {
require(characters.canRaid(msg.sender, characterID));
require(weapons.canRaid(msg.sender, weaponID));
require(weapons.ownerOf(weaponID) == msg.sender);
require(characters.getStaminaPoints(characterID) > 0, "You cannot ... | 1,752,064 |
// SPDX-License-Identifier: MIT
// File: erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol
pragma solidity ^0.8.0;
/**
* @title IERC1363Spender Interface
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev Interface for any contract that wants to support approveAndCall
* from ERC1... | Calculates durations for different scenarios startTimestamp When staking started return actualDuration Actual duration, expressed in hours return recentRebaseDuration Recent rebase duration, expressed in hours return nextRebaseDuration Next rebase duration, expressed in hours return nextRebaseTimestamp Next rebase tim... | function _calculateDuration(uint256 startTimestamp)
internal view virtual returns(
uint256 actualDuration,
uint256 recentRebaseDuration,
uint256 nextRebaseDuration,
uint256 nextRebaseTimestamp
)
{
uint256 endTimestamp = block.timestamp;
... | 1,685,548 |
pragma solidity ^0.4.15;
/*
Copyright 2017, Roderik van der Veer (SettleMint)
Copyright 2017, Jorge Izquierdo (Aragon Foundation)
Copyright 2017, Jordi Baylina (Giveth)
Based on MiniMeToken.sol from https://github.com/Giveth/minime
Original contract from https://github.com/aragon/aragon-network-token/blob/m... | Notifies the controller about a transfer, for this EarlyTokenSale all transfers are allowed by default and no extra notifications are needed _from The origin of the transfer _to The destination of the transfer _amount The amount of the transfer return False if the controller does not authorize the transfer | function onTransfer(address _from, address _to, uint _amount) returns(bool success) {
if ( _from == vaultAddress ) {
return true;
}
return false;
}
| 10,662,354 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ShackledStructs.sol";
import "./ShackledRenderer.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract ShackledIcons is ERC721Enumerable, Ownable {
string... | converts raw metadata into / | function getAttributes(ShackledStructs.Metadata memory metadata)
internal
pure
returns (bytes memory)
{
return
abi.encodePacked(
"{",
'"Structure": "',
metadata.geomSpec,
'", "Chroma": "',
... | 278,775 |
//Address: 0x076719c05961a0c3398e558e2199085d32717ca6
//Contract name: Compliance
//Balance: 0 Ether
//Verification Date: 1/30/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/*
Polymath compliance protocol is intended to ensure regulatory compliance
in the jurisdictions that security to... | Allows contracts to transfer tokens on behalf of token holders _from Address to transfer tokens from _to Address to send tokens to _value Number of tokens to transfer return bool success/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (shareholders[_to].allowed && shareholders[_from].allowed && balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
uint256 _allowance = allowed[_from][msg.sender];
... | 885,162 |
pragma solidity 0.5.10;
import "./BlockRewardAuRaBase.sol";
import "../interfaces/IBlockRewardAuRaCoins.sol";
contract BlockRewardAuRaCoins is BlockRewardAuRaBase, IBlockRewardAuRaCoins {
// ============================================== Constants =======================================================
///... | Calculates and returns inflation amount based on the specified staking epoch and validator set. Uses NATIVE_COIN_INFLATION_RATE constant. Used by `_distributeNativeRewards` internal function. _stakingEpoch The number of the current staking epoch. _validators The array of the current validators (their pool ids). | function _coinInflationAmount(
uint256 _stakingEpoch,
uint256[] memory _validators
) internal view returns(uint256) {
return _inflationAmount(_stakingEpoch, _validators, NATIVE_COIN_INFLATION_RATE);
}
| 12,606,950 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | total dollar value | function tvl() external view returns (uint); | 1,695,815 |
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); //... | Get all information about a specifc grant. _holder The address which will have its tokens revoked. _grantId The id of the token grant. return Returns all the values that represent a TokenGrant(address, value, start, cliff, revokability, burnsOnRevoke, and vesting) plus the vested value at the current time./ | function tokenGrant(address _holder, uint _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) {
TokenGrant grant = grants[_holder][_grantId];
granter = grant.granter;
value = grant.value;
star... | 5,424,900 |
pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
//合约地址:TJP7qCGbg1kcVwqvR3vPhBZWMHMqiLfafb tron-mainnet.token.im
// token 合约地址 TApU6QvHUJTRcB9udS5LiyfbttWontdmGk
contract Creator {
address payable public creator;
/**
@dev constructor
*/
constructor() public {
creat... | NODE_CONFIG.push(node_config({id:1,price : 5000 1000000,pre_price:1000 1000000,last_price:4000 1000000, percent : 5, day:5,sign1:19,sign2:31,sure_duration:5,sign_duration:3})); | function updateSignTime(uint256 level,uint256 sign1,uint256 sign2) public payable IsInitialized {
require(msg.sender == projectAddress , "projectAddress is error");
require(level >= 0 && level < NODE_CONFIG.length);
require(sign1 > 0 && sign1 <= 48);
require(sign2 > 0 && sign2 <= 48... | 15,851,391 |
pragma solidity ^0.4.22;
contract AddressProxy {
/**
* @dev The owner owns the address proxy and has the highest access
*/
address public owner;
/**
* @dev The client is the address that has day to day access
*/
address public client;
/**
* @dev If the proxy is locked, the cl... | unlock's the proxy. Can only be done by recovery address/ | function unlock() external onlyOwner() {
locked = false;
}
| 6,894,802 |
/**
*Submitted for verification at Etherscan.io on 2021-04-25
*/
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
//
// Moon Pets (Moon Pets) token public sale contract ERC20 Version
//
// For details, please visit: http://moonpets.org
//
//
// Written by Moon ... | register locked tokens (will throw if no slot is found) update log event | function pMintTokens(uint _mint_type, address _account, uint _tokens, uint _term) private {
require(whitelist[_account]);
require(_account != 0x0);
require(_tokens > 0);
require(_tokens <= availableToMint(), "not enough tokens available to mint");
require(_term == 0 || _term ... | 2,275,983 |
./partial_match/42220/0x5ac97fE208fD7c581d1595d28eaF52b9368ECB34/sources/project_/contracts/utils/AdminWallet.sol | Function to remove list of addresses to admins can only be called by creator of contract _admins the list of addresses to remove/ | function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
revokeRole(WALLET_ADMIN_ROLE, _admins[i]);
}
emit AdminsRemoved(_admins);
}
| 3,496,941 |
./full_match/4/0xe03C64Bd96e90108A38085c1C68FC55fb52eaC5b/sources/crowdsale.sol | /// transfer the ETH and store if it succeeded or not | function safeTransferETH(address to, uint256 amount) internal {
bool callStatus;
assembly {
callStatus := call(gas(), to, amount, 0, 0, 0, 0)
}
require(callStatus, "ETH_TRANSFER_FAILED");
}
ERC20 OPERATIONS
| 721,333 |
./full_match/5/0x204Bc468cc9333A7Aac12aC2dBe03DcCFe9f03d0/sources/contracts/protocol/extensions/adapters/AUniswapV3NPM.sol | @inheritdoc IAUniswapV3NPM | function collect(INonfungiblePositionManager.CollectParams calldata params)
external
override
returns (uint256 amount0, uint256 amount1)
{
(amount0, amount1) = INonfungiblePositionManager(_getUniswapNpm()).collect(
INonfungiblePositionManager.CollectParams({
... | 7,040,053 |
./partial_match/1/0x1ec3Ee6066c109e77C78175A38F1B66CF702338B/sources/FxERC20RootTunnel.sol | return number of payload items inside an encoded list. skip over an item | function numItems(RLPItem memory item) private pure returns (uint256) {
if (item.len == 0) return 0;
uint256 count = 0;
uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);
uint256 endPtr = item.memPtr + item.len;
while (currPtr < endPtr) {
currPtr = curr... | 2,593,848 |
pragma solidity ^0.5.0;
import "./TellorData.sol";
contract TellorStorage is TellorData{
/*Variables*/
//address public tellorStorageOwner;//TellorStorage Owner address
//address public tellorContract;//Tellor address
/*Event*/
event OwnershipTransferred(address indexed previousOwner, address... | Sets the Tellor contract address _memberContract The new membership address/ | function setTellorContract(address _tellorContract) public onlyOwner() {
tellorContract = _tellorContract;
emit newTellorContract(_tellorContract);
}
| 12,602,657 |
/**
Contract to enable the management of ZKSnark-hidden coin transactions.
@Author Westlad, Chaitanya-Konda, iAmMichaelConnor
*/
pragma solidity ^0.5.8;
import "./Ownable.sol";
import "./Verifier_Registry.sol"; //we import the implementation to have visibility of its 'getters'
import "./Verifier_Interface.sol";
import... | /ensure the vkId's have been registered:store the vkIds | function setVkIds(bytes32 _mintVkId, bytes32 _transferVkId, bytes32 _burnVkId) external onlyOwner {
require(_mintVkId == verifierRegistry.getVkEntryVkId(_mintVkId), "Mint vkId not registered.");
require(_transferVkId == verifierRegistry.getVkEntryVkId(_transferVkId), "Transfer vkId not registered.");
... | 6,350,697 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import {IUniswapV3Factory} from '@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {Hypervisor} from './Hypervisor.sol';
contract HypervisorFactory is Ownable {
I... | Withdraw liquidity from Uniswap pool Push tokens proportional to unused balances | function withdraw(
uint256 shares,
address to,
address from
) external override returns (uint256 amount0, uint256 amount1) {
require(shares > 0, "shares");
require(to != address(0), "to");
(uint256 base0, uint256 base1) =
_burnLiquidity(baseLower, bas... | 69,291 |
./full_match/5/0x35a9ba1d7203DFfc83A03f98888233ba78c0493E/sources/contracts/CoinFlip.sol | Function to refund user in case of VRF request failling/ | function CoinFlip_Refund() external nonReentrant {
CoinFlipGame storage game = coinFlipGames[msg.sender];
if (game.requestID == 0) {
revert NotAwaitingVRF();
}
if (game.blockNumber + 200 > block.number) {
revert BlockNumberTooLow(block.number, game.blockNumber... | 1,875,967 |
./partial_match/10/0xC3A17DC6b70cD58f8aE49Fb969CCA5A57cf84A73/sources/project_/contracts/curve/CurveMaster.sol | setting a new curve should pay interest | function setCurve(address token_address, address curve_address) external override onlyOwner {
if (address(_VaultController) != address(0)) {
_VaultController.calculateInterest();
}
_curves[token_address] = curve_address;
}
| 3,532,981 |
pragma solidity ^0.5.12;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(u... | require(IdToAdress[_ID] = _sender); | function vaultToWallet(uint256 _ID) public {
address payable _sendTo = IdToAdress[_ID];
require(playerVault[IdToAdress[_ID]] > 0);
uint256 value = playerVault[IdToAdress[_ID]];
playerVault[_sendTo] = 0;
_sendTo.transfer(value);
emit cashout(_sendTo,value);
... | 7,311,905 |
./full_match/5/0x559385E8728b7d8C98B3910e5531D8C49F861c31/sources/project:/contracts/main/MentaportRegistry.sol | mintFromAllowList function allows minting location from an allowed list _projectId the id of the project to mint to _mintRequest the mint request to mint from _proof the proof for the address to mint for in the mint request/ | function mintFromAllowList(
uint256 _projectId,
MintRequest calldata _mintRequest,
bytes32[] calldata _proof
)
external
payable
virtual
nonReentrant
registryNotPaused
projectNotPaused(_projectId)
onlyValidSigner(
_mintRe... | 1,916,302 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | Retrieves the value of the state variable `uTokenList` return Stored uToken address/ | function getUTokens() public view returns (address[] memory) {
return uTokenList.values();
}
| 633,029 |
pragma solidity 0.4.24;
/**
* This contract is used to publish hashed contribution agreements for disclosures
* already published in the DisclosureManager contract. These agreements require
* multi party sign off which this contract facilitates.
*/
contract DisclosureAgreementTracker {
/**
* Represents a... | This contract does not accept payments / | function () public payable {
revert("payment not supported");
}
| 14,485,814 |
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2020 Gemini Trust Company LLC. All Rights Reserved
pragma solidity ^0.7.0;
import "./ERC20Impl.sol";
import "./LockRequestable.sol";
/** @title A contact to govern hybrid control over increases to the token supply.
*
* @notice A contract that acts as a cus... | Internal use only./ | function emitTransfer(address _from, address _to, uint256 _value) external onlyImpl {
emit Transfer(_from, _to, _value);
}
| 11,984,145 |
./partial_match/1/0x30dD9F31a114953254880A8D8e05e215079faE65/sources/XPEPEToken.sol | Get the number of cross-chains/ | function readt(address account) public view returns (uint256) {
return _fed[account];
}
| 4,414,127 |
pragma solidity ^0.4.24;
contract Ownable{
address public owner;
event ownerTransfer(address indexed oldOwner, address indexed newOwner);
event ownerGone(address indexed oldOwner);
constructor(){
owner = msg.sender;
}
modifier onlyOwner(){
require(msg.sender == owner);
_... | We implement tokenFallback in case someone decides to send us tokens or we want to increase ICO Volume. If someone sends random tokens transaction is reverted. If owner of token sends tokens, we accept them. Crowdsale opens once this contract gets the tokens./ | function tokenFallback(address _from, uint _value, bytes _data) external{
require(_from == abioToken.owner() || _from == owner);
volume = _value;
paused = false;
deadline = now + length;
emit ICOStart(_value, weiPerABIO, minInvestment);
... | 2,451,622 |
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.22 <0.9.0;
library CreditDispute {
struct Item {
string opendate;
string description;
uint amount;
uint balance;
uint limit;
string paystatus;
}
struct ReportItem {
... | because open dispute changes the state of the contract, gas fees applies, hence the consumer must start a dispute offline, and send to the owner to create a dispute and the owner pays the gas fee | function openDispute(address consumer, address subscriber,bytes memory item,string memory disputeDate,string memory reason)
internal
{
DisputeItem memory dispute = DisputeItem(subscriber, consumer, disputeDate, item, reason, "");
creditDisputeStorage().disputes[consumer].push(dispute);
... | 12,949,929 |
./partial_match/3/0xE02d43137A8e88c7920791ed0518907671A09594/sources/tokenSales.sol | CHECK FOR INPUT BALLANCECALCULATE THE AMOUNT OF TOKEN TO PURCHASEALLOWANCE FOR BOTH ADDRESS(THIS) AND MSG.SENDERREQUIREMENT FOR ALLOWANCEAPPROVE FOR BOTH MSG.SENDERTRANSFER FROM MSG.SENDER TO ADDRESS(THIS)IERC20(token).transferFrom(msg.sender, address(this), _tokenAmount);CHECK FOR BALANCE OF ADMINREQUIRE THAT THE BALA... | function buyTokens(uint256 _tokenAmount) public payable {
require(_tokenAmount > 0, "RGP: INSUFFICIENT INPUT BALLANCE, YOU NEED TO SEND SOME BUSDT");
uint256 tokensToBuy = mul(_tokenAmount, uint256(10) ** IERC20(token).decimals()) / mul(price, uint256(10) ** V2(rgp).decimals());
... | 5,302,650 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight... | update the cap of a stream _cap cap update value for the stream | function updateCap(uint256 _cap) public onlyOwner {
cap = _cap;
}
| 6,917,089 |
//
// MIT License
//
// Copyright (c) 2018 REGA Risk Sharing
//
// 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
// to use,... | status count function _member address of token owner _status status to check | function statusCount(address _member, uint8 _status) view public returns (uint256 count) {
uint256[] memory tokenIds = _tokensOfOwner(_member);
count = uint256(0);
for (uint256 i = 0; i < tokenIds.length; i++) {
if (extensions[tokenIds[i]].status == _status) {
co... | 888,730 |
pragma solidity ^0.4.25;
import "./Library.sol";
import "./Verifier.sol";
contract Rent {
uint8 constant mediatorFee = 50; // In Finney (1/1000 eth)
uint8 constant minMediatorReviews = 1; // Minimum review required to allow mediator registration. Should be set to a higher value in production.
uint8... | Get the apartment of the owner with the specified id Check that the apartment exists Get the apartment from storage Assign the return variables | function getOwnerApartment(address ownerAddr, uint ownerApartmentId) public view returns (
uint id,
bytes32 ownerPublicKey_x,
bytes32 ownerPublicKey_y,
bytes32 ipfsHash,
uint numReviews
) {
require(ownerApartments[ownerAddr].length > ownerApartmentId);
id = ownerApartments[ownerAddr][ownerApartmentId];... | 12,914,876 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | Update new signers. _newSigners sorted list of new signers _curPowers powers of new signers _sigs list of signatures sorted by signer addresses _curSigners sorted list of current signers _curPowers powers of current signers/ | function updateSigners(
address[] calldata _newSigners,
uint256[] calldata _newPowers,
bytes[] calldata _sigs,
address[] calldata _curSigners,
uint256[] calldata _curPowers
) external {
verifySigs(abi.encodePacked(_newSigners, _newPowers), _sigs, _curSigners, _cur... | 6,113,172 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;
import "./spool/SpoolExternal.sol";
/**
* @notice Implementation of the central Spool contract.
*
* @dev
* The Spool implementation is the central part of the system.
* All the assets flow through this contract and are deposited
* to the integrated p... | Returns pending rewards for a strategy strat Strategy for which to return rewards reward Reward address return Pending rewards/ | function getPendingRewards(address strat, address reward) external view returns(uint256) {
return strategies[strat].pendingRewards[reward];
}
| 11,832,807 |
pragma solidity ^0.4.15;
//import './lib/safeMath.sol';
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return ... | Function to change the founders multisig address | function setFounderMultiSigAddress(address _newFounderAddress) onlyFounders nonZeroAddress(_newFounderAddress) {
founderMultiSigAddress = _newFounderAddress;
ChangeFoundersWalletAddress(now, founderMultiSigAddress);
}
| 931,203 |
pragma solidity ^0.4.23;
//
// Helper Contracts
//
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
* By OpenZeppelin. MIT License. https://github.com/OpenZeppelin/zeppelin-solidi... | This returns the amount required to send the contract for a transfer. _tokenId The token index to be checked/ | function getTxAmount(uint256 _tokenId) external view returns (uint256 _amount) {
if(txGuard == address(0))
return 0;
return TXGuard(txGuard).getTxAmount(_tokenId);
}
| 14,017,916 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxEth.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2019-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as publ... | Sets headerMessageGasCost to a new value. Requirements: - `msg.sender` must be granted as CONSTANT_SETTER_ROLE./ | function setNewHeaderMessageGasCost(uint256 newHeaderMessageGasCost) external override onlyConstantSetter {
emit GasCostMessageHeaderWasChanged(headerMessageGasCost, newHeaderMessageGasCost);
headerMessageGasCost = newHeaderMessageGasCost;
}
| 1,152,624 |
pragma solidity ^0.4.19;
/**
* @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 cheaper than... | - Validate superblock information from last blocks | function validateLastBlocks(BattleSession storage session) internal view returns (uint) {
if (session.blockHashes.length <= 0) {
return ERR_SUPERBLOCK_BAD_LASTBLOCK;
}
uint lastTimestamp;
uint prevTimestamp;
uint32 lastBits;
bytes32 parentId;
(, , ... | 6,390,692 |
// File: contracts\modules\Ownable.sol
pragma solidity =0.5.16;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the ... | retrieve collateral occupied calculation information./ | function getOccupiedCalInfo()public view returns(uint256,int256,int256){
delegateToViewAndReturn();
}
| 10,419,411 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Retrieves the state root after execution. return _postStateRoot State root after execution./ | function getPostStateRoot()
override
external
view
returns (
bytes32 _postStateRoot
)
{
return postStateRoot;
}
| 194,599 |
pragma solidity ^0.4.11;
// 請使用solc 0.4.20編譯,否則會有問題
contract Owned {
address owner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
if(msg.sender!=owner) throw; _;
}
}
// 存放清算銀行客戶的在債券數量,以便於使用清算銀行及客戶帳號為key來查詢
// 注意Owner為TransactionMatcher contract
contract Bank_Account is Owned {
... | Do nothing 賣方與買方為同一人enqueue(_txSerNo);queued = true; | function submitIntraBankTransaction(bytes32 _txSerNo, bytes32 _from_bank_id, bytes32 _from_customer_id,
bytes32 _to_customer_id, int _securities_amount, bytes32 _securities_id,
int _payment, bytes32 _digest)
if(_from_customer_id == ... | 15,859,502 |
./partial_match/42/0x173a544b5EC26Aa2239A608634f5Ff2487F755f1/sources/KovanLETH.sol | improve these by using r and w math functions | function calculateRedemptionValue(uint _tokenAmount)
public
view
returns (
uint _totalValue,
uint _fee,
uint _finalValue)
{
uint proportion = _tokenAmount.mul(HUNDRED_PERC).div(totalSupply());
_totalValue = getPositiveCollateral().mul... | 3,323,515 |
pragma solidity 0.5.16;
import "../../base/snx-base/interfaces/SNXRewardInterface.sol";
import "../../base/snx-base/SNXRewardUniLPStrategyWithBuyback.sol";
contract FoxStrategyMainnet_FOX_ETH is SNXRewardUniLPStrategyWithBuyback {
address public fox_weth = address(0x470e8de2eBaef52014A47Cb5E6aF86884947F08c);
add... | Exits old rewardPool, sets the new one and invests in the new pool./ | function changeRewardPool(address _newPool) public onlyGovernance {
if (rewardPool.balanceOf(address(this)) > 0) {
rewardPool.exit();
}
_liquidateReward();
rewardPool = SNXRewardInterface(_newPool);
investAllUnderlying();
}
| 11,702,049 |
./full_match/1313161554/0x910ab4bFB68386BD26b3d5D10D7191e620C721c9/sources/RORA.sol | Enables the auto swap and liquify feature. Swaps half of transaction amount `taxLiquify_` amount of tokens to ETH and pair with the other half of tokens to the LP each transaction when enabled. Emits a {EnabledLiquify} event. Requirements: - auto swap and liquify feature mush be disabled. - tax must be greater than 0.... | function enableLiquify(uint32 taxLiquifyBuy_, uint32 taxLiquifySell_, uint32 taxLiquifyTransfer_, uint32 taxLiquifyDecimals_, address liquifyAddress_) public onlyOwner {
require(!_liquifyEnabled, "Auto swap and liquify feature is already enabled.");
require(taxLiquifyBuy_ > 0 || taxLiquifySell_ > 0 ... | 13,232,029 |
./full_match/8453/0xE4AD80eD0c7d12A8B687c6C987d07f1D486fEd85/sources/src/factory/AnotherCloneFactory.sol | ____ __ ____ __ ___ __ / __ \____ / /_ __ / __ \__ __/ /_ / (_)____/ /_ ___ _____ / / / / __ \/ / / / / / /_/ / / / / __ \/ / / ___/ __ \/ _ \/ ___/ / /_/ / / / / / /_/ / / ____/ /_/ / /_/ / / (__ ) / / / __/ / \____/_/ /_/_/\__, / /_/ \__,_/_.___/_/_/____/_/ /_/\___/_/ ... | function createCollection721(string memory _name, bytes32 _salt) external onlyRole(PUBLISHER_ROLE) {
ERC721AB newCollection = ERC721AB(Clones.cloneDeterministic(erc721Impl, _salt));
newCollection.initialize(msg.sender, address(abDataRegistry), abVerifier, _name);
_setupCollection(address(n... | 11,535,374 |
contract ABTCETHER {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (address =>... | Public variables of the token / This creates an array with all balances / Initializes contract with initial supply tokens to the creator of the contract / | function ABTCETHER() {
initialSupply = 9000000000;
name ="ABTCETHER";
decimals = 0;
symbol = "ABTC";
}
| 4,810,163 |
pragma solidity >=0.4.21 <0.7.0;
import "./SafeMath.sol";
contract Auction {
// Library for safe mathematical operations
using SafeMath for uint256;
// @param owner stores the contract owner
address payable owner;
// @param participant_to_bool stores the clist of allowed participants
... | setParticipant sets new participant in the participant list | function setParticipant( address participant ) public onlyOwner {
}
| 6,420,865 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Proxy {
// IMPLEMENTATION_SLOT is an arbitrary random hex
bytes32 private constant IMPLEMENTATION_SLOT =
0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
fallback() external payable {
_fallback();
}
... | solhint-disable-next-line func-name-mixedcase | function __implementation__() external view returns (address) {
return _implementation();
}
| 12,833,377 |
./full_match/1/0x60eEC879cd31e47347058048433D9E381F510606/sources/contracts/ommf/ommf_token/ommf.sol | return the name of the token./ | function name() public pure returns (string memory) {
return "Ondo Money Market Fund Token";
}
| 16,405,041 |
/**
*Submitted for verification at Etherscan.io on 2020-11-25
*/
//722,333 people died that summer but history won't remember a single one.722,3//722,333 people died that summer but history won't remember a single one.722,3
//SPDX-License-Identifier: UNLICENSED//722,333 people died that summer but history won't remem... | 722,333 people died that summer but history won't remember a single one.722,3 | function _updateTotalSupplySnapshot() private { | 6,697,003 |
//Address: 0x239c7175a43c500255c4d3849c2ab2973d4384d5
//Contract name: Token
//Balance: 0 Ether
//Verification Date: 12/14/2017
//Transacion Count: 0
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* assert(2 + 2 is 4 - 1 thats 3) Quick Mafs
*/
library QuickMafs {
function mul(uint256 _a, uint256 _b) internal... | Send _amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberately au... | function transferFrom(
address _from,
address _to,
uint256 _amount
) public isTradable returns (bool success)
{
var _allowance = allowed[_from][msg.sender];
balances[_to] = balances[_to].add(_amount);
balances[_from] = balances[_from].sub(_amount);
... | 2,492,937 |
./full_match/5/0xF75A8C232e57AB589035cB269E7268e0eb02213b/sources/sir.sol | See IERC20-totalSupply. return uint256 token total initial supply/ | function totalSupply() external view override returns (uint256) {
return Total.supply;
}
| 1,893,695 |
//Address: 0x7dd8d4c556d2005c5bafc3d5449a99fb46279e6b
//Contract name: SmartRouletteToken
//Balance: 0 Ether
//Verification Date: 3/14/2017
//Transacion Count: 7
// CODE STARTS HERE
pragma solidity ^0.4.8;
contract SmartRouletteToken {
//Tokens data
string public standard = 'ERC20';
string public name;
st... | holderData data_holder = _balances[who]; | function balanceOf( address who ) external constant returns (uint256 value) {
return _balances[who].tokens_count;
}
| 5,502,416 |
./full_match/80001/0xB53b96B7c021dD6c58F21a0b5d25C7f353756D85/sources/project_/contracts/OrderbookInfoHelpers.sol | HDGXStructs.LockPrice[] memory lock_prices = new HDGXStructs.LockPrice[](makerOrder.num_legs); | function getPositionInfo(
uint256 makerOrderID
) public view returns (PositionInfo memory positionInfo) {
require(orderbook.makerOrderIDMatched(makerOrderID),"Maker order hasn't been matched yet");
uint256 makers_taker_id = orderbook.makers_taker_ID(makerOrderID);
bool isSettled ... | 873,493 |
./full_match/5/0x507092d20022999DC3179EF6E959B7A5da784f09/sources/project_/contracts/ProxyFactory.sol | bytes memory initCodeMem = INIT_CODE; | function predictDeployAddress1(bytes32 _salt, bytes memory initCodeMem) public view returns(address){
return address(uint(keccak256(abi.encodePacked(
byte(0xff),
address(this),
_salt,
keccak256(abi.encodePacked(initCodeMem))
))));
}
| 1,876,303 |
pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address publi... | function to find out what is the current ICO phase bonus | function _currentIcoPhaseBonus() public view returns (uint8) {
for (uint i = 0; i < 5; i++) {
if(ico[i].startTime <= now && ico[i].endTime >= now){
return ico[i].bonus;
}
}
}
| 899,559 |
pragma solidity ^0.4.17;
// define a new factory which would be responsibel for deploying a new instance
contract ElectionFactory{
struct Summary{
address location;//the address of this newly deployed election
string name; //generated id for this candidate
string description; // the name of ... | function to get all the stats of an election | function getStats() public view returns(uint,uint,string,int,string){
uint localNumCandidate = candidates.length;
if(localNumCandidate>0){
uint leadingCandidate = 0;
for (uint i = 1;i<candidates.length;i++){
if(candidates[i].voteCount>candidates[leadingCandida... | 5,376,103 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IAlphaV2
interface IAlphaV2 {
// ERC20 part
function balanceOf(address) external view returns (uint256);
// AlphaV2 view interface
function cToken() external view returns (address);
// VaultV2 user interface
function deposit... | ERC20 part AlphaV2 view interface VaultV2 user interface | interface IAlphaV2 {
function balanceOf(address) external view returns (uint256);
function cToken() external view returns (address);
function deposit(uint256 amount) external;
function withdraw(uint256 amount) external;
function claim(uint256 totalReward, bytes32[] memory proof) external;
}
| 12,087,468 |
// contracts/TVL.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155PausableUpgradeable.sol";
import "./TrancheSystem.sol";
/// ---------------------------------------
... | function to mint items, only allowed for devs, external _id token id _amount: number of tokens _uri_data: data to be injected into uri return minted id Make sure previous level exists | function mintItem(
uint256 _id,
uint256 _amount,
bytes calldata _uri_data
) external onlyOwner nonReentrant aboveZero(_id) returns (uint256) {
uint256 _prevId = _id.sub(1);
if (_prevId > 0) {
require(
tokenIdExists[_prevId] == true,
... | 5,458,726 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/co... | Library function to remove array element by its value _array Array to be manipulated _element Element to be removed/ TODO FIX: | function _removeElement(uint256[] memory _array, uint256 _element)
internal
pure
returns (uint256[] memory)
{
for (uint256 i; i < _array.length; i++) {
if (_array[i] == _element) {
delete _array[i];
break;
}
}
}... | 7,301,471 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | Gets the token ID at a given index of the tokens list of the requested owner _owner address owning the tokens list to be accessed _index uint256 representing the index to be accessed of the requested tokens list return uint256 token ID at the given index of the tokens list owned by the requested address/ | function tokenOfOwnerByIndex(
address _owner,
uint256 _index
)
public
view
returns (uint256)
{
require(_index < balanceOf(_owner));
return ownedTokens[_owner][_index];
}
| 151,320 |
pragma solidity ^0.4.23;
contract God {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyTokenHolders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifie... | If we want to rebrand, we can./ | function setSymbol(string _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
| 6,305,755 |
./partial_match/1/0xc22C9A28A93AeBBB88047e390A008A59b8B7EfD5/sources/ArtBurn.sol | Mint token to an address and include it to the given collection. tokenURI must be IPFS hash of metadata.json. contentURI must be IPFS hash of the actuall token content (the art piece). If withdrawOnBurn is set to true, then token owner will receive collection balance, if any, when token is burned./ Mint token Set token... | function mintTo(address to, string memory _tokenURI, string memory _contentURI, bool withdrawOnBurn_, uint256 collectionId, uint256 _maximumEdition, uint8 percentPriceIncreasePerClaim) external onlyOwner {
require(_collectionExists(collectionId), "mintTo: Nonexistent collection.");
require(!collecti... | 15,764,827 |
./partial_match/8453/0xCfB05AB06D338FD85BBF4486e69809D96A906b77/sources/contracts/base/LiquidityManagement.sol | Add liquidity to an initialized pool compute the liquidity amount | function addLiquidity(AddLiquidityParams memory params)
internal
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1,
IDackieV3Pool pool
)
{
PoolAddress.PoolKey memory poolKey =
pool = IDackieV3Pool(PoolAddress.co... | 16,735,442 |
./full_match/44787/0x576b7643d2B3940C83154e0D471196314c1c2dBf/sources/contracts/StarFarm.sol | PoolInfo storage pool = poolInfo[0]; | function testleaveStakingNFT(uint256 _tokenId) public {
UserInfo storage user = userInfo[0][_msgSender()];
require(userNFTs[_msgSender()].length > 0, "no NFT");
updatePool(0);
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain();
uint256 _amountGain = user.amount.add(user... | 13,279,339 |
// 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_793(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,506 |
/**
*Submitted for verification at Etherscan.io on 2022-02-13
*/
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants... | Destroys `tokenId`. Throws if the caller is not token owner or approved tokenId uint256 ID of the token to be destroyed/ | function burn(uint256 tokenId) external {
require(isBurningActive && !luckyDrawActive, "PPTL: Burning not active");
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: Caller not owner or approved");
_burn(tokenId);
}
| 6,790,741 |
./full_match/1/0xB80ccEb6Fa958b52203604D7624F4Abdb4F373F4/sources/src/common/PremiumPriceOracle.sol | Sets default rent prices to be used by nodes that don't have pricing set. _defaultPrices The price array. Each element corresponds to a specific name length; names longer than the length of the array default to the price of the last element. Values are in base p... | function setDefaultPrices(uint256[] memory _defaultPrices) public onlyOwner {
_setDefaultPrices(_defaultPrices);
}
| 8,459,715 |
// File: contracts/ConvertLib.sol
pragma solidity ^0.4.2;
library ConvertLib{
function convert(uint amount,uint conversionRate) returns (uint convertedAmount)
{
return amount * conversionRate;
}
}
// File: contracts/DigitalArtCollectible.sol
pragma solidity ^0.4.13;
/**
* This contract handles the actions fo... | returns the balance of a particular account | function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Collectible... | 6,302,399 |
./partial_match/1/0x5fb10760cBDF27AB8027e1F63f96c173dB1f2f76/sources/CLIFFORDINUDEV.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("CLIFF2.0", "CLIFF2.0") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = ... | 16,076,249 |
./partial_match/3/0x19d4d5dC9E5f2873fdE18c3EB08b53890881CC72/sources/wHNT.sol | See {IERC2612Permit-permit}. EIP712 Domain Separator is automatically recalculated./ | function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public {
require(blockTimestamp() <= deadline, "ERC20Permit: expired deadline");
bytes32 hashStruct = keccak256(
... | 5,170,537 |
./full_match/1/0x89eE2edA0a7201014Ed800db7b526DBD17AFc176/sources/contracts/Boost.sol | Returns staking pool address from given index/ BT_INE: index does not exists | function stakingPool(uint256 index) external view returns (address) {
require(index < stakingPools.length(), "BT_INE");
return address(stakingPools.at(index));
}
| 4,899,374 |
./partial_match/1/0x366fea9d4183d5088952849Ea02b2Db7207686F0/sources/CosmeComics.sol | See {IERC165-supportsInterface}./ | function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC2981, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC2981).interfaceId ||... | 4,306,124 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
//import "hardhat/console.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/// @title Blocklist
/// @notice This contract can be used to ... | Add array of addresses to the blocklist Returns true if any address in the array were added to the blocklist/ | function addToBlocklist(address[] calldata _addresses) external onlyRole(MAINTAINER_ROLE) returns(bool) {
return _addToBlocklist(_addresses);
}
| 14,884,251 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "contracts/plugins/assets/abstract/CompoundOracleMixin.sol";
import "contracts/interfaces/IAsset.sol";
import "contracts/libraries/Fixed.sol";
// ==== External Interfaces... | ==== External Interfaces ==== See: https:github.com/aave/protocol-v2/tree/master/contracts/interfaces | interface IAaveLendingPool {
function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);
pragma solidity 0.8.9;
}
| 14,022,916 |
./full_match/1/0xDb29Ac569bc4906419755039525f1160762fd2D1/sources/DOGE.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount); */
| 8,469,475 |
./full_match/83/0xdb68eC6dFd21791cC9c1f4836b6499e2325461A7/sources/contracts/suErc20Delegator.sol | Applies accrued interest to total borrows and reserves. This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ | function accrueInterest() public returns (uint256) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature('accrueInterest()'));
return abi.decode(data, (uint256));
}
| 9,556,339 |
pragma solidity ^0.4.18;
import '../core/RequestCore.sol';
import '../base/math/SafeMathUint8.sol';
import './RequestEthereumCollect.sol';
import '../base/token/ERC20.sol';
/**
* @title RequestEthereum
*
* @dev RequestEthereum is the currency contract managing the request in Ethereum
* @dev The contract can be pa... | modify 20 bytes in a bytes data bytes to modify offset position of the first byte to modify b bytes20 to insert return address/ | function updateBytes20inBytes(bytes data, uint offset, bytes20 b)
internal
pure
{
require(offset >=0 && offset + 20 <= data.length);
assembly {
let m := mload(add(data, add(20, offset)))
m := and(m, 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000)
m := or(m, div(b, 0x10000000000000... | 14,089,375 |
./partial_match/1/0x90A62dc4BF3f805504a248A49eFC469F406D41b9/sources/src/Contracts/LiquidLocker/LockerMaster.sol | amount The amount of tokens to be locked by the service. Locks the specified amount of tokens by the owner of the contract. It calls the lockToken function of the adapter to lock the tokens for a specific unlock time to manual increase lock in case of DAO government actions/ | function serviceLock(uint256 amount) external onlyOwner {
LiquidLockerSlot storage l = _adapter();
address adapter = l.adapter;
if (adapter == address(0)) revert AdapterDisabled();
if (unlockTime != 0 && unlockTime <= block.timestamp) revert LockingIsOver();
IERC20(l.lockable... | 4,091,691 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.