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.5.16;
import "./IERC20.sol";
import "./SafeERC20.sol";
/**
* @title KUSDVault stores the Kine off-chain trading system's kUSD. When total vault of synthetic assets in Kine trading system changed, Kine reporter will mint/burn corresponding
* kUSD in this vault to ensure kUSD total supply synced wi... | only admin can set counterParty | function _setCounterParty(address newCounterParty) external onlyAdmin {
address oldCounterParty = counterParty;
counterParty = newCounterParty;
emit NewCounterParty(oldCounterParty, newCounterParty);
}
| 12,656,579 |
./full_match/1/0x2760712092BA61e67043fE04FF3c4f54cd045ca0/sources/contracts/vaults/Drops4626.sol | Deposits weth into CEther and receive receipt tokens assets The amount of weth being deposited receiver The account that will receive the receipt tokens return shares The amount of receipt tokens minted | function deposit(
uint256 assets,
address receiver
) external nonReentrant returns (uint256 shares) {
if (assets == 0) {
revert ParameterOutOfBounds();
}
if (receiver == address(0)) {
revert InvalidAddress();
}
shares = previewDepo... | 2,955,557 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
library TransferHelper {
function sa... | Withdraw LP tokens. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pendingAmount = user.amount.mul(pool.accBonus... | 13,090,374 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 dete... | Transfer `amount` stablecoin from `msg.sender` Approve `amount` stablecoin to lendingPool Deposit `amount` stablecoin to lendingPool | function deposit(uint256 amount) external override onlyOwner {
require(amount > 0, "AaveMarket: amount is 0");
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
stablecoin.safeTransferFrom(msg.sender, address(this), amount);
stablecoin.safeIncreaseAllowance(addre... | 6,963,502 |
./partial_match/1/0xcB8e35229135d096C169A62e091cD99835792Ab9/sources/BabyCramer.sol | Create a uniswap pair for this new token exclude from paying fees or having max transaction amount enable owner and fixed-sale wallet to send tokens before presales are over | constructor() ERC20("Baby Cramer", "Cwamer") {
uint256 _liquidityFee = 2;
uint256 _burnFees = 0;
uint256 _marketingFees = 0;
uint256 _devFees = 2;
usdcManager = new USDCManager();
liquidityFee = _liquidityFee;
burnFees = _burnFees;
marketingFees = _mar... | 9,180,930 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity w... | Allows governance to mint new tokens to treasury amount the amount of tokens to mint to treasury/ | function mint(uint amount) external {
require(msg.sender == governance, "mint: !gov");
_mint(governance, amount);
}
| 336,392 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'Deciser' token contract
//
// Deployed to : 0xBDa4f6C850F67F263BC2c1Ea94bbCCbF0C44De03
// Symbol : DEC
// Name : Deciser Token
// Total supply: 10'000'000'000 (total DEC coins, no decimals)
// Decim... | ------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as thi... | function approve(address _spender, uint _tokens) public returns (bool success) {
allowed[msg.sender][_spender] = _tokens;
Approval(msg.sender, _spender, _tokens);
return true;
}
| 5,835,908 |
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
/*
Copyright 2018 dYdX Trading Inc.
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/LICENS... | Calculates time elapsed rounded up to the nearest interestPeriod/ round up to interestPeriod | function calculateEffectiveTimeElapsed(
Position storage position,
uint256 timestamp
)
internal
view
returns (uint256)
{
uint256 elapsed = timestamp.sub(position.startTimestamp);
uint256 period = position.interestPeriod;
if (period > 1) {
... | 1,593,937 |
./partial_match/42/0x3515C0946aeA5e32E7238DC5Eb34aaB46e5e7127/sources/PERC20.sol | 转账给flashloan合约调用flashloan合约的闪电贷方法 | function flashloan(address _receiver, uint256 _amount, bytes memory _params) external nonReentrant {
require(_amount > 0, "amount must bigger than zero");
uint256 availableLiquidityBefore = getCashPrior();
require(availableLiquidityBefore >= _amount, "There is not enough liquidity availabl... | 3,315,306 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.18;
pragma experimental ABIEncoderV2;
import "contracts/Zipper.sol";
/// @title Set containing proposals
/// @author Giovanni Rescinito
/// @notice proposals submitted by agents, along with the corresponding assignment and commitment
library Proposals{
//Data... | returns the number of proposals submitted s set containing proposals return the length of the list contained in the set | function length(Set storage s) view external returns (uint) {
return s.elements.length;
}
| 5,544,870 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/con... | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to) public pure returns (uint256) {
return _to-_from;
}
| 6,364,950 |
./full_match/11155111/0x18d19C513562A772defd41797f0640758238216F/sources/contracts/L1/messaging/L1StandardBridge.sol | Performs the logic for bridging by storing the ETH and informing the L2 ETH Gateway of the bridge. _from Account to pull the ETH from on L1. _to Account to give the ETH to on L2. _l2Gas Gas limit required to complete the bridge on L2. _data Optional data to forward to L2. This data is provided solely as a co... | function _initiateETHBridge(
address _from,
address _to,
uint32 _l2Gas,
bytes memory _data
) internal {
bytes memory message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeBridge.selector,
address(0),
Lib_PredeployAddresses.NVM_ETH,
... | 3,793,126 |
./partial_match/1/0x089504de59277A3D085ad41F0d87E48581589d49/sources/MeebitsResolver.sol | Returns a positive number if `other` comes lexicographically after `self`, a negative number if it comes before, or zero if the contents of the two bytes are equal. Comparison is done per-rune, on unicode codepoints. self The first bytes to compare. offset The offset of self. len The length of self... | function compare(
bytes memory self,
uint256 offset,
uint256 len,
bytes memory other,
uint256 otheroffset,
uint256 otherlen
) internal pure returns (int256) {
if (offset + len > self.length) {
revert OffsetOutOfBoundsError(offset + len, self.le... | 3,953,506 |
import "./summa-tx/BtcParser.sol";
import "./summa-tx/ValidateSPV.sol";
pragma experimental ABIEncoderV2;
pragma solidity ^0.5.10;
contract ETH2BTC {
struct Order {
uint256 etherAmount;
uint256 bitcoinAmountAtRate;
uint256 dueTimestamp;
address payable refundAddress;
}
mapp... | call this if bitcoin transaction never arrives and order is still present | function getRefundForOrder(Order memory order, bytes20 orderOwner) public {
bool orderIsPresent = false;
uint256 pos = 0;
bytes32 hashOfOrder = hashOrder(order);
for (uint256 i = 0; i < orders[orderOwner].length; i++) {
Order memory currentOrder = orders[orderOwner][i];
... | 1,779,906 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.4.21 <0.8.0;
pragma experimental ABIEncoderV2;
import "./GorenCoinToken.sol";
contract Election {
// Structs
struct Candidate {
string fullName;
uint256 voteCount;
}
struct Voter {
bool authorized;
bool voted;
... | Autorize someone to vote - only by owner | function authorize(address _person) public ownerOnly {
voters[_person].authorized = true;
}
| 908,860 |
./partial_match/1/0xB53E093cDDbd0d3117e5103b38595c618A3C49a3/sources/Swapper.sol | calculates the CREATE2 address for a pair without making any external calls | function pairFor(
address factory,
address tokenA,
address tokenB
) internal pure returns (address pair) {
}
| 4,400,880 |
./partial_match/1/0x11b2164DDf1C3c0a420cEaD050d422B26530d11C/sources/contracts/facets/ERC712/ERC712Facet.sol | @inheritdoc IERC712Facet If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized and the EIP712 domain is not reliable, as it will be missing name and version. | function eip712Domain()
public
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
... | 9,188,795 |
./full_match/3/0xf3C3c63Af990927517D3aA85Ce62d110ea4e5295/sources/ManualCommonSyrup_2.sol | Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in rewardToken)/ | function deposit(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
if (hasUserLimit) {
require(
_amount.add(user.amount) <= poolLimitPerUser,
"User amount above limit"
);
}
_updatePool();
... | 14,140,009 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
//
... | inject NONSTANDARD NAMING | function MINT537(address to) external returns (uint liquidity); | 12,546,439 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contrac... | NOTE: Checkpoint may be below total underlying Scale the checkpoint to match the new total C = C (S - s) / S; Checkpoint balance matched beforehand so make sure it matches afterward | function leaveInKind(uint256 _share) external override nonReentrant {
require(_share > 0, "V:S_ZERO");
bool belowCheckpoint;
{
uint256 totalUnderlying = _applyFee();
belowCheckpoint = totalUnderlying < checkpointBalance;
}
uint256 totalShares = totalS... | 981,860 |
./partial_match/1/0xc287C97754BFe97409f93EB8339Dc9448F9BdC57/sources/FlashBot.sol | exclude from paying fees or having max transaction amount | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
}
}
}
constructor() ERC20("FlashBot", "FBT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router... | 4,102,161 |
./partial_match/41/0x7fa250E1B3F586769bD522fC386352111D1da97e/sources/contracts/seed/ERC20Seed.sol | Transfers are disabled by default (only minting and burning is allowed). While transfers are paused, transfers are still allowed for whitelisted addresses. This is useful for bridging, exchanges, etc. Blacklisted addresses are always prevented from receiving and sending tokens./ | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual override {
require(
!areTransfersPaused ||
whitelisted[recipient] ||
whitelisted[sender],
"Transfers are paused"
);
re... | 3,504,029 |
/*
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, ... | Decode StaticCall asset data from the format described in the AssetProxy contract specification. assetData AssetProxy-compliant asset data describing a StaticCall asset return assetProxyId The StaticCall AssetProxy identifier return staticCallTargetAddress The target address of the StaticCall return staticCallData The... | function decodeStaticCallAssetData(bytes memory assetData)
public
pure
returns (
bytes4 assetProxyId,
address staticCallTargetAddress,
bytes memory staticCallData,
bytes32 expectedReturnDataHash
)
{
return LibAssetData.decod... | 6,362,896 |
pragma solidity ^0.4.24;
// _____.___. __ .__.__ _____ .___.__ _____.__ .___
// \__ | | ____ ____ | | _|__|__| / \ ____ __| _/|__|/ ____\__| ____ __| _/
// / | |/ _ \_/ ___\| |/ / | | / \ / \ / _ \ / __ | | \ __\| |/ __ \ / __ |
// \____ ... | this is the core logic for any buy/reload that happens while a round is live./ if player is new to round early round eth limiter mint the new keys if they bought at least 1 whole key set new leaders gib muni calculate prize and give it to winner adjust airDropPot let event know a tier 3 prize was won calculate prize an... | function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < (100 ether) && ply... | 2,104,088 |
// SPDX-License-Identifier: MIXED
// File @openzeppelin/contracts/math/Math.sol@v3.4.2
// License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(u... | Dynamic max expansion percent First 28 epochs with 4.5% expansion set seigniorageSaved to it's balance | function initialize(
address _kitty,
address _bbond,
address _bshare,
address _kittyOracle,
address _nursery,
uint256 _startTime
) public notInitialized {
kitty = _kitty;
bbond = _bbond;
bshare = _bshare;
kittyOracle = _kittyOracle;... | 1,062,519 |
// SPDX-License-Identifier: UNLICENSED
// Banker Medium Risk
// __ __ __ __ _____ __ __
// | |/ .---.-.-----| |--|__| | |_.-----.-----.--| |__.-----.-----.
// | <| _ |__ --| | | | | -__| | _ | | | _ |
// |__|\__|___._|_____|__|__|__| ... | Sender borrows `amount` and transfers it to `to`. return part Total part of the debt held by borrowers. return share Total amount in shares borrowed. | function borrow(address to, uint256 amount)
public
solvent
returns (uint256 part, uint256 share)
{
accrue();
(part, share) = _borrow(to, amount);
}
| 5,355,353 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IClimberTImelock {
function execute(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata dataElements,
bytes32 salt
) external payable;
function schedule(
address[] calldata targe... | here we do not need to pass arguments, because schedule wrapper is defined below - without this calling this would be impossible | function attack() external {
salt = "A_BIT_OF_SALT";
values = [
0,
0,
0];
targets = [
address(timelockAddress),
address(vaultAddress),
address(this)
];
dataElements = [
abi.encodeWithSignature... | 13,089,352 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.5;
// ============ External Imports ============
import {IKoansAuctionHouse} from "../external/interfaces/IKoansAuctionHouse.sol";
// ============ Internal Imports ============
import {IMarketWrapper} from "./IMarketWrapper.sol";
/**
* @title KoansMarketWrapper
*... | Determine whether there is an existing, active auction for this token. In the Koans auction house, the current auction id is the token id, which increments sequentially, forever. The auction is considered active while the current block timestamp is less than the auction's end time. return TRUE if the auction exists/ | function auctionExists(uint256 auctionId)
public
view
returns (bool)
{
(uint256 currentAuctionId, , , uint256 endTime, , , ) = market.auction();
return auctionId == currentAuctionId && block.timestamp < endTime;
}
| 10,193,431 |
/**
*Submitted for verification at Etherscan.io on 2021-07-30
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
// Part: OpenZeppelin/[email protected]/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract... | mints the item with the given tokenId and transfers it to the caller.funds to pay for the item must be transferred with the request.this function confirms that the given tokenId has't previously been minted | function mint(uint256 tokenId) public payable {
require(isMintEnabled, "Items are not currently mintable." );
uint256 priceWei = getPriceWei(tokenId);
require(msg.value >= priceWei, "Insufficient ETH sent to purchase.");
_bbsMint(tokenId);
}
| 15,121,477 |
./full_match/44787/0xFA766A11cEA1f9d5d1Bd1A1F861250b0B6D38b47/sources/contracts/registry/ENSRegistryUpgradeable.sol | Returns the TTL of a node, and any records associated with it. _node The specified node. return ttl of the node./ | function ttl(bytes32 _node) public view virtual override returns (uint64) {
return records[_node].ttl;
}
| 13,265,270 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./ILayerZeroReceiver.sol";
import "./ILayerZeroEndpoint.sol";
import "./LayerZeroStorage.s... | Only owner can upgrade logic contract solhint-disable-next-line no-empty-blocks | function _authorizeUpgrade(address newImplementation) internal override onlyGovernor {}
| 12,573,802 |
// SPDX-License-Identifier: MIT
//
// ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
// ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
// ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
// ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓... | Finalizes the sortition pool rewards ban duration update process. Can be called only by the contract owner, after the governance delay elapses. slither-disable-next-line reentrancy-no-eth | function finalizeSortitionPoolRewardsBanDurationUpdate()
external
onlyOwner
onlyAfterGovernanceDelay(
sortitionPoolRewardsBanDurationChangeInitiated,
STANDARD_PARAMETER_GOVERNANCE_DELAY
)
{
emit SortitionPoolRewardsBanDurationUpdated(
n... | 12,899,134 |
./full_match/44787/0xF49c589ECf3eA81525d7A354401b38BBFd20Fd26/sources/contracts/WittyEuro-8.sol | WEUR only has 2 decimals, just as the real EUR./ | function decimals() public pure override returns (uint8) {
return 2;
}
| 13,244,704 |
//Address: 0x4221eb87b28de194e916f2b09274471fb0b01b1c
//Contract name: TrueDeckToken
//Balance: 0 Ether
//Verification Date: 5/29/2018
//Transacion Count: 19
// CODE STARTS HERE
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function decreaseApproval(address _spender, uint256 _subtractedValue) public whenNotPaused returns (bool) {
require(_spender != address(0));
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed... | 898,947 |
./partial_match/42/0xB40ea11f489300d0F4DCC9890Fc70b4444F003Eb/sources/DController.sol | If the redeemer is not 'in' the market, then we can bypass the liquidity check / | function redeemAllowedInternal(address dToken, address redeemer, uint redeemTokens) internal view returns (uint) {
if (!markets[dToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
if (!markets[dToken].accountMembership[redeemer]) {
return uint(Error.NO_ERROR)... | 3,428,390 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
// Data persistance
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Fallback function for funding smart contract./ this.fund(msg.sender); | function() external payable
{
}
| 6,467,275 |
./partial_match/1/0xBc913FBF1B3475f0a3a963b56398c00a9FeC1068/sources/ArtFungible.sol | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals Clear metadata (if any) | function _burn(uint256 tokenId) internal virtual {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: burn caller is not owner or approved"
);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
if (bytes(_tok... | 15,535,125 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.11;
import './Bet.sol';
import "@chainlink/contracts/src/v0.8/KeeperCompatible.sol";
/// @title Bet factory contract.
/// @author Fermin Carranza
/// @notice Basic contract to create bets. Only ETH/USD currently supported.
/// @dev Chainlink Keeper not curren... | Chainlink function to check if outside data should make it into the contract. Currently not working. | function checkUpkeep(
bytes calldata /*checkData */
) external override view returns (bool upkeepNeeded, bytes memory) {
upkeepNeeded = bets.length > 0;
}
| 15,863,258 |
./full_match/432204/0xDD23b1253020B8C66DB630fc091D1cC3E984A878/sources/contracts/TradePairs.sol | increments the id counter to be used as order id or as an execution id return uint256 id/ | function getNextId() private returns (uint256) {
return idCounter++;
}
| 16,381,180 |
./full_match/1/0x3349705FF99e44d1A42c8ea600DE7cF5bE36E034/sources/contracts/scripty/ScriptyStorage.sol | Edit the script details name - Name given to the script. Eg: threejs.min.js_r148 details - Any details the owner wishes to store about the script Emits an {ScriptDetailsUpdated} event./ | function updateDetails(string calldata name, bytes calldata details)
public
isFrozen(name)
isScriptOwner(name)
{
scripts[name].details = details;
emit ScriptDetailsUpdated(name, details);
}
| 17,054,994 |
./partial_match/1/0x90d0560171c825DE7Fd0940470686D079a79ca45/sources/contracts/lib/ERC1967Proxy.sol | return the implementation address of the proxy/ | function implementation() external view returns (address impl) {
return ERC1967Upgrade._getImplementation();
}
| 9,158,873 |
./full_match/421613/0x1474236fEB9E96Cf0B9f913fF5418856139caAe3/sources/contracts/Game.sol | Step 6 trigger; Game pushes deltaAllocations to vaults Trigger to push delta allocations in protocols to cross chain vaults _vaultNumber Number of vault _chain Chain id of the vault where the allocations need to be sent Sends over an array where the index is the protocolId | function pushAllocationsToVaults(uint256 _vaultNumber, uint32 _chain) external payable {
address vault = getVaultAddress(_vaultNumber, _chain);
require(vault != address(0), "Game: not a valid vaultnumber");
require(isXChainRebalancing[_vaultNumber][_chain], "Vault is not rebalancing");
int256[] memor... | 11,576,174 |
/**
*Submitted for verification at Etherscan.io on 2021-08-07
*/
// File: contracts/common/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() ex... | ========== STATE VARIABLES ========== / ========== CONSTRUCTOR ========== / | function _deposit() internal virtual;
function _claimReward() internal virtual;
function _withdrawSome(uint _amount) internal virtual returns (uint);
function _withdrawAll() internal virtual;
function getName() external pure virtual returns (string memory);
function balanceOf() public view... | 7,844,013 |
//Address: 0x095c0f071fd75875a6b5a1def3f3a993f591080c
//Contract name: Locker
//Balance: 0 Ether
//Verification Date: 6/11/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mu... | returns maximum borrowable token amount allowed by LTD params / | function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {
uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))
.div(PERCENT_100);
allowedByLtdDifferencePt = totalLoanAmount >= allowedB... | 978,546 |
pragma solidity 0.5.4;
import "./lib/Ownable.sol";
import "./lib/SafeMath.sol";
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint2... | Claim vested token this will be eligible after vesting start + cliff or schedule times/ | function claim() public {
address beneficiary = msg.sender;
Grant storage grantInfo = grants[beneficiary];
require(grantInfo.value > 0, "Grant does not exist");
uint256 vested = calculateTransferableTokens(grantInfo, now);
require(vested > 0, "There is no vested tokens");
... | 14,035,569 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./Staking.sol";
import "../interfaces/IVault.sol";
/// @dev Add a new sta... | Get the working balance for the stake with the given stake id. _stakeId The id of the stake return The working balance, calculated as stake.amount stake.lockPeriod | function workingBalanceOfStake(uint256 _stakeId) external view returns (uint256) {
if (_stakeId < stakes.length) {
Stake memory s = stakes[_stakeId];
return _workingBalanceOfStake(s);
}
return 0;
}
| 11,889,958 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
//
... | inject NONSTANDARD NAMING | function TRANSFEROWNERSHIP407(address newOwner) public virtual ONLYOWNER460 { | 12,546,385 |
./full_match/1/0xD05ca8f5B9fd7fa84D1c92b2e64feA8259EeC1ae/sources/browser/CompMiner_flat.sol | main total close position function FLASHLOAN LOGIC END FLASHLOAN LOGIC | function closePositionFlashloan() internal {
uint flashLoanAmount = ICToken(cTokenAddress).borrowBalanceCurrent(
address(this)
);
state = OP.CLOSE;
initiateFlashLoan(uint(-1), flashLoanAmount);
state = OP.UNKNOWN;
}
| 9,805,955 |
//Address: 0x25b16c95f3ebb1d8583a1c173f81257bc916a9be
//Contract name: SignalsCrowdsale
//Balance: 0 Ether
//Verification Date: 3/12/2018
//Transacion Count: 1706
// CODE STARTS HERE
pragma solidity ^0.4.20;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {... | Only function for the tokens withdrawal (3% anytime, 5% after one year, 10% after two year) Will withdraw the whole allowance;/ | function withdraw() onlyOwner public {
require(now - start >= 25920000);
uint256 toWithdraw = canWithdraw();
withdrawn += toWithdraw;
token.transfer(owner, toWithdraw);
TokensWithdrawn(owner, toWithdraw);
}
| 14,091,126 |
./full_match/80001/0x8DD6f857bCF86316b6086cf858d9958ACc230d09/sources/lib/openzeppelin-contracts/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol | See {IERC165-supportsInterface}./ | function supportsInterface(
bytes4 interfaceId
) public view virtual override(AccessControlEnumerable, ERC1155) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 5,705,045 |
./partial_match/1/0xBd5d9451E004fc495F105cEaB40d6c955E4192bA/sources/Orchestrator.sol | Main entry point to initiate a rebase operation. The Orchestrator calls rebase on the policy and notifies downstream applications. Contracts are guarded from calling, to avoid flash loan attacks on liquidity providers. If a transaction in the transaction list reverts, it is swallowed and... | function rebase() external {
policy.rebase();
for (uint256 i = 0; i < transactions.length; i++) {
Transaction storage t = transactions[i];
if (t.enabled) {
bool result = externalCall(t.destination, t.data);
if (!result) {
... | 2,659,257 |
./partial_match/42/0x94E64a52FE20AB1AcEA11EAF126314dfc5075319/sources/HYPEAdmin.sol | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw_single(uint256 _pid) public {
SinglePoolInfo storage pool = poolInfo_single[_pid];
UserInfo storage user = userInfo_single[_pid][msg.sender];
pool.sToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw_single(msg.sender, _pid, user.am... | 3,357,778 |
pragma solidity ^0.6.4;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../governance/Governed.sol";
import "../upgrades/GraphProxy.sol";
import "../upgrades/GraphUpgradeable.sol";
import "./CurationStorage.sol";
import "./ICuration.sol";
/**
* @title Curation contract
* @dev Allows curators to signal... | Set the default reserve ratio percentage for a curation pool. Update the default reserver ratio to `_defaultReserveRatio` _defaultReserveRatio Reserve ratio (in PPM)/ Reserve Ratio must be within 0% to 100% (exclusive, in PPM) | function setDefaultReserveRatio(uint32 _defaultReserveRatio) external override onlyGovernor {
require(_defaultReserveRatio > 0, "Default reserve ratio must be > 0");
require(
_defaultReserveRatio <= MAX_PPM,
"Default reserve ratio cannot be higher than MAX_PPM"
);
... | 12,735,981 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../interfaces/IController.sol";
import "../interfaces/IConverter.sol";
import "../int... | Updates the stored balance of a given strategy for a vault _vault The address of the vault _strategy The address of the strategy/ | function updateBalance(
address _vault,
address _strategy
)
internal
{
_vaultDetails[_vault].balances[_strategy] = IStrategy(_strategy).balanceOf();
}
| 930,725 |
/*
⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠
This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!
This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release!
The proxy can be found by looking up the PROXY propert... | false if our cache is invalid or if the resolver doesn't have the required address | function isResolverCached() external view returns (bool) {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
if (resolver.getAddress(name) != addressCache[name] || addre... | 84,643 |
./full_match/11155111/0xfAc451d01F8003B751d91Ae3990056E52676CBDC/sources/project:/contracts/superfluid/SuperTokenFactory.sol | @inheritdoc ISuperTokenFactory | function createERC20Wrapper(
IERC20Metadata underlyingToken,
uint8 underlyingDecimals,
Upgradability upgradability,
string calldata name,
string calldata symbol
)
external override
returns (ISuperToken superToken)
{
return createERC20Wrapper(
... | 3,806,961 |
pragma solidity >=0.0;
/*
Copyright 2016, Jordi Baylina
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | `onlyRecipientOrLeadLink` Sends the milestone payment as specified in `payData`; the recipient can only call this after the `reviewTime` has elapsed _idMilestone ID of the milestone to be paid out | function requestMilestonePayment(uint _idMilestone
) public campaignNotCanceled notChanging {
if (_idMilestone >= milestones.length) revert();
Milestone storage milestone = milestones[_idMilestone];
if ( (msg.sender != milestone.milestoneLeadLink)
&&(msg.sender != recipi... | 15,850,346 |
pragma solidity >=0.4.18 <0.7.0;
import '../solidity-lib/openzeppelin-solidity-112/contracts/ownership/Claimable.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/lifecycle/TokenDestructible.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/token/ERC20/ERC20.sol';
import '../solidity-l... | record withdraw into this contract _time the timstamp of the withdraw time _to is where the tokens will be sent to _value is the number of the token/ | function recordWithdraw(uint256 _time, address payable _to, uint256 _value) public onlyOwner {
withdrRecs.push(TransferRecord(_time, _to, _value));
}
| 12,834,610 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.7;
import { EtherOrcs } from "./EtherOrcs.sol";
import { ERC20 } from "./ERC20.sol";
contract Migrator {
address implementation_;
address public admin;
EtherOrcs public oldOrcs;
EtherOrcs public newOrcs;
ERC20 public zug;
addre... | give retroactive time | function migrateAndTrain(uint256 tokenId) public {
_migrate(tokenId);
newOrcs.migrationAction(tokenId, msg.sender, EtherOrcs.Actions.TRAINING);
}
| 10,240,232 |
pragma solidity ^0.7.6;
// SPDX-License-Identifier: MIT
// Source code: https://github.com/DeCash-Official/smart-contracts
import "../interface/DeCashProxyInterface.sol";
import "../lib/Address.sol";
import "./DeCashBase.sol";
import "./Proxy.sol";
/// @title DeCash Proxy Contract
/// @author Fabrizio Amodio (ZioFab... | Returns the current implementation address./ solhint-disable-next-line no-inline-assembly | function _implementation() internal view override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| 1,022,702 |
./partial_match/420666/0xF6f517df0e5cB5AaE1D96B83F7E43523eE674923/sources/TopKek/TopKek.sol | Stuck Balances Functions | function rescueToken(address tokenAddress, uint256 tokens) public onlyOwner returns (bool success) {
return IERC20(tokenAddress).transfer(msg.sender, tokens);
}
| 3,503,957 |
./full_match/4/0x3d6835E9a5c580eC1AAD998cf267c65288754479/sources/Bank/Chromium.sol | this function will swap cblt tokens for tokens that are allowed/ | function swapForCblt(
IERC20 fromToken,
uint256 amount
)
external
payable
{
(uint256 sellTokenValue, uint256 buyTokenValue) = oracle.priceOfPair(address(fromToken), address(cbltToken));
uint returnAmount = SafeMath.mul(amount,
SafeMath.findRate(sellTokenVa... | 12,378,265 |
./full_match/1313161554/0xCFEED4a123ECa680aeA2DdEa6dde42DFE724D955/sources/contracts/feedVaults/targetVaults/TargetVault.sol | Set buy back token address/ | function setBuyBackToken(address _buyBackToken) public virtual onlyOwner {
require(_buyBackToken != address(0), "TargetVault(setBuyBackToken): buy back token cannot be zero address");
buyBackToken = _buyBackToken;
tokenToBuyBackPath = [address(token), wBNB, buyBackToken];
emit Buy... | 13,235,084 |
// 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... | Function to get pricePerShare from V2 pools | interface IVesperPool is IERC20 {
function calculateUniversalFee(uint256 _profit) external view returns (uint256 _fee);
function deposit() external payable;
function deposit(uint256 _share) external;
function multiTransfer(address[] memory _recipients, uint256[] memory _amounts) external returns (boo... | 11,983,083 |
pragma solidity 0.5.11;
/**
* @title Gods Unchained ERC-721 Token Raffle
* @author Unchained Games
*/
contract RaffleMarket {
// You can't win the raffle if you don't buy a ticket
// ==== EVENTS ==== //
/**
* @dev OnBuyRaffleTickets emits an event when raffle tickets are purchased
*
* @... | createRaffle creates a new raffle tokenId - ERC721 Token ID host - The host of the raffle costPerTicket - The cost of one raffle ticket minimumTickets - The minimum number of tickets needed for a raffle/ Require the cost of a ticket to be greater than or equal to the minimum cost of a raffle ticket Require at least... | function createRaffle(uint256 tokenId, address host, uint256 costPerTicket, uint256 minimumTickets)
private
{
require(costPerTicket >= minRaffleTicketCost, "ticket price must meet the minimum");
require(minimumTickets > 0, "must set at least one raffle ticket");
totalRaffles = ... | 944,823 |
/**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File openzeppelin-solidity/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context,... | setRewardsSplit - set the pool token rewards split upon an approval the function can be called only by governance. the sum of the rewards split should be less than 10000 (less than 100%) _pid pool id _rewardsSplit split and sent to the hacker(claim reported)/ | function setRewardsSplit(uint256 _pid, RewardsSplit memory _rewardsSplit)
external
onlyGovernance noPendingApproval(_pid) noSafetyPeriod {
validateSplit(_rewardsSplit);
poolsRewards[_pid].rewardsSplit = _rewardsSplit;
emit SetRewardsSplit(_pid, _rewardsSplit);
}
| 2,322,373 |
// SPDX-License-Identifier: MIT
// Amended by Ali
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
pragma soli... | Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./ | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
... | 439,951 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "./interfaces/IOniiChainDescriptor.sol";
import "./interfaces/IOniiChain.sol";
import "./libraries/NFTDescriptor.sol";
import "./libraries/DetailHelper.sol";
import "base64-sol/base64.sol";
/// @title Describes Onii
/// @notice Produc... | generate Json Metadata description | function generateDescription(SVGParams memory params) internal pure returns (string memory) {
return
string(
abi.encodePacked(
"Generated by ",
Strings.toHexString(uint256(uint160(params.creator))),
" at ",
... | 5,890,146 |
/**
*Submitted for verification at Etherscan.io on 2021-12-13
*/
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/lib/AddressUtil.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Utility Functions for addresses
/// @author Daniel Wang ... | Calculate the Merkle root using the Merkle paths provided Verify the NFT data | function isAccountBalanceCorrect(
uint merkleRoot,
ExchangeData.MerkleProof memory merkleProof
)
public
pure
returns (bool)
{
uint calculatedRoot = getBalancesRoot(
merkleProof.balanceLeaf.tokenID,
merkleP... | 7,920,806 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import {Decimal} from "../external/Decimal.sol";
import {CoreRef} from "./../refs/CoreRef.sol";
import {IScalingPriceOracle} from "./IScalingPriceOracle.sol";
import {IOraclePassThrough} from "./IOraclePassThrough.sol";
import {Ownable} from "@openze... | interface to get data from the Scaling Price Oracle ----------- Getters ----------- ----------- Governor only state changing api ----------- | interface IOraclePassThrough {
function scalingPriceOracle() external view returns (IScalingPriceOracle);
function read()
external
view
returns (Decimal.D256 memory price, bool valid);
function getCurrentOraclePrice() external view returns (uint256);
function currPegPrice() e... | 6,963,216 |
pragma solidity ^0.4.11;
/*
TenX Buyer
========================
Buys TenX tokens from the crowdsale on your behalf.
Author: /u/Cintix
*/
// ERC20 Interface: https://github.com/ethereum/EIPs/issues/20
// Well, almost. PAY tokens throw on transfer failure instead of returning false.
contract ERC20 {
function tran... | A helper function for the default function, allowing contracts to interact. Treat 0 ETH transactions as withdrawal requests. Otherwise, the user is sending funds to buy tokens. Only allow deposits if the contract hasn&39;t already purchased the tokens. Update records of deposited ETH to include the received amount. | function default_helper() payable {
if (msg.value == 0) {
withdraw();
}
else {
if (bought_tokens) throw;
balances[msg.sender] += msg.value;
}
}
| 2,216,233 |
/**
*Submitted for verification at Etherscan.io on 2021-07-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length | function safeApprove(RC token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, s... | 10,869,624 |
pragma solidity ^0.4.24;
/** ----------------------MonetaryCoin V1.0.0 ------------------------*/
/**
* Homepage: https://MonetaryCoin.org Distribution: https://MonetaryCoin.io
*
* Full source code: https://github.com/Monetary-Foundation/MonetaryCoin
*
* Licenced MIT - The Monetary Foundation 2018
... | the block reward return the current block reward/ | function blockReward() public view returns (int256) {
return blockReward_;
}
| 910,995 |
./full_match/43113/0x5F8bE8B38bAb68683157718b05C4FFa703a8283B/sources/_MAKO.sol | Include All Okama Functions & Events function mintFrom(address tokenAddress, uint amount, address creditAccount) external returns(bool,uint){ if (tokenAddress == v1Contract) { _maxSupply += amount; _mintTokens(creditAccount, amount); } else { _mintTokens(creditAcc... | interface OkamaProject {
function mintFrom(address tokenAddress, uint amount, address creditAccount) external returns(bool,uint);
function activateContract(uint256 unMintedTokens) external returns(bool);
}
| 7,107,536 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "./lib/IERC20.sol";
import "./lib/SafeMath.sol";
import './lib/IUniswapV2Pair.sol';
import "./lib/UniswapV2OracleLibrary.sol";
import "./lib/Context.sol";
import "./lib/Ownable.sol";
import "./lib/IXAUToken.sol";
import "... | Adds a transaction that gets called for a downstream receiver of rebases destination Address of contract destination data Transaction data payload/ | function addTransaction(address destination, bytes calldata data)
external
onlyOwner
{
transactions.push(Transaction({
enabled: true,
destination: destination,
data: data
}));
}
| 7,267,204 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// Part: OpenZeppelin/[email protected]/Context
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are gen... | Mint tokens when bridging This function is only used for bridging to mint tokens on one end to Address to send new tokens to value Number of new tokens to mint | function bridgeMint(address to, uint256 value) external {
require(bridge != address(0), "Bridge is not set");
require(msg.sender == bridge, "Only bridge can do this");
_mint(to, _getMaximumRewards(value));
}
| 2,204,226 |
pragma solidity ^0.5.7;
interface TubInterface {
function open() external returns (bytes32);
function join(uint) external;
function exit(uint) external;
function lock(bytes32, uint) external;
function free(bytes32, uint) external;
function draw(bytes32, uint) external;
function wipe(bytes32... | get InstaDApp Liquidity contract/ | function getLiquidityAddr() public pure returns (address liquidity) {
liquidity = 0x7281Db02c62e2966d5Cd20504B7C4C6eF4bD48E1;
}
| 12,651,794 |
./full_match/4/0x4D18FdDB0000fB895bf2960928a889b27acDcb03/sources/Users/patrick/Documents/TRON/Lottery/contracts/JackPot.sol | uint256 balance_won = address(this).balance 50 / 100;players[index].transfer(balance_won);players = new address payable[](0);emit logWinner(players[index],balance_won); | function __callback( bytes32 _queryId, string memory _result, bytes memory _proof ) public {
require(msg.sender == provable_cbAddress());
require(ongoingBets[_queryId].sender != address(0x0) , 'query does not exist');
if(provable_randomDS_proofVerify__returnCode( _queryId, _result, _proof) !... | 12,317,428 |
pragma solidity ^0.5.0;
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./Valset.sol";
import "./CosmosBridge.sol";
contract Oracle {
using SafeMath for uint256;
/*
* @dev: Public variable declarations
*/
CosmosBridge public cosmosBridge;
Valset public ... | : newOracleClaim Allows validators to make new OracleClaims on an existing Prophecy/ Validate the msg.sender's signature Confirm that this address has not already made an oracle claim on this prophecy Process the prophecy | function newOracleClaim(
uint256 _prophecyID,
bytes32 _message,
bytes memory _signature
)
public
onlyValidator
isPending(_prophecyID)
{
address validatorAddress = msg.sender;
require(
validatorAddress == valset.recover(
... | 6,387,148 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Crowdfunding {
// Data struct definition
struct Project {
uint init;
uint end;
uint target;
uint amount;
bool finished;
string title;
string description;
}
struct Proje... | Devolver dinheiro dos apoiadores Chamada pelo dono do projeto ao encerrar ou expirar o projeto | function refundDonation(address _projectOwner) private {
for(uint i = 0; i < donationOwners.length; i++){
for(uint j = 0; j < donations[donationOwners[i]].length; j++){
if(donations[donationOwners[i]][j].project == _projectOwner){
payable(donationOwners[i]).tr... | 15,805,066 |
pragma solidity ^0.4.24;
/**
* @title ERC20
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowanc... | now send all the token balance | function tokenBalance(address _tokenContract) public view returns(uint _balance) {
ERC20 token = ERC20(_tokenContract);
uint balance = token.balanceOf(this);
return balance;
}
| 12,856,582 |
/**
*Submitted for verification at Etherscan.io on 2021-11-30
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | we use this to clone our original strategy to other vaults Copied from https:github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol EIP-1167 bytecode | function cloneCurve3CrvRewards(
address _vault,
address _strategist,
address _rewards,
address _keeper,
address _curvePool,
address _gauge,
bool _hasRewards,
address _rewardsToken,
string memory _name
) external returns (address newStrategy... | 2,340,311 |
pragma solidity ^0.4.25;
library Math {
function min(uint a, uint b) internal pure returns(uint) {
if (a > b) {
return b;
}
return a;
}
function max(uint a, uint b) internal pure returns(uint) {
if (a > b) {
return a;
}
return b;
}
}
library Percent {
... | перенос очереди из проекта MMM3.0Reloadкошельки администрации проекта MMM3.0Reload исключаем из переноса | function FromMMM30Reload(address _ImportContract, uint _from, uint _to) public onlyOwner {
require(!migrationFinished);
distribution ImportContract = distribution(_ImportContract);
address depositor;
uint amount;
uint depositeTime;
uint paymentTime;
u... | 12,887,656 |
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
... | ------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address to, uint tokens)override public onlyPayloadSize(2*32) returns (bool success) {
return true;
}
| 4,807,594 |
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/NPMCaller.sol | Query if an address is an authorized operator for another address npm Uniswap v3 Nonfungible Position Manager owner The address that owns the NFTs operator The address that acts on behalf of the owner return isApproved True if `operator` is an approved operator for `owner`, false otherwise Write the abi-encoded call... | function isApprovedForAll(INPM npm, address owner, address operator) internal view returns (bool isApproved) {
bytes4 selector = IERC721.isApprovedForAll.selector;
assembly ("memory-safe") {
mstore(0, selector)
mstore(4, owner)
mstore(0x24, operator)
i... | 15,622,099 |
contract owned {
function owned() {
owner = msg.sender;
}
address public owner;
modifier onlyowner { if (msg.sender != owner) throw; _ }
event OwnershipTransfer(address indexed from, address indexed to);
function transferOwnership(address to) public onlyowner {
ow... | Cancel the order, returning all funds to the owner. | function cancel() onlyowner {
selfdestruct(owner);
}
| 7,271,482 |
pragma solidity >=0.5;
pragma experimental ABIEncoderV2;
/**
* @title DexStatus
* @dev Status for Dex
*/
contract DexStatus {
string constant ONLY_RELAYER = "ONLY_RELAYER";
string constant ONLY_AIRDROP = "ONLY_AIRDROP";
string constant ONLY_INACTIVITY = "ONLY_INACTIVITY";
string... | deposit eth/ | function deposit() public payable {
_deposit(msg.sender,address(0),msg.value);
}
| 1,805,294 |
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**... | Retrieve the rate for a specific currency/ | function rateForCurrency(bytes4 currencyKey)
public
view
returns (uint)
{
return rates[currencyKey];
}
| 1,080,763 |
// SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, ... | bootstrap a market (aka the first one to add liquidity) Users can either set _token as ETH or WETH to trade with XYT-WETH markets If they put in ETH, they must send ETH along and _token will be auto wrapped to WETH If they put in WETH, the function will run the same as other tokens/ | function bootstrapMarket(
bytes32 _marketFactoryId,
address _xyt,
address _token,
uint256 _initialXytLiquidity,
uint256 _initialTokenLiquidity
) external payable override pendleNonReentrant {
require(_initialXytLiquidity > 0, "INVALID_XYT_AMOUNT");
require... | 12,866,243 |
./full_match/1/0x69d8f2cb6Aa9E274864574a4e9F22e22DbE3b9A5/sources/contracts/mixins/BuyNowSellingAgreementProvider.sol | see {IExchangeArtNFTMarketBuyNow-editBuyNowSellingAgreement} | function editBuyNowSellingAgreement(
address nftContractAddress,
uint256 tokenId,
uint256 newPrice
) external override nonReentrant {
BuyNowSellingAgreement memory sellingAgreement = s_buyNowSellingAgreements[
nftContractAddress
][tokenId];
sellingAgreement.mustExist();
sellingAgr... | 4,890,567 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {PermissionAdmin} from '@kyber.network/utils-sc/contracts/PermissionAdmin.sol';
import {IKyberGovernance} from '../interfaces/governance/IKyberGovernance.sol';
impo... | Get the current state of a proposal proposalId id of the proposal return The current state if the proposal/ | function getProposalState(uint256 proposalId) public override view returns (ProposalState) {
require(proposalId < _proposalsCount, 'invalid proposal id');
ProposalWithoutVote storage proposal = _proposals[proposalId].proposalData;
if (proposal.canceled) {
return ProposalState.Canceled;
return ... | 5,428,164 |
./full_match/5/0x4cDc11e8B5294DC4902bD95a7Fb78Fb7e81B466c/sources/project_/contracts/BookDatabase.sol | testar se o livro existe. O delete não verifica, apenas não faz nada.decrementa a quantidade de livros existente | function removeBook(uint32 id) public restricted {
if(books[id].year > 0) {
delete books[id];
count--;
}
}
| 7,077,213 |
./partial_match/1/0x68FD40FB0713a35627C98ba9549c7cCed73827F9/sources/contracts/libs/ERC4626Upgradeable.sol | Internal conversion function (from assets to shares) with support for rounding direction. Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset would represent an infinite amount of shares./ | function _convertToShares(uint256 assets, Math.Rounding rounding)
internal
view
virtual
returns (uint256 shares)
{
uint256 supply = totalSupply();
return
(assets == 0 || supply == 0)
? _initialConvertToShares(assets, rounding)
... | 15,606,860 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
abstract contract stKSM is IERC20, Pausable {
/**
* @dev stKSM balances are dynamic and are calculated based on the accounts' shares
*... | return the amount of shares owned by `_account`./ | function sharesOf(address _account) public view returns (uint256) {
return _sharesOf(_account);
}
| 2,510,482 |
./full_match/1/0x88ed3B8D03e5a70Bf23286872b24cFFd76e91922/sources/src/Chief.sol | Executes pause state changes. vaults to change pause state data encoded data containing pause or unpause commands./ | function _changePauseState(IPausableVault[] memory vaults, bytes memory data) internal {
uint256 alength = vaults.length;
for (uint256 i; i < alength;) {
address(vaults[i]).functionCall(data, ": pause call failed");
unchecked {
++i;
}
}
}
| 17,056,404 |
./full_match/1/0xEaE4B88C1fb5530eDcf6B45aA19cdC84BAde18BB/sources/contracts/BucketAuction.sol | get the number of tokens purchased by an address, after the clearing price has been set. a address to query./ | function amountPurchased(address a) public view returns (uint256) {
if (_price == 0) revert PriceNotSet();
return _userData[a].contribution / _price;
}
| 17,118,100 |
/**
*Submitted for verification at Etherscan.io on 2022-05-01
*/
// Sources flattened with hardhat v2.9.3 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma s... | require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "admin only"); | function setRandomness(address _randomness)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
randomness = ISBRandomness(_randomness);
}
| 7,636,261 |
// 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 o... | Withdraws a given amount from lender amount The amount the caller wants to withdraw return Amount actually withdrawn | function withdraw(uint256 amount) external override onlyRole(STRATEGY_ROLE) returns (uint256) {
return _withdraw(amount);
}
| 1,475,900 |
./full_match/5/0x13FDeFcadca58916f3BFDD492dBa2F522fb58558/sources/ERC1410Operator.sol | Authorises an operator for all partitions of `msg.sender` _operator An address which is being authorised | function authorizeOperator(
address _operator,
address tokenHolder
) external onlyOwner {
operatorForAllPartitions[tokenHolder][_operator] = true;
emit AuthorizedOperator(_operator, tokenHolder);
}
| 1,852,807 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol";
import "@boringcrypto/boring-solidity/contracts/BoringBatchable.sol";
import "@boringcrypto/boring-solidity/contracts/BoringOwnable.sol";
import "./libra... | Add a new LP to the pool. Can only be called by the owner. DO NOT add the same LP token more than once. Rewards will be messed up if you do. allocPoint AP of the new pool. _lpToken Address of the LP ERC-20 token. _rewarder Address of the rewarder delegate. | function add(uint256 allocPoint, IERC20 _lpToken, IRewarder _rewarder) public onlyOwner {
uint256 lastRewardBlock = block.number;
totalAllocPoint = totalAllocPoint.add(allocPoint);
lpToken.push(_lpToken);
rewarder.push(_rewarder);
poolInfo.push(PoolInfo({
allocPo... | 13,089,464 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.