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/80001/0x4196DcD4a4DF8F125Ca9a09b62aF432369694f3e/sources/contracts/lens/Quoter.sol | Parses a revert reason that should contain the numeric quote | function parseRevertReason(bytes memory reason) private pure returns (uint256, uint16) {
if (reason.length != 64) {
if (reason.length < 68) revert('Unexpected error');
assembly {
reason := add(reason, 0x04)
}
revert(abi.decode(reason, (string))... | 8,803,144 |
./full_match/5/0x5b49c637bEFC9Eaf226Fdc5c924C3DD4fee236AD/sources/contracts/utils/lib_storage/UserProxyStorage.sol | Get the storage bucket for this contract. Dip into assembly to change the slot pointed to by the local variable `stor`. See https:solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slotaccess-to-external-variables-functions-and-libraries | function getStorage() internal pure returns (Storage storage stor) {
assert(STORAGE_SLOT == bytes32(uint256(keccak256("userproxy.pmm.storage")) - 1));
bytes32 slot = STORAGE_SLOT;
}
| 11,612,953 |
/*
βββ βββββββββββ βββ
βββ ββββββββββββββββ
βββ ββββββ ββββββ
βββ ββββββ ββββββ
ββββββββββββββββββββ βββ
βββββββββββββββββββ βββ
βββββββββ βββββββ βββ βββββββββββββββ βββ
ββ... | eip-2612 permit() pattern: | function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _f... | 1,492,329 |
./partial_match/5/0xf96dc01589969B85e27017F1bC449CB981eED9C8/sources/contracts/L1/rollup/ChainStorageContainer.sol | @inheritdoc IChainStorageContainer/ | function setGlobalMetadata(
bytes27 _globalMetadata
)
public
onlyOwner
{
return buffer.setExtraData(_globalMetadata);
}
| 16,868,725 |
pragma solidity ^0.4.23;
import "../../libs/math/SafeMath.sol";
import "./IERC888.sol";
contract ERC888 is IERC888 {
using SafeMath for uint;
mapping(uint => mapping(address => mapping(address => uint))) internal allowed;
mapping(uint => mapping(address => uint)) internal balances;
mapping(uint => uint) int... | Increase the amount of tokens that an owner allowed to a spender. _tokenId subtoken identifier. _spender The address which will spend the funds. _addedValue The amount of tokens to increase the allowance by./ | function increaseApproval(uint _tokenId, address _spender, uint _addedValue) external returns (bool) {
address _sender = msg.sender;
uint _allowed = allowed[_tokenId][_sender][_spender];
_allowed = _allowed.add(_addedValue);
allowed[_tokenId][_sender][_spender] = _allowed;
emit Approval(_tokenId, ... | 14,033,040 |
./full_match/1/0x7d0C7372f38958d9CF5aE6DA2b0794337045559b/sources/contracts/Controller.sol | Remove strategy from storage array and update the strategies hash strategy strategy address to remove/ | function _removeStrategyStorage(address strategy) private {
uint256 lastEntry = strategies.length - 1;
for (uint256 i = 0; i < lastEntry; i++) {
if (strategies[i] == strategy) {
strategies[i] = strategies[lastEntry];
break;
}
}
... | 9,716,456 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@1001-digital/check-address/contracts/CheckAddress.sol";
/// @author 1001.digital
/// @title An extension that enables checking that an address only holds one token.
abstract contract OnePerWallet... | Track transfers in `_ownedToken` instead of `_balances` from the address from which to transfer the token to the address to which to transfer the token tokenId the tokenId that is being transferred overrides the OpenZeppelin `_transfer` method to accomodate for our own balance tracker We add one to account for 0-in... | function _transfer(address from, address to, uint256 tokenId) internal virtual override onePerWallet(to) {
super._transfer(from, to, tokenId);
_ownedToken[from] = 0;
_ownedToken[to] = tokenId + 1;
}
| 14,109,872 |
./partial_match/1/0x965Dc715EcD99C1CB2D3600D68F59A6FeF8Dd37C/sources/PriceOracle.sol | Updates the price of the token specified. Throws if the sender is not the owner of this contract. tokenAddr The address of the token newTokenPrice The new price of the token, expressed in USD with 6 decimal positions/ | function updateTokenPrice (address tokenAddr, uint256 newTokenPrice) external override onlyOwner {
require(tokenAddr != address(0), "Token address required");
require(newTokenPrice > 0, "Token price required");
_tokenPrice[tokenAddr] = newTokenPrice;
}
}
| 4,219,694 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
im... | Allows claiming a number of tokens to a given address _to The address to send the minted tokens to _amount The amount of tokens to claim _proof The merkle proof of the claim _tokenId The tokenId of wagumi cats Revert if already claimed Revert if claim period has ended Send additional tokens if owner has wagumi cats | function claim(
address _to,
uint256 _amount,
bytes32[] calldata _proof,
uint256 _tokenId
) external whenNotPaused {
if (!isClaimed(_to)) {
revert AlreadyClaimed();
}
if (block.timestamp > claimPeriodEnds) {
revert ClaimEnded();
}
bool valid = verify(_proof, leaf);
... | 6,401,351 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() exte... | / withdraw LP from LiquidityGaugeV2 withdraw creates LP dust Now we have underlying | function _withdraw(uint _amount) private returns (uint) {
require(_amount > 0, "withdraw = 0");
uint total = _totalAssets();
if (_amount >= total) {
_amount = total;
}
uint totalShares = _getTotalShares();
uint shares = _getShares(_amount, total, totalS... | 1,663,800 |
./full_match/5/0x029159ceCBcD830022de23ED4D57945f6dC46880/sources/project_/contracts/NBPresale.sol | Withdraw USDT from the contract to the sender's wallet. Only callable by the owner/ | function withdrawUsdt() public onlyOwner nonReentrant {
uint256 balance = usdt.balanceOf(address(this));
usdt.transfer(msg.sender, balance);
}
| 1,923,756 |
./full_match/56/0xe69dec5312c1cc07950a9a1EC8a194567F15C40D/sources/@pancakeswap/v3-periphery/contracts/interfaces/IswapRouter.sol | Router token swapping functionality Functions for swapping tokens via PancakeSwap V3 | interface ISwapRouter is IPancakeV3SwapCallback {
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPrice... | 3,234,734 |
./partial_match/4/0xD978E2881C07813A010Ed1403F3b1ADAc72545D1/sources/Exchange.sol | Burns In Tokens _amount - In Token units/ | function burnInTokens (
uint256 _amount
)
public
onlyOwner
{
require(_amount != 0, "amount is 0");
inToken.burn(_amount);
emit Burned(msg.sender, _amount);
}
| 8,716,057 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router02.sol";
contract JcamUniswap {
address internal constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
IUniswapV2Router... | refund leftover ETH to user msg.sender.call.value(address(this).balance)(""); | function convertEthToDai(uint daiAmount) public payable {
uniswapRouter.swapETHForExactTokens.value(msg.value)(daiAmount, getPathForETHtoDAI(), address(this), deadline);
}
| 1,084,491 |
./full_match/1/0x207C6F6fD67310Cfaa30A170C0737d7258c4662E/sources/contracts/OBABabes.sol | Mint NFTs to the specified recipient | function airdropTokens(address[] memory recipients, uint256[] memory _quantities) public onlyOwner {
require(recipients.length > 0, "Recipients array must not be empty");
require(recipients.length == _quantities.length, "Data length mismatch");
uint256 total = 0;
for (uint2... | 17,002,112 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint2... | Fee should not exceed 100% and should be a multiple of a basis point. _fee Fee value represented as scaled value/ | function validateFee(
uint256 _fee
)
private
view
{
ScaleValidations.validateLessThanEqualOneHundredPercent(_fee);
ScaleValidations.validateMultipleOfBasisPoint(_fee);
}
| 12,893,199 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./utils/Ownable.sol";
import "./CosmoBugsERC721.sol";
interface IERC20BurnTransfer {
function burn(uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
inter... | Finalize starting index/ | function finalizeStartingIndex() public {
require(startingIndex == 0, "CosmoBugs: starting index is already set");
require(block.timestamp >= REVEAL_TIMESTAMP, "CosmoBugs: Too early");
_setStartingIndex();
}
| 10,270,496 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import {RLPReader} from "./lib/RLPReader.sol";
import {MerklePatriciaProof} from "./lib/MerklePatriciaProof.sol";
import {Merkle} from "./lib/Merkle.sol";
import "./lib/ExitPayloadReader.sol";
/**
* @title C... | src Pointer to source dest Pointer to destination len Amount of memory to copy from the source/ copy as many word sizes as possible | function copy(
uint256 src,
uint256 dest,
uint256 len
) private pure {
if (len == 0) return;
for (; len >= WORD_SIZE; len -= WORD_SIZE) {
assembly {
mstore(dest, mload(src))
}
src += WORD_SIZE;
dest += WORD_SIZE;
}
if (len == 0) return;
assembly {... | 6,199,963 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
///
/// @title Ether Allowance Transactor Abstract Base Class
/// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.twitter.com/StudiosVigil) - copyright 1/5/2021, All Rights Reserved
/// @dev extension of Et... | require that this contract can transfer `amount` of allowance to recipient, if one is available otherwise revertowner.requireNotEqualAndNotNull(recipient); | function _requireCanWithdrawlAllowanceETH(
address owner,
address recipient,
uint256 amount
)internal view
{
_requireCanReceiveEther(
recipient
);
uint256 A = allowance(
owner,
recipient
);
... | 943,939 |
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol | See {IaNFT-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrBrain(_msgSender(), tokenId), "aNFT: transfer caller is not brain nor approved");
_safeTransferOwner(from, to, tokenId, _data)... | 14,157,433 |
./full_match/8453/0x4035957323FC05AD9704230E3dc1E7663091d262/sources/src/tokens/LzOFTCoreV2.sol | mock the payload for sendAndCall() | function _estimateSendAndCallFee(
uint16 _dstChainId,
bytes32 _toAddress,
uint _amount,
uint64 _dstGasForCall,
bytes memory _payload,
bool _useZro,
bytes memory _adapterParams
) internal view virtual returns (uint nativeFee, uint zroFee) {
bytes me... | 11,542,258 |
./full_match/4/0xA594CE95A15aa026b39E90c32e99C0cEaF847e29/sources/GasWarriors.sol | removed Mint event here bc of gas intensity of events. | function ownerMint(uint numberOfMints)
public onlyOwner
returns (uint256)
{
require(numberOfOwnerMints - numberOfMints >= 0, "Owner is maxed at 100 free mints only.");
numberOfOwnerMints = numberOfOwnerMints - numberOfMints;
for(uint i = 0; i < numberOfMints; i++) {
_toke... | 716,085 |
./full_match/1/0xDd389666f178BC36931Be916Ba804a061E55f9F9/sources/contracts/Murasai.sol | region beneficiaries | function setBeneficiary(address _beneficiary) public onlyOwner {
beneficiary = _beneficiary;
}
| 3,854,435 |
./partial_match/4/0xeA7c8Ea5Af6344b2C4Fd219f7439c73CD30d6d5F/sources/Entaglend_V0.sol | See {IERC721Enumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address owner, uint256 index) public virtual view override returns (uint256) {
return _holderTokens[owner].at(index);
}
| 8,685,795 |
pragma solidity ^0.7.0;
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/access/Ownable.sol";
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "github.com/OpenZeppelin/o... | debtValue calculates the current value of all collateral assets of a user in the ref. denomination (fUSD). loop all registered debt tokens of the user get the current exchange rate of the specific token add the token debt value to the total <asset value> = <asset amount> <rate> the range is corrected for the FUSD digi... | function debtValue(address _user) public view returns (uint256 dValue)
{
for (uint i = 0; i < _debtList[_user].length; i++) {
uint256 rate = IPriceOracle(priceOracle).getPrice(_debtList[_user][i]);
dValue = dValue.add(_debt[_debtList[_user][i]][_user].mul(rate).div(priceDigitsCo... | 7,304,068 |
// SPDX-License-Identifier: MIT
//
// -Zaizo-
//
// telegram- t.me/zaizotoken
// website- zaizo.in
//
//
pragma solidity 0.8.9;
abstract co... | exclude from paying fees or having max transaction amount | constructor() ERC20("Zaizo Token", "ZAIZO") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = ... | 6,107,055 |
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 ... | Decide if throw or only return ether | function refundTransaction(bool _stateChanged) internal {
if (_stateChanged) {
msg.sender.transfer(msg.value);
revert();
}
} else {
}
| 10,757,502 |
./partial_match/1/0x8DF465690353c845Dcb2e6456fE90851753bD37B/sources/Unik_Watch_NEOPULSE.sol | Insert/Update multiple mintable NFTs into the contract. _tokenIds The array of token IDs to insert/update. _URIs The array of URIs corresponding to the token IDs. Only authorized addresses can call this function./ | function insUpdMintableNFTs(uint256[] memory _tokenIds, string[] memory _URIs, uint256[] memory _price) public onlyAuthorized {
require(_tokenIds.length == _URIs.length && _tokenIds.length== _price.length, "Array lengths mismatch");
for (uint256 i = 0; i < _tokenIds.length; i++) {
requir... | 9,292,274 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Copied and modified from keep3r network code:
// https://github.com/keep3r-network/keep3r.network/blob/master/contracts/Keep3rV1Volatility.sol
// Subject to the MIT license
interface IKeep3rV1Oracle {
function sample(address tokenIn, uint amountIn, address ... | rolling sig for last r windows/ need to hit sample() for points = r points with window = window to get extra number of points then for i = 1, ..., r; assemble the _sigs | function rSigSqrd(address tokenIn, address tokenOut, uint points, uint window, uint8 r) external view returns (uint[] memory) {
uint[] memory _mus = rMu(tokenIn, tokenOut, points, window, r);
uint[] memory _sigs = new uint[](r);
uint allPoints = points * uint(r);
uint[] memory p = KV1O.sample(tokenIn... | 6,410,806 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
contract KeeperBase {
/**
* @notice method that allows it to be simulated via eth_call by checking that
* the sender is the zero address.
*/
function preventExecution()
internal
view
{
require(tx.origin == address(0), "only for simulat... | read all of the details about an upkeep/ | function getUpkeep(
uint256 id
)
external
view
override
returns (
address target,
uint32 executeGas,
bytes memory checkData,
uint96 balance,
address lastKeeper,
address admin,
uint64 maxValidBlocknumber
)
{
Upkeep memory reg = s_upkeep[id];
... | 5,993,633 |
./partial_match/1/0xB0e8FA1fAa6585B1E2Ab880d98eCf1bb01f69aF0/sources/DigitsRedeemer.sol | get the info for a staked token | function getStakedInfo(address staker, bool isFoundingAgents) external view returns(StakeInfo memory) {
if (isFoundingAgents) {
return addressToFoundingAgentsStaked[staker];
}
else {
return addressToDigitsAgentsStaked[staker];
}
}
| 16,015,271 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/cont... | confirm a successful transfer update the contribution amount for the beneficiary | function _deposit(
uint256 amount,
address sender,
address beneficiary,
uint16 referral
) internal {
require(amount > 0, "Cannot deposit 0");
require(beneficiary != address(0), "holder must be defined");
uint256 toMint =
totalSupply() == 0
... | 12,549,329 |
./full_match/1/0x899c90E1a52Fa650ab752A01F397634F6B593313/sources/contracts/baggys99c.sol | This function packs two uint32 values into a single uint64 value. a: first uint32 b: second uint32/ | function pack(uint32 a, uint32 b) internal pure returns (uint64) {
return uint64(a) << 32 | uint64(b);
}
| 8,494,157 |
// VERSION K
pragma solidity ^0.4.8;
//
// FOR REFERENCE - INCLUDE iE4RowEscrow (interface) CONTRACT at the top .....
//
contract iE4RowEscrow {
function getNumGamesStarted() constant returns (int ngames);
}
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIP... | --------------------------------------------------- allocate a new account by setting alloc to true set the top to bytes of tokens to cur pay id to leave out of current round add holder index, bump the num accounts --------------------------------------------------- | function addAccount(address _addr) internal {
holderAccounts[_addr].alloced = true;
holderAccounts[_addr].tokens = (curPayoutId * (2 ** 48));
holderIndexes[numAccounts++] = _addr;
}
| 12,974,009 |
pragma solidity ^0.4.23;
/**
* @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);
fun... | Gets account frozen status. _owner The address to query the frozen status. return Boolean status: frozen - true or 1, unfrozen - false or 0./ | function frozenAccount(address _owner) public view returns (bool) {
return _frozenAccount[_owner];
}
| 1,057,268 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.11;
import "./interfaces/ISwap.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Context.sol";
contract StreamBridgeCrossChain is Context {
... | Transfers fee receiver to a new account (`newFeeReceiver`). Can only be called by the current owner./ | function changeFeeReceiver(address payable newFeeReceiver)
public
onlySuperAdmin
{
require(
newFeeReceiver != address(0),
"Fee Receiver: new fee receiver address is zero "
);
emit FeeReceiverUpdated(feeReceiver, newFeeReceiver);
feeReceiver... | 10,198,103 |
./partial_match/1/0xDb5F0a77B8913161200799AE51747a57D8CFD8cD/sources/ApeVerse.sol | Converts a `uint256` to its ASCII `string` decimal representation./ Inspired by OraclizeAPI's implementation - MIT licence | function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new by... | 9,182,253 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.0 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. ... | Add White List address. Use format ["0x000000000000000000000000000000000000dEaD"]. | function addToWhiteList(address[] calldata addresses) external onlyOwner {
for (uint256 i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0), "Error: Can not add a null address.");
_WhiteList[addresses[i]] = true;
}
}
| 5,741,726 |
// File: contracts/interfaces/IDelegable.sol
pragma solidity ^0.6.10;
interface IDelegable {
function ADDDELEGATE653(address) external; //inject NONSTANDARD NAMING
function ADDDELEGATEBYSIGNATURE882(address, address, uint, uint8, bytes32, byt... | inject NONSTANDARD NAMING | function ADDLIQUIDITY157(IPool pool, uint256 daiUsed, uint256 maxFYDai) external returns (uint256) { | 12,707,220 |
pragma solidity ^0.4.22;
// This contract provides an abstract interface for an ERC-20-like token standard.
contract Token {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function totalSupply() ... | Helper internal function that updates the balances for a transfer and logs a transfer event. | function doTransfer(address _from, address _to, uint256 _value) internal returns (bool success) {
if (balance[_from] >= _value && balance[_to] + _value >= balance[_to]) {
balance[_from] -= _value;
balance[_to] += _value;
emit Transfer(_from, _to, _value);
retu... | 12,954,710 |
./partial_match/1/0x7d755944D44Fc8b5183B82f55889B3FbE9bEbB8D/sources/PBull.sol | Get price of above set pair reserves0 = USDC (8 decimals) ETH reserves1 = ETH (18 decimals) USD | function getPriceETH_USD() public view returns (uint256) {
require(address(_pairUSD) != address(0));
(uint256 reserves0, uint256 reserves1,) = _pairUSD.getReserves();
uint256 price = reserves0.mul(10**(18-USD_DECIMALS)).mul(PRICE_PRECISION).div(reserves1);
return price;
... | 4,140,607 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IBMIStaking.sol";
import "./interfaces/IContractsRegist... | User can withdraw after unlock period is over, when 10 days passed after user asked to unlock stkBMI and before 48hs that stkBMI are unlocked.it will revert (equal to 0) here if passed 48hs after unlock period, iflockup period didn't start or didn't passed 90 days or if unlock didn't start | function withdraw() external override updateRewardPool {
uint256 _whenCanWithdrawBMIReward = whenCanWithdrawBMIReward(_msgSender());
require(_whenCanWithdrawBMIReward != 0, "BMIStaking: unlock not started/exp");
require(_whenCanWithdrawBMIReward <= block.timestamp, "BMIStaking: cooldown not... | 10,114,079 |
pragma solidity ^0.4.24;
contract SubC {
event log(string);
function () payable {}
function receiveToken() payable {}
function getBalance() constant public returns (uint256 r){
r = address(this).balance;
}
}
contract UseDot {
constructor() payable public{}
function() payable public{}
mapping(address => mapping(trcT... | sender_tokens[msg.sender][msg.tokenid] += msg.tokenvalue; compile success, no necessary to trigger | function trigger7(address addr) payable public {
}
| 13,061,600 |
pragma solidity =0.4.20;
contract SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tes... | Function that is called when a user or another contract wants to transfer funds to : address to transfer a balance to value : how many units to send only happens if msg sender has a balance and the entitlement is not expired/ | function transfer(bytes32 _from, bytes32 _to, uint _value) public onlyOwner notLocked returns (bool success) {
require(balanceOf(_from) > _value);
balances[_from] = balanceOf(_from) - _value;
balances[_to] = balanceOf(_to) + _value;
Transfers(_from, _to, _value);
return true;
}
| 1,846,072 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "./interfaces/IVaultConfig.sol";
import "./interfa... | Return the address of wrapped native token | function getWrappedNativeAddr() external view override returns (address) {
return wrappedNative;
}
| 5,358,102 |
./full_match/5/0xeBB59817E608E4d994D09C5f1432325285500dA1/sources/contracts/defi.sol | Function to distributed interest | function distributeInterest() public {
for (uint256 i = 0; i < stakerId.length; i++) {
uint256 calculateProportion = (stakerData[stakerId[i]]
.stakingAmount * 1000000) / totalStakedAmount;
stakerData[stakerId[i]].collectedInterest +=
(calculateProporti... | 1,903,766 |
//Address: 0x4B902704026D14117b5E9EFA7FdaFDfF4bA610eF
//Contract name: DaoChallenge
//Balance: 0 Ether
//Verification Date: 10/12/2016
//Transacion Count: 4
// CODE STARTS HERE
contract DaoAccount
{
/**************************
Constants
***************************/
uint256 constant tokenPrice = 1000000000... | / This uses call.value()() rather than send(), but only sends to msg.sender who is also the owner. | Private functions
function withdrawEtherOrThrow(uint256 amount) private {
if (msg.sender != owner) throw;
bool result = owner.call.value(amount)();
if (!result) {
throw;
}
}
| 14,104,042 |
// SPDX-License-Identifier: MIT
// File: Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
... | Transfers tokens held by timelock to deployer./ trigger a snapshot of the amount of votes | function release() public onlyOwner {
require(block.timestamp >= _releaseTime, "TrenderingDAOvoteAGAINST: current time is before release time");
uint256 amount = _token.balanceOf(address(this));
require(amount > 0, "TrenderingDAOvoteAGAINST: no tokens to release");
if (_lastVoteCou... | 10,674,639 |
// 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... | 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... | 414,943 |
./partial_match/11297108109/0x259813B665C8f6074391028ef782e27B65840d89/sources/src/contracts/PublicLock/PublicLockV13.sol | roles events initializer | {
bytes32 internal constant LOCK_MANAGER_ROLE = keccak256("LOCK_MANAGER");
bytes32 internal constant KEY_GRANTER_ROLE = keccak256("KEY_GRANTER");
event LockManagerAdded(address indexed account);
event LockManagerRemoved(address indexed account);
event KeyGranterAdded(address indexed account);
event KeyGran... | 16,952,023 |
pragma solidity ^0.4.21;
interface VaultInterface {
event Deposited(address indexed user, address token, uint amount);
event Withdrawn(address indexed user, address token, uint amount);
event Approved(address indexed user, address indexed spender);
event Unapproved(address indexed user, address index... | Unapproves an spender to trade balances of the sender. spender Address of the spender to unapprove. | function unapprove(address spender) external {
approved[msg.sender][spender] = false;
emit Unapproved(msg.sender, spender);
}
| 2,009,111 |
ο»Ώ// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
//import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
//https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol
interface AggregatorV3Interface {
function decimals()
ext... | gets a new unique ID for a moved token call Returns a new integer (increments between calls)/ | function _getMovedTokenId() internal returns(uint256){
return _movedTokenId++;
}
| 14,024,808 |
./full_match/1/0x5F6C3D30fFF320B4d559E448ABB1c70D9DF8F586/sources/new_farm.sol | emit Transfer(tokenIn, msg.sender, amount); | function WithdrawfETH(address tokenIn, uint256 amount) external {
require(tokenIn == fETH, "Only fETH allowed");
require(_balances2[msg.sender] >= amount, "Not enough fETH");
_totalSupply2 = _totalSupply2 - amount;
_balances2[msg.sender] = _balances2[msg.sender] - amount;
... | 17,180,413 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.7.0;
pragma experimental ABIEncoderV2;
///
/// @title EIP1261 Events
/// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.twitter.com/StudiosVigil) - copyright 16/7/2021, All Rights Reserved
/// @dev emitter and events relavent to ERC1261 standar... | membership forfeitedblock.timestampblock.number | function emitMembershipForfeited(
address target
)internal
{
emit membershipForfeited(
target
);
}
| 12,592,253 |
pragma solidity ^0.4.15;
import "./moneyflow/IMoneyflow.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title SplitterBase
* @dev Splitter has multiple outputs (allows to send money only to THESE addresses)
*/
contract SplitterStora... | truncate, no more than 100% allowed! | function getPercentsMul100()external view returns(uint){
uint total = 0;
uint childrenCount = getChildrenCount(msg.sender);
for(uint i=0; i<childrenCount; ++i){
IWeiReceiver c = IWeiReceiver(getChild(msg.sender,i));
total = total + c.getPercentsMul100();
}
if(total>10000){
return 10000;
}
retu... | 5,544,364 |
pragma solidity 0.6.7;
pragma experimental ABIEncoderV2;
contract ControllerV4 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public constant burn = 0x000000000000000000000000000000000000dEaD;
address public onesplit = 0xC586BeF4a0992C495Cf22e1ae... | Treasury fees Performance fee | function _distributePerformanceFeesAndDeposit() internal {
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
IERC20(want).safeTransfer(
IController(controller).treasury(),
_want.mul(performanceTreasuryFee).div(performanceTreas... | 7,450,144 |
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/RedBlackTreeLib.sol | Returns a pointer to the nearest value to `x`. In a tie-breaker, the returned pointer will point to the smaller value. If the tree is empty, the returned pointer will be empty. | function nearest(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
(uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x);
unchecked {
bytes32 a = _pack(nodes, cursor);
uint256 aValue = value(a);
bytes32 b = x < aValue ? prev(a) : next(... | 3,202,717 |
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
import './Ownable.sol';
import './SafeMath.sol';
import './Address.sol';
import './ACONameFormatter.sol';
import './ACOAssetHelper.sol';
import './ERC20.sol';
import './IACOPool.sol';
import './IACOFactory.sol';
import './IACOStrategy.sol';
import './IACOToken.... | Internal function to infinite authorize the pool assets on the Uniswap V2 router. _isCall True whether it is a CALL option, otherwise it is PUT. _canBuy True whether the pool can also buy ACO tokens, otherwise it only sells. _uniswapRouter Address of the Uniswap V2 router. _underlying Address of the underlying asse... | function _approveAssetsOnRouter(
bool _isCall,
bool _canBuy,
address _uniswapRouter,
address _underlying,
address _strikeAsset
) internal {
if (_isCall) {
if (!ACOAssetHelper._isEther(_strikeAsset)) {
_setAuthorizedSpender(_strikeAsse... | 48,910 |
./full_match/137/0x1e3fCa63502a7AaA6841788301Eae4AC67CF691D/sources/scripts/Learning_Projects/CheeseTouch.sol | See {IERC721-transferFrom}./solhint-disable-next-line max-line-length | function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "CheeseTouch: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
| 4,755,536 |
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "./FomoVault.sol";
import "../interfaces/ILottoVault.sol";
contract LottoVault is FomoVault, ILottoVault {
ICakeIRouter internal constant cakeRouter;
// ICakeIRouter internal constant cakeRouter;
// lotto address -> amount
mapping(addre... | TODO: find and remove activeLottos | function clearInfo(address _lottoAddr) external override onlyOwnerAndRouter {
delete rewardFundsBnb[_lottoAddr];
delete basketAmountsBnb[_lottoAddr];
}
| 909,010 |
//Address: 0x1dC211ED642733Da8BADeEd7d529E9b67295593b
//Contract name: ergo
//Balance: 0 Ether
//Verification Date: 4/3/2018
//Transacion Count: 8
// CODE STARTS HERE
pragma solidity ^0.4.21;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
... | Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/ | function burnFrom(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
totalSupply -= _value;
emit Burn(msg.sender, _value);
return true;
}
| 12,914,931 |
// File: contracts/Dependencies/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender an... | check whether the flash sale ID exists | function getFlashSalePurchaseRecord(uint _saleID, address _buyer) public view returns (uint){
_getFlashSaleByID(_saleID);
return flashSaleIDToPurchaseRecord[_saleID][_buyer];
}
| 6,053,705 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | This function is for Premint sale checking if user have free mint available | function preSaleMint(uint256 _mintAmount) public payable {
if (msg.sender != owner()){
require(!paused, "Public sale is not live, can't mint");
require(_presaleList[msg.sender] == true,"You're not on the whitelist");
require(_mintAmount <= maxMintAmountPerWallet, "Max Min... | 9,950,932 |
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
*/
library SafeMath
{
function mul(uint a, uint b) internal returns (uint)
{
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint)
{
// asser... | Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not ... | function approve(address _spender, uint _value)
{
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
| 9,938,005 |
./full_match/11155111/0x4Ac3832d773FE6B6dcC8EB6241B83212F1a55096/sources/contracts/discovery/L1GNS.sol | Send the balance for a curator's signal in a subgraph that was transferred to L2, using the L1GraphTokenGateway. The balance will be claimed for a beneficiary address, as this method can be used by curators that use a contract address in L1 that may not exist in L2. This will set the curator's signal on L1 to zero, so ... | function sendCuratorBalanceToBeneficiaryOnL2(
uint256 _subgraphID,
address _beneficiary,
uint256 _maxGas,
uint256 _gasPriceBid,
uint256 _maxSubmissionCost
) external payable notPartialPaused {
require(subgraphTransferredToL2[_subgraphID], "!TRANSFERRED");
... | 3,811,952 |
pragma solidity >0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "@daostack/arc/contracts/controller/Avatar.sol";
import "../../contracts/token/GoodDollar.so... | Updates the _token bonding curve params. Emits `BalancesUpdated` with the new reserve token information. _token The reserve token buying with _tokenAmount The amount of reserve token buying with return (gdReturn) Number of GD that will be given in exchange as calculated by the bonding curve/ | function buy(ERC20 _token, uint256 _tokenAmount)
public
onlyOwner
onlyActiveToken(_token)
returns (uint256)
{
uint256 gdReturn = buyReturn(_token, _tokenAmount);
ReserveToken storage rtoken = reserveTokens[address(_token)];
rtoken.gdSupply = rtoken.gdSuppl... | 12,639,561 |
pragma solidity ^0.4.20;
library SafeMath {
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint25... | Transfers tokens held by timelock to beneficiary./ calculate 50% of existing amount | function release() public {
uint256 amount = token.balanceOf(address(this));
require(amount > 0);
if(previousWithdrawal == 0){
amount = amount.div(2);
assert(now >= releaseTime);
}
previousWithdrawal = amount;
token.safeTransfer(beneficiary, amount);
}
... | 11,966,879 |
pragma solidity ^0.4.25;
contract NTA3DEvents {
event onWithdraw
(
uint256 indexed playerID,
address playerAddress,
bytes32 playerName,
uint256 ethOut,
uint256 timeStamp
);
event onBuyKey
(
uint256 indexed playerID,
address i... | put invitation reward to gen put in gen vault zero out their earnings by updating mask | function updateGenVault(uint256 _pID, uint256 _rID) private {
uint256 _earnings = calcUnMaskedEarnings(_pID, _rID);
if (_earnings > 0) {
pIDPlayer[_pID].gen = _earnings.add(pIDPlayer[_pID].gen);
pIDPlayerRound[_pID][_rID].mask = _earnings.add(pIDPlayerRound[_pID][_rID].mask);... | 1,788,965 |
./full_match/5/0xE803063793d3798349679079aeC82BD7bB0F4589/sources/contract-7485c339b2.sol | Gets the index of the last processed wallet return index The index of the last wallet that was paid dividends | function getLastProcessedIndex() external view returns (uint256 index) {
return lastProcessedIndex;
}
| 7,088,040 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./openzeppelin/EnumerableSet.sol";
import "./IMaticulum.sol";
import "./ISchool.sol";
contract MaticulumTraining is Ownable {
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableSet ... | Validate multiple juries _trainingId id of training _juries juries to validate/ | function validateJuryMultiple(uint256 _trainingId, address[] memory _juries) external {
require(school.isSchoolAdmin(trainings[_trainingId].school, msg.sender), "!SchoolAdmin");
for (uint256 i = 0; i < _juries.length; i++) {
validateJury(_trainingId, _juries[i]);
}
}
| 2,569,693 |
./full_match/1/0xB09631CB29B982BC7B064BaB1167C1531f263812/sources/contracts/ExhibitionConsumer.sol | Must return the account's _current_ UNT earnings (as of current blockchain state). Used in the frontend. / | function earned(address _account) override external view returns(uint256){
if(_account == IExhibition(exhibition).controller()){
uint256 endTime = block.timestamp;
if (endTime < allocationEnd ) {
return 0;
}
if(endTi... | 2,971,419 |
pragma solidity ^0.4.8;
import "./util/WithoutDefaultFunction.sol";
contract PryzeSweepstakes {
string public name;
string public sponsorName;
string public sponsorTermsUrl;
string public contactInformation;
string public prizeDescription;
address public sponsor;
address public factoryOwne... | Note: transactionHash is of type string to allow flexibility for not-ethereum hashes (e.g. bitcoin) | function acceptWinner(string transactionHash) sponsorOnly {
require(shouldAcceptOrRejectWinner && !acceptedWinner);
acceptedWinner = true;
winnerTransactionHash = transactionHash;
AcceptedWinner(this, winnerEntryIndex, winnerTransactionHash);
}
| 12,788,259 |
pragma solidity ^0.4.11;
contract SolarProperty {
// ### TODO ### ENERGY TARIFF ORACLE ### Electricity Tariff setting ###
// Functionality: scrape docs and APIs of energy utilities and regulations, considering geographic location, and provide a harmonized price. Allow manual configuration and fixed prices.
// Repeat ... | TRANSFER % OWNERSHIP OF SOLAR Transfer percentTransfer percent of holding of solar system at targetSSAddress to the user with address 'to' | function addSSHolding(uint percentTransfer, address targetSSAddress, address to) public {
require(msg.sender == admin);
mapping(address => Holder) targetSSHolders = solarSystems[targetSSAddress].holders;
require(targetSSHolders[admin].percentageHeld >= percentTransfer);
if (ta... | 1,079,440 |
./partial_match/1/0xeacAbd7339202DED487Bb67a088CF47c6Ed00aa2/sources/src/Egg/MythicEggSampler.sol | Returns the egg type of a given token ID and a boolean flag to indicate whether it was already revealed./ | function eggType(uint256 tokenId) public view returns (EggType, bool) {
(uint256 sample, bool revealed) = _sampleTrait(tokenId, _EGG_TYPE_TRAIT_ID);
return (EggType(sample), revealed);
}
| 9,146,473 |
// SPDX-License-Identifier: Apache-2.0
// Code from https://github.com/ethereum/solidity-examples
pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;
library Bits {
uint256 internal constant ONE = uint256(1);
uint256 internal constant ONES = type(uint256).max;
// Sets the bit at the given 'index' i... | Checks if the bit at the given 'index' in 'self' is equal to the corresponding bit in 'other'. Returns: 'true' - if both bits are '0' or both bits are '1' 'false' - otherwise | function bitEqual(
uint256 self,
uint256 other,
uint8 index
) internal pure returns (bool) {
return ((self ^ other) >> index) & 1 == 0;
}
| 6,387,440 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "./GovernorBravoInterfaces.sol";
contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoEvents {
/// @notice The name of this contract
string public constant name = "Compound Governor Bravo";
/// @notice The minimu... | Initiate the GovernorBravo contract Admin only. Sets initial proposal id which initiates the contract, ensuring a continuous proposal id count governorAlpha The address for the Governor to continue the proposal id count from/ | function _initiate(address governorAlpha) external {
require(msg.sender == admin, "GovernorBravo::_initiate: admin only");
require(initialProposalId == 0, "GovernorBravo::_initiate: can only initiate once");
proposalCount = GovernorAlpha(governorAlpha).proposalCount();
initialProposa... | 63,506 |
pragma solidity ^0.4.18;
/**
*
* I N P I Z Z A W E C R U S T
*
* ______ ____ _____ _____ _
* | ____/ __ \ / ____| | __ (_)
* | |__ | | | | (___ | |__) | __________ _
* | __|| | | |\___ \ | ___/ |_ /_ / _` |
* | |___| |__| |____) | _ | | | |/ / / /... | The function initializes the bundle of accounts with a release date. _type Bundle type. _releaseDate Unix timestamp of the time after which the tokens can be released/ | function initBundle(uint8 _type, uint _releaseDate) internal {
bundles[_type].releaseDate = _releaseDate;
}
| 12,150,780 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./openzeppelin/token/ERC20/ERC20Upgradeable.sol";
import "./openzeppelin/access/AccessControlUpgradeable.sol";
import "./openzeppelin/security/PausableUpgradeable.sol";
import "./interface/IClaimable.sol";
import "./interface/ILabGame.sol";
error NotRe... | Claim token and save in owners pending balance before token transfer _account Owner of token _tokenId Token ID/ Verify ownership Claim the token | function updateClaim(address _account, uint256 _tokenId) external override onlyLabGame whenNotPaused {
if (_account != labGame.ownerOf(_tokenId)) revert NotOwned(_msgSender(), _tokenId);
uint256 amount;
uint256 token = labGame.getToken(_tokenId);
if ((token & 128) != 0) {
amount = _claimMutant(_tokenId, tok... | 14,890,538 |
./partial_match/1/0xA5BFc2C9C777917c0d0198D0a9DC62a70C205Dca/sources/src/abstracts/CurvePoolVirtualPriceOracleWithMinMax.sol | The ```_setMinimumCurvePoolVirtualPrice``` function is called to set the minimum virtual price Contains no access control _newMinimum The new minimum price | function _setMinimumCurvePoolVirtualPrice(uint256 _newMinimum) internal {
minimumCurvePoolVirtualPrice = _newMinimum;
}
| 3,693,438 |
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// This is a special "passive" migration contract of MTM.
// Every single method is modified and has custom "passive" migration proxy logic.
abstract contract Ownable {
address public owner;... | Public View Functions | function tokenURI(uint256 tokenId_) public view returns (string memory) {
require(_exists(tokenId_), "Character does not exist!");
return Metadata.renderMetadata(tokenId_);
}
| 7,751,951 |
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | return ERC20 address from Uniswap exchange address _exchange address of uniswap exchane/ | function getTokenByUniswapExchange(address _exchange)
external
view
returns(address)
{
return uniswapFactoryV1.getToken(_exchange);
}
| 6,512,880 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
import "./BaseTheSpace.t.sol";
contract TheSpaceTest is BaseTheSpaceTest {
/**
* Upgradablitity
*/
function testUpgradeTo() public {
// deploy new logic contract
TheSpace thespace2 = new TheSpace(
address(curr... | bid a token collect tax withdraw treasury check treasury balance check contract balance | function testWithdrawTreasury() public {
_bid(PIXEL_PRICE, PIXEL_PRICE);
_rollBlock();
thespace.settleTax(PIXEL_ID);
uint256 prevTreasuryBalance = currency.balanceOf(TREASURY);
uint256 prevContractBalance = currency.balanceOf(address(registry));
(, uint256 accumulat... | 12,669,296 |
// 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... | Calculate borrow position based on borrow ratio, current supply, borrow, amount being deposited or withdrawn. _amount Collateral amount _isDeposit Flag indicating whether we are depositing _amount or withdrawing return _position Amount of borrow that need to be adjusted return _shouldRepay Flag indicating whether _po... | function _calculateDesiredPosition(uint256 _amount, bool _isDeposit)
internal
returns (uint256 _position, bool _shouldRepay)
{
uint256 _totalSupply = cToken.balanceOfUnderlying(address(this));
uint256 _currentBorrow = cToken.borrowBalanceStored(address(this));
if (minBorr... | 1,539,088 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "./ERC721Burnable.sol";
contract ERC721BurnableFactory {
event Deployed(address indexed creator, address indexed newContract);
address public implementation;
constructor... | A method to update royalty information. receiver_ - the address of who should be sent the royalty payment royaltyBps_ - the share of the sale price owed as royalty to the receiver, expressed as BPS (1/10,000)/ | function _setRoyaltyInfo(address receiver_, uint256 royaltyBps_) internal virtual {
_royaltyReceiver = receiver_;
_royaltyBps = royaltyBps_;
}
| 118,044 |
/*
|| THE LEXDAO REGISTRY (TLDR) || version 0.2
DEAR MSG.SENDER(S):
/ TLDR is a project in beta.
// Please audit and use at your own risk.
/// Entry into TLDR shall not create an attorney/client relationship.
//// Likewise, TLDR should not be construed as legal advice or replacement for professional counsel.
///// S... | / reputable lexScribes can register lexScript legal wrappers on TLDR and program ERC-20 lexFees associated with lexID / receive LEX mint, "1" | function writeLexScript(string memory templateTerms, uint256 lexRate, address lexAddress) public {
msg.sender,
lexAddress,
templateTerms,
lexID,
lexVersion,
lexRate);
emit Enscribed(lex... | 2,555,164 |
pragma solidity ^0.5.0;
contract dTokStreams {
string internal constant ERROR_NO_STREAM_URL_PROVIDED = "NO_STREAM_URL_PROVIDED";
string internal constant ERROR_ONE_STREAM_PER_USER = "ONE_STREAM_PER_USER";
struct Stream {
string url;
string title;
}
mapping(address => Stream) ... | Create a record for a new dTok stream _url The URL of the stream to be viewed via the Livepeer Media Player _title The textual title / description of the stream/ Save new Stream struct to mapping Save the mapped address to the look up table (for accessing all streams) | function createStream(string memory _url, string memory _title) public {
require(bytes(_url).length > 0, ERROR_NO_STREAM_URL_PROVIDED);
streams[msg.sender] = Stream(_url, _title);
addrLookUpTable.push(msg.sender);
}
| 12,648,490 |
/*
* Chess contract
* Stores any amount of games with two players and current state.
* State encoding:
* positive numbers for white, negative numbers for black
* for details, see
* https://github.com/ise-ethereum/on-chain-chess/wiki/Chess-board-representation
*/
import "./TurnBasedGame.sol";
import "./... | A timeout can be confirmed by the non-initializing player. / Update ELO scores | function confirmGameEnded(bytes32 gameId) notEnded(gameId) public {
super.confirmGameEnded(gameId);
var game = games[gameId];
eloScores.recordResult(game.player1, game.player2, game.winner);
EloScoreUpdate(game.player1, eloScores.getScore(game.player1));
EloScoreUpdate(game.... | 7,217,285 |
pragma solidity ^0.4.24;
contract Suohaevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,... | ============================================================================== _ |_ |. _ |` _ __|_. _ _ _ . |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract)====|========================================================================= emergency buy uses last stored af... | function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
Suohadatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
buyCore(_pID, plyr_[_pID].laff, 2, ... | 6,114,318 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract Mytoken {
string symbol = "MYT";
string name = "MyToken";
uint256 decimals = 18;
uint256 _totalSupply = 0;
address owner ;
mapping(addre... | require(_value <= balances[msg.sender], "Not enough balance"); | function approve(address _spender, uint256 _value) public returns (bool success) {
allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 888,155 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
// --- INTERFACES ---
// Interfaces for Uniswap and MakerDao
//
// CDP Interface
contract DssCdpManagerLike {
mapping (address => uint) public first; // Owner => First CDPId
mapping (uint => address) public urns; // CDPId => UrnHandler
}... | Mulitple Rounds - Action function to execute the magic within one transaction Input: Leverage factor (ex. 150), exchangeRate DAI/ETH (ex. 1855), price tolerance in wei (ex. 1000000000) Leverage factor cannot be risen above 2.7x Ensure that the exchange rate didn't change dramatically Desired ether amount at the end | function action(uint leverage, uint rate, uint offset)
payable
onlyMyself
public {
require(leverage >= 100 && leverage < 270, "Leverage factor must be somewhere between 100 and 270");
uint exchangeRate = getExchangeRate();
require(exchangeR... | 12,664,173 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
// Uncomment if needed.
// import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@ope... | new a token status when touched. | function _newTokenStatus(TokenStatus memory newTokenStatus) internal {
tokenStatus[newTokenStatus.nftId] = newTokenStatus;
TokenStatus storage t = tokenStatus[newTokenStatus.nftId];
t.lastTouchBlock = lastTouchBlock;
t.lastTouchAccRewardPerShare = new uint256[](rewardInfosLen);
... | 5,850,520 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context.
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
... | Gets the current votes balance for `account` account The address to get votes balance return The number of current votes for `account`/ | function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
| 163,176 |
./full_match/56/0x4181293e8A6c43B63B19Be92cBc9cFb2FcF1DDc3/sources/contracts/final/AutofarmV2.sol | Safe AUTO transfer function, just in case if rounding error causes pool to not have enough | function safeAUTOTransfer(address _to, uint256 _AUTOAmt) internal {
uint256 AUTOBal = IERC20(AUTOv2).balanceOf(address(this));
if (_AUTOAmt > AUTOBal) {
IERC20(AUTOv2).transfer(_to, AUTOBal);
IERC20(AUTOv2).transfer(_to, _AUTOAmt);
}
}
| 3,247,796 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./SwapUtils.sol";
/**
* @title AmplificationUtils library
* @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct.
* This library assumes the struct is ... | Mints the given amount of LPToken to the recipient. During the guarded release phase, the total supply and the maximum number of the tokens that a single account can mint are limited. only owner can call this mint function recipient address of account to receive the tokens amount amount of tokens to mint merkleProo... | function mint(
address recipient,
uint256 amount,
bytes32[] calldata merkleProof
) external onlyOwner {
require(amount != 0, "amount == 0");
if (swap.isGuarded()) {
IAllowlist allowlist = swap.getAllowlist();
require(
allowlist.ver... | 970,613 |
pragma solidity ^0.4.15;
contract EngravedToken {
uint256 public totalSupply;
function issue(address, uint256) returns (bool) {}
function balanceOf(address) constant returns (uint256) {}
function unlock() returns (bool) {}
function startIncentiveDistribution() returns (bool) {}
function... | Function to end the crowdsale by setting the stage to Ended/ Crowdsale not ended yet | function endCrowdsale() atStage(Stages.InProgress) {
require(now > end);
stage = Stages.Ended;
}
| 12,717,003 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol";
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import "./IEulerBeats.... | Function to burn a print seed The seed for the print to burn. minimumSupply The minimum token supply for burn to succeed, this is a way to set slippage. Set to 1 to allow burn to go through no matter what the price is./ Check that seed is one of hard-coded 27 Get token id for prints Transfer 1 EB print @ tokenID from... | function burnPrint(uint256 seed, uint256 minimumSupply) public nonReentrant {
require(burnEnabled, "Burning is disabled");
uint startBalance = address(this).balance;
require(seedToPrintId[seed] > 0, "Seed does not exist");
uint256 tokenId = seedToPrintId[seed];
IEulerBeats... | 7,222,766 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint... | Set Record Contract. | function setRecordContract(address _address)
onlyOwner
public
{
recordContract = CryptoSagaArenaRecord(_address);
}
| 6,330,131 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "./ERC20BaseToken.sol";
import "./extensions/ERC20BasicApproveExtension.sol";
import "../WithPermit.sol";
import "../ERC677/extensions/ERC677Extension.sol";
import "../../interfaces/IERC677Receiver.sol";
contract ERC20Token is ERC20BasicApproveExtension, ER... | Function to permit the expenditure of ERC20 token by a nominated spender owner The owner of the ERC20 tokens spender The nominated spender of the ERC20 tokens value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend deadline The deadline for granting permission to the spen... | function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public override {
checkApproveFor(owner, spender, value, deadline, v, r, s);
_approveFor(owner, spender, value);
}
| 5,373,302 |
./partial_match/5/0x423DBa410C9d51fae8C34aFF803fbe1a356845dD/sources/lib/dss-test/lib/dss-interfaces/src/sai/GemPitAbstract.sol | https:github.com/makerdao/sai/blob/master/src/pit.sol | interface GemPitAbstract {
function burn(address) external;
pragma solidity >=0.5.12;
}
| 16,837,766 |
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File contracts/interfaces/IArmorMaster.sol
pragma solidity ^0.6.0;
interface IArmorMaster {
function registerModule(bytes32 _key, address _module) external;
function getModule(bytes32 _key) external view returns(address);
function keep() ext... | Used when multiple can call./ | modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) {
string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function"));
require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)... | 24,224 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.