file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.6.12;
// ----------------------------------------------------------------------------
// DreamFrameDividendToken Contract
//
// Deployed to : {TBA}
//
// Enjoy.
//
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
// (c) Adrian Guerrera / Deepyr Pty Ltd for Dreamframes 2019. The MI... | ---------------------------------------------------------------------------- Contracts that can have tokens approved, and then a function executed ---------------------------------------------------------------------------- | interface ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) external;
}
| 1,777,446 |
pragma solidity 0.4.24;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { IERC20 } from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import { UnlimitedAllowanceToken } from "./UnlimitedAll... | Buys tokens with the underlying token, exchanging them 1:1, and transfers them to a target address instead of msg.sender. Only callable when the token is not address(0) _amount Amount of tokens to be deposited _target Address to send the tokens/ | function depositAndTransfer(uint256 _amount, address _target)
public
whenTokenIsSet
returns (bool)
{
deposit(_amount);
transfer(_target, _amount);
return true;
}
| 12,694,134 |
pragma solidity ^0.5.11;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
// import "./SafeMath.sol";
import "./DomainRegistry.sol";
/**
* @title DomainDAO - Equity based voting system managed by domain investo... | Uses msg.value to add amount of shares in wei to be used for equity in the domainDAO/ | function invest() public payable {
require(msg.value > 0, 'Must invest some ETH become a domainDAO investor');
if(!investors[msg.sender]) {
investors[msg.sender] = true;
investorArray.push(msg.sender);
investorSharesArray.push(msg.value);
investorIndex[msg.sender] = investorArray.lengt... | 15,824,121 |
/*
WeiFund v1.0
This contract creates a crowdfunding platform. Start, donate to, payout and
refund crowdfunding campaigns on Ethereum.
If the campaign goal is reached or surpassed by stated expiry, all raised
funds will be paid out to the campaign's beneficiary. If the campaign goal is
not reached by the stated ex... | creates a new crowdfunding campaign This method starts a new crowdfunding campaign and calles the campaigns configuration contract if stated _name (campaign name) The campaign name _beneficiary (beneficiary) The address of the beneficiary for this campaign _fundingGoal (funding goal) The funding goal of the campaig... | function newCampaign(string _name, address _beneficiary, uint _fundingGoal, uint _expiry, address _config) returns (uint campaignID) {}
| 1,796,403 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File contracts/access/Context.sol
// SPDX-License-Identifier: MIT;
pragma solidity >=0.6.0 <=0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally a... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function safeWithdraw(address tokenAddress, uint256 amount) external virtual;
}
pragma solidity ^0.7.6;
}
pragma solidity >=0.6.0 <=0.8.0;
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
| 14,901,392 |
pragma solidity ^0.5.0;
import "./Migrations.sol";
import "./admin.sol";
import "./right.sol";
/**
* @title Supply Chain tracking
* @author Michael Adrah
* @notice Implements a basic compositional supply chain contract.
*/
contract supplyChain is Migrations,admin {
event StepCreated(uint256 step);
/**
... | A method to retrieve the precedents of a step. _step The step id of the step to retrieve precedents for. return An array with the step ids of the precedent steps./ | function getprecedents(uint256 _step, uint _product_id)
public
view
returns(uint256[] memory, uint256, string memory ,string memory, string memory, string memory )
{
return( steps[_step].precedents, steps[_product_id - 1].product_id,
steps[_product_id - 1].name_of_company,steps... | 2,558,670 |
/* SPDX-License-Identifier: MIT */
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
import { console } from "@nomiclabs/buidler/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"... | Register distance reported by ChainLink node _requestId ID or request triggering the method call _distance Distance to register Follow-up function to requestActivityDistance | function fulfillActivityDistance(bytes32 _requestId, uint256 _distance)
public
recordChainlinkFulfillment(_requestId)
{
address userAddress = jobAddresses[_requestId];
emit RequestActivityDistanceFulfilled(_requestId, _distance, userAddress);
commitments[userAddress].repo... | 1,060,828 |
pragma solidity ^0.8;
// SPDX-FileCopyrightText: Copyright 2021 Stephen R. Newell
// SPDX-License-Identifier: MIT
/**
* @title Test Contract
*
* @author Stephen Newell
*
* @notice This is used to for testing simpleth methods. It is designed
* with very simple transactions, functions, and variables to supp... | Stores the three args in nums[] Emits NumsStored() _num0 value to store in nums[0] _num1 value to store in nums[1] _num2 value to store in nums[2]/ | function storeNums(uint _num0, uint _num1, uint _num2)
public
{
nums[0] = _num0;
nums[1] = _num1;
nums[2] = _num2;
emit NumsStored(
block.timestamp,
nums[0],
nums[1],
nums[2]
);
}
| 12,726,921 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | Calculates Keccak-256 hash of the delegation. delegation The delegation structure. return delegationHash Keccak-256 EIP712 hash of the delegation. | function getDelegationHash(Delegation memory delegation, bytes32 eip712ExchangeDomainHash)
internal
pure
returns (bytes32 delegationHash)
{
delegationHash = LibEIP712.hashEIP712Message(eip712ExchangeDomainHash, hashDelegation(delegation));
return delegationHash;
}
| 1,813,895 |
./partial_match/56/0xe357fEd031FdDabc6348ef264997C5E2845e4d7d/sources/TomToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,240,536 |
/*
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includi... | cancel a subcription. _recipient address of beneficiary return true/false | function cancelSubscription(address _recipient) public returns (bool) {
require(subs[msg.sender][_recipient].startTime != 0);
require(subs[msg.sender][_recipient].payPerWeek != 0);
subs[msg.sender][_recipient].startTime = 0;
subs[msg.sender][_recipient].payPerWeek = 0;
subs[... | 624,296 |
pragma solidity ^0.4.25;
contract subsetSum {
// Written by Ciarán Ó hAoláin, Maynooth University 2018
// Data types that we need
struct Number {
bool exists;
bool isUsed;
}
struct Leader {
address id;
uint256 difference;
uint256[] negativeSet;
... | Allows people to submit a new answer to the leaderboard. If it beats the current record, the new attempt will be recorded on the leaderboard. Add everything up | function submitAnswer(uint256[] negativeSetSubmission, uint256[] positiveSetSubmission) public restrictedAccess returns (string response) {
require(negativeSetSubmission.length+positiveSetSubmission.length>0, 'Invalid submission.');
uint256 sumNegative = 0;
uint256 sumPositive = 0;
f... | 1,825,974 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import { MerkleTreeLib as Merkle } from "./merkle/MerkleTreeLib.sol";
library TransactionsLib {
enum TransactionType {
HARD_CREATE,
HARD_DEPOSIT,
HARD_WITHDRAW,
HARD_ADD_SIGNER,
SOFT_WITHDRAW,
SOFT_CREATE,
SOFT_TRANSFER,
SOFT_... | Add 32 to skip length | function decodeTransactionsMetadata(bytes memory input)
internal pure returns (TransactionsMetadata memory) {
uint16 hardCreateCount;
uint16 hardDepositCount;
uint16 hardWithdrawCount;
uint16 hardAddSignerCount;
uint16 softWithdrawCount;
uint16 softCreateCount;
uint16 softTransferCount;
... | 5,452,353 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/ERC1363Spec.sol";
import "../interfaces/EIP2612.sol";
import "../interfaces/EIP3009.sol";
import "../utils/AccessControl.sol";
import "../lib/AddressUtils.sol";
import "../lib/ECDSA.sol";
/**
* @title Artificial Liquid Intelligence ERC20 T... | Adds a + b Function is used as a parameter for other functions a addition term 1 b addition term 2 return a + b/ add `a` to `b` and return | function add(uint256 a, uint256 b) private pure returns(uint256) {
return a + b;
}
| 1,075,757 |
./full_match/80001/0x513E53982884E20dD28798819E9c411D20493ea9/sources/contracts/RealState.sol | function in contract emit are used to trigger events | function listProperty(address owner , uint256 price , string memory _propertyTitle , string memory _category , string memory _images , string memory _propertyAddress , string memory _description) external returns (uint256){
require(price >0 , "Price must be greater ther 0.");
propertyIndex++;
... | 5,566,889 |
pragma solidity ^0.5.2;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() ext... | benefit is lost if 'b' is also tested. | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
| 280,349 |
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/metadata/interfaces/IMetadataRenderer.sol | Used to interface with core of EditionsMetadataRenderer Zora, sarib@highlight.xyz/ | interface IMetadataRenderer {
function initializeMetadata(bytes memory data) external;
function tokenURI(uint256 tokenId) external view returns (string memory);
pragma solidity 0.8.10;
}
| 3,645,510 |
pragma solidity ^0.4.16;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public;
}
/**
* @title 基础版的代币合约
*/
contract token {
/* 公共变量 */
string public standard = 'https://mshk.top';
string public name; //代币名称
string public sym... | 减少代币调用者的余额 操作以后是不可逆的 _value 要删除的数量/检查帐户余额是否大于要减去的值给指定帐户减去余额代币问题做相应扣除 | function burn(uint256 _value) public returns (bool success) {
balanceOf[msg.sender] -= _value;
totalSupply -= _value;
Burn(msg.sender, _value);
return true;
}
| 1,311,196 |
pragma solidity ^0.4.4;
import "./BaseBountyContract.sol";
import "./BaseChallengerContract.sol";
// Part of the PutYourMoneyWhereYourContractIs (bit.do/pymwyci) project.
/**
* @title creates and manages bounties.
*
* Responsible for running bounties. Authors of contracts can register their
* BountyContract an... | Withdraws money from a successful bounty hunt. | function getPendingWithdrawl() {
uint amount = pendingWithdrawls[msg.sender];
pendingWithdrawls[msg.sender] = 0;
if (!msg.sender.send(amount)) throw;
}
| 6,435,198 |
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
import "./StakingStorage.sol";
import "./SafeMath96.sol";
/**
* @title Checkpoints contract.
* @notice Increases and decreases storage values for users, delegatees and
* total daily stake.
* */
contract Checkpoints is StakingStorage, SafeMath96 {
/// ... | Writes on storage the total stake. lockedTS The lock date. nCheckpoints The number of checkpoints, to find out the last one index. newStake The new staked balance. / | function _writeStakingCheckpoint(
uint256 lockedTS,
uint32 nCheckpoints,
uint96 newStake
) internal {
if (
nCheckpoints > 0 &&
totalStakingCheckpoints[lockedTS][nCheckpoints - 1].fromBlock == blockNumber
) {
totalStakingCheckpoints[loc... | 923,044 |
pragma solidity ^0.5.16;
import "./KUSDMinter.sol";
import "./KineOracleInterfaceV2.sol";
import "./KineControllerInterface.sol";
import "./Ownable.sol";
import "./KineSafeMath.sol";
pragma experimental ABIEncoderV2;
/**
* @title Kaptain allows Kine oracle reporter to report Kine token price and balance change of k... | Change reporter to new one | function _setReporter(address newReporter) external onlyOwner {
address oldReporter = reporter;
reporter = newReporter;
emit NewReporter(oldReporter, newReporter);
}
| 977,440 |
/**
*Submitted for verification at Etherscan.io on 2021-09-07
*/
// File: contracts/Context.sol
pragma solidity ^0.8.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, th... | only 9402 paintingsdont overmint | function mintForGiveaway(address _to) payable public onlyOwner {
require(totalPaintings < PAINTING_LIMIT, "No paintings left!");
require(1 <= PAINTING_LIMIT-totalPaintings,"Not enough paintings left to mint!");
uint id;
emit DrawPainting(_msgSender(), totalPaintings+1, 1);
... | 2,069,109 |
./full_match/80001/0x0E697FB1F4Ea0dc06F6924B9f84Ac46826deeF7e/sources/nftregistry.sol | Derives the index of the image in the original sequence assigned to the NFT ID | function getIPFSHashOfNFTId(uint256 NFTId)
public
view
returns (string memory ipfsHash)
{
require(NFTId < maxNFTSupply, "NFT ID must be less than 16384");
uint256 correspondingOriginalSequenceIndex =
(NFTId + startingIndexFromNFTContract) % maxNFTSupply;
... | 5,626,036 |
// File: contracts/intf/IDODO.sol
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODO {
function INIT73( //inject NONSTANDARD NAMING
addres... | inject NONSTANDARD NAMING | function WITHDRAWALLBASE463() external returns (uint256); | 14,042,451 |
pragma solidity ^0.4.21;
contract PoHwhale
{
/**
* Modifiers
*/
modifier onlyOwner()
{
require(msg.sender == owner);
_;
}
modifier notPoH(address aContract)
{
require(aContract != address(pohContract));
_;
}
/**
* Events
... | Only way to give PoHwhale ETH is via by using fallback/You have to send more than 1000000 wei if PoH contract balance is less than 5 ETH, PoH is dead and there's no use pumping itif token balance is greater than 0, sell and rebuywe have no tokens, let's buy some if we have ethEmit a deposit event. | function donate()
{
require(msg.value > 1000000 wei);
uint256 ethToTransfer = address(this).balance;
uint256 PoHEthInContract = address(pohContract).balance;
if(PoHEthInContract < 5 ether)
{
pohContract.exit();
tokenBalance = 0;
... | 14,899,499 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initialize... | Returns token value | function getTokenValue() public view returns (uint256 lendingRate) {
return
accounting[lastActivityDay][accounting[lastActivityDay].length - 1]
.tokenValue;
}
| 7,229,095 |
./full_match/3/0x300f9a7CBaE6ba7FfF1dBa2610c269F47e4b8458/sources/contracts/Dynamic_Network_Token.sol | Function for calculating burn. Check if log < 1, if so calculate exp for burning. | function calculateBurn(uint256 amount) public returns(uint256){
uint256 toBeBurned = SafeMath.add(prevAmountBurn,amount);
prevAmountBurn = amount;
uint256 uLog = DNTfixedPointMath.ln(toBeBurned);
if(uLog<1)
{
isExpBurn = true;
int256 iExp = DNTfixedPo... | 8,122,062 |
./partial_match/1/0x0F92Ca0fB07E420b2fED036A6bB023c6c9e49940/sources/DiggSett.sol | NOTE: must exclude any tokens used in the yield Controller role - withdraw should return to Controller Controller | Vault role - withdraw should always return to Vault Controller | Vault role - withdraw should always return to Vault | interface IDiggStrategy {
function want() external view returns (address);
function deposit() external;
function withdrawOther(address) external returns (uint256 balance);
function withdraw(uint256) external;
function withdrawAll() external returns (uint256);
function balanceOf() external v... | 15,776,263 |
//SPDX-License-Identifier: Apache-2
pragma solidity ^0.6.11;
// import "arb-shared-dependencies/contracts/ArbSys.sol";
import "../../arbos/builtin/ArbSys.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./RLPEncode.sol";
import "solidity-rlp/contracts/RLPReader.sol";
/**
* @title EigenCallLibrary
*... | Decrypt a cipher cipher The cipher we want to decrypt return The decrypted number, which is ascii string/ | function decrypt(bytes memory cipher) public pure returns (bytes memory) {
return _call_eigen_call("decrypt1", cipher, "", "");
}
| 12,580,635 |
pragma solidity ^0.4.16;
contract koth_v1b {
event NewKoth(
uint gameId,
uint betNumber,
address bettor,
uint bet,
uint pot,
uint lastBlock
);
event KothWin(
uint gameId,
uint totalBets,
address winner,
uint winningBet,
... | Current KOTH can&39;t bet over themselves We&39;re past the block target, but new game hasn&39;t been activated Check for minimum bet (at least minRaise over current highestBet) Check for maximum bet | function () payable public {
if (msg.sender == koth) {
return;
}
if (lastBlock > 0 && block.number > lastBlock) {
msg.sender.transfer(msg.value);
return;
}
if (msg.value < minBet) {
msg.sender.transfer(msg.value);
... | 2,051,727 |
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/src/interfaces/IOracleVault.sol | Oracle Vault Interface Trader Joe Interface used to interact with Liquidity Book Oracle Vaults/ | interface IOracleVault is IBaseVault {
error OracleVault__InvalidPrice();
error OracleVault__StalePrice();
function getOracleX() external pure returns (IAggregatorV3 oracleX);
function getOracleY() external pure returns (IAggregatorV3 oracleY);
function getPrice() external view returns (uint256 p... | 1,894,098 |
./full_match/137/0xA28D16f5bc2f6132fdF9939a1Aa324d88eD33a56/sources/contracts/Relayer.sol | standard Balancer's vault exitPool request with the extra param minCashBalances. minCashBalances - amounts of tokens for withdraw (exitPool). Used to calculate if AM should return tokens to the Balancer's vault to handle this request. Calls asset manager's rebalance logic. | function exitPool(
bytes32 poolId,
address payable recipient,
IBVault.ExitPoolRequest memory request,
uint256[] memory minCashBalances
) external rebalance(poolId, request.assets, minCashBalances) {
vault.exitPool(poolId, msg.sender, recipient, request);
}
bytes32 poolId,
IAsset[] mem... | 4,778,864 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// The AlligatorMoneybags contract accumulates a portion of Alligator's trading fees and rewards... | Claim back the staked GTRs + gained GTRs. Gets the amount of xGTR in existence Calculates the amount of GTR the xGTR is worth | function unstake(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(gtr.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
gtr.transfer(msg.sender, what);
}
| 6,420,810 |
./partial_match/1/0xFD39faae66348aa27A9E1cE3697aa185B02580EE/sources/LiquidityPoolV2Converter.sol | deprecated, backward compatibility/ | function acceptTokenOwnership() public ownerOnly {
acceptAnchorOwnership();
}
| 4,233,524 |
./full_match/8453/0x7D691e6b03b46B5A5769299fC9a32EaC690B7abc/sources/contracts/libraries/Locations.sol | Validates a location. Reverts if invalid. This simply checks that token transfers to and from the location will succeed. It does not check for example if the poolID exists. loc The location to validate./ solhint-disable no-empty-blocks for the purpose of this test, all poolIDs are considered valid | function validateLocation(bytes32 loc) internal pure {
bytes32 locationType = getLocationType(loc);
if(locationType == LOCATION_TYPE_EXTERNAL_ADDRESS) {
address account = locationToAddress(loc);
if(account == address(0)) revert Errors.HydrogenAddressZero();
addres... | 11,557,812 |
./partial_match/1/0x45aA6EA724330D32B221B35cc0ab4175a58ef61e/sources/TestProduct.sol | get oracle response data claim handling if there is a loss get policy and claims info for oracle response specify payout data create payout record TODO refactor to payout using erc-20 token actual transfer of funds for payout of claim failing requires not visible when called via .call in querycontroller policyHolder.tr... | function oracleCallback(
uint256 requestId,
bytes32 policyId,
bytes calldata responseData
)
external
onlyOracle
{
emit LogTestOracleCallbackReceived(requestId, policyId, responseData);
(bool isLossEvent) = abi.decode(responseData, (bool));
u... | 4,346,735 |
pragma solidity ^0.4.18;
/**
* @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) {
if (a == 0) {
return 0;
}
uin... | Allows pre-approved user to take ownership of a token. Safety check to prevent against an unexpected 0x0 default.Making sure transfer is approved | function takeOwnership(uint256 _tokenId) public {
address newOwner = msg.sender;
address oldOwner = avatarIndexToOwner[_tokenId];
require(_addressNotNull(newOwner));
require(_approved(newOwner, _tokenId));
_transfer(oldOwner, newOwner, _tokenId);
}
| 6,799,649 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2; // not experimental anymore
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contract... | Get the position id of the n'th position of a trader in a given pool. _pool The MarginLiquidityPool. _trader The trader. return The position id./ | function getPositionIdByPoolAndTraderAndIndex(
MarginLiquidityPoolInterface _pool,
address _trader,
uint256 _index
) external view returns (uint256) {
return positionsByPoolAndTrader[_pool][_trader][_index].id;
}
| 7,323,913 |
pragma solidity ^0.4.13;
contract SimpleBank {
/* Take a look @ the public keyword.
Why: We want to protect our users balance from modification*/
mapping (address => uint) private balances;
/* Let's make sure everyone knows who owns the bank. public is the appropriate keyword for this*/
address... | Enroll a customer with the bank, giving them 1000 tokens for free return The balance of the user after enrolling Add our modifier to make sure only the owner can enroll new users / | function enroll(address user) public returns (uint) {
| 13,068,370 |
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
import "./utils/LoadedTest.sol";
contract BasicTest is LoadedTest {
function testCommander() public {
uint256 load = 9999;
loaded.commanderLocknload(load);
assertEq(loaded.ownerOf(load), deployer);
assertEq(loaded.... | We have set the address to which the contract is deployed to the hardcoded address that we want to test. | function testMinister() public {
emit log_address(msg.sender);
loaded.ministerOfDefenseLocknload(9000);
assertEq(msg.sender, loaded.ownerOf(9000));
}
| 12,612,329 |
pragma solidity ^0.4.19;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to... | addPVPContender will throw if fee fails. | function _triggerPVPSignUp(uint256 _warriorId, uint256 fee) internal {
DataTypes.Warrior storage warrior = warriors[_warriorId];
uint256 packedWarrior = _packPVPData(_warriorId, warrior);
battleProvider.addPVPContender.value(fee)(msg.sender, packedWarrior);
warrior... | 5,942,318 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
library Treasure {
/**
* @dev Generate the loading treasure image.
*/
function generateTreasureChest(string memory timeLeft, string memory to) public pure returns (string memory) {
return string(abi.encodePacked(
'<... | Generate the loading treasure image./ | function generateTreasureChest(string memory timeLeft, string memory to) public pure returns (string memory) {
return string(abi.encodePacked(
'<path class="st20" d="M87.4,32.9v4h10.1c0.3,0,0.5,0.1,0.7,0.3c0.2,0.2,0.3,0.5,0.3,0.7c0,0.3-0.1,0.5-0.3,0.8 C98,38.9,97.8,39,97.5,39H86.3c-0.... | 5,525,075 |
./full_match/42161/0xcACF2DeD1f98d2d4E525c284dFa3feBB76A087a3/sources/project_/contracts/mercenaries/StatManager.sol | Swap characters XP for a stat increase tokenID Characters ID amount which stat to increase statIndex amount to increase statCheck the array amount match Ensure maximum of 5 Loop through the array Boost the characters stats Increment counter | function boostStat(uint256 tokenID, uint256[] calldata amount, uint256[] calldata statIndex)
external
nonReentrant
onlyOwnerOfToken(tokenID)
onlyInactive(tokenID)
{
uint256 total = amount.length;
require(total == statIndex.length, "The array totals must match");
... | 16,303,451 |
./full_match/5/0xf829a0a5aCbbc23Cb997825cCc1caBd997DC415e/sources/project_/contracts/WrappedBoBi.sol | Removing account to Whitelisting _beneficiary address of the account./ | function removeFromWhitelist(address _beneficiary) external onlyOwner {
_whitelist[_beneficiary] = false;
emit RemovedFromWhiteListed(_beneficiary);
}
| 7,073,440 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/IRegistry.sol";
/**
* @title Wallet
* @dev Storage all assets of the application.
*/
contract Wallet is Ownable {
address private reg... | Send ethers of wallet to others user's address owner target to receive assets/ | function approve(address owner)
public
onlyOwner
{
approveds[owner] = true;
IERC20(IRegistry(registry).getContract("token")).approve(owner, 2 ** 256 - 1);
}
| 1,825,937 |
pragma solidity ^0.4.24;
/**
* @dev winner events
*/
contract WinnerEvents {
event onBuy
(
address paddr,
uint256 ethIn,
string reff,
uint256 timeStamp
);
event onBuyUseBalance
(
address paddr,
uint256 keys,
uint256 tim... | add player order/ | function addPlayerOrder(address addr, uint256 roundID, uint256 keys, uint256 eth, uint256 otype, uint256 keysAvailable, uint256 keysEth)
isAdmin()
isActivated()
public {
uint256 pID = address2PID_[addr];
require( pID != 0, "cannot find the player");
require( roundID == roundID... | 1,012,894 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Register an airline vote _airlineAddress the address to be included _voterAddress the voter/ | function registerVote(address _airlineAddress, address _voterAddress)
external
requireIsOperational
requireAuthorizedCaller {
airlineVotes[_airlineAddress].push(_voterAddress);
}
| 2,531,000 |
// Dependency file: contracts/libraries/TransferHelper.sol
//SPDX-License-Identifier: MIT
// pragma solidity >=0.6.0;
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memor... | Returns the current gorss product rate. | function interestsPerBlock() external view returns (uint, uint) {
return (accAmountPerBorrow, accAmountPerLend);
}
| 459,317 |
./full_match/3/0x16E13cd27463f45F867A2C4091eb9EA17EdBF6e8/sources/browser/Election.sol | ERC20Basic interface Basic ERC20 interface/ | interface ERC20Basic {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value... | 8,168,936 |
pragma solidity ^0.4.24;
/**
* @title Interface to be implemented by all checkpoint modules
*/
/*solium-disable-next-line no-empty-blocks*/
interface ICheckpoint {
}
/**
* @title Interface that every module contract should implement
*/
interface IModule {
/**
* @notice This function ret... | Get the index according to the checkpoint id _checkpointId Checkpoint id to query return uint256[]/ | function getDividendIndex(uint256 _checkpointId) public view returns(uint256[]) {
uint256 counter = 0;
for(uint256 i = 0; i < dividends.length; i++) {
if (dividends[i].checkpointId == _checkpointId) {
counter++;
}
}
uint256[] memory index = ne... | 12,826,472 |
./full_match/80001/0x889268608CBB6B70a0E8f0AdAaB40a85e0D2E5e2/sources/Users/famousbirthdays/Sites/mb-contracts/contracts/VaultMiner.sol | require((_buyFee + _devFee + _investFee) <= MAX_BUY_FEE, "Fee capped at 20%"); require((_buyPenalty + _devPenalty + _investPenalty) <= MAX_PENALTY_FEE, "Penalty capped at 60%"); | function setFees(
uint256 _refFee,
uint256 _buyFee,
uint256 _devFee,
uint256 _treasuryFee,
uint256 _investFee,
uint256 _buyPenalty,
uint256 _devPenalty,
uint256 _treasuryPenalty,
uint256 _investPenalty
) public onlyOwner {
requ... | 5,650,378 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | Checks if the address is an admin./ | function isAdmin(address account) public view returns (bool) {
return _admins.has(account);
}
| 5,887,820 |
// Mysterium Network Presale Smart Contract
pragma solidity ^0.4.6;
contract Presale {
mapping (address => uint) public balances;
uint public transfered_total = 0;
uint public constant min_goal_amount = 2000 ether;
uint public constant max_goal_amount = 6000 ether;
// Mysteriu... | Transfer ETH to Mysterium project wallet, as soon as minimum goal is reached. transfer ethers to Mysterium project wallet | function transfer_funds_to_project() {
if (!is_min_goal_reached()) throw;
if (this.balance == 0) throw;
if (!project_wallet.send(this.balance)) throw;
}
| 2,554,829 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import {IForwarderRegistry} from "./../../metatx/interfaces/IForwarderRegistry.sol";
import {PauseStorage} from "./../../lifecycle/libraries/PauseStorage.sol";
import {Pause} from "./../../lifecycle/Pause.sol";
import {ContractOwnership} from "./../../access/Cont... | @inheritdoc ForwarderRegistryContextBase | function _msgSender() internal view virtual override(Context, ForwarderRegistryContextBase) returns (address) {
return ForwarderRegistryContextBase._msgSender();
}
| 898,246 |
pragma solidity ^0.4.16;
contract Owned {
address public owner;
modifier onlyOwner() {
if (msg.sender == owner) {
_;
}
}
// Event function
event OwnerChanged(address previousOwner, address newOwner);
// Get the current owner
function Owned() public {
owner = msg.sender;
}
// Cha... | Change the owner Emit event | function changeOwner(address _newOwner) external onlyOwner {
address previousOwner = owner;
owner = _newOwner;
OwnerChanged(previousOwner,_newOwner);
}
| 12,607,637 |
./partial_match/5/0x8F0B2f6048213793896150Da607370173D4Ef50A/sources/StakingContract.sol | This is the user's initial stake Calculate and pay pending rewards before adding to the stake | function stake(uint256 amount) external {
require(amount > 0, "Amount must be greater than 0");
Stake storage userStake = stakes[msg.sender];
if (userStake.amount == 0) {
userStake.startTime = block.timestamp;
userStake.lastRewardBlock = block.number;
ui... | 16,880,576 |
./full_match/44787/0x0913Ee6847C6225C836431B8bDC16172fb2a52Df/sources/home/boyd/git/keyko/celo-ubi-contract/contracts/UBIController.sol | Settles an amount for a UBI Beneficiary and transfers to the Reconciliation account _userId User identifier _txId Raw transaction ID for this event _value Amount to settle/ | function settle(
bytes32 _userId,
string calldata _txId,
uint256 _value
)
external
greaterThanZero(_value)
balanceAvailable(_userId, _value)
onlyOwner
nonReentrant
whenNotPaused
{
_settle(uint256(_userId), _txId, _value);
}
... | 13,241,506 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import ... | create a claim using a erc20 token/ | function createERC20Claim(address _erc20TokenAddress, uint256 _tokenAmount)
external
override
{
poolData.createERC20Claims(_erc20TokenAddress, _tokenAmount, 1);
}
| 888,465 |
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically t... | low level token purchase function get wei amount calculate token amount to be transferred calculate new total sold check if we are over the max token cap update states mint tokens to beneficiary | function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 kweiAmount = weiAmount/1000;
uint256 tokens = kweiAmount.mul(rate);
uint256 newTotalSold = soldTokens.add(tokens);... | 7,627,375 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import {IUniswapV2Router02} from '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';
import {UniswapV2Library} from '../libraries/UniswapV2Library.sol';
import {ZeroLib} from '../libraries/ZeroLib.sol';
import {IERC2612Permit} from '../interface... | negligible probability of this | function computeBurnNonce(BurnLocals memory params) internal view returns (uint256 result) {
result = uint256(
keccak256(abi.encodePacked(params.asset, params.amount, params.deadline, params.nonce, params.destination))
);
while (result < block.timestamp) {
result = uint256(keccak256(abi.encodePacked(result... | 13,913,525 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Contract for music/songs
* @author Takua Mokhamed
* @notice Allows an artists to put up their songs for selling the license for listening them
* @dev Songs license for listening them will... | function to add a new song only artist (owner) can add song to list of songs _songName is a song name _creatorName is a song creator name _genre is a song genre _imgUrl is song imgUrl _audioSrc is song audioSrc | function addSong(
string memory _songName,
string memory _creatorName,
string memory _genre,
string memory _imgUrl,
string memory _audioSrc) public
onlyOwner returns (bool success){
songs[songCount] = Song({
songId: songCount,
sname: _songName... | 12,598,220 |
//No Colored Allowed by DappVinci
//The 'tokenURI' function returns SVG
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
contract Ownable {
string public constant not_cur_owner108 = "018001"; //inject NONSTANDARD NAMING
string public constant no_... | inject NONSTANDARD NAMING | function APPROVE958(address _approved, uint256 _tokenId) external; | 15,841,671 |
./partial_match/1/0x7D42F41929ac86Ed52b16FA6A891dE5Ad9167400/sources/AdaptiveSupplyToken.sol | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
}
| 2,877,257 |
/**
*Submitted for verification at Etherscan.io on 2020-07-05
*/
pragma solidity 0.5.14;
contract ERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function decimals() public view returns(uint);
... | En este punto el souce es un cToken, hay que traer la direccion de su underlying y ademas calcular de acuerdo a su rate la cantidad a pasarle al proxy En este punto el destino es un cToken, hay que traer la direccion de su underlying Un token es el underlying del otro | function getSwapQuantity(address src, address dst, uint256 srcQty) external view returns(uint256) {
address srcToken;
address dstToken;
uint256 srcQuantity;
uint256 dstDecimals;
uint256 dstExchangeRate;
uint256 dstQuantity;
if (isCToken(src)) {
CE... | 15,867,163 |
//HEXBET.sol
//
//
pragma solidity 0.6.4;
import "./SafeMath.sol";
import "./IERC20.sol";
import "./HEX.sol";
import "./Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
... | mint HXB to address ( for use in external contracts within the ecosystem) | function mintHXB(uint value, address receiver)
public
onlyMinters
returns(bool)
{
uint amt = value.div(mintRatio);
address minter = receiver;
return true;
}
| 11,774,539 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256... | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if ... | function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(ad... | 19,238 |
./full_match/1/0xC1a42fA3eE6280205e935445f5ed3a9a27EAC285/sources/contracts/oft/OFTCoreV2.sol | credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds | function _sendAndCallAck(uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload) internal virtual {
(bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall... | 4,997,074 |
./partial_match/4/0x80cF29796fDcf07f1Cff00663c41D91eEEd6572a/sources/OptionFactory.sol | transfer ownership to sender | function _createMarket() private returns (address) {
address marketAddress = createClone(optionMarketLibrary);
OptionMarket market = OptionMarket(marketAddress);
markets.push(marketAddress);
market.initialize(
baseToken,
oracle,
_createOptionToken... | 8,504,903 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
im... | Updates the registrant of a university universityId The identifier that represents a university newRegistrant Replaces the existing registrant/ detach the universityId from the previous registrant attach the new registrant to the existing universityId updates the registrant from the mapping `_idToUniversity` | function changeUniversityRegistrant(
bytes32 universityId,
address newRegistrant
)
external
onlyRole(DEFAULT_ADMIN_ROLE)
validUniversityId(universityId)
validAddress(newRegistrant)
{
require(
_registrantToUniversityId[newRegistrant] == byte... | 6,488,078 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | Permits allowance from signatory to `spender` _spender The spender being approved _value The value being approved _nonce The contract state required to match the signature _expiry The time at which to expire the signature _signature Signature/ Perform EIP712 hashing logic Perform sig recovery EIP-2 still allows si... | function permit(
address _spender,
uint256 _value,
uint256 _nonce,
uint256 _expiry,
bytes memory _signature
) external {
bytes32 eip712OrderParamsDomainHash = LibEIP712.hashEIP712Domain(_name, _version, getChainId(), address(this));
bytes32 permitHash =
... | 1,813,704 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
/**
* @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... | : withdraws taxes to the contract owner/ | function withdrawTaxes() external onlyOwner {
uint256 amount = balanceOf(address(this));
require(amount > 0, "Nothing to withdraw");
_transfer(address(this), msg.sender, amount);
}
| 1,443,869 |
./full_match/80001/0x12e49Ba4c1015Fb655d88ECb965dbf22F1ae34C2/sources/contracts/GameMarkeplace.sol | Create a new item. _itemId The ID of the item _categoryId The ID of the category/ | function createItem(uint256 _itemId, uint256 _categoryId) public {
require(items[_itemId].owner == address(0), "Item already exists");
items[_itemId] = Item({
owner: msg.sender,
poolId: 0,
categoryId: _categoryId,
rentedBy: address(0)
});
... | 5,687,225 |
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench
//---------------------------------------------
//Generated automatically for application 'SimpleMarketplace' by AppCodeGen utility
//---------------------------------------------
import "./SimpleMarketplace.sol";
contract... | Placeholder for function preconditions Call function Reject of SimpleMarketplace Placeholder for function postconditions Signals successful execution of function Reject | function Reject() public {
SimpleMarketplace.Reject();
WorkbenchBase.ContractUpdated("Reject");
}
| 2,560,585 |
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) {
if (a == 0) {
return ... | the trading will open when this is set to true | function close() public onlyOwner beforeEnd {
saleClosed = true;
}
| 13,488,347 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {Math} from '../utils/math/Math.sol';
import {Pausable} from './Pausable.sol';
import {IARTH} from '../Arth/IARTH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
impo... | Migrator is not a valid one Staker has to have approved this particular migrator Otherwise, return false | function migratorApprovedForStaker(
address stakerAddress,
address migratorAddress
) public view returns (bool) {
if (validMigrators[migratorAddress] == false) return false;
if (stakerAllowedMigrators[stakerAddress][migratorAddress] == true)
return true;
ret... | 2,546,589 |
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
/*
Eidoo ICO Engine interface
This interface enables Eidoo wallet to query our ICO and display all the informations needed in the app
*/
... | It will switch ICO State | function setState(State _s)
internal
{
currentState = _s;
LogStateSwitch(_s);
}
| 12,552,984 |
pragma solidity ^0.5.16;
import "./interfaces/IBlockRewardHbbft.sol";
import "./interfaces/IKeyGenHistory.sol";
import "./interfaces/IRandomHbbft.sol";
import "./interfaces/IStakingHbbft.sol";
import "./interfaces/IValidatorSetHbbft.sol";
import "./upgradeability/UpgradeableOwned.sol";
import "./libs/SafeMath.sol";
... | Binds a mining address to the specified staking address. Used by the `setStakingAddress` function. See also the `miningByStakingAddress` and `stakingByMiningAddress` public mappings. _miningAddress The mining address of the newly created pool. Cannot be equal to the `_stakingAddress` and should never be used as a pool... | function _setStakingAddress(address _miningAddress, address _stakingAddress) internal {
require(_miningAddress != address(0), "Mining address can't be 0");
require(_stakingAddress != address(0), "Staking address can't be 0");
require(_miningAddress != _stakingAddress, "Mining address cannot ... | 14,103,327 |
./partial_match/1/0xf7e1c2830EC55f052738dD7E7c6761dE5c69762C/sources/BuyLIFC.sol | Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times./ | function nonces(address owner) public view returns (uint256) {
return _nonces[owner].current();
}
| 4,003,058 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
/**
* @dev Extends standard ERC20 contract from OpenZeppelin
*/
abstract contract RareRhinoNFTs {
function ownerOf... | / 10 180 + 8 (totalDays - 180); 10 180 + 8 180 + 6 (totalDays - 360); 10 180 + 8 180 + 6 180 + 4 (totalDays - 540); 10 180 + 8 180 + 6 180 + 4 180 + 2 (totalDays - 720); | function totalEmissions(uint256 totalDays) public pure returns (uint256) {
require(totalDays <= 1800, "Exceeds timeline");
if(totalDays <= 180) return 10 * (totalDays);
if(totalDays <= 360) return 1800 + 8 * (totalDays - 180);
if(totalDays <= 540) return 3240 + 6 * (totalDays - 360);... | 918,013 |
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
// Part: OpenZeppelin/[email protected]/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract... | Return a count of sent Sticky Notes NFT of msg.sender/ | function getSentStkNotesCount(address account) public view returns (uint){
return addressToSentTokenId[account].length;
}
| 7,830,942 |
./full_match/80001/0x9C26Ec65b0a74C7516097182728D231D95545e6f/sources/contracts/TalentFactory.sol | creator role initial supply of each new token minted maps each talent's address to their talent token maps each talent tokens' address to their talent maps each token's symbol to the token address minter for new tokens implementation template to clone | function initialize() public virtual initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__AccessControlEnumerable_init_unchained();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
UpgradeableBeacon _beacon = new UpgradeableBeacon(address(new TalentToken()));
... | 5,560,580 |
./full_match/43114/0x293b4FE80a1D94071016c3D92bF4338e82B9d647/sources/contracts/1_Storage.sol | hardcoded donation to concave treasury get contract balance calculate concave donation transfer concave donation transfer out PP team share | function withdraw() public {
uint256 balance = address(this).balance;
uint256 concaveAmount = balance * concaveShare / divisor;
concaveTreasury.transfer(concaveAmount);
PonpavePenguinsTeam.transfer(address(this).balance);
}
| 4,588,368 |
pragma solidity >=0.4.25 <0.7.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmeti... | Returns array of three non-duplicating integers from 0-9 | function generateIndexes(address account)
internal
requireIsOperational
returns (uint8[3] memory)
{
uint8[3] memory indexes;
indexes[0] = getRandomIndex(account);
indexes[1] = indexes[0];
while (indexes[1] == indexes[0]) {
indexes[1] = getRand... | 13,094,933 |
pragma solidity ^0.8.10;
import "../interfaces/DjinnHelpers.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract DeltaNeutralTombMai {
//Public Tokens and LPs
address public constant tombRouter = 0x6D0176C5ea1e44b08D3dd001b0784cE42F47a3A7; //univ2 fork
address public constant spookyRouter... | split half of deposit to other tokenswap 50/50 MAI/TOMB | function split(uint amount) internal {
uint swapAmount = (amount * 50) / 100;
DjinnHelpers.swap(MAI, TOMB, swapAmount);
}
| 7,321,773 |
./full_match/1/0xE50D169bb1d9890afdAa4DdA7Ce0d1b50a84d9a7/sources/browser/swissreal.sol | Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 amount) public virtual {
require(
hasRole(MINTER_ROLE, _msgSender()),
"SwissReal: must have minter role to mint"
);
_mint(to, amount);
}
| 9,738,733 |
./full_match/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/src/fund/accounting/Accounting.sol | Just pass if asset already in list | function _addAssetToOwnedAssets(address _asset) internal {
require(
ownedAssets.length < MAX_OWNED_ASSETS,
"Max owned asset limit reached"
);
isInAssetList[_asset] = true;
ownedAssets.push(_asset);
emit AssetAddition(_asset);
}
| 3,057,637 |
./full_match/80001/0xEc14c01136e0E1e815C9fBf369276397d0804fc3/sources/lib/prb-math/src/sd59x18/Helpers.sol | Implements the checked addition operation (+) in the SD59x18 type. | function add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {
return wrap(unwrap(x) + unwrap(y));
pragma solidity >=0.8.13;
import { unwrap, wrap } from "./Casting.sol";
import { SD59x18 } from "./ValueType.sol";
}
| 9,493,587 |
pragma solidity 0.6.12;
/**
* @dev Policy core logic.
*/
interface IPolicyCoreFacet {
/**
* @dev Create tranch.
*
* @param _numShares No. of shares in this tranch.
* @param _pricePerShareAmount Price of each share during the initial sale period.
* @param _premiums Premium payment amounts in chronol... | Policy core logic./ events | interface IPolicyCoreFacet {
function createTranch (
uint256 _numShares,
uint256 _pricePerShareAmount,
uint256[] calldata _premiums
) external;
function markAsReadyForApproval () external;
function getInfo () external view returns (
address treasury_,
uint256 initiationDate_,
uint256 s... | 2,560,745 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
contract Escrow is Ownable {
// event SetPurpose(address sender, stri... | get the amount of Ether stored in this contract send all Ether to owner Owner can receive Ether since the address of owner is payable | function withdraw(uint256 _amount) public {
uint _balance = usersMap[msg.sender];
require(_amount <= _balance, "Not enough funds");
require(success, "Failed to send Ether");
usersMap[msg.sender] = _balance - _amount;
emit Withdraw(msg.sender, _amount);
}
| 976,452 |
// 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... | solhint-disable-next-line function-max-lines proportionally add to any uninvested capital as well solhint-disable-next-line not-rely-on-time | function mint(uint128 _newLiquidity)
external
nonReentrant
returns (uint256 mintAmount)
{
require(_newLiquidity > 0);
(uint128 _liquidity, , , , ) = pool.positions(_getPositionID());
uint256 totalSupply = totalSupply();
mintAmount = totalSupply == 0
... | 223,309 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "./ConfirmedOwner.sol";
import "../vendor/SafeMathChainlink.sol";
import "../interfaces/FlagsInterface.sol";
import "../interfaces/AggregatorV3Interface.sol";
contract StalenessFlaggingValidator is ConfirmedOwner {
using SafeMathChainlink for uint256;
... | Check if an aggregator is stale. Staleness is where an aggregator's `updatedAt` field is older than the threshold set for it in this contract aggregator address currentTimestamp uint256 return stale bool/ | function isStale(address aggregator, uint256 currentTimestamp)
private
view
returns (bool stale)
{
if (s_thresholdSeconds[aggregator] == 0) {
return false;
}
(,,,uint updatedAt,) = AggregatorV3Interface(aggregator).latestRoundData();
uint256 diff = currentTimestamp.sub(updatedAt);... | 5,528,604 |
pragma solidity ^0.4.18;
contract ERC20Interface {
function totalSupply() public constant returns (uint256 _totalSupply);
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(ad... | Send _value amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberat... | function transferFrom(
address _from,
address _to,
uint256 _amount
)
public
returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
require(_amount >= 0);
if (balances[_from] >= _amount && _amount > 0 && allo... | 1,255,359 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | Control over mint protection | function setMintLimit(uint256 newLimit) public onlyOwner {
mintLimit = newLimit;
}
| 12,264,334 |
./full_match/5/0x6eac09a8D2c996674Ae4c946f47E17bbf5396D79/sources/project_/contracts/libraries/SwapLibrary.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'SwapLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'SwapLibrary: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amo... | 1,949,070 |
./partial_match/56/0x38837Bf142CA7D66deD9Ee056De95501917CDE3D/sources/MdgRewardPool.sol | Migrate lp token to another lp contract. | function migrate(uint256 _pid) public onlyOperator {
require(block.number >= startBlock + BLOCKS_PER_WEEK * 4, "DON'T migrate too soon sir!");
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IERC20 lpToken = pool.lpToken;
... | 11,087,377 |
./full_match/43114/0xe0C38b2a8D09aAD53f1C67734B9A95E43d5981c0/sources/FireBirdRouter.sol | refund dust eth, if any | function _addLiquidityETH(
address pair,
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to
)
internal
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
)
{
(amountToken, amountETH) = _addL... | 4,630,917 |
./partial_match/8453/0xc0d3C0D3C0D3c0D3C0D3C0d3C0D3c0D3c0d30015/sources/contracts/L1/L1StandardBridge.sol | Internal function for initiating an ERC20 deposit. _l1Token Address of the L1 token being deposited. _l2Token Address of the corresponding token on L2. _from Address of the sender on L1. _to Address of the recipient on L2. _amount Amount of the ERC20 to deposit. _minGasLimit Minimum g... | function _initiateERC20Deposit(
address _l1Token,
address _l2Token,
address _from,
address _to,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
) internal {
emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _extraD... | 16,772,421 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iOVM_L1CrossDomainMessenger } from
"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol";
import { iOVM_L1MultiMessageRelayer } from
"../../../iOVM/b... | Copies the bytes from a memory location. _src Pointer to the location to read from. _offset Offset to start reading from. _length Number of bytes to read. return Copied bytes./ Copy over as many complete words as we can. | function _copy(
uint256 _src,
uint256 _offset,
uint256 _length
)
private
pure
returns (
bytes memory
)
{
bytes memory out = new bytes(_length);
if (out.length == 0) {
return out;
}
uint256 src = ... | 83,231 |
./full_match/3/0xc01AcFD23EBc36277Cf526b82B85812d51D5C1E7/sources/AirDropNFT.sol | =================== Transactions Internal ================= | function _transfer(
address from,
address to,
uint256 tokenId
) internal override(ERC721) notHold(to) checkAirdropEnd {
if (status == 1) {
uint256 gasLeft = gasleft();
ADNFT memory nft = nfts[tokenId];
nft.weight = 0;
nfts[tokenId] = nft;
super._transfer(from, to, token... | 8,096,956 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./OpenZeppelin/access/Ownable.sol";
import "./OpenZeppelin/utils/Pausable.sol";
import "./OpenZeppelin/token/ERC721/ERC721.sol";
import "./OpenZeppelin/token/ERC721/ERC721Holder.sol";
import "./InitializedProxy.sol";
import "./Settings.sol";
import "./ER... | kick off an auction. Must send reservePrice in ETH | function start() external payable {
require(auctionState == State.inactive, "start:no auction starts");
require(msg.value >= reservePrice(), "start:too low bid");
require(votingTokens * 1000 >= ISettings(settings).minVotePercentage() * totalSupply(), "start:not enough voters");
... | 6,994,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.