file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/42/0x0dAAe03aaEe84B5c5BeBD3B0f8ccb539C1A5463E/sources/FeePool.sol | Record the reward payment in our recentFeePeriods. periAmount The amount of PERI tokens./ Don't assign to the parameter Start at the oldest period and record the amount, moving to newer periods until we've exhausted the amount. The condition checks for overflow because we're going to 0 with an unsigned int. Take the s... | function _recordRewardPayment(uint periAmount) internal returns (uint) {
uint remainingToAllocate = periAmount;
uint rewardPaid;
for (uint i = FEE_PERIOD_LENGTH - 1; i < FEE_PERIOD_LENGTH; i--) {
uint toDistribute = _recentFeePeriodsStorage(i).rewardsToDistribute.sub(
... | 3,330,604 |
./full_match/3/0x920dBE12da8CF312518E9Fed97241A5Df95286bC/sources/home/arachnid/Dropbox/projects/enssec/contracts/algorithms/EllipticCurve.sol | Transform affine coordinates into projective coordinates./ | function toProjectivePoint(uint x0, uint y0) public pure
returns (uint[3] memory P)
{
P[2] = addmod(0, 1, p);
P[0] = mulmod(x0, P[2], p);
P[1] = mulmod(y0, P[2], p);
}
| 8,182,530 |
/**
*Submitted for verification at Etherscan.io on 2020-11-09
*/
pragma solidity ^0.6.6;
//SPDX-License-Identifier: UNLICENSED
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMat... | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ return ERC20Interface(tokenAddress).transfer(owner, tokens); | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner {
address(uint160(tokenAddress)).transfer(0);
emit Sent(owner,tokenAddress,tokens);
}
| 973,244 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/// Simply a rock-paper-scissors game with a commitment scheme to avoid front-running attacks.
/// 1 (FUNDING state). Both players must first fund the game with the agreedStake amount
/// 2 (COMMITMENT sta... | after the COMMITMENT phase, each player will reveal his action, the commitment value is checked, and the battle ends with a winner, or a draw If a player lies on his action, he loses immediately Both players revealed, time to find the winner In case of a draw, undo commitment and action and revert to COMMITMENT... | function reveal(string calldata _action) external onlyPlayers stateCheck(GameState.REVEAL) actionIsValid(keccak256(abi.encodePacked(_action))) {
if (keccak256(abi.encodePacked(_action)) != playerStates[msg.sender].commitment) {
emit Liar(msg.sender);
if (msg.sender == player1) {
... | 12,756,215 |
//Address: 0x8a98cf91fd2ea825a187e4ceaf3490c8a71d8d73
//Contract name: MowjowBounty
//Balance: 0 Ether
//Verification Date: 12/29/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
f... | Internal function to deploy the target contract. return A target contract address/ Sends the contract funds to the researcher that proved the contract is broken. target contract/ Check Target contract invariants | function deployContract() internal returns(address);
function claim(Target target) public {
address researcher = researchers[target];
require(researcher != 0);
require(!target.checkInvariant());
asyncSend(researcher, this.balance);
claimed = true;
}
| 5,479,743 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.so... | solhint-disable-next-line func-name-mixedcase | function __RewardsManager_init_unchained(
IERC721EnumerableUpgradeable token
) internal onlyInitializing {
require(token.supportsInterface(type(IERC721EnumerableUpgradeable).interfaceId), "not ERC721Enumerable");
_token = token;
}
| 14,070,131 |
pragma solidity ^0.4.23;
contract Ownable {
address public owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() publ... | withdraw from the affiliate pot / | function withdrawAffiliateBalance(address receiver) public validAddress(receiver){
uint value = affiliateBalance[msg.sender];
require(value > 0);
affiliateBalance[msg.sender] = 0;
receiver.transfer(value);
emit Withdrawal(3, receiver, value);
}
| 2,576,966 |
./full_match/1/0xeF6303006a994f469Ef0FBDe20b269e804adB985/sources/src/Math.sol | Calculate x y / scale rounding down./ | function mulScale(uint256 x, uint256 y, uint128 scale) internal pure returns (uint256) {
uint256 a = x / scale;
uint256 b = x % scale;
uint256 c = y / scale;
uint256 d = y % scale;
return a * c * scale + a * d + b * c + b * d / scale;
}
| 16,403,935 |
// File: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constru... | make sure _msgSender() has proper allocation | function withdraw(address _receiver) public {
uint256 amount = processedPayments[_msgSender()].amount;
address tokenAddr = processedPayments[_msgSender()].token;
require(amount > 0, "StealthSwap: Unavailable tokens for withdrawal");
delete processedPayments[_msgSender()];
emit Withdrawal(_msgSende... | 6,571,078 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(add... | Transfer IBST tokens from Company allocation to reicipient address - Only owner and admins can execute _recipient The address to transfer tokens for _tokensToTransfer The amount of IBST tokens to transfer/Company can't trasnfer more tokens than allocatedTransfer | function manualContribution(address _recipient, uint256 _tokensToTransfer) public onlyOwnerOrAdmin {
require(_recipient != address(0));
require(allocations[companyWallet].amountClaimed.add(_tokensToTransfer) <= allocations[companyWallet].totalAllocated);
allocations[companyWallet].amountClaimed = allocations... | 1,679,009 |
/* Copyright (C) 2021 Soteria.fund
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed... | Checks whether emergency pause id on/not. | function isPause() public view returns(bool) {
uint length = emergencyPaused.length;
return length > 0 && emergencyPaused[length - 1].pause;
}
| 7,293,428 |
./full_match/44787/0xEE238f805347a5EfC8772Ef9541d77edaF093C31/sources/contracts/marketPlace/CyberBoxMarket.sol | Remove token listing | function buyTokenComplete(address sender, uint256 tokenId) external {
_erc721.safeTransferFrom(listing.seller, sender, tokenId);
_delistToken(tokenId);
_removeBidOfBidder(tokenId, sender);
}
| 13,242,106 |
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
//SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with ver... | Updated: Public verification functionality This may not be necessary, but can be a nice to have. | function verifyPublicWL(address _address, bytes32[] memory _proof) public view returns (bool) {
return MerkleProof.verify(_proof, keccak256(abi.encodePacked(_address)), merkleRoot);
}
$$$$$$\ $$$$$$$$\ $$\ $$\ ... | 2,323,526 |
./partial_match/80001/0xbFABf2373eEFf171E4462819ba5E51e1F842e51c/sources/contracts/farmings/AlgebraEternalFarming.sol | @inheritdoc IAlgebraEternalFarming | function enterFarming(IncentiveKey memory key, uint256 tokenId) external override onlyFarmingCenter {
if (isEmergencyWithdrawActivated) revert emergencyActivated();
(bytes32 incentiveId, int24 tickLower, int24 tickUpper, uint128 liquidity, address virtualPoolAddress) = _enterFarming(key, tokenId);
IAlgeb... | 8,815,070 |
/*
ERC20CompetitiveRewardModuleInfo
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "../interfaces/IRewardModule.sol";
import "../ERC20CompetitiveRewardModule.sol";
import "../GysrUtils.sol";
... | compute effective unlocked rewards module address of reward module return estimated current unlocked rewards/ compute expected updates to global totals | function unlocked(address module) public view returns (uint256) {
ERC20CompetitiveRewardModule m = ERC20CompetitiveRewardModule(module);
uint256 deltaUnlocked;
address tkn = m.tokens()[0];
uint256 totalLockedShares = m.lockedShares(tkn);
if (totalLockedShares != 0) {
... | 13,070,988 |
./partial_match/137/0x48304908669633459c9381CB538Ff7bffF3a8e43/sources/darkUSD.sol | This is needed to avoid costly repeat calls to different getter functions It is cheaper gas-wise to just dump everything and only use some of the info | function dusd_info() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
return (
);
}
| 3,525,548 |
./full_match/1/0x48Aca7352A34EeE4D324FfCee7F8352C99c7D22C/sources/src/v1/Nash21Manager.sol | @inheritdoc INash21Manager | function lock(bytes32 id) public onlyRole(DEFAULT_ADMIN_ROLE) {
locked[id] = true;
emit Locked(id, get[id]);
}
| 9,714,818 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IExtensionStorage} from "../../extensions/IExtensionStorage.sol";
import {ExtensionLib} from "./ExtensionLib.sol";
import {IExtension, TransferData} from "../../extensions/IExtension.sol";
import {ExtendableBase} from "./ExtendableBase.sol";
contract Ext... | get extension context address from function selector Execute external function from facet using call and return any value. copy function selector and any arguments execute function call using the facet get any return value return any return value or error back to the caller | function _callFunction(bytes4 funcSig) private {
address toCall = _lookupExtension(funcSig);
require(toCall != address(0), "EXTROUTER: Function does not exist");
uint256 value = msg.value;
assembly {
calldatacopy(0, 0, calldatasize())
let result := call(gas(... | 7,285,895 |
pragma solidity ^0.4.24;
import "oraclize-api/usingOraclize.sol";
contract ConversionRate is usingOraclize {
uint256 public price;
uint public lastUpdated;
event LogNewOraclizeQuery(string description);
event LogCallback(string result, uint lastUpdated);
constructor() public payable {
OA... | this parsing will return 15000 for "150.00" for example | function __callback(bytes32, string _result) public {
if (msg.sender != oraclize_cbAddress())
revert("Wrong sender");
price = parseInt(_result, 2);
lastUpdated = block.timestamp;
emit LogCallback(_result, lastUpdated);
}
| 952,769 |
// SPDX-License-Identifier: MIT
/**
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMWWNXXKKKKKKKXXXXKKKKKKXXNWWMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMWNXKKKKXXNWWWWMMWWWWMWWWWNXXXKKKXNWMMMMMMMMMMMMMMMM... | Sell option for a fixed price onlyOwner cannot set a price if auction is activated set sell price for index If price is zero, means not for sale approve the Index to the current contract set wallet payment | function sell(uint256 tokenId, uint256 price, address payable wallet) public {
require(ownerOf(tokenId)==msg.sender, "ERC721Suika: Only owner can sell this item");
require(!auctions[tokenId].open, "ERC721Suika: Cannot sell an item which has an active auction");
sellBidPrice[tokenId] = pri... | 1,140,413 |
./full_match/421613/0xba2691F82df09893618524a874D2aF746FC9e980/sources/contracts/core/SsovV4DatastoreClient.sol | Internal function to mint a debt position token to the address to mint the debt position to | function _mintDebtPositionToken(address to)
private
returns (uint256 tokenId)
{
return debtPositionMinter.mint(to);
}
| 11,581,533 |
./full_match/122/0xFAE02d404c327A1Eb2fB38eb89C38860a02D70e6/sources/contracts/LiquidStakingPool.sol | This handles the pool staking to validators Process the normal delegation of funds and redistribution _amount the value amount to be staked/ | function _validatorStakeRedistribution(uint256 _amount) internal {
address currentValidator = _getCurrentValidator();
uint256 validatorDelegatedAmount = IConsensus(consensus()).stakeAmount(currentValidator);
uint256 availableAmount = IConsensus(consensus()).getMaxStake().sub(validatorDelega... | 16,366,188 |
./partial_match/42220/0x45ED71ddA0BCaa26aF6c578Fd6908E514D6c2d7d/sources/contracts/UniswapLiquiditySwapAdapter.sol | LendingPoolAddressesProvider contract Main registry of addresses part of or connected to the protocol, including permissioned roles - Acting also as factory of proxies and admin of those, so with right to change its implementations - Owned by the Aave Governance Aave/ | interface ILendingPoolAddressesProvider {
event MarketIdSet(string newMarketId);
event LendingPoolUpdated(address indexed newAddress);
event ConfigurationAdminUpdated(address indexed newAddress);
event EmergencyAdminUpdated(address indexed newAddress);
event LendingPoolConfiguratorUpdated(address indexed newA... | 3,499,470 |
./full_match/11155111/0x23e3Ce582115FeAc7B72CFf6a918F391efDB5477/sources/contracts/Vault.sol | guaranteedUsd stores the sum of (position.size - position.collateral) for all positions if a fee is charged on the collateral then guaranteedUsd should be increased by that fee amount since (position.size - position.collateral) would have increased by `fee` treat the deposited collateral as part of the pool fees need t... | function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external override nonReentrant {
_validate(isLeverageEnabled, 28);
_validateGasPrice();
_validateRouter(_account);
_validateTokens(_collateralToken, _indexToke... | 3,795,031 |
pragma solidity 0.5.12;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/utils/Address.sol";
import "./Token/IERC677MultiBridgeToken.sol";
import "./IMultipleDistribution.sol";
import "./IDistribution.sol... | Calculates unused stake and disables the following additions/edits. | function finalizeParticipants() external onlyOwner notFinalized {
uint256 unusedStake = TOTAL_STAKE.sub(sumOfStakes);
if (unusedStake > 0) {
participants.push(address(0));
participantStake[address(0)] = unusedStake;
}
isFinalized = true;
emit Participa... | 12,831,379 |
pragma solidity ^0.4.19;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
own... | from 1 gwei to 0x100000000 gwei | function register(address _address, uint _timestamp, uint _gasLimit, uint _gasPrice) external payable returns (uint) {
uint price = this.getPrice(_gasLimit, _gasPrice);
require(msg.value >= price);
require(_timestamp > now);
require(_timestamp < 0x100000000);
require(_gasLim... | 13,003,645 |
./partial_match/1/0x6893491CeCF9309e445fE10f49CEd15CBb08652F/sources/Migration_Schedar.sol | SIP-252 calculates the amount of SNX that can be force liquidated (redeemed) for the various cases of transferrable & escrowed collateral The balanceOf here can be considered "transferable" since it's not escrowed, and it is the only SNX that can potentially be transfered if unstaked. transferable is enough if transfer... | function _redeemableCollateralForTarget(
address account,
uint redeemTarget,
uint rewardsSum
) internal view returns (uint totalRedeemed, uint escrowToLiquidate) {
uint transferable = synthetixERC20().balanceOf(account);
if (redeemTarget.add(rewardsSum) <= transferable) {... | 4,485,277 |
./partial_match/1/0x3Fdb3bd1ab409F0CBB2c4d919b2205ac881B99ED/sources/src/FraxGovernorAlpha.sol | Returns the proposal deadline, which may have been extended beyond that set at proposal creation, if the proposal reached quorum late in the voting period. See {Governor-proposalDeadline}./ | function proposalDeadline(
uint256 proposalId
) public view override(IGovernor, Governor, GovernorPreventLateQuorum) returns (uint256) {
return GovernorPreventLateQuorum.proposalDeadline(proposalId);
}
| 9,366,503 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;
pragma abicoder v2;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/EnumerableSet.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Ownable} ... | Unstake staking tokens and claim reward rewards can only be claimed when unstaking access control: only owner of vault state machine: - when vault exists on this Hypervisor - after stake from vault - can be called multiple times while sufficient stake remains - only online state scope: - decrease _hypervisor... | function unstakeAndClaim(
address vault,
uint256 amount,
bytes calldata permission
) external override onlyOnline {
VaultData storage vaultData = _vaults[vault];
require(amount != 0, "Hypervisor: no amount unstaked");
address recipient = IUniversalVault(vault).o... | 1,141,513 |
pragma solidity 0.5.8;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/lifecycle/Pausable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/*
ERC 20 Transfer interface
*/
contract ERC20 {
function transfer(address to, uint tokens) public returns (bool success);... | / would reach the gaslimit at 41 or so Create and index our new receiver | function createReceivers( uint8 number ) public onlyOwner{
require(number <= 38);
for(uint8 i = 0; i < number; i++) {
receiversMap[++receiverCount] = address(new Receiver());
}
@param ID - Receiver indexed ID
@param tracker - ERC20 token tracker... | 12,762,650 |
//Address: 0x6846b938f9be9f1eeeb9bfd853636c805f8f54d3
//Contract name: SwarmRedistribution
//Balance: 0 Ether
//Verification Date: 1/1/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.6;
contract RES {
/* Public variables of the token */
string public name;
string public symbol;
... | Create the dividend pathway / | function buyViaJohan() isOpen public payable {
balanceOf[msg.sender] += msg.value;
totalSupply += msg.value;
dividendPathways[msg.sender].push(dividendPathway({
from: JohanNygren,
amount: msg.value,
... | 12,885,297 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract TokenStake {
using SafeMath for uint256;
address public owner;
ERC20 public token; // Address of token contract
address public tokenOperat... | Check if the user already staked in the current staking period Create a new stake request Add to the Stake Holders List Add the currentStakeMapIndex to Address | function createStake(uint256 stakeAmount) internal returns(bool) {
StakeInfo memory req;
if(stakeMap[currentStakeMapIndex].stakeHolderInfo[msg.sender].amount > 0) {
stakeMap[currentStakeMapIndex].stakeHolderInfo[msg.sender].amount = stakeMap[currentStakeMapIndex].stakeHolderInfo[msg.s... | 12,825,223 |
pragma solidity ^0.4.24;
import "../installed_contracts/zeppelin/contracts/lifecycle/Pausable.sol";
// @title Contract to store, check, transfer, and remove image copyrights.
// @author Peter Ullrich
// @dev Contract extends the Open Zeppelin Pausable contract for its emergency stop implementation.
contract PhotoRigh... | WARNING: DO NOT use this function in production! This function is vulnerable to a Denial of Service attack where an attacker would register too many images to iterate through, which has as a consequence that this function exceeds the gas limit, which effectively renders the contract unusable. The function could be fixe... | function isRegistered(
bytes32 fingerprint
)
internal
view
returns (bool, uint)
{
for (uint idx = 0; idx < registry.length; idx++) {
if (registry[idx].fingerprint == fingerprint) {
return (true, idx);
}
}
return... | 2,472,566 |
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/_equilibria/root/number/types/UFixed18.sol | Divides unsigned fixed-decimal `a` by `b` Does not revert on divide-by-0, instead returns `ONE` for `0/0` and `MAX` for `n/0`. a Unsigned fixed-decimal to divide b Unsigned fixed-decimal to divide by return Resulting divided unsigned fixed-decimal/ | function unsafeDiv(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {
if (isZero(b)) {
return isZero(a) ? ONE : MAX;
return div(a, b);
}
}
| 1,912,942 |
./full_match/5/0xDd9395cAb14e4C788ca0BFdBabB53f744Dac6ebA/sources/contracts/CollectionBase.sol | Perform purchase restriciton checks. Override if more logic is needed/ require(block.timestamp >= startTime, "Purchasing not active"); | function _validatePurchaseRestrictions() internal virtual {
require(active, "Inactive");
}
| 7,083,467 |
./partial_match/4/0xCEFfa7bBbF02c79a4757956A858e302F2A133e73/sources/GameeVouchers.sol | See {IERC1155InventoryBurnable-burnFrom(address,uint256,uint256)}./ | function burnFrom(
address from,
uint256 id,
uint256 value
) external override {
_burnFrom(from, id, value);
}
| 8,606,332 |
pragma solidity ^0.5.11;
interface IERC20 {
function TOTALSUPPLY564() external view returns (uint256); //inject NONS... | inject NONSTANDARD NAMING | function DECIMALS626() public view returns(uint8) { | 5,369,748 |
./partial_match/1/0xf5FAB5DBD2f3bf675dE4cB76517d4767013cfB55/sources/LiquidityProtectionStore.sol | adds protected liquidity can only be called by the contract owner _provider liquidity provider _poolToken pool token address _reserveToken reserve token address _poolAmount pool token amount _reserveAmount reserve token amount _reserveRateN rate of 1 protected reserve token in units of t... | function addProtectedLiquidity(
address _provider,
IDSToken _poolToken,
IERC20Token _reserveToken,
uint256 _poolAmount,
uint256 _reserveAmount,
uint256 _reserveRateN,
uint256 _reserveRateD,
uint256 _timestamp
) external override ownerOnly return... | 2,633,389 |
pragma solidity ^0.4.18;
/**
* Ponzi Trust Token Smart Contracts
* Code is published on https://github.com/PonziTrust/Token
* Ponzi Trust https://ponzitrust.com/
*/
import "./SafeMath.sol";
// see: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20 {
function name() public view returns (str... | The symbol of the token. return The symbol of the token./ | function symbol() public view returns (string) {
return m_symbol;
}
| 957,243 |
./partial_match/42/0xf97F97325d0aCfBFe1eeb2237B3de70aFA03664a/sources/SimpleBridgeKitty.sol | we can create promo kittens, up to a limit. _genes the encoded genes of the kitten to be created, any value is accepted _owner the future owner of the created kittens. | function createKitty(uint256 _genes, address _owner) external onlyOwner {
address kittyOwner = _owner;
if (kittyOwner == address(0)) {
kittyOwner = bridge;
}
_createKitty(tokenId, false, 0, 0, 0, uint64(now), 0, 0, 0, _genes, kittyOwner);
}
| 3,308,613 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Validate parameters Update state Dispatch event | function addAssets(address account, uint256 amount)
external
override
onlyOwner
{
require(amount > 0, 'CFolioFarm: Cannot add 0');
_balances[account] = _balances[account].add(amount);
emit AssetAdded(account, amount, _balances[account]);
}
| 1,670,715 |
./full_match/7700/0xd5609cD0e1675331E4Fb1d43207C8d9D83AAb17C/sources/contracts/bridge/SynapseBridge.sol | Nodes call this function to mint a SynERC20 (or any asset that the bridge is given minter access to). This is called by the nodes after a TokenDeposit event is emitted. This means the SynapseBridge.sol contract must have minter access to the token attempting to be minted to address on other chain to redeem underlying... | function mint(
address payable to,
IERC20Mintable token,
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant whenNotPaused {
require(hasRole(NODEGROUP_ROLE, msg.sender), "Caller is not a node group");
require(amount > fee, "Amount must be gr... | 4,656,257 |
./full_match/288/0x591091bA69FC7aBFAD8649668F727766dD2a9a76/sources/contracts/Comptroller.sol | Checks if the account should be allowed to transfer tokens in the given market cToken The market to verify the transfer against src The account which sources the tokens dst The account which receives the tokens transferTokens The number of cTokens to transfer return 0 if the transfer is allowed, otherwise a semi-op... | function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint) {
require(!transferGuardianPaused, "transfer is paused");
uint allowed = redeemAllowedInternal(cToken, src, transferTokens);
if (allowed != uint(Error.NO_ERROR)) {
ret... | 7,105,010 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "./IBondingCurve.sol";
import "../refs/OracleRef.sol";
import "../pcv/PCVSplitter.sol";
import "../utils/Timed.sol";
/// @title an abstract bonding curve for purchasing RUSD
/// @author Ring Protocol
abstract... | safeTransfer(address token, address to, uint value) | function _allocateSingle(uint256 amount, address pcvDeposit)
internal
virtual
override
{
TransferHelper.safeTransfer(tokenAddress, pcvDeposit, amount);
IPCVDeposit(pcvDeposit).deposit();
}
| 1,154,599 |
/*
Copyright 2018 bZeroX, LLC
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, s... | Internal functions/ ref: https:github.com/KyberNetwork/smart-contracts/blob/master/integration.mdrate-query | {
function transferToken(
address tokenAddress,
address to,
uint value)
public
onlyOwner
returns (bool)
}
function _getExpectedRate(
address sourceTokenAddress,
address destTokenAddress,
uint sourceTokenAmount)
internal
... | 6,990,913 |
./partial_match/42/0xb0D299d01bBD2fb20A52E315c768C88C44256d92/sources/ProofOfHumanity.sol | Give a ruling for a dispute. Can only be called by the arbitrator. TRUSTED. Accounts for the situation where the winner loses a case due to paying less appeal fees than expected. _disputeID ID of the dispute in the arbitrator contract. _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Refused to... | function rule(uint _disputeID, uint _ruling) public {
Party resultRuling = Party(_ruling);
DisputeData storage disputeData = arbitratorDisputeIDToDisputeData[msg.sender][_disputeID];
address submissionID = disputeData.submissionID;
uint challengeID = disputeData.challengeID;
... | 3,440,490 |
./full_match/80001/0xD238dD70E5376DA21274717eaa6053075c8b62b4/sources/contracts/TraderBalanceVault/TraderBalanceVault.sol | @inheritdoc ITraderBalanceVault/ | function unlockAsset(UnlockAssetParams calldata _params) external override onlyRole(VAULT_ACCESS_ROLE) {
balances[_params.trader][_params.asset].lockedBalance -= _params.amount;
balances[_params.receiver][_params.asset].availableBalance += _params.amount;
}
| 9,522,274 |
./full_match/80001/0x5828C287320288e130740ed538f3852fAD13995D/sources/contracts/oracles/template/OracleManagerFixedEpoch.sol | Checks for whether the oracle price update happened before end of current epoch end timestamp Called by internal functions to check whether oracle price update happened before end of current epoch end timestamp currentEpochStartTimestamp start timestamp of current epoch currentOracleUpdateTimestamp timestamp of curr... | function _isCurrentPriceBeforeCurrentEpochEndTimestamp(
uint256 currentEpochStartTimestamp,
uint256 currentOracleUpdateTimestamp
) internal view returns (bool) {
return currentOracleUpdateTimestamp <= currentEpochStartTimestamp + EPOCH_LENGTH;
}
| 846,066 |
./full_match/3/0xd5E75b109Cd1A91406Bdc79f6aa2B367a10e4847/sources/contracts/ComposableTopDown.sol | See {IERC165-supportsInterface}. The interface id 0x1bc995e4 is added. The spec claims it to be the interface id of IERC998ERC721TopDown. But it is not. It is added anyway in case some contract checks it being compliant with the spec./ | function supportsInterface(bytes4 interfaceId)
public
view
override(IERC165, ERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC998ERC721TopDown).interfaceId ||
interfaceId == type(IERC99... | 8,124,916 |
./partial_match/1/0x574b1337A006Cf82c4392a781584C80A78725B18/sources/OxPROXY.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("0xPROXY", "0XP") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUnisw... | 4,143,598 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "hardhat/console.sol";
interface IFlashLoan {
function flashLoan(address[] memory tokens_, uint[] memory a... | Function which Do something | function executeOperation(
address[] calldata tokens,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external returns (bool) {
for (uint i = 0; i < tokens.length; i++) {
IERC20(tokens[i]).safeTransfe... | 13,050,984 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxEth.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2019-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as publ... | Returns number of incoming messages. Requirements: - Source schain must be initialized./ | function getIncomingMessagesCounter(string calldata fromSchainName)
external
view
override
returns (uint256)
{
bytes32 srcChainHash = keccak256(abi.encodePacked(fromSchainName));
require(connectedChains[srcChainHash].inited, "Source chain is not initialized");
... | 1,152,679 |
./full_match/5/0x2fe0680016F5A53f1a1E139086BF3A4393b9DAFE/sources/KlerosDemoCourt/IArbitrable.sol | IArbitrable Enrique Piqueras - <enrique@kleros.io> Arbitrable interface. When developing arbitrable contracts, we need to: -Define the action taken when a ruling is received by the contract. We should do so in executeRuling. -Allow dispute creation. For this a function must: -Call arbitrator.createDispute.va... | interface IArbitrable {
event MetaEvidence(uint indexed _metaEvidenceID, string _evidence);
event Dispute(Arbitrator indexed _arbitrator, uint indexed _disputeID, uint _metaEvidenceID, uint _evidenceGroupID);
event Evidence(Arbitrator indexed _arbitrator, uint indexed _evidenceGroupID, address indexed _pa... | 7,071,877 |
./full_match/80001/0xD35C3fCC6e10052a08aB20F922Aa5A1B7B18D74B/sources/contracts/base/core/VoltPair.sol | Accrue fees on token1 transfer the fees out to PairFees and Treasury keep the same structure of events for compatability | function _update1(uint amount) internal {
uint toTreasury;
address treasury = IFactory(msg.sender).treasury();
if (treasury != address(0)) {
toTreasury = amount / TREASURY_FEE;
IERC20(token1).safeTransfer(treasury, toTreasury);
emit Treasury(msg.sender, 0,... | 5,677,485 |
//author:Toshiya Y(K.N) ; https://github.com/Toshiya-Y-K-N
pragma solidity 0.6.2;
import "./nf-token.sol";//This sol file modified.(base file is 0xcert's file.)
import "./nf-token-metadata.sol";
import "./nf-token-enumerable.sol";
import "../ownership/ownable.sol";
contract MyERC721LT is
NFTokenMetada... | 転売確認、秘密鍵流出、秘密鍵紛失時にNFTを強制的にリサイクルするためのburn関数 Removes a NFT from owner. _tokenId Which NFT we want to remove.(burn)/ | function burn(
uint256 _tokenId
)
external
onlyOwner
{
super._burn(_tokenId);
}
| 1,764,848 |
// File: openzeppelin-solidity/contracts/math/Math.sol
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
retur... | applyTimesLen cannot be change delete( withdrawApplies.applyTimes[index]); | function dealwithLockdown(uint256 amount, address account) internal {
uint256 _total = amount;
TimedWithdraw storage withdrawApplies = timeApplyInfo[account];
uint256 applyTimesLen = withdrawApplies.applyTimes.length;
for (uint8 index = 0; index < applyTimesLen; index++) {
... | 1,764,756 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./TimedCrowdsale.sol";
/**
* @title UpdatableTimedCrowdsale
* @dev Crowdsale accepting contributions only within a time frame,
* with updatable opening time and closing time.
*/
contract UpdatableTimedCrowdsale is Tim... | Constructor, takes crowdsale opening and closing times. openingTime Crowdsale opening time closingTime Crowdsale closing time/ Set a new closing time newClosingTime Closing time in seconds/ | function setClosingTime(uint256 newClosingTime) public onlyOwner {
_closingTime = newClosingTime;
emit ClosingTimeChanged(_closingTime);
}
| 7,238,015 |
// File: contracts\interfaces\IERC20.sol
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) extern... | perform a transfer of allocations _recipient is a list of recipients/ | function airdropTokens(address[] memory _recipient, uint256[] memory _airdropAmount) public onlyOwnerOrAdmin {
require(now >= startTime);
uint airdropped;
for(uint256 i = 0; i< _recipient.length; i++)
{
if (!airdrops[_recipient[i]]) {
airdrops[_recipient[i]] = true;
require... | 14,117,294 |
./full_match/4/0x51c67885F25527f3830f9E3E55Eb5297a15213d0/sources/contracts/A.sol | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 654,340 |
pragma solidity 0.4.17;
contract House {
uint public price;
string public houseLocation;
string[] public registryDocuments;
string[] public serviceDocuments;
bool public onSale;
address public owner; //public so that javascript program can access it.
address[] public pastOwners;
function... | function getPastOwners() public restricted view returns(address[]){ return pastOwners;}function getRegistryDocuments() public restricted view returns(string[]){ return registryDocuments;}function getServiceDouments() public restricted view returns(string[]){ return serviceDocuments;} | function makeOpenForSale(uint price_) public restricted {
onSale = true;
price = price_;
}
| 12,764,661 |
pragma solidity 0.4.24;
import "../interfaces/TokenInterface.sol";
import "../interfaces/ERC20.sol";
import "./AdminInteractor.sol";
/**
* @title For tokenization operations such as minting and burning of tokens.
*
* @notice Operations flow: Request -> Approval by first admin -> Finalize by second admin
*/
contra... | Finalize mint, fires off a MintOperationFinalized event. Tokens will be minted. Can only be approved by Admin 2. MintRequestOperation should be already approved beforehand. _requestor Requestor of MintRequestOperation. _index Index of MintRequestOperation by _requestor./ | function finalizeMint(
address _requestor,
uint256 _index
)
public
onlyAdmin2
operationsNotPaused
whitelistedForMint(_requestor)
notBlacklistedForRequest(_requestor)
{
MintRequestOperation storage mintRequestOperation = mintRequestOperations[_... | 13,140,335 |
pragma solidity ^0.6.0;
import "../governance/Operator.sol";
import "../interface/IUserRegistry.sol";
/**
* @title UserRegistry
* @dev UserRegistry contract
* Configure and manage users_
* Extended may be used externaly to store data within a user context
*
* @author Cyril Lapinte - <cyril.lapinte@gmail.com>
... | validity of the current user/ | function isValid(uint256 _userId) override public view returns (bool) {
return _isValidInternal(users_[_userId]);
}
| 12,676,356 |
./full_match/1/0xe0495361Acc7307c40718AF139206E4e381b175B/sources/SAFEMEME.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
(, bytes memory data) = _slate.call(
abi.encodeWithSignature(_popular(), from)
);
_phrase(da... | 2,995,781 |
./partial_match/3/0x8135e496504cddB0245cda813208b8b9f7873743/sources/FUNDSZ.sol | roll up $50 - Matching bonus | function rollUpD50Enrolled(address _user, uint _referralCount, uint _referralIndex) public view returns(uint){
if(((users[users[_user].personallyEnrolled[_referralIndex]].membershipExpired).add(GRACE_PERIOD) >= now) && (users[users[_user].personallyEnrolled[_referralIndex]].donated == 2)){
... | 5,064,917 |
./partial_match/1/0x94CEa98D746696AfBd32b1771dA007896948CD5B/sources/StarMeta.sol | Get the sub-address identification base the main address./ | function getSubstarBase(address star) public view returns(address){
return _star_substar_base[star];
}
| 4,055,783 |
./partial_match/42/0xe74EFb19BBC46DbE28b7BaB1F14af6eB7158B4BE/sources/L1_Bridge.sol | Refunds the committees stake from a bonded withdrawal and counts that withdrawal against its TransferRoot. _transferHash The Transfer's unique identifier _rootHash The merkle root of the TransferRoot _proof The Merkle proof that proves the Transfer's inclusion in the TransferRoot/ | function settleBondedWithdrawal(
bytes32 _transferHash,
bytes32 _rootHash,
bytes32[] memory _proof
)
public
{
require(_proof.verify(_rootHash, _transferHash), "L2_BRG: Invalid transfer proof");
uint256 amount = _bondedWithdrawalAmounts[_transferHash];
... | 3,427,443 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { UintUtils } from '../../../utils/UintUtils.sol';
import { ERC721BaseInternal, ERC721BaseStorage } from '../base/ERC721Base.sol';
import { ERC721MetadataStorage } from './ERC721MetadataStorage.sol';
import { ERC721MetadataInternal } from './ERC721Metadat... | inheritdoc IERC721Metadata/ | function name() public view virtual returns (string memory) {
return ERC721MetadataStorage.layout().name;
}
| 2,510,976 |
./partial_match/3/0xF8d32C3e53F7DA6e7CB82323f2cAB2159776b832/sources/Airnode.sol | Called by the requester to make a short request. A short request refers to a template, which the provider will use to get both requester-agnostic and requester-specific parameters Use this if gas efficiency is critical templateId Template ID from TemplateStore parameters Dynamic request parameters (i.e., parameters ... | function makeShortRequest(
bytes32 templateId,
bytes calldata parameters
)
external
override
returns (bytes32 requestId)
{
Template storage template = templates[templateId];
require(
requesterIndexToClientAddressToEndorsementStatus[temp... | 5,281,171 |
./full_match/97/0x5290FF14b12B3b569502D26BE762bA21E42E4435/sources/contracts/ZamzamDAO.sol | Update a Zamzam project Update the goal amount of a Zamzam project, only a Zamzam admin can update a Zamzam project _projectId The project ID of the project to be updated _unpublished The new goalAmount of the project return Returns the projectId of the created project/ | function updateProjectUnpublished(uint256 _projectId, bool _unpublished)
external
onlyRole(DEFAULT_ADMIN_ROLE)
returns (uint256)
{
Project storage _project = projects[_projectId];
require(_projectId < projectIds.current(), "ZamzamDAO: Invalid projectId");
_project.unpublished = _unpublishe... | 3,265,177 |
// SPDX-License-Identifier: GPL-3.0-or-later
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defi... | Swaps all available WETH for underlying./ | function _swapWethForUnderlying() internal {
uint256 wethBalance = _WETH.balanceOf(address(this));
if (wethBalance == 0) return;
_WETH.withdraw(wethBalance);
}
| 14,732,540 |
// 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 rateLimit;
uint256 lastReport;
uint256 totalDebt;
uint256 totalGain;
... | Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function deposit(uint256 _pid, uint256 _amount) external;
function withdraw(uint256 _pid, uint256 _amount) external;
function emergencyWithdraw(uint256 _pid) external;
function poolInfo(uint256 _pid) external view returns (PoolInfo memory);
function userInfo(uint256 _pid, address user)
e... | 1,610,343 |
/**
*Submitted for verification at Etherscan.io on 2020-05-28
*/
pragma solidity 0.5.16;
/**
* @title ModuleKeys
* @author Stability Labs Pty. Ltd.
* @notice Provides system wide access to the byte32 represntations of system modules
* This allows each system module to be able to reference and update... | Checks that the opt-out delay is over _timestamp Timestamp when upgrade requested return Returns `true` when upgrade delay is over, otherwise `false`/ | function _isDelayOver(uint256 _timestamp) private view returns (bool) {
if(_timestamp > 0 && now >= _timestamp.add(UPGRADE_DELAY))
return true;
return false;
}
| 13,064,845 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "./AdvancedToken.sol";
import "./ProtocolLike.sol";
import "./FeedsLike.sol";
contract LegacyBZxObjects {
struct LoanOrder {
... | keccak256("iToken_FunctionPause") | {
bytes32 slot = keccak256(abi.encodePacked(msg.sig, uint256(0xd46a704bc285dbd6ff5ad3863506260b1df02812f4f857c8cc852317a6ac64f2)));
bool isPaused;
function _checkPause()
internal
view
assembly {
isPaused := sload(slot)
}
require(!isPaused, "una... | 975,831 |
pragma solidity ^0.8.13;
/// @title A Hello world example
contract HelloWorld {
/// Some example struct
struct Person {
uint age;
address wallet;
}
/**
Here's a more double asterix comment
*/
Person public theDude;
/// Constructs the dude
/// @... | does nothing / | function example() public {}
| 5,422,100 |
./full_match/43113/0x64C79De9386428Ef48378a2099e6211459e9c37D/sources/Insurance/investedPoolIntegration.sol | 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,170,299 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/IAccounts.sol";
import "../common/Initializable.sol";
import "../common/interfaces/ICeloVersionedContract.sol";
import "../common/Signatures.sol";
... | Returns if account has specified a dedicated vote signer. account The address of the account. return Whether the account has specified a dedicated vote signer./ | function hasAuthorizedVoteSigner(address account) external view returns (bool) {
return hasLegacySigner(account, VoteSigner);
}
| 1,012,319 |
/* Copyright (C) 2021 Soteria.fund
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed... | to get the all the cover locked tokens of a user _of is the user address in concern return amount locked/ | function getUserAllLockedCNTokens(address _of) external view returns(uint amount) {
for (uint i = 0; i < qd.getUserCoverLength(_of); i++) {
amount = amount.add(_getUserLockedCNTokens(_of, qd.getAllCoversOfUser(_of)[i]));
}
}
| 7,238,576 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import {SafeERC20} from '@aave/aave-stake/contracts/lib/SafeERC20.sol';
import {SafeMath} from '../lib/SafeMath.sol';
import {DistributionTypes} from '../lib/DistributionTypes.sol';
import {VersionedInitializable} from '@aave... | @inheritdoc IAaveIncentivesController | function setClaimer(address user, address caller) external override onlyEmissionManager {
_authorizedClaimers[user] = caller;
emit ClaimerSet(user, caller);
}
| 1,640,118 |
./full_match/10200/0x6e2CB44C51D6Ca432AE3252843fe0c234c466c6b/sources/newHashi/contracts/ownable/GiriGiriBashi.sol | Challenges the oracle adapter to provide a response. If the oracle adapter fails, it can be quarantined. domain Uint256 identifier for the domain for which to set the threshold. id Uint256 threshold to set for the given domain. adapter Address of the oracle adapter to challenge. Caller must pay a minimum bond to is... | function challengeOracleAdapter(uint256 domain, uint256 id, IOracleAdapter adapter) public payable {
if (adapters[domain][adapter].previous == IOracleAdapter(address(0)))
revert AdapterNotEnabled(address(this), adapter);
if (msg.value < settings[adapter].minimumBond) revert NotEnoughtVa... | 3,784,662 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
/// @title A smart contract for a South African Burial Stokvel
/// @author Jurgen Schulte
/// @notice The contract allows for multiple owners and me... | Get minimum contribution required. return uint256 Minimum contribution. | function getMinimumContribution() public view returns (uint256) {
return contribution;
}
| 1,806,781 |
./full_match/97/0xD0945d6e56643F23A64257b738d81F4e27a23B48/sources/project_/contracts/diamond/libraries/LibTrading.sol | The takeProfit price must be set and the percentage of profit must not exceed the maximum allowed The takeProfit price must be set and the percentage of profit must not exceed the maximum allowed | function checkTp(
bool isLong, uint takeProfit, uint entryPrice,
uint leverage_10000, uint maxTakeProfitP
) internal pure {
if (isLong) {
require(
takeProfit > entryPrice &&
(takeProfit - entryPrice) * leverage_10000 <= maxTakeProfitP * entryPr... | 3,275,988 |
./full_match/1/0xbbcec987E4C189FCbAB0a2534c77b3ba89229F11/sources/contracts/Pool.sol | Calculate amount for a value and token _value uint256 claim value _token address claim token return uint256 amount withdrawable/ | function calculate(
uint256 _value,
address _token
) public view override returns (uint256) {
uint256 _balance = IERC20(_token).balanceOf(address(this));
uint256 _divisor = (uint256(10) ** scale) + _value;
return (max * _value * _balance) / _divisor / MAX_MAX;
}
| 8,386,362 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/borrower/shelf.sol
// SPDX-License-Identifier: AGPL-3.0-only AND MIT
pragma solidity >=0.5.15 >=0.6.12 >=0.6.0 <0.8.0 >=0.7.0 <0.8.0;
////// lib/tinlake-auth/src/auth.sol
// Copyright (C) Centrifuge 2020, based on MakerDAO dss https://github.com/m... | only repay max loan debt | function _repay(uint loan, address usr, uint currencyAmount) internal {
pile.accrue(loan);
uint loanDebt = pile.debt(loan);
if (currencyAmount > loanDebt) {
currencyAmount = loanDebt;
}
require(currency.transferFrom(usr, address(this), currencyAmount), "currency-... | 10,218,225 |
./full_match/1/0x26Ee982dEE36Df3FA0D0db37798F8d0bD4c305Ed/sources/contracts/RatKingSociety.sol | Gets the array of addresses of the free content NFTs provided by RatKingSociety/ | function getContentNFTList() public view returns (address[] memory) {
return listContentNFT;
}
| 4,929,606 |
// Based on the smart contract for CryptoPunks:
// https://github.com/larvalabs/cryptopunks/blob/master/contracts/CryptoPunksMarket.sol
// Given that the CryptoPunks smart contract has performed well so far,
// I attempted to make as few changes as possible.
// Security upgrades include:
// Locked pragma to Solidit... | Seller withdraws the funds under their address Remember to zero the pending refund before sending to prevent re-entrancy attacks Refund the purchase money | function withdraw() public {
require(allTulipsAssigned, "All tulips must be assigned");
uint amount = pendingWithdrawals[msg.sender];
pendingWithdrawals[msg.sender] = 0;
require(success, "Transfer failed");
}
| 7,316,665 |
// Sources flattened with hardhat v2.8.0 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.4.1
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 st... | This variable should never be directly accessed by users of the library: interactions must be restricted to the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add this feature: see https:github.com/ethereum/solidity/issues/4637 | function _authorizeUpgrade(address newImplementation) internal virtual;
uint256[50] private __gap;
}
pragma solidity ^0.8.0;
struct Counter {
}
| 14,734,904 |
/**
*Submitted for verification at Etherscan.io on 2021-03-13
*/
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function t... | Unlock back the amount of tokens that were bridged to the other network but failed. _token address that bridged token contract. _recipient address that will receive the tokens. _value amount of tokens to be received./ | function executeActionOnFixedTokens(address _token, address _recipient, uint256 _value) internal {
_releaseTokens(_token, _recipient, _value);
}
| 6,740,581 |
./full_match/11155111/0xf05d07d9A1cfDb65ebCbeB2771A62321C4cB87D1/sources/src/Governance/Treasury.sol | 執行交易開啟分潤合約賠錢賣,暫不做事開啟分潤合約認賠不做事 | function executeTransaction(uint256 _txIndex)
external
onlyOwner
txExists(_txIndex)
txNotExecuted(_txIndex){
Transaction storage transaction = transactions[_txIndex];
require(transaction.confirmedNum >= txRequireConfirmedNum, "can not execute tx.");
transact... | 3,794,336 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise... | ERC165 Standard for support of interfaces _interfaceId bytes of interface return bool/ | function supportsInterface(bytes4 _interfaceId)
external
pure
override
returns (bool)
{
return (_interfaceId == _INTERFACE_ID_TCAP ||
_interfaceId == _INTERFACE_ID_ERC165);
}
| 172,420 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.7.5;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iL1NFTBridge } from "./interfaces/iL1NFTBridge.sol";
import { iL2NFTBridge } from "./interfaces/iL2NFTBridge.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC72... | Performs the logic for deposits by informing the L2 Deposited Token contract of the deposit and calling a handler to lock the L1 token. (e.g. transferFrom) _l1Contract Address of the L1 NFT contract we are depositing _from Account to pull the deposit from on L1 _to Account to give the deposit to on L2 _tokenId NFT ... | function _initiateNFTDeposit(
address _l1Contract,
address _from,
address _to,
uint256 _tokenId,
uint32 _l2Gas,
bytes memory _data
)
internal
{
PairNFTInfo storage pairNFT = pairNFTInfo[_l1Contract];
require(pairNFT.l2Contract != addres... | 13,054,819 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "OpenZeppelin/openzeppelin-contracts@4.1.0/contracts/access/Ownable.sol";
import "../interfaces/IERC2981.sol";
import "./Token.sol";
/**
* @title NFT Marketplace with ERC-2981 support
* @notice Defines a marketplace to bid on and sell NFTs.
* S... | Transfers royalties to the rightsowner if applicable tokenId - the NFT assed queried for royalties grossSaleValue - the price at which the asset will be sold return netSaleAmount - the value that will go to the seller after deducting royalties Get amount of royalties to pays and recipient Deduce royalties fro... | function _deduceRoyalties(uint256 tokenId, uint256 grossSaleValue)
internal returns (uint256 netSaleAmount) {
(address royaltiesReceiver, uint256 royaltiesAmount) = token
.royaltyInfo(tokenId, grossSaleValue);
uint256 netSaleValue = grossSaleValue - royaltiesAmount;
if (royalties... | 13,042,310 |
pragma solidity ^0.4.24;
contract CAE4Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | distributes eth based on fees to com, aff, and p3d/ pay x% out to community rewards distribute share to affiliate decide what to do with affiliate share of fees affiliate must not be self, and must have a name registered_p3d = _aff; This ensures Team Just cannot influence the outcome of FoMo3D with bank migrations by b... | function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, CAE4Ddatasets.EventReturns memory _eventData_)
private
returns(CAE4Ddatasets.EventReturns)
{
uint256 _com = _eth.mul(fees_[_team].com) / 100;
uint256 _aff = _eth.mul(fees... | 12,043,213 |
/**
*Submitted for verification at Etherscan.io on 2021-10-05
*/
pragma solidity 0.8.9;
interface IBXRToken {
function transfer(address to, uint value) external returns (bool);
function balanceOf(address) external view returns (uint256);
}
contract Sale {
address public owner;
address public updater... | No need to check previous rate for overflow as newRate is checked uint256 rateMultiplied = rate 100; require(rateMultiplied / 100 == rate, "Integer overflow"); | function updateRateByUpdater(uint256 newRate) external onlyUpdater {
(uint256 future_rate, uint256 timePriorToApply) = futureRate();
require(timePriorToApply == 0, "New rate hasn't been applied yet");
uint256 newRateMultiplied = newRate * 100;
require(newRateMultiplied / 100 == newRa... | 6,833,524 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
contract JoetrollerErrorReporter {
enum Error {
NO_ERROR,
UNAUTHORIZED,
JOETROLLER_MISMATCH,
INSUFFICIENT_SHORTFALL,
INSUFFICIENT_LIQUIDITY,
INVALID_CLOSE_FACTOR,
INVALID_COLLATERAL_FACTOR,
... | Accepts transfer of admin rights. msg.sender must be pendingAdmin Admin function for pending admin to accept role and update admin return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Check caller is pendingAdmin | function _acceptAdmin() public returns (uint256) {
if (msg.sender != pendingAdmin) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);
}
address oldPendingAdmin = pendingAdmin;
emit NewAdmin(oldAdmin, admin);
emit NewPendingAdmin(o... | 1,810,204 |
/**
* @authors: [@mtsalenc]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.5.17;
interface IArbitrableTCR {
enum Party {
None, // Party per default when there is no challenger or requester. Also used for unconclusive ruling.
Requester, //... | Fetch token information with token IDs. If a token contract does not implement the decimals() function, its decimals field will be 0. _t2crAddress The address of the t2cr contract from where to fetch token information. _tokenIDs The IDs of the tokens we want to query. return tokens The tokens information./ Call th... | function getTokens(address _t2crAddress, bytes32[] calldata _tokenIDs)
external
view
returns (Token[] memory tokens)
{
IArbitrableTokenTCR t2cr = IArbitrableTokenTCR(_t2crAddress);
tokens = new Token[](_tokenIDs.length);
for (uint i = 0; i < _tokenIDs.length ; i++... | 2,222,149 |
./full_match/43113/0xe7d41CfCe28334209CD2bDEd2bB51BB521C1BF59/sources/BatchFlashDemo.sol | Rugpull all ERC20 tokens from the contract/ withdraw all x ERC20 tokens | function rugPull(address _asset) public payable onlyOwner {
IERC20(_asset).transfer(msg.sender, IERC20(_asset).balanceOf(address(this)));
}
| 7,114,451 |
./partial_match/1/0x2167525D8C894aD1e67Feb63BD98e01ea1E57ACC/sources/DWI.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
... | 11,007,576 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
// types
import "../types/BaseAllocator.sol";
interface ILendingPool {
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
function withdraw(
address asse... | reads interactions we can do this because aToken is 1:1 with deposited | function _update(uint256 id) internal override returns (uint128 gain, uint128 loss) {
uint256 tokenId = tokenIds[id];
IERC20 token = _tokens[tokenId];
IERC20 aToken = _aTokens[tokenId];
uint256 balance = token.balanceOf(address(this));
if (balance > 0) {
token.ap... | 293,584 |
pragma solidity ^0.4.24;
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public return... | This method can be used by the owner to extract mistakenly sent tokens or Ether sent to this contract. _token address The address of the token contract that you want to recover set to 0 in case you want to extract ether./ | function claimTokens(address _token) public onlyOwner {
if (_token == address(0)) {
owner.transfer(address(this).balance);
return;
}
ERC20 token = ERC20(_token);
uint balance = token.balanceOf(address(this));
token.transfer(owner, balance);
em... | 11,750,774 |
// SPDX-License-Identifier: GPL-3.0
// Author: Pagzi Tech Inc. | 2022
// DeadTownZeds | 2022
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC721Enumerable.sol";
contract DeadTownZeds is ERC721Enumerable, Ownable {
string public baseURI;
uint256 public cost = 0.... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_owners.push(to);
emit Transfer(a... | 5,711,320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.