file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// This is a source code of Ethereum Smart contract for "Recurring Contingent Proof of Retreivability Payment (RC-PoR-P)" protocol.
// It is a conbined contract that includes both SAP and SC smart contracts.
// After deployment of the contract, to interact with the contract you can use either of the following options:... | This function can be called by the client during client-side initiation phase/period (i.e. within the 1st delta) and by the server until the server-side initiation is finished, i.e. the 1st two deltas. | function deposite() payable public{
int256 get_slot_1 = get_slot_1_= (int256(now) - start) / int256(delta);
int256 get_slot_2 = (int256(now) - start - int256(delta)) / int256(delta);
if (msg.sender == client && get_slot_1 == 0){
coin_c = msg.value;
}
if (... | 6,400,395 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol... | change the price per token | function setPublicCost(uint256 newPrice) external onlyOwner {
publicTokenPrice = newPrice;
}
| 6,971,162 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../base/ISWLToken.sol";
import "../base/ERC20.sol";
import "../base/ERC20Capped.sol";
import "../base/ERC20PresetMinterPauser.sol";
import "../erc/utils/SafeMath.sol";
import "../erc/access/Ownable.sol";
/**
* SWL is Sweet Love Token which will used to... | Method used to return rewards number in rewards pool if exist staker in pool and have reward KevinNguyen _stakeholder address of stakeholder/ | function _isRewarder(address _stakeholder) public view virtual returns (bool, uint256) {
for(uint i = 0; i < stakeholders.length; i++) {
if(stakeholders[i] == _stakeholder && rewards[_stakeholder] != 0) {
return (true, rewards[_stakeholder]);
}
}
retur... | 15,830,994 |
./partial_match/1/0xDB7346f9Cc85ED5c81b7daE8A2Da86255c108E6F/sources/SUCKMYDICK.sol | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 2,652,330 |
./partial_match/1/0x99b57Abf76E69E52EfF39a5f876280d4B525119F/sources/contracts/cedar/drop/CedarERC721DropLogic.sol | Book-keeping before the calling contract does the actual transfer and mint the relevant NFTs to claimer. Update the supply minted under mint condition. if transfer claimed tokens is called when `to != msg.sender`, it'd use msg.sender's limits. behavior would be similar to `msg.sender` mint for itself, then transfer to ... | function recordTransferClaimedTokens(
DropERC721DataTypes.ClaimData storage claimData,
uint256 _conditionId,
uint256 _quantityBeingClaimed,
address msgSender
) public returns (uint256[] memory tokens) {
claimData.claimCondition.phases[_conditionId].supplyClaimed += _quant... | 3,659,949 |
// 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... | Allows a user to unstake all their tokens/ | function exit(IERC20[] calldata pools) external {
for (uint256 p; p < pools.length; p++) {
IERC20 pool = pools[p];
unstake(pool, _balances[pool][msg.sender], msg.sender);
}
getReward(pools);
}
| 13,433,234 |
./full_match/80001/0xA6FDC6BA5565249CC4990b894F6D57bFB2B4F9b9/sources/KoNFTFactory_flat.sol | limit batching of tokens due to gas limit restrictions | {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
mapping(uint256 => string) private _tokenURIs;
bytes32 public constant DEPOSITOR_ROLE = keccak256("DEPOSITOR_ROLE");
mapping (uint256 => bool) public withdrawnTokens;
using Strings for uint256;
uint256 public consta... | 9,521,147 |
pragma solidity ^0.4.24;
import "./abstracts/ValidatorSet.sol";
import "./eternal-storage/EternalStorage.sol";
import "./ProxyStorage.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
/**
* @title Consensus utility contract
* @author LiorRabin
*/... | returns maximum stake (wei) for a validator/ | function getMaxStake() public pure returns(uint256) {
return MAX_STAKE;
}
| 1,806,344 |
pragma solidity >=0.5.7 <0.6.0;
import "./ECDSA.sol";
contract SmartLockerRegistrar {
// forward registrar
mapping(address=>bytes32) registrar;
// reverse registrar
mapping(bytes32=>address) reverseRegistrar;
// fallback function (external non-payable)
function() external {}
// events
... | get the key list (external view) | function getKeyList() external view
returns (address[] memory) {
return keyList;
}
| 5,413,725 |
./full_match/42161/0xC593ED16ED921b6c00A5FD5deeecb262073a5877/sources/contracts/smartWallet/SmartWalletFactory.sol | pad code to 64 bytes and position implementation address at lower 20 bytes of word 0 check that rest of the code matches ERC-1167 standart | function getWalletImplementation(address smartWallet) external view returns (address impl) {
bytes memory code = smartWallet.code;
require(code.length == 45, "ERC1167: wrong clone codesize");
code = bytes.concat(new bytes(2), code, new bytes(17));
(uint word0, uint word1) = abi.decode(code, (uint, uin... | 16,307,261 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721Tradable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./utils/IERC20.sol";
contract UniqGenerator is ERC721Tradable{
// ----- VARIABLES ----- //
uint256 internal _verificationPrice;
address internal _tokenForPay... | ----- PUBLIC METHODS ----- | function payForVerification(bytes32 _itemHash) external {
require(!_isItemMinted[_itemHash], "Already minted");
require(
_verificationRequester[_itemHash] == address(0),
"Verification already requested"
);
require(
IERC20(_tokenForPaying).transferF... | 331,025 |
pragma solidity ^0.4.24;
/**
* Copyright YHT Community.
* This software is copyrighted by the YHT community.
* Prohibits any unauthorized copying and modification.
* It is allowed through ABI calls.
*/
//==============================================================================
// Begin: This part c... | get user informations at once/ | function getUserInfos(address addr) view public returns(uint256, uint256, uint256) {
return (
totalSupply_,
balanceOf(addr),
getEarnings(addr)
);
}
| 7,302,901 |
./full_match/1/0x2d68676c40Bf820Eb84e3B7d8d77a1C473b08B61/sources/contracts/crossChainSwaps/CrossChainSwaps.sol | Inherit from ICrossChainSwaps check if trade exist and is in correct state mark trade as requsted recovery emit event | function requestRecovery(
bytes32 tradeOfferHash,
TradeConstants calldata tradeConstants
) external override {
Trade storage trade = _state.trades[tradeOfferHash];
if (trade.status != Status.PENDING) {
revert SwapError(SwapErrorCode.INVALID_TRADE_STATUS);
}
... | 17,067,064 |
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/introspection/[emailΒ protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.... | Set maximal fungible tickets possible to mint per pool (pool == class == tokenId)/ | function setMaxFungibleTicketsPerPool(
uint _maxFungibleTicketsPerPool
)
external
onlyHordCongress
{
require(_maxFungibleTicketsPerPool > 0);
maxFungibleTicketsPerPool = _maxFungibleTicketsPerPool;
}
| 7,819,923 |
/**
*Submitted for verification at Etherscan.io on 2021-02-02
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | utility, checks whether allowance for the given spender exists and approves one if it doesn't. note that we use the non standard erc-20 interface in which `approve` has no return value so that this function will work for both standard and non standard tokens _token token to check the allowance in _spender approved ... | function ensureAllowance(
IERC20Token _token,
address _spender,
uint256 _value
) private {
uint256 allowance = _token.allowance(address(this), _spender);
if (allowance < _value) {
if (allowance > 0) safeApprove(_token, _spender, 0);
safeApprove(_to... | 2,294,319 |
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/utils/ERC1155Base.sol | ERC165 compatibility for ERC1155 skip interfaceId the hash signature of the interface id/ | function supportsInterface(bytes4 interfaceId) external override view returns (bool) {
if (interfaceId == ERC1155_INTERFACE) return true;
}
| 16,064,804 |
./partial_match/1/0x916c729002C041972c640390A0fAD1Db29b6a6c2/sources/Whitelist.sol | Called once to complete configuration for this contract. Done with `initialize` instead of a constructor in order to support using this contract via an Upgradable Proxy./ | function initialize(address _callingContract) public {
Ownable.initialize(msg.sender);
_initializeOperatorRole();
callingContract = IERC20(_callingContract);
}
| 11,021,670 |
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* ... | ===== View Functions ===== | function version() external pure returns (string memory) {
return "1.2";
}
| 10,188,579 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function GETORCACHEVALIDITYBOND873() public returns (uint256); | 2,554,000 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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 one... | ========== Status Queries ========== / | function getCurrentLiquidityDeltas() external view override returns (int256[] memory liquidityDeltas) {
(IErc20Adapter[] memory adapters, uint256[] memory weights) = getAdaptersAndWeights();
BalanceSheet memory balanceSheet = getBalanceSheet(adapters);
liquidityDeltas = AdapterHelper.getLiquidityDeltas(
... | 11,951,375 |
pragma solidity ^0.4.19;
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 ... | Edit a city if it hasn't been bought yet requires | function adminEditCity(uint16 _cityId, string _name, uint256 _price, address _owner) public {
require(msg.sender == unitedNations);
require(cities[_cityId].owner == 0x0);
cities[_cityId].name = _name;
cities[_cityId].price = _price;
cities[_cityId].owner = _owner;
}
| 12,845,465 |
/**
* SPDX-License-Identifier: MIT
*/
// Wagmi - WE ARE ALL GOING TO MAKE IT
pragma solidity ^0.8.6;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
function... | The code below removes balances of addresses excluded from rewards from rSupply and tSupply, which effectively increases the % of transaction fees delivered to non-excluded holders/ | function _getCurrentSupply() internal view returns(uint256, uint256) {
uint256 rSupply = _reflectedSupply;
uint256 tSupply = _totalSupply;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_reflectedBalances[_excluded[i]] > rSupply || _balances[_excluded[i]] > tSupply)
... | 1,752,395 |
./partial_match/42/0x06e3E20Dc439B5270470aDF0cCF7d621fcA8Cd49/sources/YFDStaking.sol | Deposit LP tokens to MasterFarmer for YFD allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accYfdPerShare).div(1e12).sub(user.rewardDe... | 3,388,882 |
pragma solidity ^0.5.3;
import './ModuloMathLib.sol';
contract KeyGenProofVerifier {
using ModuloMathLib for uint256;
struct Proof {
uint256 c;
uint256 d;
}
struct Parameters {
uint256 p; // prime
uint256 q; // prime factor: p = 2*q+1
uint256 g; // generator
... | recompute the challenge c = hash(id, h_, b) verify that: g^d == b h_^c | function verifyProof(
uint256 c,
uint256 d,
) public view returns (bool) {
uint256 p = parameters.p;
uint256 q = parameters.q;
uint256 g = parameters.g;
Proof memory _proof = Proof(c, d);
uint256 b = computeB(g, p, h_, _proof.d, _proof.c);
uint2... | 15,849,969 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental A... | inject NONSTANDARD NAMING | function GETNONCE95() external view returns (uint256 nonce); | 5,491,982 |
pragma solidity ^0.8.0;
/**
* @title DelegateCall
* @dev Calls delegates for non view functions only
*
* @author Cyril Lapinte - <cyril.lapinte@openfiz.com>
* SPDX-License-Identifier: MIT
*
* Error Messages:
**/
library DelegateCall {
function _delegateCall(address _delegate) internal returns (bool status)... | solhint-disable-next-line avoid-low-level-calls | function _delegateCallBytes(address _delegate)
internal returns (bytes memory result)
{
bool status;
(status, result) = _delegate.delegatecall(msg.data);
require(status, string(result));
}
| 6,423,640 |
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/SqrtPriceMath.sol | Gets the amount0 delta between two prices Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper), i.e. liquidity (sqrt(upper) - sqrt(lower)) / (sqrt(upper) sqrt(lower)) sqrtRatioAX96 A sqrt price assumed to be lower otherwise swapped sqrtRatioBX96 Another sqrt price liquidity The amount of usable liquidity ... | function getAmount0Delta(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity,
bool roundUp
) internal pure returns (uint256 amount0) {
(sqrtRatioAX96, sqrtRatioBX96) = TernaryLib.sort2(sqrtRatioAX96, sqrtRatioBX96);
assembly ("memory-safe") {
... | 15,622,160 |
./partial_match/1/0x34BB76F3EAD9d5D2a2DbA3F040072a6524E2DC7F/sources/TransferOnlySGATokenManager.sol | Handle the operation of ETH deposit into the SGAToken contract. _sender The address of the account which has issued the operation. _balance The amount of ETH in the SGAToken contract. _amount The deposited ETH amount. return The address of the reserve-wallet and the deficient amount of ETH in the SGAToken contract./ | function uponDeposit(address _sender, uint256 _balance, uint256 _amount) external returns (address, uint256) {
require(false, "SGA token has been deprecated. Use SGR token instead");
_sender;
_balance;
_amount;
return (address(0), 0);
}
| 3,663,952 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
/**
* @dev Collection of functions related to array 256 types.
*
* Originally based on code by Zabo. It has been upgraded to be compatible with
* solidity version ^0.6 and apply `SafeMath` library f... | Utility function for heapSort/ | function _getLeftChildI(uint256 index) private pure returns (uint256) {
uint256 i = index.mul(2);
return i.add(1);
}
| 12,848,554 |
./full_match/3/0x019bb07DE90Ba9D48cA35178cAdD92a600098CfA/sources/token-tjs.sol | ------------------------------------------------------------------------ Transfer the balance from token owner's account to receiver account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address receiver, uint tokens) public override returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens * 10**decimals);
balances[receiver] = safeAdd(balances[receiver], tokens * 10**decimals);
emit Transfer(msg.sender, receiver, tokens * 10**dec... | 8,216,882 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c ... | unset token's pause | function unpauseToken() external onlyOwner {
Token(token).unpause();
}
| 11,844,901 |
./full_match/4/0x164c24d0844c267DA15a4c841eaBae817d211EA1/sources/Users/hristiyangeorgiev/Documents/Projects/Redemeum/ERC20/bsn-core-prototype/contracts/IERC721TokenReceiver.sol | Note: the ERC-165 identifier for this interface is 0x150b7a02. | interface ERC721TokenReceiver {
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4);
} | 13,350,975 |
./partial_match/1/0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9/sources/lib/hats-module/src/HatsModule.sol | /// This contract is a clone with immutable args, which means that it is deployed with a set of immutable storage variables (ie constants). Accessing these constants is cheaper than accessing regular storage variables (such as those set on initialization of a typical EIP-1167 clone), but requires a slightly different a... | function IMPLEMENTATION() public pure returns (address) {
return _getArgAddress(0);
}
| 2,750,310 |
./partial_match/1/0xE0926B2f1B37c2DAE0c5682F5Fd75ADf83CFe771/sources/BCHShifter.sol | shiftOut burns tokens after taking a fee for the `_feeRecipient`. _to The address to receive the unshifted digital asset. The format of this address should be of the destination chain. For example, when shifting out to Bitcoin, _to should be a Bitcoin address. _amount The amount of the token bein... | function shiftOut(bytes memory _to, uint256 _amount) public returns (uint256) {
require(_to.length != 0, "to address is empty");
require(_amount >= minShiftAmount, "amount is less than the minimum shiftOut amount");
uint256 absoluteFee = (_amount.mul(fee)).div(BIPS_DENOMINATOR);
tok... | 9,160,825 |
./full_match/97/0x13c67E6865c2BFe41Db37308E3992022bf1bA686/sources/project_/contracts/USDT.sol | Forward ERC20 methods to upgraded contract if this one is deprecated | function transferFrom(
address _from,
address _to,
uint _value
) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return
UpgradedStandardToken(upgradedAddress).transferFromByLegacy(
msg.sender,
... | 3,290,937 |
pragma solidity 0.4.18;
contract SafeMath {
function safeMul(uint a, uint b) pure internal returns(uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) pure internal returns(uint) {
assert(b <= a);
return a - b;
}
... | Name of the token Symbol of token | {
string public constant name = "Mari";
string public constant symbol = "MAR";
uint8 public constant decimals = 18;
address public owner;
uint256 public _price_tokn = 483 ;
uint256 no_of_tokens;
bool stopped = true;
uint256 startdate;
uint256 enddate;
mapping(address => uint) b... | 15,099,898 |
/*
Copyright 2020 ZeroEx Intl.
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 writing, ... | Sample buy quotes from Shell contract takerToken Address of the taker token (what to sell). makerToken Address of the maker token (what to buy). makerTokenAmounts Maker token buy amount for each sample. return takerTokenAmounts Taker amounts sold at each maker token amount. Initialize array of maker token am... | function sampleBuysFromShell(
address takerToken,
address makerToken,
uint256[] memory makerTokenAmounts
)
public
view
returns (uint256[] memory takerTokenAmounts)
{
uint256 numSamples = makerTokenAmounts.length;
takerTokenAmounts = new uint256... | 5,396,440 |
./partial_match/3/0x6aa269b701E9666Fe5314ec6deB2B907cDE1A8b2/sources/LDBToken.sol | Transfers are allowed only after the end of minting | function transfer(address _to, uint256 _value) public returns (bool) {
require(wasMintingFinished(), "cant transfer before minting finished");
return super.transfer(_to,_value);
}
| 5,218,522 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
interface IERC20 {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view... | don't need to define other functions, only using `transfer()` in this case | interface IERC20 {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
pragma solidity ^0.8.0;
}
| 10,114,501 |
./partial_match/1/0x9A93a421b74F1c5755b83dD2C211614dC419C44b/sources/src/LBRouter.sol | Simulate a swap out pair The address of the LBPair amountIn The amount of token sent swapForY Whether you swap X for Y (true), or Y for X (false) return amountInLeft The amount of token In that can't be swapped due to a lack of liquidity return amountOut The amount of token received if amountIn tokenX are sent retur... | function getSwapOut(ILBPair pair, uint128 amountIn, bool swapForY)
external
view
override
returns (uint128 amountInLeft, uint128 amountOut, uint128 fee)
{
(amountInLeft, amountOut, fee) = pair.getSwapOut(amountIn, swapForY);
}
| 9,304,482 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | Calculates how many shares are required to withdraw so much from a given gToken. _token The gToken to withdraw from. _underlyingCost The desired amount to be withdrawn. return _grossShares The number of shares required to withdraw the desired amount./ | function _calcWithdrawalSharesFromUnderlyingCost(Self storage /* _self */, address _token, uint256 _underlyingCost) internal view returns (uint256 _grossShares)
{
uint256 _totalReserve = GCToken(_token).totalReserve();
uint256 _totalSupply = GCToken(_token).totalSupply();
uint256 _withdrawalFee = GCToken(_token... | 2,650,991 |
./full_match/83/0x27C488b243904A598758E6fb0C18F99530016B88/sources/contracts/BaseV1-periphery.sol | refund dust eth, if any | function addLiquidityETH(
address token,
bool stable,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
(amoun... | 9,563,783 |
./full_match/11155111/0x84a9bA8F1F3546Baa2c9b7bC20073EE6a3a0c83e/sources/project:/contracts/staticVault/staticVault.sol | allow any token holder to swap their tokens for the underlying assets amount the amount of tokens to swap (in the smallest unit of the token)/ Burn the tokens get the fee Transfer the underlying assets | function redeem(uint256 amount) checkValue(amount) external {
ITokenLogic token = ITokenLogic(_token);
require(token.balanceOf(msg.sender) >= amount, "Not enough tokens to burn");
token.burn(amount, msg.sender);
for (uint256 i = 0; i < _tokens.length; i++) {
IERC20 unde... | 3,788,571 |
./partial_match/1/0x6c9EE65Aea249d57296e31b10ad419303Ae59762/sources/messi.sol | Create a uniswap pair for this new token set the rest of the contract variablesexclude owner and this contract from fee exclude from the Max wallet balance exclude from the max tnx limit | constructor () ERC20("MESSIvsRONALDO", "GOATVOTE.IO"){
numTokensSellToSendEthToDev = 2000 * 10 ** decimals();
_devWalletAddress = 0x4E74C0C0507e0C42AFfdA2A0ECd3A810079C147F;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb... | 9,408,053 |
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench
//---------------------------------------------
//Generated automatically for application 'RoomThermostat' by AppCodeGen utility
//---------------------------------------------
import "./RoomThermostat.sol";
contract... | Placeholder for function preconditions Call function SetMode of RoomThermostat Placeholder for function postconditions Signals successful execution of function SetMode | function SetMode(RoomThermostat.ModeEnum mode) public {
RoomThermostat.SetMode(mode);
WorkbenchBase.ContractUpdated("SetMode");
}
| 7,290,915 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPolicyPool} from "../interfaces/IPolicyPool.sol";
import {Policy} from "./Policy.sol";
import {RiskModule} from "./RiskModule.sol";
import {Chainlink} from "@chainlink/contracts/src/v0.8/Chainlink.sol";
import {ChainlinkClientUpgradeable} from "./depende... | Forces the resolution of the policy (without waiting Chainlink scheduled on creation) policyId The id of the policy previously created (in newPolicy)/ | function resolvePolicy(uint256 policyId) external onlyRole(PRICER_ROLE) returns (uint256) {
PolicyData storage policy = _policies[policyId];
require(policy.expectedArrival != 0, "Policy not found!");
_chainlinkRequest(policyId, policy, 0);
return policyId;
}
| 7,242,667 |
/**
*Submitted for verification at Etherscan.io on 2020-03-13
*/
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental... | Increment nonce in order to prevent reuse of signatures after the call. Use all available cTokens to mint the respective dTokens. If any step in the process fails, the call will revert and prior steps will be rolled back. Also note that existing underlying tokens are not included as part of this operation./ | function _migrateCTokenToDToken(AssetType token) internal {
CTokenInterface cToken;
DTokenInterface dToken;
function _validateActionAndIncrementNonce(
ActionType action,
bytes memory arguments,
uint256 minimumActionGas,
bytes memory userSignature,
bytes memory dharmaSignature
}
... | 985,303 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "ds-test/src/test.sol";
import "openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol";
import "openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
import "./SphinxSociety.sol";
// hevm interface to modify tes... | try setting baseURI as user | function testFail_setBaseUri_asUser() public {
}
| 6,415,125 |
./partial_match/4/0x65826D82FDB2b8c27D433D1A1b1f13890D7a0953/sources/ToshiDojo.sol | We need to call this function, if we ever mint manually some cards included in a pack | function updateCardsData(
uint256[][] memory _cardIndexList,
uint256[][] memory _cardIdList,
uint256 _packId,
uint256[] memory _tierSizes
) public onlyOwner {
for (uint256 i = 0; i < _cardIdList.length; ++i) {
if (_tierSizes[i] > 0) {
packs[_packId].cardIdList[i]... | 8,702,693 |
/**
*Submitted for verification at hecoinfo.com on 2021-05-20
*/
pragma solidity ^0.6.0;
//SPDX-License-Identifier: UNLICENSED
contract addressController {
address public owner;
address public manager;
mapping(string => address) public addrList;
mapping(address => bool) public ManagerList;
mappin... | function addManager(address _addrM) public onlyOwner{ | function addManager(address _addrM) public onlyOwner{
ManagerList[_addrM] = true;
}
| 9,908,493 |
/**
* This contract specifically stores all the user
* data to avoid inconsistencies during Blockvitae
* contract update.
*
* This files acts as the DB layer between the
* model User.sol and the controller Blockvitae.sol
*/
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2; // experimental
// im... | @description checks if the user with given address exists address _user address of the user to be looked up return bool true if user exists else false | function isUserExists(address _user) public view isOwner(msg.sender) returns(bool) {
require(_user != address(0));
return db.isExists(_user, msg.sender);
}
| 12,780,487 |
./full_match/1/0x52DDEb52a755cEa4B62d1bAd072Cc2627e15BBDb/sources/Users/wz/c_r_y_p_t_o/l7l/contracts/Booty.sol | Helper to check shares of user based on current state. _payee Address of user whose balance we are checking. _state Cached current game state./ | function sharesByState(address _payee, State _state) public view returns (uint256) {
if (_state == State.BlueWon) {
return blueShares[_payee];
return greenShares[_payee];
return blueShares[_payee].add(greenShares[_payee]);
return 0;
}
}
| 3,072,166 |
./full_match/100/0x2582A3aa105227b23805E2A099c834d28AD7290A/sources/contracts/official/SB01/SB01Token.sol | Returns the total amount of payments needed to finish this contract/ | function getPaymentCount() public view returns (uint256) {
return PERIOD_VALUES.length;
}
| 14,282,333 |
pragma solidity ^0.4.20;
/*
* ====================================*
* _____ ____ ____ _______ *
* | ___| / __ \ | \ |__ __| *
* | |___ | |__| | | / | | *
* | ___|| __ | | |\ \ | | *
* | | | | | | | | \ \ | | *
* |_| |_| |_| |_| \_\ |_| *
* ========... | Adds two numbers, throws on overflow./ If you have read all the way to here, thank you. You are one of the good players that does their OWN resarch! Way to go! | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| 2,420,041 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IPriceFeed.sol";
import "../interfaces/IPriceProvider.sol";
import "../interfaces/IConfigurationManager.sol";
/**
* @title PriceProvider
* @author Pods Finance
* @notice Storage ... | Unregister price feeds Will not remove unregistered assets _assets Array of assets/ | function removeAssetFeeds(address[] memory _assets) external override onlyOwner {
for (uint256 i = 0; i < _assets.length; i++) {
address removedFeed = address(_assetPriceFeeds[_assets[i]]);
if (removedFeed != address(0)) {
delete _assetPriceFeeds[_assets[i]];
... | 13,467,162 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... | Removes a protocol adapter. protocolAdapterName Protocol adapter's protocolAdapterName./ | function removeProtocolAdapter(bytes32 protocolAdapterName) internal {
require(
_protocolAdapterAddress[protocolAdapterName] != address(0),
"PAM: does not exist[1]"
);
uint256 length = _protocolAdapterNames.length;
uint256 index = 0;
while (_protocolA... | 6,394,053 |
./partial_match/1/0xd9b7eC74C06c558A59AfdE6a16E614950730F44d/sources/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol | View function that returns appropriate revenue splits between different render provider, platform provider, Artist, and Artist's additional primary sales payee given a sale price of `_price` on project `_projectId`. This always returns four revenue amounts and four addresses, but if a revenue is zero for either Artist ... | function getPrimaryRevenueSplits(
uint256 _projectId,
uint256 _price
)
external
view
returns (
uint256 renderProviderRevenue_,
address payable renderProviderAddress_,
uint256 platformProviderRevenue_,
address payable platfor... | 3,903,929 |
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/FunctionsRouter.sol | Used within FunctionsSubscriptions.sol | function _whenNotPaused() internal view override {
_requireNotPaused();
}
| 4,322,566 |
./partial_match/1/0x441761326490cACF7aF299725B6292597EE822c2/sources/IERC20.sol | ERC20 interface/ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
... | 2,615,368 |
/*
Copyright 2020 ZeroEx Intl.
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 writing, ... | Returns (a <= b); Requires trimmed inputs If the current byte of a is less than that of b then a is less than b If it's strictly more then b is greater | function lte(bytes memory a, bytes memory b) internal pure returns (bool) {
if (a.length < b.length) {
return true;
}
if (a.length > b.length) {
return false;
}
for (uint i = 0; i < a.length; i++) {
if (a[i] < b[i]) {
retur... | 12,980,130 |
pragma solidity ^0.4.24;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "@0x/contracts-utils/contracts/src/SafeMath.sol";
import "./interfaces/IERC20Token.sol";
contract ERC20Token is IERC20Token, SafeMath {
using LibBytes for bytes;
// EXTERNAL FUNCTIONS
constructor() public {
... | Approves account with address `spender` to spend `value` amount of tokens on behalf of account `msg.sender`. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by an unfortunate transaction ordering. One possible solution to mitigate this rare cond... | function approve(address spender, uint256 value) external returns (bool) {
_allowances[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 12,796,314 |
./full_match/137/0xb6Bc9B50b4AC1397AB03d8a24d8fa529a5070ff0/sources/contracts/wallet/ModuleManager.sol | Allows a Module to execute a Safe transaction without any further confirmations and return data to Destination address of module transaction. value Ether value of module transaction. data Data payload of module transaction. operation Operation type of module transaction. solhint-disable-next-line no-inline-assembly... | function execTransactionFromModuleReturnData(
address to,
uint256 value,
bytes memory data,
Operation operation
) public returns (bool success, bytes memory returnData) {
success = execTransactionFromModule(to, value, data, operation);
assembly {
let p... | 4,740,324 |
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
// File: contracts/CoinFlip.sol
pragma solidity ^0.8.7;
contract CoinFlip {
struct GameData {
address p1;
address p2;
uint16 status;
uint wager;
bytes32 p1Hash;
bytes32 p2Hash;
}
address pr... | ~52k gas Update game data with player2 and status 2 (awaiting randomness) | function joinGame(uint176 id, bytes32 hash) payable external {
GameData memory g = getGameData(id, false);
require(g.status == 1, "Bad Status");
require(g.wager == msg.value, "Wrong Wager");
games[id] = encodeGameData(2, msg.sender);
playerHashes[id+2] = hash;
emit... | 7,613,749 |
/**
*Submitted for verification at Etherscan.io on 2021-04-01
*/
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
// Part: AddressUpgradeable
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
... | Set guardian. This is a trusted account with the powers to pause and unpause trading and to emergency withdraw. These protections are needed for example to protect funds if there is an oracle mispricing./ | function setGuardian(address _guardian) external onlyGovernance {
guardian = _guardian;
}
| 7,646,958 |
./full_match/5/0xF97933b24de3D6339061cC2Ec5C9e609fFFeA8d5/sources/project_/contracts/BaseContracts/Base721Staking.sol | Stakes user's NFTs tokenIds The tokenIds of the NFTs which will be staked Transfer user's NFTs to the staking contract Increment the amount which will be staked Save who is the staker/depositor of the token | function stake(uint256[] memory tokenIds)
external
nonReentrant
whenNotPaused
updateReward(msg.sender)
{
require(tokenIds.length != 0, "Staking: No tokenIds provided");
uint256 amount;
for (uint256 i = 0; i < tokenIds.length; i += 1) {
staking... | 1,883,446 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | Refreshes the address of the other contracts the contract interacts with called by the registry contract upon an update of a contract in the registry | function refreshContracts() external override {
electionsContract = IElections(getElectionsContract());
stakingContractHandler = IStakingContractHandler(getStakingContractHandler());
stakingRewardsContract = IStakingRewards(getStakingRewardsContract());
}
| 615,414 |
/**
* Developed by The Flowchain Foundation
*
* The Flowchain tokens (FLC v2) smart contract
*/
pragma solidity 0.5.16;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contr... | Suspend the issuance of new tokens. Once set to false, '_isIssuable' can never be set to 'true' again./ | function suspendIssuance() external onlyOwner {
_isIssuable = false;
}
| 7,232,531 |
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/Portfolios.sol | A generic, internal function that trades positions within a portfolio. account account that holds the portfolio to trade currency the currency that the trades should be denominated in amount of cash available tradeType the assetType to trade in the portfolio/ Only Escrow can execute actions to trade the portfolio A... | function _tradePortfolio(
address account,
uint16 currency,
uint128 amount,
bytes1 tradeType,
Common.Asset[] memory portfolio
) internal returns (TradePortfolioState memory) {
require(calledByEscrow(), "20");
TradePortfolioState memory state = TradePortfo... | 16,064,682 |
./full_match/5/0x012824681E098B5Aa9ee91B39777F3DB2aB7Bd42/sources/contracts/ContinuousOffering.sol | Eth value to go from one amount of (sold) tokens tothe other, either by buying or selling. Assume _tokenEnd >= _tokenStart.No overflow check: make sure contractTokenGrant exponent coefnum < 2256 | function areaUnderCurve(
uint _tokenStart,
uint _tokenEnd
) internal view
returns(uint)
{
return coefNum * (_tokenEnd ** (exponent + 1) - _tokenStart ** (exponent + 1))
/ (coefDen * (exponent + 1))
+ offset * (_tokenEnd - _tokenStart);
}
| 1,921,739 |
./full_match/1/0xa3F4fB87e19B60622bEA119C4469c0Df2c7c4739/sources/contracts/interfaces/ICurvePlainPool.sol | ren and sbtc pool ren and sbtc pool | interface ICurvePlainPool {
function exchange(
int128 i,
int128 j,
uint256 dx,
uint256 min_dy
) external payable;
function get_dy(
int128 i,
int128 j,
uint256 dx
) external view returns (uint256);
function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external... | 4,924,498 |
./full_match/100/0x62D007D4c4Db781C24FF6ac19279B9A9Ec32b344/sources/contracts/recover/recover.sol | Give a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract. _disputeID ID of the dispute in the Arbitrator contract. _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting ... | function rule(uint _disputeID, uint _ruling) override external {
require(_msgSender() == address(arbitrator), "The sender of the transaction must be the arbitrator.");
require(Status.DisputeCreated == itemClaim.status, "The dispute has already been resolved.");
emit Ruling(Arbitrator(_msg... | 14,273,944 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "../libraries/Address.sol";
import "../libraries/SafeMath.sol";
import "../libraries/SafeERC20.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/ITreasury.sol";
import "../types/Ownable.sol";
interface IMasterChef {
function... | remove liquidity pool and corresponding PID _pool address _index uint/ | function removePool(address _pool, uint256 _index) external onlyOwner {
uint256 pid = pids[_index];
require(pools[pid] == _pool);
pids[_index] = 0;
pools[pid] = address(0);
}
| 14,026,015 |
// File: openzeppelin-solidity/contracts/utils/Address.sol
pragma solidity ^0.5.0;
/**
* @dev Collection of functions related to the address type,
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the... | Update the rank of token. Can only be called by owner. token The token contract address. rank The rank to be assigned./ | function updateTokenRank(address token, uint256 rank) external onlyOwner {
(bool ok,) = _implementation().delegatecall(
abi.encodeWithSignature("updateRank(address,uint256)", token, rank)
);
require(ok);
}
| 14,016,244 |
./full_match/44787/0x2AE92543eC7C10bd76502a2149Fbd1408FA2FCda/sources/contracts/StarFarm.sol | Withdraw LP tokens from MasterChef.require (_pid != 0, 'withdraw STAR by unstaking');if (_pid == 0) require(userNFTs[_msgSender()].length == 0, "nft user");uint256 _amountGain = _useramount.add(_useramount.mul(_selfGain).div(100));uint256 _nftAmountGain = user.nftAmount.add(user.nftAmount.mul(_selfGain).div(100)); | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_msgSender()];
uint256 _useramount = user.amount.sub(user.nftAmount);
require(_useramount >= _amount, "withdraw: amount error");
updatePool... | 13,290,416 |
pragma solidity ^0.5.0;
import "../InitializableV2.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "../Staking.sol";
import "../AudiusAdminUpgradeabilityProxy.sol";
// TEST ONLY MOCK ... | Used to intentionally generate a function signature clash with AudiusAdminUpgradeabilityProxy Returns current address instead of proxy admin address | function getAudiusProxyAdminAddress() external view returns (address) {
return address(this);
}
| 6,406,337 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./GetLastPrice.sol";
contract OBdefiStaking {
// Constants
uint public constant STAKING_RATE = 6;
// define here what the r... | calculate reward amount for a given token tokenAddress address of the staked token return uint | function getTokenReward (address tokenAddress) public view returns (uint) {
int arrayIndex = int(tokenMap[tokenAddress]) - 1;
if (arrayIndex == -1) {
return 0;
}
else {
return calculateReward(tokens[uint(arrayIndex)]);
}
}
| 6,347,119 |
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.13;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces... | Allows the `from` to withdraw `from` his/her tokens or the `router` from `MAIL_DEPLOYER`. token The ERC20 token the `msg.sender` wishes to withdraw amount The number of `token` the `msg.sender` wishes to withdraw to The account, which will receive the tokens Requirements: - Only the `msg.sender` or the `router` can ... | function withdraw(
address token,
uint256 amount,
address to
) external isMarketListed(token) isSolvent {
_accrue(token);
_withdraw(token, amount, msg.sender, to);
}
| 15,826,787 |
./partial_match/56/0x24CE0E58D074eEf5868E99C770430F2dCEFB2e9B/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accTripPerShar... | 11,096,480 |
./partial_match/1/0x8e80Fe2beA6878a0192BEeb14dF355Ae5284f5b8/sources/RollERCGame.sol | Transfer betAmount from each player's wallet to this contract | function startGame(int64 groupId, address[] memory _wallets, uint96 betAmount, uint80 _playerCount) external onlyOwner {
require(_wallets.length == _playerCount, "Mismatch in wallets length and player count.");
require(_playerCount < maxPlayers, "You are trying to start a game with more players tha... | 15,485,873 |
./partial_match/1/0x4A2be89f57846c7cdd66428017B2524D0b298518/sources/FullWithdrawals.sol | Return request value. Expect zero if the request doesn't exist or has been serviced, and a non-zero value otherwise. | function getFullWithdrawalRequest(uint256 starkKey, uint256 vaultId)
external
view
returns (uint256 res)
{
res = fullWithdrawalRequests[starkKey][vaultId];
}
| 4,465,909 |
/**
*Submitted for verification at Etherscan.io on 2021-02-12
*/
pragma solidity 0.8.0;
pragma abicoder v2;
interface MassetStructs {
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfe... | Update transfer fee flag for a given bAsset, should it change its fee practice _bAssetPersonal Basset data storage array _bAssetIndexes Mapping of bAsset address to their index _bAsset bAsset address _flag Charge transfer fee when its set to 'true', otherwise 'false'/ if token has tx fees, it can no ... | function setTransferFeesFlag(
MassetStructs.BassetPersonal[] storage _bAssetPersonal,
mapping(address => uint8) storage _bAssetIndexes,
address _bAsset,
bool _flag
) external {
uint256 index = _getAssetIndex(_bAssetPersonal, _bAssetIndexes, _bAsset);
_bAssetPerson... | 2,378,699 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./lib/Withdrawable.sol";
import "./TraceToMetaInfoInterface.sol";
import "./TraceToRequestorListInterface.sol";
import "./TraceToSPListInterface.sol";
import "./TraceToVerifierListInterface.sol";
import "./TraceToProfileToken... | get kyc token list by profile token id _tokenId profile token id return _kycTokens the list for this profile's kyc tokens/ | function getProfileKYCs(uint256 _tokenId)
public
view
returns (uint256[] _kycTokens){
_kycTokens = new uint256[](profileTokens[_tokenId].totalKYCTokens);
for (uint256 i = 0; i<profileTokens[_tokenId].totalKYCTokens; i = i.add(1)){
_kycTokens[i] = profileTokens[_tokenId].kycTo... | 15,802,798 |
./full_match/1/0xd0CA3F9B0E22a45536991889B8881642411eB7F8/sources/contracts/LBPController.sol | Creates the CRP smart pool and initializes its parameters Needs owner to have approved the tokens and collateral before calling this (manually and externally) This LBPController becomes the Controller of the CRP and holds its liquidity tokens Most of the logic was taken from https://github.com/balancer-labs/bactions... | function createSmartPool() external onlyOwner {
require(address(crp) == address(0), "LBPController.createSmartPool, pool already exists");
CRPFactory factory = CRPFactory(CRPFactoryAddress);
require(poolParams.constituentTokens.length == ConstituentsCount, "ERR_LENGTH_MISMATCH");
require(poolParams.t... | 2,969,521 |
./partial_match/1/0x4e9bBd716E045D2bA93a0cdf0e7aF7F34B9a4745/sources/CbmToken.sol | 컨νΈλνΈκ° μμ±λ λ μ€ν. 컨νΈλ νΈ μμ μ μ§κ°μ λͺ¨λ ν ν°μ ν λΉνλ€. λ°νλμ΄λ μ΄λ¦μ μμ€μ½λμμ νμΈν μ μλλ‘ λ³κ²½νμμ/ μ΄ Cbm λ°νλ (10μ΅) wei λ¨μλ‘ ν ν° μ΄λμ μμ±νλ€. | function CbmToken() public {
uint256 supplyCbm = 1000000000;
totalSupply = supplyCbm * 10 ** uint256(decimals);
balances[msg.sender] = totalSupply;
Transfer(0x0, msg.sender, totalSupply);
}
| 2,643,837 |
./full_match/1/0xCd28c86b3Fd08b135F4e1c7c95e39cecD8F36E60/sources/project_/contracts/Raptors.sol | Only Owner Function to withdraw ETH sent to contract receiver Address to withdraw ETH to/ | function withdrawAllEth(address receiver) public virtual onlyOwner {
uint256 balance = address(this).balance;
payable(receiver).transfer(balance);
emit BalanceWithdrawn(receiver, balance);
}
| 3,130,483 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/saviours/NativeUnderlyingUniswapV2SafeSaviour.sol
pragma solidity =0.6.7 >=0.6.0 <0.8.0 >=0.6.7 <0.7.0;
////// src/interfaces/CoinJoinLike.sol
/* pragma solidity 0.6.7; */
abstract contract CoinJoinLike {
function systemCoin() virtual public ... | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function setDefaultCRatio(bytes32, uint256) virtual external;
function setMinDesiredCollateralizationRatio(bytes32 collateralType, uint256 cRatio) virtual external;
function setDesiredCollateralizationRatio(bytes32 collateralType, uint256 safeID, uint256 cRatio) virtual external;
}
}
function add(u... | 8,007 |
./partial_match/44787/0x76Eb2820207313AFf098478A64996ca38C6052ff/sources/contracts/CarbonPathAdmin.sol | Buy CPCO2 Tokens from the contract This automatically transfer cUSD to the seller address/ cpAmount amount of CPCO2 tokens to be bought | function buy(uint256 cpAmount) external nonZeroAmount(cpAmount) {
require(carbonPathToken.balanceOf(address(this)) >= cpAmount, "Admin: not enough balance");
uint256 requiredAmount = _calculateStableTokenAmount(cpAmount);
require(
stableToken.balanceOf(_msgSender()) >= requiredAmount,
"Admin:... | 16,956,774 |
./partial_match/3/0x717ad870a38f1fCE670Ec17F3e25C373F7cE0e56/sources/VORFaucet.sol | send 5000 Token with a minimum time lock of 5 hours | function drip5Token()
public
faucetOn()
{
if(checkStatus(msg.sender)) {
revert();
}
tokenInstance.transfer(msg.sender, fiveKToken);
updateStatus(msg.sender, fiveHours);
emit FiveKTokenSent(msg.sender);
}
| 5,117,980 |
./full_match/80001/0x0a4aFA9E1cF6367cc4C62574F97909b187B9fd9B/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, Metadata memory metadata) public override isNotExistNTT(tokenId) onlyRole(MINT_ROLE) {
address account = msg.sender;
_nttBalances[account].push(tokenId);
_nttOwners[tokenId] = account;
_mint(account, tokenId, TOKEN_MINT_COUNT, "");
_n... | 877,521 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/token.sol
// SPDX-License-Identifier: MIT AND GPL-3.0-only
pragma solidity >=0.8.0 <0.9.0 >=0.8.2 <0.9.0 >=0.8.7 <0.9.0;
////// lib/openzeppelin-contracts/contracts/utils/Context.sol
/* pragma solidity ^0.8.0; */
/**
* @dev Provides information... | Sets the user's or the account's drips configuration. Transfers funds between the user's wallet and the drips hub contract to fulfill the change of the drips balance. userOrAccount The user or their account lastUpdate The timestamp of the last drips update of the user or the account. If this is the first update, pass... | function _setDrips(
UserOrAccount memory userOrAccount,
uint64 lastUpdate,
uint128 lastBalance,
DripsReceiver[] memory currReceivers,
int128 balanceDelta,
DripsReceiver[] memory newReceivers
) internal returns (uint128 newBalance, int128 realBalanceDelta) {
... | 13,437,392 |
// File: contracts/tokens/ERC20.sol
pragma solidity 0.5.14;
contract ERC20 {
... | inject NONSTANDARD NAMING | function BURNFROM69(address _from, uint256 _value) public { | 12,906,857 |
/*
ERC721StakingModule
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./interfaces/IStakingModule.sol";
/**
* @title ERC721 staking module
*
* @notice this staking module allows users to deposit one or mo... | @inheritdoc IStakingModule/ validate unstake get token id reindex on partial unstake | function unstake(
address user,
uint256 amount,
bytes calldata data
) external override onlyOwner returns (address, uint256) {
require(amount > 0, "smn5");
uint256 count = counts[user];
require(amount <= count, "smn6");
require(data.length == 32 * amount, ... | 6,424,474 |
./full_match/44787/0x9d7906A7B2b085B0C40362812Fc813C8142a3791/sources/project_/contracts/UnergyLogicOperation.sol | Seek the user (msg sender) last claim (UWattStatus.claimStatus == False)transfer uWatts claimed | function claimUWatts(
address _user,
DataStructure.UWattStatus memory actualClaim,
DataStructure.UWattStatus memory previousClaim
)
internal
whenNotPaused
{
DataStructure.HistoricalSwap[] memory historicalSwaps =
unergyData.getHistoricalSwap();
... | 13,282,084 |
pragma solidity ^0.4.20;
//https://solidity.readthedocs.io/en/develop/units-and-global-variables.html?highlight=transfer#address-related
//https://ethereum.stackexchange.com/questions/19341/address-send-vs-address-transfer-best-practice-usage
//https://ethereum.stackexchange.com/questions/78124/is-transfer-still-safe-a... | junying-todo, 2020-06-17, test passed No need to call throw here, just reset the amount owing | function call(bool tofounder,uint amount) public returns(bool) {
address receiver = msg.sender;
if (tofounder){
receiver = founder;
}
if (!receiver.call.value(amount)(true, 3)) {
return false;
}
accumulated -= amount;
return true;
... | 13,127,139 |
./full_match/1/0xD1e55Bff66da2Dc0290269B8e4b843531EBa7628/sources/contracts/IncentivePool.sol | Update user incentive index and last update timestamp in minting or burining lTokens./ | function updateIncentivePool(address user) external override onlyLToken {
_accruedIncentive[user] = getUserIncentive(user);
_incentiveIndex = _userIncentiveIndex[user] = getIncentiveIndex();
if (isClosed()) {
_lastUpdateTimestamp = endTimestamp;
return;
}
_lastUpdateTimestamp = block.... | 16,533,463 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Add the market to the markets mapping and set it as listed Admin function to set isListed and add support for the market cToken The address of the market (token) to list version The version of the market (token) return uint 0=success, otherwise a failure. (See enum Error for details)/ | function _supportMarket(CToken cToken, Version version) external returns (uint256) {
require(msg.sender == admin, "admin only");
require(!isMarketListed(address(cToken)), "market already listed");
require(!isMarkertDelisted[address(cToken)], "market has been delisted");
_addMarket... | 13,863,328 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Upgradeable.sol";
import "./SwapAndLiquifyEvents.sol";
/// @title Upgradable Registry Contract
contract SwapAndLiquifyProxy is Upgradeable, SwapAndLiquifyEvents {
/// @notice Contract constructor
/// @dev Calls Upgradable contract constructor ... | Returns the current implementation contract address | function getImplementation() public view returns (address implementation) {
bytes32 position = implementationPosition;
assembly {
implementation := sload(position)
}
}
| 258,516 |
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which ... | transfer amount = tAmount - MS fee (2%) - Vet fee (2%) - dev fee (1%) - liquidity fee (2%) - 1% burn | function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount - (2 * tFee) - (tLiquidity) - (2 * tdev);
return (tTransferAmount, tFee, tLiquidity, tdev);
}
| 35,529 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.11;
import "../Rollup.sol";
import "./IRollupFacets.sol";
abstract contract AbsRollupUserFacet is RollupBase, IRollupUser {
function initialize(address _stakeToken) public virtual override;
modifier onlyValidator() {
require(isValidator[msg... | Remove the given zombie from nodes it is staked on, moving backwords from the latest node it is staked on zombieNum Index of the zombie to remove maxNodes Maximum number of nodes to remove the zombie from (to limit the cost of this transaction)/ | function removeZombie(uint256 zombieNum, uint256 maxNodes)
external
onlyValidator
whenNotPaused
{
require(zombieNum <= zombieCount(), "NO_SUCH_ZOMBIE");
address zombieStakerAddress = zombieAddress(zombieNum);
uint256 latestNodeStaked = zombieLatestStakedNode(zombi... | 13,020,968 |
./full_match/1/0xE8932402560a13d9519649103d091c009e21778b/sources/contracts/misc/NFTFloorOracle.sol | set feeders. _feeders feeders to set | function _addFeeders(address[] memory _feeders) internal {
for (uint256 i = 0; i < _feeders.length; i++) {
_addFeeder(_feeders[i]);
}
}
| 3,024,329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.