file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title EternalStorage
* @dev An ownable contract that can be used as a storage where the variables
* are stored in a set of mappings indexed by hash names.
*/
contract EternalStorage {
struct Storage {
mapp... | Get the value stored of a address variable by the hash name h The keccak256 hash of the variable name/ | function getAddress(bytes32 h) public view returns (address) {
return s._address[h];
}
| 6,382,841 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/ILiquidityProtectionSystemStore.sol";
import "../utility/Utils.sol";
/**
* @dev This contract aggregates the... | decreases the amount of network tokens minted into a specific pool Requirements: - the caller must have the ROLE_OWNER role/ | function decNetworkTokensMinted(IConverterAnchor poolAnchor, uint256 amount)
external
override
ownerOnly
validAddress(address(poolAnchor))
{
uint256 prevAmount = _networkTokensMinted[poolAnchor];
uint256 newAmount = prevAmount > amount ? prevAmount - amount : 0;
... | 1,828,937 |
./partial_match/100/0x34c576C6fC6Ac90B847B83Aa9597CCC216A5aBA7/sources/ClearingHouse.sol | open a position _amm amm address _side enum Side; BUY for long and SELL for short _quoteAssetAmount quote asset amount in 18 digits. Can Not be 0 _leverage leverage in 18 digits. Can Not be 0 _baseAssetAmountLimit minimum base asset amount expected to get to prevent from slippage./ add scope for stack too deep er... | function openPosition(
IAmm _amm,
Side _side,
Decimal.decimal calldata _quoteAssetAmount,
Decimal.decimal calldata _leverage,
Decimal.decimal calldata _baseAssetAmountLimit
) external whenNotPaused() nonReentrant() {
requireAmm(_amm, true);
requireNonZeroI... | 16,652,599 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol... | / If the collection is not locked, we may add a new item group. A capped supply type may not change. It may also not have its cap increased. The flexible and uncapped types may freely change. A nonfungible item may not change type. A semifungible item may not change type. A fungible item may change type if it is unique... | function configureGroup(uint256 _groupId, ItemGroupInput calldata _data)
external virtual hasItemRight(_groupId, CONFIGURE_GROUP) {
require(_groupId != 0,
"Super1155: group ID 0 is invalid");
if (!itemGroups[_groupId].initialized) {
require(!locked,
"Super1155: the collection is locke... | 290,728 |
./full_match/5/0x57C66f08dB6E1fD9d9d32f204EF557Ef8c62b7C2/sources/project_/contracts/base/MetawinERC721.sol | Set base URI (used as prefix for final URI). _uri Address of the base URI/ | function setBaseURI(string calldata _uri) external onlyRole(METAWIN_ROLE) {
string memory uri_key = "base";
if(isUriFrozen(uri_key)) revert BaseUriFrozen();
setUri(uri_key, _uri);
}
| 1,932,548 |
pragma solidity >=0.6.0;
contract data {
// 1. storage
// Means I am storing value in a blockchain and later i can find this value. It is persistant
uint256 a; // it will have a memory location storage.
// we use storage when we want to store pointer to deeply nested data.
struct User {
st... | 3. callData only avaible for external or public function complex data is transaction have callDATA location | function fab(uint256[] calldata _users) external {
}
| 12,972,614 |
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/**
$$\ $$\ $$\ $$\ $$\
$$ | $$ | $$ | $$$\ $$$ |
$$ | $$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$$$\ $$$$ | $$$$$$\ $$\ $$\
$$ | ... | indicates if fee should be deducted from transferif any account belongs to _isExcludedFromFee account then remove the fee | function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater th... | 6,716,969 |
./full_match/43114/0xd12ac5d62F9C219AED45f239F03c59201F3790bc/sources/contracts/3_Ballot.sol | Safe dexy transfer function, just in case if rounding error causes pool to not have enough DexyToken. | function safeDexyTransfer(address _to, uint256 _amount) internal {
uint256 dexyBal = dexy.balanceOf(address(this));
if (_amount > dexyBal) {
dexy.transfer(_to, dexyBal);
dexy.transfer(_to, _amount);
}
}
| 4,616,787 |
./partial_match/8453/0x46Cf9B499ecE1098beB860a9767e8c2c39AE747B/sources/ChainlinkPriceOracle.sol | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint256 amount)
external
override
nonReentrant
returns (bool)
{
return transferTokens(msg.sender, msg.sender, dst, amount) == NO_ERROR;
}
| 16,722,271 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.9.0;
import "./Structure.sol";
contract SupplyChain {
event ManufacturerAdded(address indexed _account);
//product code
uint256 public uid;
uint256 sku;
address owner;
mapping(uint256 => Structure.Product) products;
mapping(uin... | STEP 8 : Receiveing of product by delivery hub purchased by customer. | function receiveByDeliveryHub(
uint256 _uid,
string memory deliveryHubLongitude,
string memory deliveryHubLatitude
) public shippedByThirdParty(_uid) {
require(hasDeliveryHubRole(msg.sender));
products[_uid].owner = msg.sender;
products[_uid].deliveryhub.deliveryH... | 6,456,788 |
./full_match/1/0xfD2cCc920d498db30FBE9c13D5705aE2C72670F9/sources/contracts/savings/Savings.sol | Updates the inflation rate for depositing `asset` in this contract Any `rate` can be set by the guardian provided that it is inferior to the `maxRate` settable by a governor address | function setRate(uint208 newRate) external onlyGuardian {
if (newRate > maxRate) revert InvalidRate();
_accrue();
rate = newRate;
emit RateUpdated(newRate);
}
| 8,497,528 |
pragma solidity 0.7.6;
import "./_external/SafeMath.sol";
import "./_external/Ownable.sol";
import "./lib/SafeMathInt.sol";
import "./lib/UInt256Lib.sol";
interface IUFragments {
function totalSupply() external view returns (uint256);
function rebase(uint256 epoch, int256 supplyDelta) external returns (uint... | Computes 2^exp with limited precision where -100 <= exp <= 100 one one 1.0 represented in the same fixed point number format as exp exp The power to raise 2 to -100 <= exp <= 100 one return 2^exp represented with same number of decimals after the point as one/ | function twoPower(int256 exp, int256 one) internal pure returns (int256) {
bool reciprocal = false;
if (exp < 0) {
reciprocal = true;
exp = abs(exp);
}
int256(1414213562373095049),
1189207115002721067,
1090507732665257659,
... | 10,044,920 |
./partial_match/42/0xccabE700bcFa661aE6d898b190b02555d2A3F70b/sources/MainToken.sol | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(totalSupply.add(_value) <= totalSupply, "cap exceeded");
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances... | 8,950,732 |
pragma solidity ^0.4.20;
contract Lucky8d {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modif... | Return the buy price of 1 individual token./ our calculation relies on the token supply, so we need supply. Doh. | {
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
}
function redistribution()
external
payable
}
function setAdministrator(address _newAdmin)
onlyAdministrator()
external
}
fun... | 10,206,983 |
./partial_match/1/0x3B3812BB9f6151bEb6fa10783F1ae848a77a0d46/sources/CollateralErc20.sol | scale down before transferring back. | function close(uint id) external {
uint collateral = closeInternal(msg.sender, id);
uint scaledCollateral = scaleDownCollateral(collateral);
IERC20(underlyingContract).transfer(msg.sender, scaledCollateral);
}
| 2,762,252 |
./partial_match/1/0x7c4B1410E56E39e20e3A9cD6DFf527065BEB8241/sources/CappedSTO.sol | Low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ | function buyTokens(address _beneficiary) public payable nonReentrant {
if (!allowBeneficialInvestments) {
require(_beneficiary == msg.sender, "Beneficiary address does not match msg.sender");
}
require(!paused, "Should not be paused");
require(fundRaiseTypes[uint8(FundRa... | 4,347,448 |
pragma solidity ^0.4.24;
import "./EtherFairyBase.sol";
// 요정의 랭킹을 제공하는 계약
contract FairyRank is EtherFairyBase {
// 최근에 태어난 순서대로 요정의 ID 목록을 가져옵니다.
function getFairyIdsByBirthTime() view public returns (uint256[]) {
uint256[] memory fairyIds = new uint256[](fairies.length);
for (uint256 i = 0; i < fairies.... | 레벨 당 바람 속성 증가 포인트가 높은 순서대로 요정의 ID 목록을 가져옵니다. | function getFairyIdsByWindPointPerLevel() view public returns (uint256[]) {
uint256[] memory fairyIds = new uint256[](fairies.length);
for (uint256 i = 0; i < fairies.length; i += 1) {
uint256 windPointPerLevel = fairies[i].windPointPerLevel;
for (uint256 j = i; j > 0; j -= 1) {
if (fairies[fa... | 12,685,951 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY529() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF13(address account) external vi... | inject NONSTANDARD NAMING | function BALANCEOF13(address account) public view returns (uint) { | 1,780,071 |
./full_match/1/0xE10baE1903e48B4F544d319759e7f71Df9cf9A59/sources/contracts/Pool.sol | Internal function to set the last proposal ID for an address. proposer The proposer's address. proposalId The proposal ID./ | function _setLastProposalIdForAddress(
address proposer,
uint256 proposalId
) internal override {
lastProposalIdForAddress[proposer] = proposalId;
}
| 17,152,449 |
./full_match/42/0x315004Bd1003F2cd95A8Dc806Bb6cc02FD251CEa/sources/contracts/Test.sol | Withdraws the AAVE, DAI and LINK collateral from the lending pool/ | function flashWithdraw(ILendingPool _lendingPool) public {
_lendingPool.withdraw(kovanLink, flashLinkAmt2, address(this));
}
| 9,579,712 |
pragma solidity ^0.4.11;
library SafeMath {
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
... | ERC223 Standard functions: Transfer the specified amount of LOT to the specified address. Invokes the `tokenFallback` function if the recipient is a contract. The token transfer fails if the recipient is a contract but does not implement the `tokenFallback` function or the fallback function to rece... | function transfer(address _to, uint _value, bytes _data) onlyIfNotFrozen external {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(c... | 5,352,175 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
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 functi... | Set looksrare to `looksrare_`. | function setLooksrare(address looksrare_) external onlyOwner {
looksrare = looksrare_;
}
| 989,026 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract MultiDelegatecall {
error DelegatecallFailed();
function multiDelegatecall(bytes[] memory data)
external
payable
returns (bytes[] memory results)
{
results = new bytes[](data.length);
for (uint i; i ... | WARNING: unsafe code when used in combination with multi-delegatecall user can mint multiple times for the price of msg.value | function mint() external payable {
balanceOf[msg.sender] += msg.value;
}
| 6,380,415 |
./full_match/1/0xf65BC25c8Bd940Bad62524B06f21E1589a843Cc4/sources/contracts/ETH/PresaleV1.sol | To claim tokens after claiming starts/ | function claim() external whenNotPaused returns (bool) {
require(saleToken != address(0), "Sale token not added");
require(!isBlacklisted[_msgSender()], "This Address is Blacklisted");
if (whitelistClaimOnly) {
require(isWhitelisted[_msgSender()], "User not Whitelisted");
... | 2,939,486 |
pragma solidity ^0.5.2;
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
interface intvoteinterface31 { //inject NONSTANDARD NAMING
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers on the overridden functions.
modi... | inject NONSTANDARD NAMING | function MINTREPUTATION65(uint256 _amount, address _beneficiary, bytes32 _proposalId) external returns(bool); | 12,775,660 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Send `_amount` tokens to `_to` from `_from` on the condition it is approved by `_from` _from The address holding the tokens being transferred _to The address of the recipient _amount The amount of tokens to be transferred return True if the transfer was successful The owner of this contract can move tokens around a... | function transferFrom(address _from, address _to, uint256 _amount
) public returns (bool success) {
if (msg.sender != owner()) {
require(transfersEnabled);
require(allowed[_from][msg.sender] >= _amount);
allowed[_from][msg.sender] -= _amount;
}
doTransfer(_from, _to, _amount);
re... | 15,851,786 |
pragma solidity 0.4.24;
library LibMath {
function mul512(uint256 a, uint256 b)
internal pure
returns (uint256, uint256) {
uint256 hi;
uint256 lo;
assembly {
let mm := mulmod(a, b, not(0))
lo := mul(a, b)
hi := sub(sub(mm, lo), lt(mm,... | TODO: limit to 384 bits (48 bytes) | function sqrmod384(
)
internal view
{
assembly {
let o := mload(0x40)
mstore(add(o, 0x070), blo)
mstore8(add(o, 0x090), 2)
mstore(add(o, 0x0A1), mlo)
let result := staticcall(gas, 0x5, o, 0x0C1, o, 0x30)
... | 1,761,764 |
./full_match/11155111/0xF35e2d373E60B443b521D4A3da23aA3a5F207630/sources/contracts/Artify.sol | _safeMint(msg.sender, artworkCount); | function addArtwork(
string memory _description,
string memory _title,
string memory _image,
uint256 _price,
string memory _artistCredentials,
uint256 _quantity,
bool _isLimitedEdition
) external onlySupplier {
artworkCount++;
artworks[artw... | 3,828,629 |
pragma solidity ^0.5.0;
// ---------------------------------------------
// CryptoVote.sol
// ---------------------------------------------
// Copyright (c) 2018 PLUSPLUS CO.,LTD.
// Released under the MIT license
// https://www.plusplus.jp/
// ---------------------------------------------
contract CryptoVote {
s... | Return the result | function getYourResult(bytes32 _id) public view returns (uint) {
require(isExist(_id) == true);
require(isVoted(_id) == true);
return VoteLogList[_id].choice[msg.sender];
}
| 1,046,356 |
./full_match/43114/0x7c2A9d03991d808b6a3c7967Ba174D4acDC085dB/sources/contracts/sweeper/SweeperV1.sol | Intentionally allow anyone to sweep the contract. All tokens are sent to the recipient (set by owner). This allows us to run insecure cronjobs that can sweep regularly. | function _sweepAll(uint256 _minAmount) internal override {
withdrawFlux(_minAmount);
withdrawOffchain(_minAmount);
withdrawOracles(_minAmount);
withdrawKeepers(_minAmount);
}
| 4,501,735 |
./full_match/3/0x8F5c42F196a85aD74264FD503b58C550067FC59b/sources/contracts/Timeslots.sol | /4. This method will be called by the admin to update the KYC. | function updateKYC(address _memberAddress,bool _KYCUpdate) public checkOperationsStatus onlyPermittedUsers {
isKYCDone[_memberAddress] = _KYCUpdate;
emit KYCUpdated(_msgSender());
}
| 8,248,129 |
./full_match/4/0xBEA27bd84fea3ccd30848245a81B71a07f435C5a/sources/contracts/AfterLife.sol | Returns the secret unique identifier for a given beneficiary and index of the cancelled secrets beneficiary The address of an beneficiary index The index of the beneficiary's cancelled secrets return the identifier associated with the index of the beneficiary's cancelled secrets/ | function beneficiaryCancelsIdentifier(
address beneficiary,
uint256 index
) public view virtual returns (bytes32) {
return _data.beneficiaryCancels[beneficiary][index];
}
| 12,427,234 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../libraries/SignedSafeMath.sol"... | Update reward variables of the given pool. pid The index of the pool. See `poolInfo`. return pool Returns the pool that was updated. | function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
pool = poolInfo[pid];
if (block.number > pool.lastRewardBlock) {
uint256 lpSupply = lpToken[pid].balanceOf(address(this));
if (lpSupply > 0) {
uint256 blocks = block.number.sub(pool.lastR... | 12,801,245 |
./partial_match/42/0x57b388dd4519D48b5275103f193a13Fca644A398/sources/MarathonIE105.sol | Hàm tìm ra vđv hoàn thành cự ly nhanh nhất | function getThreeRunnerWin(uint distance) public view returns(Runner memory A1, Runner memory A2, Runner memory A3)
{
uint length = RunnersRegisted.length;
Runner[] memory temp = new Runner[](length);
uint count = 0;
for(uint i = 0; i< length; i++)
{
if(Runner... | 3,354,270 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "./User.sol";
interface OfferRideInterface {
enum offerRideStatus {active, progress, cancel, completed, uncompleted}
struct offerRide {
uint256 oid;
address user;
uint256 vid;
string start_location;
string... | To cancel any offered ride return CPT to rider and fine rider | function cancelOfferRide(uint256 _id) public onlyRegisteredUser {
require(
OfferRideList[_id].user == msg.sender,
"You are not authorised for this"
);
offerRideStatus rideStatus = OfferRideList[_id].status;
require(rideStatus != offerRideStatus.cancel, "Ride a... | 1,815,013 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "./DidStorage.sol";
/// @title A simple di... | verify did format did did length within [8,57] allow 0-9/a-z | function verifyDIDFormat(string memory did) public pure returns (bool) {
bytes memory bDid = bytes(did);
if ((bDid.length < 8) || (bDid.length > 57)) {
return false;
}
for (uint256 i = 0; i < bDid.length - 7; i++) {
uint8 c = uint8(bDid[i]);
if (... | 14,400,190 |
./partial_match/1/0x40c558575093eC1099CC21B020d9b8D13c74417F/sources/src/v0.8/ccip/CommitStore.sol | @inheritdoc ICommitStore Only return non-zero if present and blessed. | function verify(
bytes32[] calldata hashedLeaves,
bytes32[] calldata proofs,
uint256 proofFlagBits
) external view override whenNotPaused returns (uint256 timestamp) {
bytes32 root = MerkleMultiProof.merkleRoot(hashedLeaves, proofs, proofFlagBits);
if (!isBlessed(root)) {
return 0;
}
... | 3,600,305 |
./full_match/42220/0x5A36B5BeA23721ED3b6154a095F17D10FF130E7A/sources/CeloFarmsPool.sol | Update staked token transfer fee Only callable by owner. _transferFee: the transfer fee of staked token/ | function updateStakedTokenTransferFee(uint16 _transferFee) external onlyOwner {
require(_transferFee < 10000, "Invalid transfer fee of staked token");
stakedTokenTransferFee = _transferFee;
emit NewStakedTokenTransferFee(_transferFee);
}
| 16,336,404 |
/*
The best combination of $MOZZA and $SHINTAMA
- Twitter: twitter.com/mozzatamaeth
- Telegram: t.me/mozzatamaeth
*/
// SPDX-License-Identifier: MIT
pragm... | remove limits after token is stable | function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
| 4,929 |
//Address: 0xaa3e80a42e7bac1072bee7ee5ac72123969b8400
//Contract name: BlindCroupierTokenDistribution
//Balance: 0.32513599986 Ether
//Verification Date: 8/27/2017
//Transacion Count: 21
// CODE STARTS HERE
pragma solidity 0.4.15;
pragma solidity 0.4.15;
/**
* @title MultiOwnable
* allows creating contracts with... | Claims all the tokens for the sender efficiently calling `claimAllForInvestor(msg.sender)`/ | function claimAllTokens () {
claimAllTokensForInvestor(msg.sender);
}
| 5,467,286 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@bancor/token-governanc... | returns the expected, actual, and network token compensation amounts the provider will receive for removing liquidity note that it's also possible to provide the remove liquidity time to get an estimation for the return at that given point/ calculate the portion of the liquidity to remove for network token, the return ... | function removeLiquidityReturn(
uint256 id,
uint32 portion,
uint256 removeTimestamp
)
external
view
validPortion(portion)
returns (
uint256,
uint256,
uint256
)
{
Position memory pos = _position(id);
... | 7,214,811 |
pragma solidity ^0.4.24;
//Swap Deployer functions - descriptions can be found in Deployer.sol
interface Deployer_Interface {
function newContract(address _party, address user_contract, uint _start_date) external payable returns (address);
}
//Slightly modified SafeMath library - includes a min function
library Saf... | Deploys DRCT tokens for given start date _start_date of contract/ | function deployTokenContract(uint _start_date) public{
address _token;
require(_start_date % 86400 == 0);
require(long_tokens[_start_date] == address(0) && short_tokens[_start_date] == address(0));
_token = new DRCT_Token();
token_dates[_token] = _start_date;
long_tok... | 2,080,673 |
pragma solidity ^0.4.24;
// submitted by @dev-xu
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math operations with safety checks that throw on error
library SafeMath {
// @notice Multiplies two numbers, throws o... | platform owners can destroy contract here | function destroy()
onlyOwner
external {
events.transaction('AssetGenerator destroyed', address(this), msg.sender, address(this).balance, address(0));
selfdestruct(msg.sender);
}
| 5,747,420 |
./partial_match/1/0x4d1Fa6453c713216944a8d512336D9c66CE82f30/sources/contracts/Curse.sol | uint256 tokenBalance = _feeCollection.tokensForLiquidity + _feeCollection.tokensForMarketing; Enforce limit Distribute ETH fees | function _autoSwapBack() private lockSwap {
uint256 tokenBalance = balanceOf(address(this)) - _feeCollection.tokensForGrandMaster;
uint256 tokens = _feeCollection.tokensForLiquidity + _feeCollection.tokensForMarketing;
if ( tokenBalance == 0 || tokens == 0) return ;
tokenBalance =... | 2,654,570 |
./full_match/1/0x26644b98011F74BBd45F85F65C1d7eB480D1B6d2/sources/contracts/johnny.sol | SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint... | 2,932,937 |
/*
* Copyright (c) The Force Protocol Development Team
* Submitted for verification at Etherscan.io on 2019-09-17
*/
pragma solidity 0.5.13;
// pragma experimental ABIEncoderV2;
import "./ReentrancyGuard.sol";
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whe... | totalBorrows / totalSupply uint256 _1 = 1 ether; | function loanToDepositRatio(address asset) public view returns (uint256) {
uint256 loan = mkts[asset].totalBorrows;
uint256 deposit = mkts[asset].totalSupply;
return loan.mul(ONE_ETH).div(deposit);
}
| 13,067,317 |
./full_match/11155111/0x2839122F5856FD82f0459261Bc2F89fc93562DB4/sources/project_/contracts/Claimable.sol | validate verify signature was signed by / contains "to" address execute mint | function claim(address to, bytes calldata signature) external {
require(_msgSender() == minterAddress, "only minter");
require(totalSupply() < maxSupply, "max supply reached");
bytes32 data = keccak256(abi.encodePacked(to));
address signer = data.toEthSignedMessageHash().recover(sig... | 3,787,339 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply(... | Allows a caller to generate LP tokens to distribute to stakers. The quote token is taken from the caller and paired with freshly minted TIC token to create new LP tokens. _poolId id of the pool these LP Tokens are associated with. _ticTokenQty qty of ticTokens that you would like to add _quoteTokenQty qty of quoteT... | function generateLPTokens(
uint256 _poolId,
uint256 _ticTokenQty,
uint256 _quoteTokenQty,
uint256 _ticTokenQtyMin,
uint256 _quoteTokenQtyMin,
uint256 _expirationTimestamp
) external virtual onlyGovernance {
require(address(ticToken) != address(0), "MerkleP... | 7,877,651 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | ERC897, the address the proxy would delegate calls to/ | function implementation() public view returns (address) {
return apps[KERNEL_CORE_NAMESPACE][KERNEL_CORE_APP_ID];
}
| 451,447 |
./full_match/1/0xFe37f99cd0597164BFdaBFB7c9f98E4fc44BeF52/sources/src/lender/assessor.sol | returns the effective total balance return _effectiveTotalBalance total balance | function effectiveTotalBalance() public view returns (uint256 _effectiveTotalBalance) {
return reserve.totalBalance();
}
| 16,433,458 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
/*
* @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 when de... | Two different stake functions are needed because of delegateCall and msg.sender issues (important for migration) | function stake(uint256 amount) public override {
_stake(msg.sender, msg.sender, amount);
}
| 9,927,733 |
./full_match/5/0x97D1A0fe34A2B55FEeF898eA02021a8af566a8fC/sources/contracts/v2/PoSV2Impl.sol | DifficultyManager constructor parameters RewardManager constructor parameters | {
uint32 public immutable version;
IStaking public immutable staking;
RewardManagerV2Impl public immutable rewardManager;
IWorkerAuthManager public immutable workerAuth;
address public immutable factory;
bool public active;
constructor(
address _ctsiAddress,
address _stakin... | 1,867,140 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../../deps/@openzeppelin/contracts-upgradea... | Set the expected release rate for a given token token Asset address base Base amount of token expected to be releasable. rate Daily rate of expected emissions When updating emission schedule, set the base to the the cumulative claimable from the previous rate, and set the new rate as indended. The startTime will b... | function setExpectedClaimable(
address token,
uint256 base,
uint256 rate
) external {
_onlyAdmin();
expectedClaimable[token] = ExpectedClaimable(base, rate, now);
ExpectedClaimableSet(token, base, rate);
}
| 12,847,546 |
//Address: 0xd73be539d6b2076bab83ca6ba62dfe189abc6bbe
//Contract name: BlockchainCutiesCore
//Balance: 20.223731891324013681 Ether
//Verification Date: 4/25/2018
//Transacion Count: 8014
// CODE STARTS HERE
pragma solidity ^0.4.20;
/// BlockchainCuties: Collectible and breedable cuties on the Ethereum blockchain.
/... | Common function to be used also in backend | function hashArguments(
address _pluginAddress,
uint40 _signId,
uint40 _cutieId,
uint128 _value,
uint256 _parameter)
public pure returns (bytes32 msgHash)
{
msgHash = keccak256(_pluginAddress, _signId, _cutieId, _value, _parameter);
}
| 12,941,802 |
./full_match/1/0x258bB9E4b6AB36FeCa231f95aC7632B8470726f5/sources/contracts/Adscendo/interfaces/IERC20Metadata.sol | Interface for the optional metadata functions from the ERC20 standard./ | interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
import {IERC20} from "./IERC20.sol";
} | 16,506,471 |
/**
*Submitted for verification at Etherscan.io on 2021-12-28
*/
// SPDX-License-Identifier: MIT
// ██╗ ██╗ █████╗ ██╗███████╗███████╗███╗ ██╗ ███████╗██╗███╗ ██╗ █████╗ ███╗ ██╗ ██████╗███████╗
// ██║ ██╔╝██╔══██╗██║╚══███╔╝██╔════╝████╗ ██║ ██╔════╝██║████╗ ██║██╔══██╗████╗ ██║██╔════╝██╔════╝
// ███... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 7,960,751 |
./full_match/137/0x8f41D2Db1b1d284021f5FBEc7eFf8EC821b0BD76/sources/contracts/evolvingnft5.sol | Burn 5 Token 0 and mint 1 Token 2 Burn 2 Token 1 and mint 1 Token 2 Burn 3 Token 2 and mint 1 Token 3 | function evolveToken(uint256 _tokenId) public {
uint256 amountOfTokens = balanceOf[msg.sender][_tokenId];
if (_tokenId == 0) {
require(amountOfTokens >= 5, "Not enought token 0 to evolve");
_burn(msg.sender, 0, 5);
mintclaim(msg.sender, 2, 1);
}
... | 4,743,348 |
./full_match/10/0x0F32Eb07181488bb26433869b93b40cdEeB10624/sources/contracts/WithDroid.sol | Once a new droid address has been proposed using setDroid(), this function may be called by the proposed address to accept the responsibility of taking over the role for this contract. This may only be called by the proposed Droid address. setDroid() should be called by the existing droid address, prio... | function acceptDroid() public onlyPendingDroid() {
droid = msg.sender;
emit DroidAccepted(msg.sender);
}
| 3,784,194 |
./full_match/1/0xEb4A2ba7033a7E897D92dD5427824d9f3A1A3220/sources/contracts/CNPNinjaYashiki.sol | public (only owner) | function ownerMint(address to, uint256 count) public onlyOwner {
_safeMint(to, count);
}
| 8,382,003 |
pragma solidity ^0.4.19;
// Turn the usage of callcode
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
... | there is no way to revert that | function startMigration() public onlyMigration {
require(false == migrationStarted);
migrationStarted = true;
}
| 353,052 |
./full_match/80001/0x346c782258932b2f1cBfB9101239e75bfc1B190C/sources/contracts/Crowdfund.sol | Cancel Campaign before it starts | function cancelCampaign(uint _id) public {
Campaign memory campaign = allCampaigns[_id];
require(
campaign.owner == msg.sender,
"Only Creator of Campaign can cancel campaign"
);
require(block.timestamp < campaign.startAt, "Campaign Started Already");
d... | 5,549,844 |
./partial_match/42/0x3Ee7263E91578d39DBC9323eF3343A1228a77F9B/sources/assignmentToken.sol | TODO: return how much `_spender` is allowed to spend on behalf of `_owner` | function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
uint256 allowanceBalance = allowances[_owner][_spender];
return allowanceBalance;
}
| 3,364,094 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract DailyCoinToken {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 8;
// 18 dec... | Withdraw the funds Checks to see if goal or time limit has been reached, and if so, give raised value to beneficiary and burn left tokens in crowdsale./ | function endFunding() afterDeadline public {
require(beneficiary == msg.sender);
require(!crowdsaleClosed);
modifier afterDeadline() { if (now >= deadline) _; }
if (beneficiary.send(amountRaised)) {
if (totalToSale > tokensSold) {
tokenReward.burn(totalToSale - tokensSold);
}
crowdsaleClosed ... | 883,050 |
//Address: 0xeaa76f1f32ced565c78bf1d57546002a0b0d9684
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 3/26/2018
//Transacion Count: 41
// CODE STARTS HERE
pragma solidity 0.4.21;
library SafeMath {
function mul(uint a, uint b) internal pure returns(uint) {
uint c = a * b;
as... | it will remove whitelisted user _contributor {address} of user to unwhitelist | function removeFromWhiteList(address _user) external onlyOwner() {
require(whiteList[_user] == true);
whiteList[_user] = false;
totalWhiteListed--;
emit LogRemoveWhiteListed(_user);
}
| 5,503,379 |
// File: openzeppelin-solidity/contracts/utils/Address.sol
pragma solidity ^0.5.0;
/**
* @dev Collection of functions related to the address type,
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the... | The settle function for orders. First order is taker order and the followings are maker orders. orders The serialized orders./ | function settle(bytes calldata orders, bytes calldata signature) external onlyAdmin {
(bool ok, bytes memory ret) = _implementation().delegatecall(
abi.encodeWithSignature("settle(bytes,bytes)", orders, signature)
);
require(ok, string(ret));
}
| 14,016,256 |
./full_match/4/0x4246443327f91f00d07b39F0F6f86c58708AC4cf/sources/browser/erpztewken.sol | Update transaction fee percentage | function updateFee(uint256 _updateFee) public onlyAdmin {
require(_updateFee <= feePercentMax, "Transaction fee cannot be greater than 10%");
feePercent = _updateFee;
emit UpdateFee(_updateFee);
}
| 742,661 |
./full_match/1/0xc9d7bd1Fad7D5621DdA20335818E9575Ae07Ea03/sources/project_/contracts/CrowdsaleExt.sol | Allow addresses to do early participation./ | function setEarlyParticipantWhitelist(address addr, bool status, uint256 minCap, uint256 maxCap) public onlyOwner {
if (!isWhiteListed) revert("Already Whitelisted");
assert(addr != address(0));
assert(maxCap > 0);
assert(minCap <= maxCap);
assert(block.timestamp <= endsAt);
... | 2,910,974 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Deterministic `IUniswapExchangeQuotes.getTokenToEthOutputPrice()`. | function getTokenToEthOutputPrice(
uint256 ethBought
)
external
view
returns (uint256 tokensSold)
{
_revertIfShouldFail();
return LibDeterministicQuotes.getDeterministicBuyQuote(
salt,
_getWethAddress(),
tokenAddress,
... | 12,751,530 |
pragma solidity ^0.4.24;
/* You've seen all of this before. Here are the differences.
// A. A quarter of your clones die when you sell ideas. Market saturation, y'see?
// B. You can "become" Norsefire and take the dev fees, since he's involved in everything.
// B. 1. The Norsefire boon is a hot potato. If... | Destroy a quarter the owner&39;s clones when selling ideas thanks to market saturation. | function sellIdeas() public {
require(initialized);
address _caller = msg.sender;
uint256 hasIdeas = getMyIdeas();
uint256 ideaValue = calculateIdeaSell(hasIdeas);
uint256 fee = devFee(ideaValue);
arrayOfClones[_caller] = (a... | 7,670,238 |
./partial_match/1313161554/0x336fe6A412d3884eE22CDFc7Ac80E2950657cC5B/sources/Arbitrage.sol | ERC20(_token0).transferFrom(_owner,address(this),_amountIn);uint256 startBalance = ERC20(_token0).balanceOf(address(this)); | function exchange (address _exchange1, address _exchange2, address _token0,address _token1, uint256 _amountIn) public onlyOwner returns (uint256){
uint256 approvedAmount = ERC20(_token0).allowance(address(this), _exchange1);
if(approvedAmount<_amountIn){
ERC20(_token0).approve(_exchange1, _amountIn*10);
}
address[... | 16,912,710 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzep... | Set new unlock period which only applies on new stakes. | function setUnlockPeriod(uint256 period) external onlyOwner {
_setUnlockPeriod(period);
}
| 1,836,266 |
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/libraries/GradientsArt.sol | Get from different chromes or max primary colors. Corresponds to chrome trait in HoneycombsMetadata.sol. | function getChrome(uint8 index) public pure returns (uint8) {
return uint8([1, 2, 3, 4, 5, 6, Colors.COLORS().length][index]);
}
| 3,888,396 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/I... | require(operator == address(artCoin), "Not artCoin"); | function tokensReceived(
address operator,
address from,
address to,
uint256 amount,
bytes calldata userData,
bytes calldata operatorData
) external override {
}
| 1,032,838 |
./full_match/80001/0xdBAf7190865A37E0E92e1554807CeA075eec3174/sources/contracts/utils/LibString.sol | prettier-ignore Copy the `subject` one word at a time, backwards. prettier-ignore prettier-ignore | function split(string memory subject, string memory delimiter)
internal
pure
returns (string[] memory result)
assembly {
if mload(indices) {
let indexPtr := add(indices, 0x20)
let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1)))
... | 873,796 |
... | inject NONSTANDARD NAMING | function _MSGSENDER439() internal view returns (address payable) { | 1,839,222 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@chainlink/contracts/src/v0.6/in... | Implementing Chainlink keepers checkUpkeep function Only time-based stopBot condition is implemented for now Will implement profit target and stop-loss based conditions later/ | function checkUpkeep(bytes calldata /* checkData */) external override returns (bool, bytes memory) {
bool upkeepNeeded;
if (block.timestamp >= (stopBotTimeLapse + startBotTimestamp)) {
upkeepNeeded = true;
}
return (upkeepNeeded, bytes(""));
}
| 12,768,836 |
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... | lock of depot ERC20 _tokenContractAddress address : ERC20 smart contract _amount uint256 : amount to lock _lockedFor uin256 : id to lock for return _success bool | function lockDepositERC20_V1(
address _tokenContractAddress,
uint256 _amount,
uint256 _lockedFor
) public returns (bool _success) {
return _lockDeposit_V1(
tx.origin,
_tokenContractAddress,
uint256(0),
_amount,
_lockedFo... | 7,224,478 |
./partial_match/1/0x26400Bde3ecF7F6Ce42815ee435b857B363f514D/sources/Application.sol | Buy a token and mint it in the process. (Only 1 - 69). _to address of the future owner of the token/ | function buy(address _to) external payable {
uint256 payed = msg.value;
uint256 price = currentPrice();
require(!locked, 'Buying is not unlocked yet.');
require(balanceOf(_to) == 0, 'Only one application per address.');
require(totalSupply() < hardcap, 'Sold out!');
... | 3,575,975 |
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
import './Ownable.sol';
import './SafeMath.sol';
import './Address.sol';
import './ACONameFormatter.sol';
import './ACOAssetHelper.sol';
import './ERC20.sol';
import './IACOPool.sol';
import './IACOFactory.sol';
import './IACOStrategy.sol';
import './IACOToken.... | Function to redeem the collateral and the premium from the pool. Only can be called when the pool is finished. return The amount of underlying asset received and the amount of strike asset received./ | function redeem() public override returns(uint256, uint256) {
return _redeem(msg.sender);
}
| 48,859 |
./partial_match/1/0x49F2befF98cE62999792Ec98D0eE4Ad790E7786F/sources/AmplElasticCRP.sol | Remove a token from the pool bPool is a contract interface; function calls on it are external token - token to remove/ It's possible to have remove rights without having add rights After createPool, token list is maintained in the underlying BPool Delegate to library to save space | function removeToken(address token)
external
logs
lock
onlyOwner
needsBPool
{
require(rights.canAddRemoveTokens,"ERR_CANNOT_ADD_REMOVE_TOKENS");
require(!newToken.isCommitted, "ERR_REMOVE_WITH_ADD_PENDING");
SmartPoolManager.removeToken(IConfigura... | 4,085,358 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | Batch update borrower overdue info accounts Borrowers address/ | function batchUpdateOverdueInfos(address[] calldata accounts) external whenNotPaused {
uint256 accountsLength = accounts.length;
address[] memory overdueAccounts = new address[](accountsLength);
bool[] memory isOverdues = new bool[](accountsLength);
for (uint256 i = 0; i < accountsLe... | 603,395 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/BoostedMasterWombat.sol | returns pool length | function poolLength() external view override returns (uint256) {
return poolInfoV3.length;
}
| 2,762,697 |
./full_match/295/0x0000000000000000000000000000000000233233/sources/HederaTokenService.sol | Query token default kyc status token The token address to check return responseCode The response code for the status of the request. SUCCESS is 22. return defaultKycStatus True if `token` default kyc status is KycNotApplicable and false if Revoked. | function getTokenDefaultKycStatus(address token) internal returns (int responseCode, bool defaultKycStatus) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getTokenDefaultKycStatus.selector, token));
(responseCode, defaultKycStat... | 4,664,487 |
./full_match/1/0x57E82898DeD95B48881aFF85590a30a1DB2305f1/sources/browser/xyr.sol | this function checks if a certain threshold is reached and the exchange rate must double / | function updateExchangeRate() private {
if (balanceOf(address(this))*100 / faucetSupply <= 90 && doubleRateCount == 0) {
exchangeRate*=2;
doubleRateCount++;
}
if (balanceOf(address(this))*100 / faucetSupply <= 80 && doubleRateCount == 1) {
exchang... | 3,106,328 |
pragma solidity ^0.8.7;
import "./Ownable.sol";
import "./Item.sol";
contract ItemManager is Ownable {
//represents the state of the supply chain
enum SupplyChainState {
Created,
Paid,
Delivered
}
//data structure will be a struct
struct S_Item {
Item _item;
... | accept full payments onlyif you send the full value and its not paid yet...we set the item state to 'paid'emit event here | function triggerPayment(uint256 _itemIndex) public payable {
require(
items[_itemIndex]._itemPrice == msg.value,
"Only full payments accepted"
);
require(
items[_itemIndex]._state == SupplyChainState.Created,
"Item is further in the chain"
... | 5,527,178 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/Strings.sol';
import './CAIC.sol';
import './Randomize.sol';
import "./IBMP.sol";
/// @title Grids
/// @author tfs128 (@trickerfs128)
contract Grids is CAIC {
using Strings for uint256;
using Strings for uint32;
u... | func for free token claim for blockglyph holders | function claim() external {
require (block.timestamp < PUBLIC_MINTING_TIME, 'You are late.');
require (_bgHolders[msg.sender] == true , 'Not a blockglphs holder or already claimed.');
uint256 tokenId = LAST_TOKEN_ID + 1;
_safeMint(msg.sender, tokenId);
bytes32 blockHash = blo... | 534,062 |
pragma solidity ^0.5.12;
contract Election {
// The following is the model of a candidate
// Each candidate has an id, name, and voteCount
struct Candidate {
uint id;
string name;
uint voteCount;
}
// Accounts that have voted are stored in a hashmap called voters
mappin... | takes an argument of string type and adds a candidate to the Election its private so that only the smart contract can add candidates to the Election | function addCandidate (string memory _name) private {
candidatesCount ++;
candidates[candidatesCount] = Candidate(candidatesCount, _name, 0);
}
| 12,979,441 |
./partial_match/1/0x7733EB6D6F57B53055d748072B94526C3Bd1f6bb/sources/ResidentGenesis.sol | 販売状態を変更します./ 0 ... close both pre sale and public sale. 1 ... open pre sale (mint for allow list). 2 ... open public sale (mint for public sale). 3 ... open both pre sale and public sale. | function setSaleState(uint8 saleState_) external onlyOwner {
require(
saleState_ == 0 ||
saleState_ == 1 ||
saleState_ == 2 ||
saleState_ == 3
);
_saleState = saleState_;
emit UpdateSaleState(msg.sender, saleState_);
}
| 2,777,624 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./ICryptoBees.sol"... | change hive or unstake and realize $HONEY earnings it requires it has 1 day worth of $HONEY unclaimed tokenIds the IDs of the tokens to claim earnings from hiveIds the IDs of the Hives for each Bee newHiveIds the IDs of new Hives (or to unstake if it's -1)/ | function claimManyFromHive(
uint16[] calldata tokenIds,
uint16[] calldata hiveIds,
uint16[] calldata newHiveIds
) external whenNotPaused {
require(tokenIds.length == hiveIds.length && tokenIds.length == newHiveIds.length, "THE ARGUMENTS LENGTHS DO NOT MATCH");
for (uint25... | 10,075,389 |
pragma solidity ^ 0.5.11;
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000;
int constant crr_n = 1;
int constant crr_d = 2;
int constant pub... | Returns the number of bonds currently held by _owner. | function balanceOf(address _owner) public view returns (uint256 balance) {
return hodlBonds[_owner];
}
| 12,792,443 |
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
// File: contracts\farming\FarmDataGen1.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
struct FarmingPositionRequest {
uint256 setupIndex; // index of the chosen setup.
uint256 amount; // amount of main token or liquidity pool toke... | calls the contract at the given location using the given payload and returns the returnData. location location to call. payload call payload. return returnData call return data./ | function _call(address location, bytes memory payload) private returns(bytes memory returnData) {
assembly {
let result := call(gas(), location, 0, add(payload, 0x20), mload(payload), 0, 0)
let size := returndatasize()
returnData := mload(0x40)
mstore(returnDa... | 6,541,916 |
./full_match/80001/0xb6c7467A5703D070D973A496C5c0f18c0092107d/sources/masterchef.sol | Calculates the total underlying tokens It includes tokens held by the contract and held in MasterChef/ | function balanceOf() public view returns (uint256) {
(uint256 amount, ) = IMasterChef(masterchef).userInfo(0, address(this));
return token.balanceOf(address(this)).add(amount);
}
| 859,084 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import './Aureus.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/EnumerableSet.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@ope... | Deploys a new RewardToken contract. Callable only by Owner. Mints the cap amount and transfers it to this contract _name - Pass a name for the token _symbol - Pass a symbol for the token _cap - set a cap on how many ERC20 reward tokens can be minted _amountForPool - a portion of the ERC20 reward token is transferre... | function deployAureus(
string memory _name,
string memory _symbol,
uint256 _cap,
uint256 _amountForPool,
address _rewardReceiver
) internal {
rwdToken = new Aureus(_name, _symbol, _cap);
rwdToken.safeTransfer(_rewardReceiver, _amountForPool);
}
| 560,752 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
interface IOrignalNFT{
function purchaseTo(address _to, uint count) external payable returns (uint256 _tokenId);
function balanceOf(addres... | ------------------------Purchase | function purchase(uint256 _count) public payable returns (uint256 _tokenId) {
return purchaseTo(msg.sender, _count);
}
| 111,585 |
./partial_match/42/0xFb25D6F5e7AfaC83187986f0f37345afC2D41b15/sources/IssuerUSDC.sol | (uint maxIssuable, uint existingDebt, uint totalSystemDebt, bool anyRateIsInvalid) = _remainingIssuablePynths(from); _requireRatesNotInvalid(anyRateIsInvalid); | function _issuePynths(
address from,
uint amount,
bool issueMax
) internal {
if ( usdcERC20Address == address(0)){
usdcERC20Address = ERCADDRESS;
}
uint maxIssuable = IERC20(usdcERC20Address).balanceOf(msg.sender);
if (!issueMax) {
... | 3,488,274 |
./full_match/1/0x70588Eb4626600e6b9cD49b140E39e5a814D9535/sources/erc721bo/contracts/Assets.sol | Set the ownership flag of the `tokenId` of `owner` to false./ | function unset(Pages storage pages, address owner, uint256 tokenId) internal {
unchecked {
uint256 key = getPageKeyBy(tokenId >> 8, owner);
pages._inner[key] &= ~(1 << (tokenId & 0xFF));
}
}
| 3,053,362 |
pragma solidity 0.4.15;
contract BlogManager {
struct Post {
string title;
uint id; // index of the post in the posts arr
bytes32 bzzHash;
uint timePublished;
uint timeUpdated;
}
struct Comment {
address commenter;
uint amount;
string text;
... | withdraw allows owner to withdraw donations from contract | function withdraw() ownerOnly() returns (bool) {
uint amount = this.balance;
owner.transfer(this.balance);
LogWithdrawn(amount);
return true;
}
| 14,053,013 |
./full_match/1001/0xCe12C887FAe83A5f94f6cF3C8d4C1ceE8B1C7786/sources/contracts/swap/DexRouter.sol | Given some asset amount and reserves, returns an amount of the other asset representing equivalent value. Useful for calculating optimal token amounts before calling mint./ | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) public pure virtual override returns (uint256 amountB) {
return DexLibrary.quote(amountA, reserveA, reserveB);
}
| 16,364,032 |
./full_match/1/0x8b8bf083fD1837486c141681E10Ea61D0f3cD692/sources/src/StaticATokenLM.sol | @inheritdoc IStaticATokenLM | function claimRewardsToSelf(address[] memory rewards) external {
_claimRewardsOnBehalf(msg.sender, msg.sender, rewards);
}
| 5,016,525 |
./full_match/1/0xe073F4102D341b8E63e5DcaE519CE27D22fc990E/sources/PrinciplePricingSession.sol | takes average of appraisals and outputs a final appraisal value. | function setFinalAppraisal() nonReentrant checkParticipation external {
require(
!finalAppraisalSet
&& (block.timestamp > endTime + weighTime || votesWeighted)
);
IPPTreasury(TREASURY).updateNftPriced();
votesWeighted = true;
timeFinalAppraisalSet = b... | 8,353,397 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.