file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/5/0x423DBa410C9d51fae8C34aFF803fbe1a356845dD/sources/lib/dss-test/lib/dss-interfaces/src/dss/mip21/RwaLiquidationOracleAbstract.sol | https:github.com/makerdao/mip21-toolkit/blob/master/src/oracles/RwaLiquidationOracle.sol | interface RwaLiquidationOracleAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function vat() external view returns (address);
function vow() external view returns (address);
function ilks(bytes32) external view... | 16,837,875 |
pragma solidity ^0.4.11;
import 'zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol';
import './evacoin.sol';
import 'zeppelin-solidity/contracts/payment/PullPayment.sol';
contract EvaCoinPreSale is CappedCrowdsale, Ownable {
// Sale1 and Sale2 EVC/ETH sale rate (without bonus)
uint256 public constant... | coins for early founders contract owner need to transfer coin to Sale1 contract | function finalize() onlyOwner public {
require(!isFinalized);
uint256 founderCoins = EARLY_FOUNDERS_CAP.mul(SALE_RATE);
coin.mint(owner, founderCoins);
coin.transferOwnership(coin.keeper());
isFinalized = true;
}
| 897,766 |
pragma solidity ^0.4.15;
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* Based on OpenZeppelin
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c /... | Allows the pendingOwner address to finalize the transfer./ | function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
| 2,530,843 |
pragma solidity ^0.4.15;
/**
* @title Queue
* @dev Data structure contract used in `Crowdsale.sol`
* Allows buyers to line up on a first-in-first-out basis
* See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html
*/
contract Queue {
/* State variables */... | Places `addr` in the first empty position in the queue / | function enqueue(address addr) {
if(numOccupied != queue.length) {
queue[numOccupied] = addr;
numOccupied += 1;
}
}
| 12,748,942 |
./full_match/1/0xE9ced91b72F71d02c14e1de998662Ec9bF8273aE/sources/contracts/MetaSender.sol | / ETH MULTI-TRANSFER transaction with different value/ _to array of receiver addresses/ _value array of amounts to transfer | function sendNativeTokenDifferentValue( address[] memory _to, uint256[] memory _value) external payable {
require( _to.length == _value.length, "Invalid Arguments: Addresses and values must be equal" );
require( _to.length <= 255, "Invalid Arguments: Max 255 transactions by batch" );
uint... | 9,746,808 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {ReentrancyGuard} from '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {Saf... | Withdraw all tokens (of the sender) from pool, also harvest reward _pid: id of the pool/ | function withdrawAll(uint256 _pid) external override nonReentrant {
_withdraw(_pid, userInfo[_pid][msg.sender].amount);
}
| 1,342,896 |
/*
Telegram: https://t.me/jeffinspaceofficial
Website: jeffin.space
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: Unlicensed
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() in... | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| 6,551 |
./full_match/43114/0x0b71852d588e693C10e984423f79EFab4a13EedF/sources/SnowBank.sol | Buy the token Approve the contract to spend tokens for us. Get the amount fo MIM in the contract. Get the estimated output for the token with a 5% slippage Use the deadline as the current time. Get the balance of SnowBank token. | function buyAndStakeSnowBank() external {
IERC20Joe(MIM_TOKEN).approve(JOE_ROUTER, uint256(-1));
uint256 amountIn = IERC20Joe(MIM_TOKEN).balanceOf(address(this));
uint256 amountOut = getEstimatedTokenForTokenWithSlippage(MIM_TOKEN, SNOWBANK_TOKEN, amountIn);
... | 4,541,891 |
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorage... | Remove budget `_accountId`, effective immediately and optionally update budget name. _accountId Id for the budget. _metadata descriptor for account (pass in empty string if unchanged)/ only access storage if necessary | function removeBudget(uint64 _accountId, string _metadata)
external
auth(CHANGE_BUDGETS_ROLE)
transitionsPeriod
accountExists(_accountId)
{
accounts[_accountId].budget = 0;
accounts[_accountId].hasBudget = false;
if (bytes(_metadata).length > 0) {
... | 5,439,320 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
import "../erc1820/ERC1820Client.sol";
import "../erc1820/ERC1820Implementer.sol";
import "./IAmpPartitionStrategyValidator.sol";
import "./lib/PartitionUtils.sol";
/**
* @title Base contract that satisfies the IAmpPartitionStrategyValidator
* interface
*/... | Report if address is an operator for a partition based on the partition's strategy. Placeholder that can be overridden by parent./ | function tokensFromPartitionToValidate(
bytes4, /* functionSig */
bytes32, /* fromPartition */
address, /* operator */
address, /* from */
address, /* to */
uint256, /* value */
bytes calldata, /* data */
bytes calldata /* operatorData */
function... | 1,823,186 |
./full_match/11155111/0x68602205724124714992817612b9d93E8d39Bdc6/sources/PhilippePhix.sol | Procure Space Cakes. Init indexes. Loop indexes. Token ID offset. Ensure this token hasn't already been procured. Create the token. Mint. Increment supply count. | function procureSpaceCakes () public nonReentrant onlyOwner {
uint256[] memory idxs = new uint256[](35);
for (uint256 i = 0; i < idxs.length; i++) {
uint256 tokenId = i + 1;
require(!_exists(tokenId), "Token has already been procured.");
_tokens[tokenId] = ... | 3,811,541 |
./partial_match/1/0x1b6a205358e9378Bf9d6cb75F4D3cCcab38cA796/sources/src/ZeroLiquid.sol | Gets the total value of the deposit collateral measured in debt tokens of the account owned by `owner`. owner The address of the account owner. return The total value. | function totalValue(address owner) public view returns (uint256) {
uint256 totalValue = 0;
Sets.AddressSet storage depositedTokens = _accounts[owner].depositedTokens;
for (uint256 i = 0; i < depositedTokens.values.length; ++i) {
address yieldToken = depositedTokens.values[i];
... | 15,484,963 |
pragma solidity ^0.4.24;
/*******************************************************************************
*
* Copyright (c) 2018 Decentralization Authority MDAO.
* Released under the MIT License.
*
* Zitetags - A Zeronet registrar, for managing Namecoin (.bit) addresses used
* by Zeronet users/clients... | Set the zitetag's registration info. Calculate the `_zitetag` hash and use it to store the registration details in the eternal database. NOTE: JSON will be the object type for registration details./ | function setInfo(
string _zitetag,
string _info
) onlyAuthBy0Admin external returns (bool success) {
bytes32 hash = keccak256(abi.encodePacked('zitetag.', _zitetag));
zer0netDb.setString(hash, _info);
emit ZitetagUpdate(hash, _zitetag, _info);
return true;
| 1,066,697 |
./partial_match/1/0x346E8E8e48f68d120D2769811349aDf5243a6994/sources/Sett.sol | Add blockLock to transfers, users cannot transfer tokens in the same block as a deposit or withdrawal. | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_blockLocked();
return super.transfer(recipient, amount);
}
| 4,252,932 |
// 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 am... | Controller only function for creating additional rewards from dust | function withdraw(IERC20 _asset) external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
require(want != address(_asset), "want");
require(y != address(_asset), "y");
require(ycrv != address(_asset), "ycrv");
require(yycrv != address(_asset), "y... | 1,516,861 |
./full_match/1/0x8A84C48FB2DE459FFA7F32279f3dc2C0158aF5A9/sources/contracts/staking/ApiCallerConsumer.sol | Implements a withdraw function to avoid locking your LINK in the contract | function withdrawLink(address payable to, uint256 amount)
external
onlyOwner
{
link.transfer(to, amount);
}
| 9,792,691 |
pragma solidity ^0.4.18;
import './SafeMath.sol';
import './interfaces/IERC20.sol';
import './interfaces/ICustomers.sol';
import './interfaces/ISecurityToken.sol';
import './interfaces/ICompliance.sol';
import './interfaces/ITemplate.sol';
import './interfaces/IOfferingFactory.sol';
/**
* @title SecurityToken
* @de... | `selectOfferingProposal` Select an security token offering proposal for the issuance _offeringFactoryProposalIndex Array index of the STO proposal return bool success/ | function selectOfferingFactory(uint8 _offeringFactoryProposalIndex) public onlyDelegate returns (bool success) {
require(!isOfferingFactorySet);
require(merkleRoot != 0x0);
isOfferingFactorySet = true;
address offeringFactory = PolyCompliance.getOfferingFactoryByProposal(this, _offer... | 1,762,003 |
./full_match/3/0x925Fb4e15178aD0dBB8fcb66A2c145c5A41E3d52/sources/browser/EthereumMoney.sol | Function which will be used to get depositHandler | function getDepositHandler() public view onlyOwner returns(string memory URL)
{
return depositHandler;
}
| 8,234,314 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.10;
import "./IVault.sol";
import "./IWeightedPool.sol";
import "../../external/gyro/ExtendedMath.sol";
import "../IPCVDepositBalances.sol";
import "../../oracle/IOracle.sol";
import "../../Constants.sol";
/// @title BalancerPool2Lens
/// @author Fei P... | Calculate x y rounding down. Revert on overflow. x signed 64.64-bit fixed point number y signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/ | function mul(int128 x, int128 y) internal pure returns (int128) {
int256 result = (int256(x) * y) >> 64;
require(result >= MIN_64x64 && result <= MAX_64x64);
return int128(result);
}
| 375,316 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/token/ERC721/exte... | Set payment address | function setPaymentAddress(address _address) external onlyOwner {
paymentAddress = _address;
}
| 14,885,102 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is ... | Must be called after crowdsale ends, to do some extra finalization work. Calls the contract's finalization function./ | function finalize() public onlyOwner {
require(!isFinalized);
require(hasClosed());
emit Finalized();
isFinalized = true;
}
| 13,065,069 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { DAI } from "./mock-tokens/DAI.sol";
import { WBTC } from "./mock-tokens/WBTC.sol... | ----------------------------------- Getter methods----------------------------------- | function getLend(uint lendId) public view returns (Lend memory _lend) {
Lend memory lend = lends[msg.sender][lendId];
return lend;
}
| 12,552,633 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than ... | Sets the bonus structure.The bonus limits must be in decreasing order. | function setBonuses(uint[] _bonusLimits, uint[] _bonusPercentages) public onlyAdmin {
require(_bonusLimits.length == _bonusPercentages.length);
require(_bonusPercentages.length == 3);
for(uint8 i=0;i<_bonusLimits.length;i++) {
bonusLimits[i] = _bonusLimits[i];
bonusPercentages[i] = _bonusPerce... | 10,556,228 |
./full_match/1/0x28e12d5079D48BB0a8A20F6F2E6f6d4daA786120/sources/contracts/BlueSubs.sol | Return the individual price of a specified version version The version to get the price of return price The price of the version/ | function getIndividualPrice(Version version) public view returns (uint price) {
return _individualPrices[version];
}
| 3,068,988 |
/**
* MPSBoardSig.sol
* Governance smart contract including multi-signature capabilities.
* It uniquely represents the Board of Directors of Mt Pelerin Group SA on-chain
* until it is superseded by a resolution of the board referring to a new
* governance on-chain reference.
* The unflattened code is avai... | IRule IRule interface Cyril Lapinte - <cyril.lapinte@mtpelerin.com> Copyright © 2016 - 2018 Mt Pelerin Group SA - All Rights Reserved Please refer to the top of this file for the license./ | interface IRule {
function isAddressValid(address _address) external view returns (bool);
function isTransferValid(address _from, address _to, uint256 _amount)
external view returns (bool);
}
| 1,773,441 |
pragma solidity ^0.4.22;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _v... | use token address ETH_TOKEN_ADDRESS for ether do one trade with a supplier src Src token amount amount of src tokens dest Destination token destAddress Address to send tokens to supplier Supplier to use validate If true, additional validations are applicable return true if trade is successful take src tokens t... | function doSupplierTrade(
ERC20 src,
uint amount,
ERC20 dest,
address destAddress,
uint expectedDestAmount,
SupplierInterface supplier,
uint conversionRate,
bool validate
)
internal
returns(bool)
{
uint callValue = 0;
... | 1,064,879 |
//Address: 0xCB95cA62AACdc3C608aA2E78057e918a1B180616
//Contract name: PapyrusPrototypeToken
//Balance: 0 Ether
//Verification Date: 11/23/2017
//Transacion Count: 1978
// CODE STARTS HERE
pragma solidity ^0.4.17;
/// @title SafeMath
/// @dev Math operations with safety checks that throw on error.
library SafeMath... | Transfers tokens from one address to another. _from The address which you want to send tokens from. _to The address which you want to transfer to. _value The amount of tokens to be transferred. return A boolean that indicates if the operation was successful. | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowances[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 923,499 |
pragma solidity ^0.5.0;
import "./ProjectRegistry.sol";
import "./HyphaToken.sol";
import "./Project.sol";
import "./ProjectLibrary.sol";
import "./Task.sol";
import "./library/PLCRVoting.sol";
import "./library/Division.sol";
import "./library/SafeMath.sol";
import "./library/Ownable.sol";
/**
@title This contract s... | Freezes the contract and allows existing token holders to withdraw tokens/ | function freezeContract() external onlyOwner {
freeze = true;
}
| 12,904,741 |
./full_match/1/0xf3De811943323797302e9fD1bE3cc3569fE52Ffa/sources/contracts/core/WaveContract.sol | override the transfer function to allow transfers only if not soulbound from The address to transfer from to The address to transfer to tokenId The token ID to transfer | function _transfer(
address from,
address to,
uint256 tokenId
) internal override {
if (isSoulbound) revert NotTransferrable();
super._transfer(from, to, tokenId);
}
| 4,949,132 |
pragma solidity >=0.6.0 <0.7.0;
/// @author 71ae and The Coding Army.
/// @title Split and Distribute Mining Rewards between a costcenter and a beneficiary.
contract SplitMiningRewards
{
// DATA
address payable owner;
mapping(address => bool) delegates;
address payable costcenter;
address payabl... | Maintenance: Change beneficiary payee address | function changePayeeBeneficiary(address payable _newBeneficiary) public onlyDelegates()
{
beneficiary = _newBeneficiary;
emit Log("Beneficiary changed to ", beneficiary);
}
| 14,019,712 |
./partial_match/4/0xFfBa27FDA412B94d370F512834BBCCC80dFbCF7f/sources/OroNetwork.sol | Unstake assets After the cooling period, user can unstake the assets/ Unstake should serve 7 days cooling period Contract should have sufficient balance to pay back Transfer of asset | function unStake(uint256 stakedId) public whenNotPaused returns(bool) {
require(stakings[msg.sender][stakedId].coolingState >= 7 days, "In cooling period");
require(
IERC20(stakings[msg.sender][stakedId].asset).balanceOf(address(this)) >=
stakings[msg.sender][stakedId].amount... | 8,772,245 |
./partial_match/1/0xdc4A5151C0F29f6deFA09b383d04B95d587fA275/sources/ProposalLogic.sol | called from 'executeProposal' | function changeAllOperationKeysWithoutDelay(address payable _account, address[] calldata _pks) external allowSelfCallsOnly {
uint256 keyCount = accountStorage.getOperationKeyCount(_account);
require(_pks.length == keyCount, "invalid number of keys");
for (uint256 i = 0; i < keyCount; i++) {
address pk = _pks[... | 4,428,062 |
pragma solidity ^0.5.16;
//Slightly modified SafeMath library - includes a min and max function, removes useless div function
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function add(int256 a... | Allows disputer to unlock the dispute fee _disputeId to unlock fee from/ | function unlockDisputeFee (uint _disputeId) external{
return tellor.unlockDisputeFee(_disputeId);
}
| 13,546,321 |
pragma solidity ^0.4.24;
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) {
uint c = a / b;
return c;
}
function sub(uint a, uint b) internal return... | CONSTRUCTOR, This address will be : 0x.../ | function ZeusToken() {
owner = msg.sender;
totalSupply = 0.2 * 10 ** 26;
balances[owner] = totalSupply;
}
| 6,755,120 |
pragma solidity ^0.4.24;
import "./ENGNS.sol";
import "./ENGNSRegistrar.sol";
contract Auction {
/* Determine the state of the auction. */
enum AuctionState { IN_PROGRESS, CALCULATING, COMPLETED }
/* EVENTS */
event Bid(address bidder);
event Winner(address winner, uint bidValue);
/* BIDDER */
struct... | The callable function. Gets the highest bidder and bid amount for the auction. NOTE: In the event of a tie, we're just taking the first bidder./ | function getHighestBidder(address[] _bidders, uint[] _bidAmounts, uint[] _stakeAmounts) public pure returns (address, uint) {
address highestBidder;
uint highestBidAmount;
for (uint i = 0; i < _bidders.length; i++) {
if ((_bidAmounts[i] > highestBidAmount) && (_bidAmounts[i] <= _stakeAmounts[i])) {
... | 14,075,836 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import '../utils/EnumerableSet.sol';
import '../utils/Address.sol';
import '../utils/Context.sol';
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms.
*
* Roles are referred to by their `bytes32` iden... | Check if the address is a valid target If sftHolder returns a valid tokenId, it must be a card not owned by this contract (which means it is locked). Even though Cryptofolio supports multiple TradeFloors, the main SFT lock handling happens only in this contract instance. test The address to test return True if the add... | function _validTarget(address test) private view returns (bool) {
uint256 tokenId;
return
test == address(0) ||
(tokenId = _addressToTokenId(test)) == uint256(-1) ||
(tokenId.isBaseCard() &&
IERC1155(address(_sftHolder)).balanceOf(address(this), tokenId) == 0);
}
| 13,594,968 |
./full_match/44787/0x0f68d51fE634d2dCF3C958B46A69b6Ca8086234B/sources/project_/contracts/CASRegistryManager.sol | exchange FCRU tokens on holder for VCRU tokens on buffer bufferInput ( bufferAddress: bytes(address), bundleId: bytes(string), bundleVolume: bytes(int), unitType: bytes(string), metadataUrl: bytes(string) projectAddress: bytes(address) ) holderInput ( holderAddress: bytes(address), bun... | function holderFcruToBufferVcruExchange(
bytes[] calldata bufferInput,
bytes[] calldata holderInput,
bytes[] calldata projectOutput,
bytes[] calldata holderOutput) public checkAccess {
exchangeCheck(bufferInput, holderInput, projectOutput, holderOutput);
IBundle(hold... | 13,288,887 |
pragma solidity ^0.4.18;
/**
* @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;
/**
* @dev The Ownable constructor sets the original `own... | Returns the address currently assigned ownership of a given EtherDog. Required for ERC-721 compliance. | function ownerOf(uint256 _tokenId)
external
view
returns (address owner)
{
owner = EtherDogIndexToOwner[_tokenId];
require(owner != address(0));
}
| 1,232,307 |
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
/... | Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./ We read and store the value's index to prevent multiple reads from the same storage slot To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, an... | function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
bytes32 lastvalue = set._values[lastIndex];
set._values... | 16,039 |
//Address: 0x37eb2e8263abe544eb5c41fdce6ef11764364c32
//Contract name: LegendsCrowdfund
//Balance: 0 Ether
//Verification Date: 2/23/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.9;
/***
* VIP Token and Crowdfunding contracts.
*/
/**
* @title ERC20
*/
contract ERC20 {
function total... | Constructor. _legendsCrowdfund Address of crowdfund contract. _preallocation Address to receive the pre-allocation. _start Timestamp when the token becomes active./ | function LegendsToken(address _legendsCrowdfund, address _preallocation, uint _start, bool _testing) {
legendsCrowdfund = _legendsCrowdfund;
start = _start;
testing = _testing;
totalVIP = ownerVIP[_preallocation] = 25000 ether;
}
| 2,546,742 |
./full_match/42220/0x163cd93cB94A414638D3582De74572C98BAcAF1e/sources/contracts/MarketPlaceNom.sol | See {INFTKEYMarketPlaceV1-buyToken}. Must have a valid listing msg.sender must not the owner of token msg.value must be at least sell price plus fees/ | function buyToken(address sender, string memory name, uint256 value) external payable {
uint256 tokenId = calculateTokenId(name);
require(!_isTokenOwner(tokenId, sender), "Token owner can't buy their own token");
require(
value >= listing.listingPrice,
"The value send... | 16,333,136 |
./partial_match/4/0xE96744795e9Fd39bE19368CFa167CF08C8c3b0eB/sources/contracts/interfaces/ILendingPool.sol | function flashLoan( address _receiver, address[] calldata _reserves, uint256[] calldata _amounts, bytes calldata params ) external; | interface ILendingPool {
event FlashLoanCompleted(
address indexed _user,
address indexed _receiver,
address indexed _token,
uint256 _amount,
uint256 _totalFee,
uint256 _protocolFee
);
function flashLoan(
address _receiver,
address _token,
... | 8,664,442 |
./full_match/137/0x3EA38B86b47A03549C4626AFB25C6A0C7a59e6FA/sources/project_/contracts/oracles/tellor/UsingTellor.sol | Retrieves the latest value for the queryId before the specified timestamp _queryId is the queryId to look up the value for _timestamp before which to search for latest value return _value the value retrieved return _timestampRetrieved the value's timestamp/ | function getDataBefore(bytes32 _queryId, uint256 _timestamp)
public
view
returns (bytes memory _value, uint256 _timestampRetrieved)
{
(, _value, _timestampRetrieved) = tellor.getDataBefore(
_queryId,
_timestamp
);
}
| 4,792,604 |
./full_match/43113/0x0efaB1D843c06ef40e0082714663EcAd986598dE/sources/contracts/1_Storage.sol | Transfer ownership to a new address. Restricted to admin. newOwner address/ | function transferOwnership(
address newOwner
)
public
override
onlyAdmin
{
renounceRole(DEFAULT_ADMIN_ROLE, owner());
_setupRole(DEFAULT_ADMIN_ROLE, newOwner);
if (!hasRole(OPERATOR_ROLE, newOwner)) {
_setupRole(OPERATOR_ROLE, newOwner);
... | 7,127,343 |
// SPDX-License-Identifier:UNLICENSED
pragma solidity ^0.7.6;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/EnumerableMapUpgradeable.sol";
import "@... | _whitelist the address of the new whitelist implementation/ | function updateImplementation(IWhitelist _whitelist) external onlyOwner {
require(address(_whitelist) != address(0), "updateImplementation: invalid address");
emit ImplementationChanged(address(getImplementation()), address(_whitelist));
whitelist = _whitelist;
}
| 6,900,123 |
/*
This exercise has been App has been upgraded to use Solidity version 0.5
*/
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/*
@title Bounty - Decentlized app for creating bounties or job offers
payed in Ether.
@author Miha Perosa
@notice This contract is was writ... | Function for accepting a submission. Function updates the status of bounty to close and rejects all other submissions. _bid Bounty id. _sid Submission id. | function acceptSubmission(uint _bid, uint _sid)
public
onlyIfSubmissionExists(_bid, _sid)
onlyIfBountyStatusNotClosed(_bid)
onlyBountyOwner(_bid)
{
bounties[_bid].status = BountyStatus.Close;
uint length = bounties[_bid].submissionCount;
for (uint i = 0; i < length; i++)... | 12,773,853 |
./full_match/3/0xD1aFD1e21C50c8843f42Bad112BB93a0cFE2aD49/sources/BCP_Commitment_and_Order_module.sol | checks whether the sender calls via his PUK addresschecks whether this sender owns the commitment he wants to changechecks whether the new commitment horizon is behind the old onechanges the entry within the commitment array | function HorizonExtension(int64 commitmentID, uint32 _newHorizon) external{
require (commitmentID >0, "Must be a commitmentID >0!");
int64 SenderID = BCPRegistration.GetSenderID(msg.sender);
require(msg.sender == BCPRegistration.GetPUK(SenderID), "not Authorized, use PUK");
Commitmen... | 8,237,288 |
./partial_match/42/0x162114Ca77bE3234E459C816bE93C3a32c3Ad5a7/sources/OwnedUpgradeabilityProxy.sol | This event will be emitted every time the implementation gets upgraded implementation representing the address of the upgraded implementation/ Storage position of the address of the current implementation Tells the address of the current implementation return impl address of the current implementation/ | function implementation() public override view returns (address impl) {
bytes32 position = implementationPosition;
assembly {
impl := sload(position)
}
}
| 9,000,076 |
./full_match/80001/0x8d4D51E0442304e171bC973c72044DDEfC5d49b0/sources/contracts/UCloneSettings.sol | Get Matrix Upline Depth/ | function getMatrix() external view returns (uint8) {
return getSettings().matrix;
}
| 9,435,743 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "../interfaces/IBridgeable.sol";
contra... | Sets the values for {name} and {symbol}. The default value of {decimals} is 18. To select a different value for {decimals} you should overload it. All two of these values are immutable: they can only be set once during construction./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
impo... | 14,956,533 |
pragma solidity 0.4.25;
////////////////////////////////////////////////////////////////////////////////
//
// Eth17 - Factory Contract
//
////////////////////////////////////////////////////////////////////////////////
// IMPORTS - now flattened for Etherscan verification
// import "github.com/oraclize/ethe... | spawn another new contract because this contract did not contain a random number | function startNewGameError() public {
require(!mutex);
require(newGameStartedError == false);
require(randomNumberRetrieved == false);
require (nextGuess == 1);
mutex = true;
spawnNewContractSeventeenGuesses();
newGameStartedError = true;
mutex = false... | 6,352,745 |
pragma solidity ^0.4.18;
/// @title SafeMath library
library SafeMath {
function mul(uint a, uint b) internal constant returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal constant returns (uint) {
uint c = a / b;
retu... | Mint new tokens. Owner, Global operator and Crowdsale can mint new tokens and update totalSupply _to Address where the tokens will be minted _amount Amount of tokens to be minted return True if successfully minted | function mint(address _to, uint _amount) public anyRole returns (bool) {
_mint(_to, _amount);
Mint(_to, _amount);
return true;
}
| 6,409,560 |
./full_match/56/0xB828A18AD261Dd508876D42b17B2A5E5d155d853/sources/BrokeDAO.sol | Set tmpSuccess to avoid warning msg | function swapBack() internal lockTheSwap {
uint256 growthPortion = gfCounter.mul(100).div(_balances[address(this)]);
uint256 tokensToLiquify = _balances[address(this)];
uint256 amountToLiquify = tokensToLiquify.mul(growthPortion).div(100).div(2);
uint256 amountToSwap = token... | 3,250,751 |
./partial_match/1/0x99B52db75A2C37efA07C3867eC5811B9D878D4e3/sources/VaultStaking.sol | Revokes supplied list of users tokens and users keep earning ETH. | function revokeTokens(address[] memory _addresses) external onlyOwner {
uint256 tokensToTransfer;
for(uint256 i = 0; i < _addresses.length; i++){
address addy = _addresses[i];
User storage user = users[addy];
if(user.withdrawableTokens > 0){
tokens... | 3,734,951 |
./full_match/1/0x0a642E8F78FEf7b1063915cC2d8302851dE71dd6/sources/contracts/AccessControl/RaffleAdminAccessControl.sol | Removes the given account from the prizeManager role, if msg.sender is admin prizeManager The account that will have the prizeManager role removed/ | function removePrizeManager(address prizeManager) onlyAdmin public {
revokeRole(PRIZE_MANAGER_ROLE, prizeManager);
emit PrizeManagerRemoved(prizeManager, managerOf);
}
| 3,122,064 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./erc1363.sol";
import "./pausable.sol";
import "./managable.sol";
import "./vendorregistry.sol";
import "./imigratablewrappedasset.sol";
import "./imigratablevendorregistry.sol";
/// An ERC1363 (also ERC20) for wrapping MRX on the ethereum or BSC chai... | @inheritdoc IMigratableWrappedAsset | function migrationBurn(address account, uint256 maxAmount) external override returns (uint256)
{
require(address(0) != nextWrappedAsset, "WrappedAsset: Migration failed because the next version has not been set.");
require(_msgSender() == nextWrappedAsset, "WrappedAsset: Access not permitted... | 7,309,027 |
./full_match/137/0xC8c74608e78d6F705043Fd2d90aadF6d1f2093e5/sources/contracts/PrimexUpkeep.sol | @inheritdoc IPrimexUpkeep/ | function performUpkeep(bytes calldata performData, address keeper) external override {
(LiquidationSource liquidationSource, uint256 count) = abi.decode(
performData[:64],
(LiquidationSource, uint256)
);
if (liquidationSource == LiquidationSource.POSITION) {
... | 4,736,949 |
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | Approves WETH to pool without spending gas on every deposit. pool The index of the pool. amount The amount of WETH to be approved./ | function approveWethToPool(uint8 pool, uint256 amount) external fundEnabled onlyRebalancer {
if (pool == 0) return DydxPoolController.approve(amount);
else if (pool == 5) return EnzymePoolController.approve(_enzymeComptroller, amount);
else revert("Invalid pool index.");
}
| 12,084,598 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import { EVM } from "../EVM.sol";
contract EVMTest is Test {
EVM evm;
function setUp() public {
evm = new EVM();
}
// 01 GAS 3: add(uint256, uint256)
function testAdd() public {
assertEq(evm.add(1, 2), 3);
/... | 12 GAS 3: slt(uint256, uint256) | function testSlt() public {
assertEq(
evm.slt(
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
0
),
1
);
assertEq(evm.slt(10, 10), 0);
}
| 14,036,123 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./CTokenInterface.sol";
import "./InterestRateModel.sol";
import "./Comptroller.sol";
import "hardhat/console.sol";
abstract contract CToken is ERC20, CTokenInterface {
InterestRateModel ... | Explain to an end user what this does borrower address of borrower repayAmount amount that is being repayed return Wether or not the repayment succeeded or not Repay Amount is greater than 0 Current Borrow Balance with Interest Amount to Repay must be greater than zero New Balance = Total Borrow Bal. - repayAmount | function borrowRepayInternal(address borrower, uint repayAmount) internal returns (bool) {
require(accrueInterest(), "ACCRUING_INTEREST_FAILED");
require(repayAmount > 0, "REPAY_AMOUNT_LESS_THAN_ZERO");
uint amountToRepay = borrowBalanceStored(borrower);
require(repayAmou... | 14,113,929 |
./full_match/43113/0xA3F609485b60887Aa89E393Cb6Bb0d74C044eb4d/sources/project_/contracts/Characters.sol | Upgrade Stats Upgrade Weapon | function upgradeCharacter(uint256 _tokenId, uint256 _statNum) external {
require(ownerOf(_tokenId) == msg.sender, "Not owner");
require(potion.balanceOf(msg.sender, 1) >= 1, "No potion");
require(_statNum <= 6, "Stat not valid");
uint256 fullRandomRes = _getFullRandomness(
... | 7,197,601 |
// SPDX-License-Identifier: Apache 2.0
// Copyright © 2022 Artem Belozerov. All rights reserved.
pragma solidity ^0.8.0;
import "./StakingMain.sol";
import "./interfaces/IStakingMain.sol";
import "./interfaces/IStakingEvents.sol";
import "./common/StakingConstants.sol";
import "./common/StakingErrors.sol";
import "./c... | the first stake must be more then the threshold check delay between stakes | function stakeVotes(uint256 votesNumber) external override {
uint256 remainder = votesNumber - (votesNumber / StakingConstants.STAKE_STEP) * StakingConstants.STAKE_STEP;
if (votesNumber < StakingConstants.STAKE_STEP || remainder != 0) revert StakingErrors.WrongMultiplicity();
Stake[] storag... | 5,541,471 |
./full_match/137/0x385590CDf2a533861f6ff6474AF27a431F598f75/sources/_openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20FlashMintUpgradeable.sol | Performs a flash loan. New tokens are minted and sent to the `receiver`, who is required to implement the {IERC3156FlashBorrower} interface. By the end of the flash loan, the receiver is expected to own amount + fee tokens and have them approved back to the token contract itself so they can be burned. receiver The rec... | function flashLoan(
IERC3156FlashBorrowerUpgradeable receiver,
address token,
uint256 amount,
bytes calldata data
) public virtual override returns (bool) {
require(amount <= maxFlashLoan(token), "ERC20FlashMint: amount exceeds maxFlashLoan");
uint256 fee = flashF... | 3,738,382 |
./full_match/1/0x1eA67cD6DA0fea19d270BE6B8Bfa44B5aDa81Fcd/sources/browser/coinbase.sol | 主入口 uni 借款 IUniswapV2Pair(_pair).swap(_amount0Out, _amount1Out, address(this), data); 回调执行了 uniswapV2Call()其它token, 全部打给sender | function go(
uint _coinbasePercent,
address _coinbaseAddress,
address _token,
address _target,
bytes memory _payload
) public onlyOwner returns (uint _profit){
require(_coinbasePercent>=0 && _coinbasePercent<100, "CaV3: invalid coinbasePercent");
uint ba... | 2,971,598 |
./partial_match/1/0xfFa56817babEF3c3A377e9c31Ffe837e673d2e1E/sources/Leprechaun.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 _createInitialSupply(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), accoun... | 9,161,778 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
imp... | Mint the `amount` of planet land type and transfers it to `wallet`. Call {MechaLandsV1-_safeMint}. Requirements: - Only owner or the `distributor` of the planet. - View {MechaLandsV1-_safeMint} requirements. wallet The wallet to transfer new tokens planetId The planet index landType The type of the land amount Th... | function airdrop(
address wallet,
uint256 planetId,
uint256 landType,
uint256 amount
) external {
require(
owner() == msg.sender ||
planets[planetId].distributor == msg.sender,
"Caller is not owner nor planet distributor"
);... | 6,883,156 |
./partial_match/1/0xF7E8Aa9540928C7Cb57ADE63a599A2CD4A29bD7d/sources/StrategyCurveWBTC.sol | calculate amount of hcrv to withdraw for amount of want | function _withdrawSome(uint256 _amount) internal returns (uint) {
uint _hcrv = _amount.mul(1e18).div(ICurveFi(liquidity_pool).get_virtual_price());
Gauge(pool).withdraw(_hcrv);
return withdrawWBTC(IERC20(hcrv).balanceOf(address(this)));
}
| 2,857,125 |
pragma solidity ^0.4.18;
import "../Models.sol";
contract NodeRegistry {
// State
mapping (bytes32 => Models.Node) public nodes;
mapping (address => bytes32[]) public nodesPerAccount;
bytes32[] public nodesIndex;
// Functions
/*
* @dev allows to register a new Node, returning a bytes32 n... | Verify existence of a given Node nonce bytes32 _nodeNonce - Nonce to verify against./ | function isNode(bytes32 _nodeNonce) public view returns(bool) {}
| 13,051,803 |
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {Unauthorized, IllegalState, IllegalArgument} from "./base/Errors.sol";
import "./base/Multicall.sol";
import "./base/Mutex.sol";
import "./interfaces/IAlchemistV2.sol";
import "./interfaces/IERC20Minimal.sol... | IAlchemicToken Alchemix Finance | interface IAlchemicToken is IERC20Minimal, IERC20Burnable, IERC20Mintable {
function hasMinted(address account) external view returns (uint256);
function lowerHasMinted(uint256 amount) external;
}
pragma solidity >=0.5.0;
}
| 504,906 |
./full_match/43113/0x3c27b7D33a8B18F035D8786EA0140ea926243739/sources/test.sol | Add a new holder in holders list _holder The address of the holder return amount The amount of tokens being granted/ | function addHolder(address _holder)
internal
returns(bool)
{
bool found = false ;
for (uint256 i = 0; i < NFTSTotal; i++) {
if(_holders[i] == _holder){
found = true;
break;
}
}
if(!found){
_holders.push(_holder);
}
return found;
}
| 7,129,566 |
// 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... | Lazily mint some reserved tokens/ | function mintReserved(uint numberOfTokens) public onlyOwner {
require(
_reservedTokenIdCounter.current().add(numberOfTokens) <= RESERVED_TOTAL,
"Minting would exceed max reserved supply"
);
for (uint i = 0; i < numberOfTokens; i++) {
_safeMintGeneric(msg.... | 639,624 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of tw... | Allows account to Book Tokens and lock them for 12 months/ | function privateSale(uint256 rnTokens, address investor) public {
require ( msg.sender == admin, "Only admin callable function");
saleBalances[investor].privateSalebalance = saleBalances[msg.sender].privateSalebalance.add(rnTokens);
saleBalances[investor].privateSaleWithdrawDate = block.time... | 5,427,827 |
./full_match/80001/0x9f9a4f3CD309D7f4609fE82F9106d1fb529932EA/sources/contracts/staking.sol | Write function to update contract on winner and amount. | function publishWinningAddress(address winnerAddress, uint winningAmount) external {
require(msg.sender == owner());
winnerRewards[winnerAddress] += winningAmount;
totalRewards += winningAmount;
emit winnerChosen(winnerAddress, winningAmount);
}
| 9,518,687 |
./full_match/80001/0xA6BFBB4d45D1699df93431D1E093Df6B660Fa6A4/sources/project_/contracts/TradingStorage.sol | delete the trade from the openTrades array and add it to the closedTrades mapping tradeIds.increment(); | function updateTrade(
uint _tradeIndex,
address _trader,
int _exitPrice,
int _pnl
) public returns(uint) {
openTrade memory _trade = usersOpenTrades[_trader][_tradeIndex];
closedTrade memory _closedTrade = closedTrade(
_trade.trader,
_trade... | 860,900 |
./partial_match/1/0x9220EF478fd8a05EdF4f56c9311FE070B42DFdfa/sources/contracts/mocks/VotingEscrowMock.sol | Get the current voting power for `msg.sender` Adheres to the ERC20 `balanceOf` interface for Aragon compatibility addr User wallet address _t Epoch time to return voting power at return User voting power/ | function balanceOf(address addr, uint256 _t) public view returns (uint256) {
uint256 _epoch = userPointEpoch[addr];
if (_epoch == 0) return 0;
else {
Point memory last_point = userPointHistory[addr][_epoch];
last_point.bias -= last_point.slope * (_t - last_point.ts).t... | 4,171,050 |
./partial_match/4/0x6f20C45085870f281715561B6894990dffA759d3/sources/EventTicketSystem.sol | set TicketSupply (global)/ | function setTicketSupply(uint64 _ticketSupply)
public
EventNotStarted
onlyOwner
{
ticketSupply = _ticketSupply;
}
| 8,717,411 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppel... | Clears the data if the {BorrowData.deadline} has been reached. Anyone can call this function./ | function clear() external virtual {
uint256 ln = _borrowerArray.length;
uint256[] memory array = new uint256[](ln);
uint256 counter = 0;
uint256 i;
for (uint256 id = 1; id <= MAX_SUPPLY; id++)
for (i = 0; i < _borrowerArray.length; i++) {
BorrowDat... | 15,811,876 |
./partial_match/1/0x3e1631D1d57e7bE1583bA88Fa89AAb06CC25cF6e/sources/Wallet.sol | Set the daily limit. _amount is the daily limit amount in base units. Require that the spend limit has not been set yet. Modify spend limit based on the provided value. Flag the operation as set. | function _setLimit(DailyLimit storage self, uint _amount) internal {
require(!self.updateable, "daily limit not updateable");
_modifyLimit(self, _amount);
self.updateable = true;
}
| 16,152,636 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since w... | Stake funds into the pool Calculate tax and after-tax amount Increment sender's balances and total supply Increment dev fund by tax Transfer funds | function stake(uint256 amount) public virtual {
uint256 taxRate = calculateTax();
uint256 taxedAmount = amount.mul(taxRate).div(100);
uint256 stakedAmount = amount.sub(taxedAmount);
_balances[msg.sender] = _balances[msg.sender].add(stakedAmount);
_totalSupply = _totalSupply.... | 87,739 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.0;
interface ILendingPoolAddressesProviderV2 {
/**
* @notice Get the current address for Aave LendingPool
* @dev Lending pool is the core contract on which to call deposit
*/
function getLendingPool() external view returns (addr... | Withdraw a quantity of bAsset from the platform _receiver Address to which the bAsset should be sent _bAsset Address of the bAsset _amount Units of bAsset to withdraw _hasTxFee Is the bAsset known to have a tx fee?/ | function withdraw(
address _receiver,
address _bAsset,
uint256 _amount,
bool _hasTxFee
)
external
override
onlyMasset
nonReentrant
{
_withdraw(_receiver, _bAsset, _amount, _amount, _hasTxFee);
}
| 626,324 |
/**
*Submitted for verification at Etherscan.io on 2019-09-27
*/
pragma solidity >=0.5.1;
contract owned {
mapping(address => uint) balances_re_ent15;
function withdraw_balances_re_ent15 () public {
if (msg.sender.send(balances_re_ent15[msg.sender ]))
balances_re_ent15[msg.sender] = 0;
... | Check if a proposal code matches proposalNumber ID number of the proposal to query destination is a transaction destination address weiAmount amount of wei transactionBytecode bytecode of transaction/ | function checkProposalCode(
uint proposalNumber,
address destination,
uint weiAmount,
bytes memory transactionBytecode
)
view public
returns (bool codeChecksOut)
{
Proposal storage p = proposals[proposalNumber];
return p.proposalHash == keccak2... | 12,550,928 |
pragma solidity ^0.4.24;
// _____.___. __ .__.__ _____ .___.__ _____.__ .___
// \__ | | ____ ____ | | _|__|__| / \ ____ __| _/|__|/ ____\__| ____ __| _/
// / | |/ _ \_/ ___\| |/ / | | / \ / \ / _ \ / __ | | \ __\| |/ __ \ / __ |
// \____ ... | set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update l... | function buyXname(bytes32 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
u... | 2,104,045 |
/**
*Submitted for verification at Etherscan.io on 2021-10-02
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
/**
* @dev ERC-721 non-fungible token standard.
* See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md.
*/
interface ERC721
{
/**
* @dev Emits when ownership of any ... | Assignes a new NFT to owner. Use and override this function with caution. Wrong usage can have serious consequences. _to Address to wich we want to add the NFT. _tokenId Which NFT we want to add./ | function _addNFToken(
address _to,
uint256 _tokenId
)
internal
virtual
{
require(idToOwner[_tokenId] == address(0), NFT_ALREADY_EXISTS);
idToOwner[_tokenId] = _to;
ownerToNFTokenCount[_to] = ownerToNFTokenCount[_to].add(1);
}
| 2,171,488 |
./full_match/1/0x184e48FA8B332D3D3FB08eDa535Fd7591e340Bb2/sources/contracts/NFT/ERC721M.sol | See {IERC721-ownerOf}./ | function ownerOf(
uint256 tokenId
) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "Invalid token");
return owner;
}
| 4,934,981 |
./full_match/1/0x6aE92a1fB0b376D440a5A878Aa9d517b24adF747/sources/contracts/utils/Ownable.sol | COVER: Initializes the contract setting the deployer as the initial owner./ | function initializeOwner() internal initializer {
_owner = msg.sender;
emit OwnershipTransferCompleted(address(0), _owner);
}
| 4,968,432 |
pragma solidity ^0.5.0;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b... | Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer t... | function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return tru... | 411,776 |
pragma solidity ^0.4.18;
/* ==================================================================== */
/* Copyright (c) 2018 The MagicAcademy Project. All rights reserved.
/*
/* https://www.magicacademy.io One of the world's first idle strategy games of blockchain
/*
/* authors <span class="__cf_email__" data-cfe... | Allows someone to send ether and obtain the token We have to claim buyer/sellder&39;s goo before updating their production values modify weight Splitbid/Overbid | function buyRareItem(address _player, uint256 _platValue,uint256 _rareId) internal {
require(cards.getGameStarted());
require(previousOwner != 0);
uint256 totalCost = SafeMath.add(cards.coinBalanceOf(_player,1),_platValue);
require(totalCost >= ethCost);
cards.updatePlayersCoinByOut(... | 15,452,563 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.4;
contract who{
//Direcció del propietari de l'smart contract de l'Organització Mundial de la Salut
address owner = 0x959FD7Ef9089B7142B6B908Dc3A8af7Aa8ff0FA1;
//Definició de variables
address SC_WHO;
address[] public Active_Labs;
address[... | ------Gestió d'entitat------Activació / desactivació de la característica d'entitat | function activeEntity(bool _active) public onlyWHO() {
entity = _active;
}
| 5,473,964 |
pragma solidity ^0.5.4;
import "./AuctionityStorage1.sol";
import "../CommonContract/AuctionityLibrary_V1.sol";
import "../CommonContract/AuctionityChainId_V1.sol";
import "../CommonContract/AuctionityLibraryDecodeRawTx_V1.sol";
import "../CommonContract/SafeMath.sol";
/// @title Auctionity Treasurer
contract Auction... | get locked balance ERC1155 _user address _tokenContractAddress address : ERC1155 smart contract _tokenId uint256 : tokenId of ERC1155 _lockedFor uin256 : id to lock for return _balanceOf uint256 | function getBalanceLockedERC1155_V1(
address _user,
address _tokenContractAddress,
uint256 _tokenId,
uint256 _lockedFor
) public view returns (uint256 _balanceOf) {
return _getBalanceLocked_V1(
_user,
_tokenContractAddress,
_tokenId,
... | 7,224,472 |
./partial_match/4/0x2628b42A329457123835c6fc61Fb4D976f5c66CB/sources/SMOOTCrowdsale.sol | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations. Example from CappedCrowdsale.sol's _preValidatePurchase method: super._preValidatePurchase(beneficiary, weiAmount); require(we... | function _preValidatePurchase(address beneficiary, uint256 weiAmount,uint256 _numberOfTokens) internal whenNotPaused {
require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address");
require(weiAmount != 0, "Crowdsale: weiAmount is 0");
numberOfTokens = _numberOfTokens;
... | 8,516,402 |
./full_match/1/0x0BbE1D2c0BB0a2b7F2E3c3D59358193C9d2b0301/sources/contracts/staking/ResourceFieldV2.sol | See {IERC721-getApproved}./ | function getApproved(uint256) external pure override returns (address) {
return address(0);
}
| 4,829,600 |
./partial_match/1/0x8431060c8e72793aFaDA261E9DD0Ab950e80894F/sources/contracts/StakingPool.sol | if there are other stakers and unclaimed rewards, deposit them back into the pool for other stakers to claim | function _removeShares(address wallet, uint256 amount) private {
require(
shares[wallet].amount > 0 && amount <= shares[wallet].amount,
'REM: amount'
);
require(
block.timestamp > shares[wallet].stakedTime + lockupPeriod,
'REM: timelock'
);
uint256 _unclaimed = getUnpaid(wa... | 9,263,122 |
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);
... | create a proposal to register a scheme _avatar the address of the organization the scheme will be registered for _scheme the address of the scheme to be registered _parametersHash a hash of the configuration of the _scheme _permissions the permission of the scheme to be registered return a proposal Id NB: not only... | function proposeScheme(
Avatar _avatar,
address _scheme,
bytes32 _parametersHash,
bytes4 _permissions
)
public
returns(bytes32)
{
require(_scheme != address(0));
Parameters memory controllerParams = parameters[getParametersFromController(_avatar)];
... | 1,417,186 |
./full_match/5/0x507092d20022999DC3179EF6E959B7A5da784f09/sources/project_/contracts/ProxyFactory.sol | copy init code into memory and immutable ExchangeDeposit address onto stack Get the position of the start of init code grab the first 32 bytes shift the address bytes 8 bits left bitwise OR them and add the address into the init code memory create the contract revert if failed | function deployNewInstances(uint256 instanceAmount, bool all) external returns (address[] memory dsts) {
bytes memory initCodeMem = INIT_CODE;
address payable addrStack = mainAddress;
address dst = address(0);
dsts = new address[](instanceAmount);
for(uint256 i=saltCnt; i<s... | 1,876,299 |
pragma solidity ^0.4.22;
// File: contracts/zeppelin/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 (uint256) {
... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 10,515,608 |
./full_match/2222/0xD510b3A5bdC8292E5a4efA0836654f335Ac3AB19/sources/contracts/liquidity-commitment-contracts/contracts/GMI.sol | Sets the address of the earn operator. This function allows the contract owner to update the earnOperator address, which represents the address authorized to manage earnings on behalf of the contract. _earnOperator The new address of the earn operator./ | function setEarnOperator(address _earnOperator) external onlyOwner {
earnOperator = _earnOperator;
}
| 7,102,525 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "./interface/IERC9999.sol";
/// @title cryptosharing
/// @author Kimos
/// @notice cryptosharing
contract ERC9999 is IERC9999 , ERC721 {
... | solhint-disable-next-line max-line-length | function transferUserFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
require(_isApprovedOrUser(_msgSender(), tokenId) || ERC721._isApprovedOrOwner(_msgSender() , tokenId), "ERC9999: transfer caller is not user or owner nor approved");
... | 901,560 |
./full_match/1/0xc6279A7Cd38819ebbF6ad3a05a0998f887DF2740/sources/src/aura-fed/BalancerAdapter.sol | /Populate Single Swap structswapStruct.userData: User data can be left empty | function swapExactIn(address assetIn, address assetOut, uint amount, uint minOut) internal {
IVault.SingleSwap memory swapStruct;
swapStruct.poolId = poolId;
swapStruct.kind = IVault.SwapKind.GIVEN_IN;
swapStruct.assetIn = IAsset(assetIn);
swapStruct.assetOut = IAsset(assetO... | 3,015,082 |
pragma solidity ^0.4.0;
contract BubbleCoin{
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) approved; // approved[owner][spender]
uint supply;
//MARK: - ERC20 functions
function totalSupply() constant returns (uint totalSupply) {
// returns the totoal circ... | gets token balance of the caller address | function getMyBalance() returns (uint) {
return balances[msg.sender];
}
| 5,347,725 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Add liquidity a second time | function _swapAndDeposit(
int24 _lowerTick,
int24 _upperTick,
uint256 _amount0,
uint256 _amount1,
int256 _swapAmount,
uint160 _swapThresholdPrice,
bool _zeroForOne
) private returns (uint256 finalAmount0, uint256 finalAmount1) {
(int256 amount0Delt... | 11,853,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.