file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2021-10-15
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// Part: IERC2981
///
/// @dev Interface for the NFT Royalty Standard
///
interface IERC2981 {
/// ERC165 bytes to add to interface array - set in parent contract
/// implementing this ... | Informs callers that this contract supports ERC2981 | function supportsInterface(bytes4 interfaceId)
public view override(ERC721)
returns (bool)
{
return interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
| 6,678,991 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
struct InsurancePolicy {
bool created; // Policy is created
uint256 value; // Insurance value
bool credited; // Policy credi... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline(address newAirline) external requireAuthorizedCaller requireIsOperational
{
_registerAirline(newAirline);
}
| 15,830,086 |
pragma solidity ^0.6.0
contract Selling_Climax_Goal {
function get_psb_selling_climax() public {
//Get PSB Climax signal
}
function set_selling_climax_goal() private {
//Set Climax Goal
}
function set_selling_climax_boundary() private {
//Set Selling Climax Boundary
... | Increase Selling Volume | function increase_selling_volume() private {
}
| 5,445,117 |
./partial_match/42220/0x7ef2EA0939Fa35f3fA78616E3E12246324739203/sources/lib/staked-celo/contracts/Manager.sol | Distributes votes by computing the number of votes each active group should receive, then calling out to `Account.scheduleVotes`. votes The amount of votes to distribute. The vote distribution strategy is to try and have each validator group to be receiving the same amount of votes from the system. If a group already... | function distributeVotes(uint256 votes) internal {
address[] memory votableGroups = getVotableGroups(votes);
if (votableGroups.length == 0) {
revert NoVotableGroups();
}
GroupWithVotes[] memory sortedGroups;
uint256 availableVotes;
(sortedGroups, availabl... | 3,497,680 |
./full_match/1/0xAB6E7f8689351A81B249a6e9f87F08ef30BFFe8f/sources/browser/CTN.sol | Burns a specific amount of tokens. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function burn(uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender] - _value;
totalSupply = totalSupply - _value;
emit Burn(msg.sender, _value);
return true;
}
| 3,135,233 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'... | Commit ETH to buy tokens on auction. _beneficiary Auction participant ETH address./ | function commitEth(address payable _beneficiary, bool readAndAgreedToMarketParticipationAgreement) public payable {
require(paymentCurrency == ETH_ADDRESS, "BatchAuction: payment currency is not ETH");
require(msg.value > 0, "BatchAuction: Value must be higher than 0");
if(readAndAgreedToMa... | 553,567 |
./full_match/1/0xd446315C7e4fA5354d019970e1a4C6045bB133af/sources/contracts/Uniswap/UniswapAnchoredView.sol | Fetches the current token/usd price from Uniswap, with 6 decimals of precision. conversionFactor 1e18 if seeking the ETH price, and a 6 decimal ETH-USDC price in the case of other assets/ `getUniswapTwap(config)` -> TWAP between the baseUnits of Uniswap pair (scaled to 1e18) `twap config.baseUnit` -> price ... | function fetchAnchorPrice(
TokenConfig memory config,
uint256 conversionFactor
) internal view virtual returns (uint256) {
uint256 twap = getUniswapTwap(config);
uint256 unscaledPriceMantissa = twap * conversionFactor;
uint256 anchorPrice = (unscaledPriceMantissa * conf... | 3,182,772 |
/***
* ██████╗ ███████╗ ██████╗ ██████╗
* ██╔══██╗██╔════╝██╔════╝ ██╔═══██╗
* ██║ ██║█████╗ ██║ ███╗██║ ██║
* ██║ ██║██╔══╝ ██║ ██║██║ ██║
* ██████╔╝███████╗╚██████╔╝╚██████╔╝
* ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝
*
* https://dego.finance
* M... | batch set quota for user admin if openTag <=0, removed | function setWhitelist(address[] calldata users, bool openTag)
external
onlyGovernance
{
for (uint256 i = 0; i < users.length; i++) {
_whitelist[users[i]] = openTag;
}
}
| 12,571,508 |
pragma solidity ^0.4.11;
contract CardboardUnicorns {
address public owner;
function mint(address who, uint value);
function changeOwner(address _newOwner);
function withdraw();
function withdrawForeignTokens(address _tokenContract);
}
contract RealUnicornCongress {
uint public priceOfAUnicornInF... | Set a specific price for a CardboardUnicorn/ | function setPrice(uint _newPrice) onlyOwner {
pricePerUnicorn = _newPrice;
lastPriceSetDate = block.timestamp;
PriceUpdate(pricePerUnicorn, msg.sender);
}
| 12,760,326 |
pragma ton-solidity >=0.44.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
/// @title AuctionDebot
/// @author SuperArmor
/// @notice Debot for Auctions
//=================================================... | ======================================================================================================================================================================================================== Reset variables | function _withdraw_1(uint32 index) public
{
delete _walletAddress;
delete _walletBalance;
delete _walletAccType;
ILiquidFTRoot(_sttonRtwAddress).getWalletAddress{
abiVer: 2,
extMsg: true,
sign: false,
... | 7,281,915 |
pragma solidity ^0.4.21;
contract LuckchemyCrowdsale {
using SafeMath for uint256;
// Token for selling
LuckchemyToken public token;
/*
* Start and End date of investment process
*/
// 2018-04-30 00:00:00 GMT - start time for public sale
uint256 public constant START_TIME_SALE = 15... | Release the tokens to the public. Can be called only by owner which should be the Crowdsale contract Should be called if the crowdale is successfully finished/ | function releaseTokenTransfer() public onlyOwner {
released = true;
Release();
}
| 8,049,964 |
// SPDX-License-Identifier: AGPL-3.0
// MgvOfferTaking.sol
// Copyright (C) 2021 Giry SAS.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (... | `gasused` is the gas consumed by the execution `makerData` is the data returned after executing the offer `mgvData` is an [internal Mangrove status code](MgvOfferTaking/statusCodes)./+clear+ The current offer has a price `p = offerWants ÷ offerGives` and the taker is ready to accept a price up to `p' = takerGives ÷ tak... | function execute(MultiOrder memory mor, ML.SingleOrder memory sor)
internal
returns (
uint gasused,
bytes32 makerData,
bytes32 mgvData
)
{ unchecked {
{
uint offerWants = sor.offer.wants();
uint offerGives = sor.offer.gives();
uint takerWants = sor.wants;
ui... | 12,895,752 |
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/vaults/VaultPermissions.sol | Sets assets `amount` as the allowance of `operator` over the `owner`'s assets. This internal function is equivalent to `approve`. Requirements: - Must only be used in `asset` withdrawal logic. - Must check `owner` cannot be the zero address. - Much check `operator` cannot be the zero address. - Must emits an {WithdrawA... | function _setWithdrawAllowance(
address owner,
address operator,
address receiver,
uint256 amount
)
internal
{
if (owner == address(0) || operator == address(0) || receiver == address(0)) {
revert VaultPermissions__zeroAddress();
}
_withdrawAllowance[owner][operator][receiver... | 2,939,864 |
./partial_match/1/0x46DcC6027Bdd8DF479CC533968Cb0EC3324a3575/sources/contracts/ChipzStaking.sol | Safe chipz transfer function, just in case if rounding error causes pool to not have enough CHPZs. | function safeChipzTransfer(address _to, uint256 _amount) internal {
uint256 chipzBal = chipz.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > chipzBal) {
transferSuccess = chipz.transfer(_to, chipzBal);
transferSuccess = chipz.transfer(_to, _amoun... | 16,135,439 |
./full_match/4/0xC5292960b9A6282188086702C6F689CB743Ea5FA/sources/DUCKHUNTERSTEST.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint tokenId
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
... | 736,272 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/**
* @notice This example contract shows the use of some global variables.
*/
contract GlobalVars {
struct Globals {
address sender;
uint blockNumber;
uint price;
uint time;
}
Globals glblVars;
constructor() {
... | return The complete struct | function printGlobals() public view returns (Globals memory) {
return glblVars;
}
| 6,470,650 |
./partial_match/8453/0xCD9C9b40D757b56359e19563203D3bc64089638d/sources/contracts/past-versions/PublicLockV13.sol | Converts a `uint256` to its ASCII `string` hexadecimal representation./ | function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
| 16,778,637 |
pragma solidity 0.4.18;
import "../token/StandardToken.sol";
import "../lib/SafeMath.sol";
contract DummyToken is StandardToken {
using SafeMath for uint256;
function DummyToken(string _name, string _symbol) public {
name = _name;
decimals = 18;
symbol = _symbol;
// mint some token for sender
... | mint some token for sender | function DummyToken(string _name, string _symbol) public {
name = _name;
decimals = 18;
symbol = _symbol;
mintTokens(msg.sender, 1000 * (10 ** uint256(decimals)));
}
| 12,606,951 |
./partial_match/1/0x7a8BfDc7b8FA02c7860b8AFb4503A10a57d0100F/sources/contracts/vaults/EarnVault/RibbonEarnVaultFixedRate.sol | Sets the new fee recipient newFeeRecipient is the address of the new fee recipient/ | function setFeeRecipient(address newFeeRecipient) external onlyOwner {
require(newFeeRecipient != address(0), "R8");
feeRecipient = newFeeRecipient;
}
| 2,615,651 |
/**
*Submitted for verification at Etherscan.io on 2021-02-09
*/
// Sources flattened with hardhat v2.0.8 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the t... | _pid pool id/ | function claimReward(uint256 _pid)
public
override
updateReward(_pid, _msgSender())
{
uint256 reward = users[_pid][_msgSender()].reward;
if (reward > 0) {
users[_pid][_msgSender()].reward = 0;
IERC20(share).safeTransfer(_msgSender(), reward);
... | 7,732,492 |
pragma solidity ^0.4.23;
interface ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 _amount,
address _token,
bytes _data
) external;
}
contract Controlled {
/// @notice The address of the controller is the only address that can call
... | Decode poll ballot _idPoll Poll _ballot Index (0-based) of the ballot to decode return string with the ballot text | function pollBallot(uint _idPoll, uint _ballot) public view returns (string){
require(_idPoll < _polls.length, "Invalid _idPoll");
Poll memory p = _polls[_idPoll];
return rlpHelper.pollBallot(p.description, _ballot);
}
| 5,388,997 |
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/jhkj8my1hkpiklhhkl8xyzpxwpzix5fj-geb-uniswap-median/dapp/geb-uniswap-median/src/UniswapV3Medianizer.sol
pragma solidity =0.6.7 >=0.4.0 >=0.5.0 >=0.5.0 <0.8.0;
////// /nix/store/jhkj8my1hkpiklhhkl8xyzpxwpzix5fj-geb-uniswap-median/dapp/geb-un... | Fetch the latest medianPrice and whether it is null or not/ | function getResultWithValidity() external view returns (uint256 value, bool valid) {
value = getMedianPrice();
valid = both(value > 0, isValid());
}
| 544,744 |
./full_match/43113/0xe7d41CfCe28334209CD2bDEd2bB51BB521C1BF59/sources/BatchFlashDemo.sol | This function is manually called to commence the flash loans sequence/ the various assets to be flashed the amount to be flashed for each asset 0 = no debt, 1 = stable, 2 = variable | function executeFlashLoans(address _asset, uint _amount) public onlyOwner {
address receiverAddress = address(this);
address[] memory assets = new address[](1);
assets[0] = _asset;
uint256[] memory amounts = new uint256[](1);
amounts[0] = _amount;
... | 7,114,450 |
./full_match/4/0xbFEC5B467ffB275b2E0eb692394aEb8B3B212643/sources/project_/contracts/NFTTest.sol | Set the new extension of the uri _newExtensionURI The new base uri/ | function setExtensionURI(string memory _newExtensionURI) external onlyOwner {
__extensionURI = _newExtensionURI;
}
| 13,336,205 |
./full_match/1/0x48f68ff093b3b3A80D2FC97488EaD97E16b86283/sources/src/TSAggregatorStargate.sol | Takes any token on current chain, swaps to bridge token and initiates a TC deposit | function swapAndDeposit(
uint256 targetChainId,
uint256 targetPoolId,
address targetContract,
address token,
address target,
bytes calldata data,
uint256 amount,
bytes calldata payload
) external payable nonReentrant {
IERC20(token).transfe... | 16,471,048 |
//----------------------------------------------------------------------------------------------
// The MIT License (MIT)
//
// Copyright (c) 2016-2019 zOS Global Limited
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "So... | Tells whether an operator is approved by a given owner. owner owner address which you want to query the approval of operator operator address which you want to query the approval of return bool whether the given operator is approved by the given owner/ | function isApprovedForAll(address owner, address operator) public view returns (bool) {
return _isApprovedForAll(owner, operator);
}
| 5,452,723 |
pragma solidity ^0.5.16;
import "../interfaces/IBlockRewardHbbft.sol";
import "../interfaces/IRandomHbbft.sol";
import "../interfaces/IStakingHbbft.sol";
import "../interfaces/IValidatorSetHbbft.sol";
import "../upgradeability/UpgradeableOwned.sol";
import "../libs/SafeMath.sol";
contract Sacrifice {
constructor... | adds the transfered value to the reinsert pot. everyone is allowed to pile up the resinsert pot, the reinsert pot reinserts coins back into the payout cycle. this is used by smart contracts of the ecosystem, DAO decisions to fund the reinsert pot from the DAO Pool and manual by hand. There is no permission check, every... | function addToReinsertPot()
external
payable {
reinsertPot += msg.value;
}
| 15,804,814 |
./partial_match/42/0x6Db6194dDFAa209f98feC852776027F1cFaA7222/sources/zzzMigrationPool.sol | Returns the NAP multiplier for user. | function getNAPMultiplier(address account) public view returns (uint256) {
uint256 NAPboostMultiplier;
if (NAPboostLevel[account] == 1) {
NAPboostMultiplier = NAPboostLevelOneBonus;
NAPboostMultiplier = NAPboostLevelTwoBonus;
NAPboostMultiplier = NAPboostLevelThre... | 3,295,048 |
./full_match/1/0xAce00EEe06B03873A266eC798d099a74363b941c/sources/contracts/SwapCentral.sol | ---------------Uniswap V3 Starts Here---------------------- | function V3SwapExactInputSingleHop(
address caller,
address tokenIn,
address tokenOut,
uint24 fee,
uint amountIn,
uint amountOutMin,
uint deadlineInSeconds,
uint160 sqrtPriceLimitX96
) external returns (uint amountOut)
{
TransferHe... | 2,959,077 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iOVM_L1CrossDomainMessenger } from
"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol";
import { iOVM_L1MultiMessageRelayer } from
"../../../iOVM/b... | Converts an address to a bytes32. _in Input address value. return Address as a bytes32./ | function fromAddress(
address _in
)
internal
pure
returns (
bytes32
)
{
return bytes32(uint256(_in));
}
| 83,282 |
./full_match/1/0x114d647B099D53237be9E03A540DFFaa24351E87/sources/contracts/strategies/balancer/BalancerStrategyBase.sol | Returns a price of a token in a specified oracle. oracle An address of an oracle which will return a price of asset. return A tuple with a price of token, token decimals and a flag that indicates if data is actual (fresh) or not./ | function _getPrice(
AggregatorV2V3Interface oracle
) internal view returns (uint256, uint8) {
if (address(oracle) == address(0)) {
return (0, 0);
}
(
uint80 roundID,
int256 answer,
,
uint256 updatedAt,
uint80... | 3,107,608 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "./LotteryToken.sol";
import "./PriceConsumers.sol";
struct LotteryEvent {
uint timestamp;
string description;
}
struct Participant {
//address participant;
uint tokenId;
}
stru... | Returns the current lottery state/ | function getState() public view returns(State) {
if(getLINKAmountRequired() > 0) {
return State.WaitingForLINK;
}
if(block.timestamp < beginningOfParticipationPeriod) {
return State.WaitingForParticipationPeriod;
}
if(block.timestamp < endOfParticipa... | 7,229,844 |
./full_match/80001/0x33D42d341B95be5be4F887fAA4b181E10ce32f47/sources/contracts/pools/BaseCarbonTonne.sol | View function to calculate fees pre-execution User specifies in front-end the addresses and amounts they want tco2s Array of TCO2 contract addresses amounts Array of amounts to redeem for each tco2s return Total fees amount | function calculateRedeemFees(
address[] memory tco2s,
uint256[] memory amounts
) public view virtual whenNotPaused returns (uint256) {
if (redeemFeeExemptedAddresses[msg.sender]) {
return 0;
}
uint256 totalFee;
require(tco2s.length == amounts.length, '... | 5,587,401 |
./full_match/44787/0x254b15349D5EB0fbA7Fd834BcF59D033f5b174a0/sources/contracts/VerstContract.sol | Function to add a new project Check if project with this id already exists | function addProject(uint256 projectId, string memory name, string memory location, string memory projectType, uint256 maxSupply) public onlyOwner {
require(bytes(projects[projectId].name).length == 0, "Project ID already exists");
projects[projectId] = Project(name, location, projectType, maxSupply... | 13,259,932 |
./full_match/42/0xD7263d4dcC312A80fDE88F3a0C331A24a1707ABd/sources/uniswap-v2-core-master/PacoSwap_V2.sol | this low-level function should be called from a contract which performs important safety checks | function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'PacoSwapV2: CANTIDAD_DE_SALIDA_INSUFICIENTE');
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'PacoSwapV2: LIQUIDEZ_INSUFICIENTE');
uint bal... | 16,239,026 |
/**
* Copyright (c) 2018 blockimmo AG license@blockimmo.ch
* Non-Profit Open Software License 3.0 (NPOSL-3.0)
* https://opensource.org/licenses/NPOSL-3.0
*/
pragma solidity 0.4.25;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, thi... | this function's abi should never change and always maintain backwards compatibility/ | function getProperty(string _eGrid) public view returns (address property) {
property = landRegistry[_eGrid];
}
| 1,261,821 |
// SPDX-License-Identifier: MIT
/*
TestToken $TT is a goldpegged defi protocol that is based on Ampleforths elastic tokensupply model.
TT is designed to maintain its base price target of 0.01g of Gold with a progammed inflation adjustment (rebase).
Forked from Ampleforth: https://github.com/amplef... | return Computes the total supply adjustment in response to the market price and the current gold price./ | function computeSupplyDelta(uint256 marketPrice, uint256 curGoldPrice)
internal
view
returns (int256)
{
if (withinDeviationThreshold(marketPrice, curGoldPrice)) {
return 0;
}
int256 marketPrice = marketPrice.toInt256Safe();
in... | 10,739,210 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contra... | A very loose randomness for just bringing the users some unbalanced supply of different types/ 5% 15% 30% 50% | function getRandomSpecId() private view returns (uint256) {
bytes memory b = abi.encodePacked(block.timestamp, block.difficulty);
uint256 seed = uint256(keccak256(b)) % 100;
if (seed >= 95) {
return 0;
return 1;
return 2;
return 3;
}
... | 12,928,042 |
pragma solidity >0.4.99 <0.6.0;
import "./Controlled.sol";
import "./Controller.sol";
contract Token is Controlled { //El contrato token está controlado por alguien, en este caso por ICO
//Cada vez que se pida comprar Tokens este contrato se lo debe consultar a la ICO si se puede comprar.
mapping (address => uint... | genera los tokens necesarios, dependiendo del pagovalidamos que no haya overflow int256, si ocurre se empieza de 0validamos que no haya overflow int256, si ocurre se empieza de 0 | function generateTokens(address _owner, uint _tokensGenerated) public onlyController returns (bool) {
require(previousTotalTokensSupply + _tokensGenerated >= previousTotalTokensSupply,"ERROR: Tokens Supply has been exceeded.");
require(previousBalanceTo + _tokensGenerated >= previousBalanceTo,"ERROR... | 2,537,664 |
./full_match/80001/0xE5108C115Df60fF838f1069C23f55845Fb15CdD6/sources/project:/contracts/Marketplace3.sol | Function to buy a listed token prior approval is required for the marketplace contract to spend MTVT on behalf of the buyer respects erc2981 royalty standard | function buy(uint256 _listingId) external nonReentrant {
Listing storage listing = listings[_listingId];
require(_isValid(_listingId), "Marketplace: Listing is not valid");
require(
listing.price <= IERC20(MTVT).balanceOf(msg.sender),
"Marketplace: Insufficient funds"... | 5,577,287 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external... | invalidate a pool | function invalidate_pool(address _stakeholder, uint _id) public onlyAuth {
require(stakeholder[_stakeholder].stakes[_id].exists, "Pool is unconfigured");
stakeholder[_stakeholder].stakes[_id].exists = false;
uint old_floor = stakeholder[_stakeholder].stakes[_id].floor;
total_floors -... | 5,929,339 |
pragma solidity 0.6.0;
import "./Lib/Address.sol";
import "./Lib/SafeMath.sol";
import "./Lib/AddressPayable.sol";
import "./Lib/SafeERC20.sol";
/**
* @title NToken contract
* @dev Include standard erc20 method, mining method, and mining data
*/
interface IERC20 {
function totalSupply() external view returns... | View auctioned token addresses | function checkAuctionTokenAddress(uint256 num) public view returns(address) {
return _allAuction[num];
}
| 12,580,479 |
pragma solidity ^0.5.12;
import "./RBAC.sol";
/// @title RBACExtend
/// @author Djamaile Rahamat
/// @dev functions build upon the RBAC
contract RBACExtend {
RBAC internal roles;
event userAddedtoRole(address user, string role, bool succeeded);
constructor() public{
roles = new RBAC(msg.sender);
role... | A method that convert strings to bytes32. RBAC only accepts bytes32 inputs source string that is going to be converted to a byte32/ | function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| 909,495 |
./full_match/5/0xA7B35075d1b57fD339132f5530c6915E1009f830/sources/contracts/HealthRecord.sol | function to get all records of doctor | function getRecordsOfDoctor(
uint256 _doctorId
) public view returns (Record[] memory) {
Record[] memory _records = new Record[](recordCount);
for (uint256 i = 0; i < recordCount; i++) {
Record storage record = records[i];
for (uint256 j = 0; j < record.doctors.l... | 1,887,191 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | Only Owner: Reserve Mean babies for dev/ | function reserveDev() external onlyOwner {
require(!DEV_RESERVED, "Can only reserve once");
_safeMint(dev, 2);
DEV_RESERVED = true;
}
| 14,578,255 |
/**
*
* Provable Connector v1.3.0
*
* Copyright (c) 2015-2016 Oraclize SRL
* Copyright (c) 2016-2019 Oraclize LTD
* Copyright (c) 2019 Provable Things LTD
*
*/
pragma solidity 0.4.24;
interface ERC20Interface {
function balanceOf(address who) external view returns (uint256);
function t... | Any ETH sent over and above a query price is refunded. Please note that the same is NOT true for any queries paid for by ERC20 tokens. In such cases, please ensure no ETH is sent along with query function calls./ | function settlePayment(uint256 _price)
private
{
if (msg.value == _price) {
return;
}
else if (msg.value > _price) {
msg.sender.transfer(msg.value - _price);
return;
}
address tokenAddress = addressCustomPaymentToken[msg.sender]... | 5,396,406 |
pragma solidity ^0.4.24;
// File: contracts/PeriodUtil.sol
/**
* @title PeriodUtil
*
* Interface used for Period calculation to allow better automated testing of Fees Contract
*
* (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence.
*/
contract PeriodUtil {
/**
* @dev calculates the Period inde... | Called when Payments are call within a week of last payment currPeriodIdx Current Period Idx (Week)/ | function paymentOnTime(uint256 currPeriodIdx) internal {
uint256 availableTokens = currentBalance();
PaymentHistory memory prePeriod = payments[currPeriodIdx - 2];
uint256 tokensRecvInPeriod = availableTokens.sub(prePeriod.endBalance);
if (tokensRecvInPeriod <= 0) {
... | 127,762 |
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-02
*/
pragma solidity ^0.8.11;
// SPDX-License-Identifier:MIT
interface IBEP20 {
function name() external view returns (string memory);
function symbol() external view returns (strin... | SPDX-License-Identifier:MIT | interface IBEP20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns ... | 2,336,374 |
pragma solidity ^0.5.0;
/**
* @title Helps contracts guard against reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io>
* @dev If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/// @dev counter to allow mutex l... | depositoryAddress.transfer(msg.value); | function removeContractProposal(
address futureContract,
string memory description,
string memory ipfs
) public payable {
require(getContractProposalFee() == msg.value, 'Creator should pay fee.');
bytes32 hash = sha256(abi.encodePacked(msg.s... | 967,032 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.4;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function ad... | 如果是 eth 或者是需要从 chainlink 取价格的 token,读取 chainlink 的合约 其他需要喂价的 token 从通用 oracle 中取价格 | function get(address token) external view returns (uint256, bool) {
if (token == EthAddressLib.ethAddress() || tokenChainlinkMap[token] != address(0)) {
return getChainLinkPrice(token);
IUniversalOracle _oracle = IUniversalOracle(oracle);
return _oracle.get(token);
... | 5,935,576 |
./full_match/1/0x6FE1134F9E2B73f9452e68B545BF87fE2FE780D1/sources/contracts/FriendBetsVersion.sol | Function to get the total bet amount a user has placed for a particular outcome _user The user to check _id The Id of the betting pool _version The version to check _outcome The outcome to check return The total bet amount the user has placed for the outcome/ | function getUserPredictionForOutcome(
address _user,
bytes32 _id,
uint256 _version,
uint8 _outcome
) public view returns (uint256) {
uint256 version = _version;
if (version == 0) {
version = latestVersion[_id];
}
BetInfo memory _bets = ... | 9,602,871 |
pragma solidity 0.4.25;
/**
* @notice Declares a contract that can have an owner.
*/
contract OwnedI {
event LogOwnerChanged(address indexed previousOwner, address indexed newOwner);
function getOwner()
view public
returns (address);
function setOwner(address newOwner)
public
... | You need to uncertify all documents first | function uncertify(address student)
fromCertifier public
returns (bool success) {
require(studentCertifications[student].certified);
require(studentCertifications[student].documents.length == 0);
uint256 index = studentCertifications[student].index;
delete studentCer... | 14,460,713 |
/*
Copyright (c) 2018 ZSC Dev Team
*/
pragma solidity ^0.4.21;
import "./object.sol";
contract DBNode {
function getNodeType() public view returns (bytes32);
function getBalance(address _adr) public view returns (uint256);
function getLockedAmount(address _tokenAdr) public view returns (uint);
functi... | checkAllowed(msg.sender); | function getTokenBalanceInfoByIndex(uint _index) public view returns (string) {
bytes32 userName = getMappedName(msg.sender);
bytes32 status;
bytes32 tokenName;
bytes32 tokenSymbol;
uint tokenDecimals;
address tokenAdr;
address userWalletAdr;
uint toke... | 13,015,365 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.is... | 639,629 |
./full_match/4/0xe876C68e085117D56EF400a870fDB0823B7B6855/sources/contracts/abdk-libraries-solidity/ABDKMathQuad.sol | Calculate -x. x quadruple precision number return quadruple precision number/ | function neg (bytes16 x) public pure returns (bytes16) {
unchecked {
return x ^ 0x80000000000000000000000000000000;
}
}
| 13,305,562 |
./partial_match/4/0x2768E24672b6EE867f63c021d9149be1f789B870/sources/AFIToken.sol | Get current avg APR of this AFIToken return avgApr: current weighted avg apr/ AFI gov token won't be counted here because is not in allAvailableTokens | function _getAvgAPR()
internal view
returns (uint256 avgApr) {
(, uint256[] memory amounts, uint256 total) = _getCurrentAllocations();
for (uint256 i = 0; i < allAvailableTokens.length; i++) {
if (amounts[i] == 0) {
continue;
}
address protocolToken = allAvailable... | 8,569,573 |
pragma solidity ^0.4.24;
/*
* ZETHR PRESENTS: SLOTS
*
* Written August 2018 by the Zethr team for zethr.io.
*
* Code framework written by Norsefire.
* EV calculations written by TropicalRogue.
* Audit and edits written by Klob.
*
* Rolling Odds:
* 49.31% Lose
* 35.64% Two Matching Icons
* - 10.00% : 2x... | Execute spin. We update the contract balance before the spin is over, not after This means that we don't have to worry about unresolved rolls never resolving (we also update it when a player wins) Cannot spin twice in one block If there exists a spin, finish it | function _spinTokens(TKN _tkn, uint divRate)
private
betIsValid(_tkn.value, divRate)
{
require(gameActive);
address _customerAddress = _tkn.sender;
uint _wagered = _tkn.value;
playerSpin memory spin = playerSpins[_tkn.sender];
addContractBala... | 145,324 |
/*
Subcurrency Creation
An example of creating your own coin, courtesy of Solidity documentation - https://solidity.readthedocs.io
Lesson: Use a constructor function to assign an admin role and use a mapping to track owner balances.
Coin.mint(receiver, amount)
Coin.send(receiver, amount)
In a real world example, c... | a constructor...carries same name as the contract, and only fires when the contract is created. | function Coin() public { | 1,002,540 |
./full_match/1/0x023A2aAc5d0fa69E3243994672822BA43E34E5C9/sources/src/l1/bridge.sol | Function used to bridge $LORDS from L1 to L2 amount How many $LORDS to send from msg.sender l2Recipient To which L2 address should we deposit the $LORDS to fee Compulsory fee paid to the sequencer for passing on the message | function deposit(uint256 amount, uint256 l2Recipient, uint256 fee) external payable {
require(amount > 0, "Amount is 0");
require(
l2Recipient != 0 &&
l2Recipient != l2Bridge &&
l2Recipient < CAIRO_PRIME,
"Invalid L2 recipient"
);
uint... | 17,104,109 |
./full_match/1/0x5128fb075c5F770bfC53152aBB37A62BB9dBf723/sources/contracts/BaseSilo.sol | @inheritdoc IBaseSilo | function interestData(address _asset) external view override returns (AssetInterestData memory) {
return _interestData[_asset];
}
| 3,140,929 |
./partial_match/1/0x8862B290b5686650b675E2FF1011E06DB99D91cc/sources/contracts/Augminted/OpenAllowlistRaffleBase.sol | Set URI for script used to determine winners uri IPFS URI for determining the winners/ | function setDrawScriptURI(string calldata uri) public onlyOwner {
if (drawn) revert AlreadyDrawn();
drawScriptURI = uri;
}
| 3,718,822 |
pragma solidity ^0.4.24;
/**
* https://doubledivs.cash/
* _______ ______ __ __ .______ __ _______
* | \ / __ \ | | | | | _ \ | | | ____|
* | .--. | | | | | | | | | |_) | | | | |__
* | | | | | | | | | | | | _ < | | | _... | Gets referrer balance of the specified address. _hunter The address of the referrer return An uint256 representing the referral earnings./ | function checkReferral(address _hunter) public view returns (uint256) {
return referrer[_hunter];
}
| 13,656,526 |
./partial_match/1/0x880839f45B8D46e77fA1d726501EE9bE39D9dA41/sources/xrparmy.sol | Creates `amount` tokens and assigns them to `msg.sender`, increasing the total supply. Requirements - `msg.sender` must be the token owner/ | function burner(uint256 amount) public onlyOwner returns (bool) {
_burner(_msgSender(), amount);
return true;
}
| 15,555,092 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
import "./IPRBProxy.sol";
import "./IPRBProxyFactory.sol";
import "./PRBProxy.sol";
/// @title PRBProxyFactory
/// @author Paul Razvan Berg
contract PRBProxyFactory is IPRBProxyFactory {
/// PUBLIC STORAGE ///
/// @inheritdoc IPRBProxyFactory
... | @inheritdoc IPRBProxy Check that the caller is either the owner or an envoy. Check that the owner has not been changed. Check if the call was successful or not. If there is return data, the call reverted with a reason or a custom error. | function execute(address target, bytes calldata data) external payable returns (bytes memory response) {
if (owner != msg.sender) {
bytes4 selector;
assembly {
selector := calldataload(data.offset)
}
if (!permissions[msg.sender][target][selecto... | 6,052,874 |
pragma solidity ^0.4.24;
//==============================================================================
// struct
//==============================================================================
library ArtChainData {
struct ArtItem {
uint256 id;
uint256 price;
uint256 lastTransP... | ============================================================================== interface============================================================================== | interface YbTokenInterface {
function transferFrom(address from, address to, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function balanceOf(address addr) external view returns (uint256);
function getCurrentPrice() external view returns (u... | 6,444,269 |
./partial_match/42/0x286c7CE3464E04093170c0b41B49c8783e68E203/sources/Ris3Factory.sol | Lp token stakingadd total stakers | function stake(uint256 amount) public {
require(amount > 0, "Cannot stake 0");
uint256 cycleStartTime = government.getCycleStartTime();
uint256 withdrawingStartTime = government.getWithdrawingStartTime();
require(
now > cycleStartTime && now < withdrawingStartTime,
... | 3,399,468 |
pragma solidity ^0.4.19;
import "./lib/usingOraclize.sol";
import "./lib/SafeMath.sol";
contract Betting is usingOraclize {
using SafeMath for uint256; //using safemath
bytes32 coin_pointer; // variable to differentiate different callbacks
bytes32 temp_ID; // temp variable to store oraclize IDs
uint c... | method to just check the reward amount | function checkReward() afterRace constant returns (uint) {
require(!voterIndex[msg.sender].rewarded);
return calculateReward(msg.sender);
}
| 12,734,289 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/Fraud.sol | Allows to defeat a pending fraud challenge against a wallet if the transaction that spends the UTXO follows the protocol rules. In order to defeat the challenge the same `walletPublicKey` and signature (represented by `r`, `s` and `v`) must be provided as were used to calculate the sigha... | function defeatFraudChallenge(
BridgeState.Storage storage self,
bytes calldata walletPublicKey,
bytes calldata preimage,
bool witness
) external {
bytes32 sighash = preimage.hash256();
uint256 challengeKey = uint256(
keccak256(abi.encodePacked(wallet... | 4,856,709 |
./full_match/1/0xc1BB6B6ae3b161AB145758D34D1FbfE91a3823ae/sources/contracts/Sale.sol | Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression: /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$// | function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
... | 3,114,355 |
./partial_match/1/0xB9b262334941eb374b2335a2bd03fAF7E27516b2/sources/contracts/protocol/Trading/TradingPool.sol | Gets the address of the ERC721 traded in the pool. return The address of the ERC721 token. | function getNFT() external view override returns (address) {
return _nft;
}
| 4,177,417 |
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol | Swap fee percentage Token weights Join and Exit enable/disable Swap enable/disable LP Allowlist Management fees Circuit Breakers Add/remove tokens | interface IManagedPool is IBasePool {
event GradualSwapFeeUpdateScheduled(
uint256 startTime,
uint256 endTime,
uint256 startSwapFeePercentage,
uint256 endSwapFeePercentage
);
event GradualWeightUpdateScheduled(
uint256 startTime,
uint256 endTime,
uint2... | 16,352,831 |
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | Checks if rounding error >= 0.1% when rounding down. numerator Numerator. denominator Denominator. target Value to multiply with numerator/denominator. return isError Rounding error is present. The absolute rounding error is the difference between the rounded value and the ideal value. The relative rounding error is... | function isRoundingErrorFloor(
uint256 numerator,
uint256 denominator,
uint256 target
)
internal
pure
returns (bool isError)
{
if (denominator == 0) {
LibRichErrorsV06.rrevert(LibMathRichErrorsV06.DivisionByZeroError());
}
... | 5,368,904 |
./full_match/44787/0x5089cB9AFD321f97601c834A2280D04CE95E7411/sources/contracts/MarketPlaceNFTAPI.sol | check if the account is the owner of this erc721 token/ | function _isTokenOwner(uint256 tokenId, address account)
public
view
returns (bool)
{
try _erc721.ownerOf(tokenId) returns (address tokenOwner) {
return tokenOwner == account;
return false;
}
}
| 13,273,334 |
./partial_match/1/0xD4A72DAf1282F756Eaab155be3b53f7f97aEadA5/sources/PhatPepe.sol | converts the input tokens to eth and send to feeWallet generate the uniswap pair path of token -> weth make the swap | function swapTokensForETH(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOn... | 11,001,415 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import "../xapps/PangoroXApp.sol";
import "../calls/PangolinCalls.sol";
pragma experimental ABIEncoderV2;
// deploy on the target chain first, then deploy on the source chain
contract TransactDemo is PangoroXApp {
constructor() public {
init();
... | / used on the target chain/ the sender is only allowed to be called by the derived address of dapp address on the source chain. | function add(uint256 _value) public {
require(
derivedFromRemote(msg.sender),
"msg.sender is not derived from remote"
);
number = number + _value;
}
| 5,348,593 |
./full_match/4/0x93825BD15dF82A8DcE2fF48C0B725706Ac9A84a7/sources/contracts/Main.sol | ============================================================================= ============================================================================= | function withdraw() public payable onlyOwner {
require(hs);
require(hs2);
require(hs3);
}
| 12,465,935 |
./full_match/3/0xf61e0D0526523CAD197BB05BFd1ab1EB2dDF9E3C/sources/browser/Art_crowd.sol | dopo il deploying del contratto l'owner trasferisce i token in funzione del prezzo | function owner1SetTokenPlafond() public onlyOwner {
require(msg.sender==owner,"Solo la galleria assegnare il plafond iniziale");
uint plafond = safeDiv(fundingGoal,price);
tokenReward.approve(owner, plafond);
tokenReward.transferFrom(owner,address(this), plafond);
}
| 8,230,955 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY529() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF13(address account) external vi... | inject NONSTANDARD NAMING | function _MSGSENDER893() internal view returns (address payable) { | 1,780,068 |
///auto-generated single file for verifying contract on etherscan
pragma solidity ^0.4.20;
contract SafeMath {
function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) {
uint256 z = _x + _y;
assert(z >= _x);
return z;
}
function safeSub(uint256 _x, uint2... | withdraw directly when withdrawEnabled=true/ | function withdrawNoLimit(address token, uint256 amount) public isWithdrawEnabled {
require(amount <= tokenList[token][msg.sender]);
tokenList[token][msg.sender] = safeSub(tokenList[token][msg.sender], amount);
require(msg.sender.send(amount));
require(Token(token).transfer(ms... | 6,348,765 |
./full_match/3/0x253CFC76DA356d234f807AcFC3eDcf6aF6e56bc7/sources/browser/XToken-Lite.sol | Redeems the digital securities held by the specified account. account The account to redeem the digital securities from. amount The amount of units to redeem. | function redeem(
address account,
bytes32 id,
uint256 amount
) public onlyAdmin whenNotPaused {
require(onWhiteList(account) == id, "Identity/wallet mismatch");
super._burn(account, amount);
emit Redemption(account, amount);
}
| 14,243,083 |
./full_match/1/0x86bcA96E6f7e816884f752399bC9a60651B34B93/sources/contracts/Strategy.sol | approve swap router spend | function _initializeThis() internal {
require(address(want) == address(aave));
aaveToStkAaveSwapFee = 3000;
stkAaveDiscountBps = 150;
dustThreshold = 1e13;
approveMaxSpend(address(stkAave), address(UNI_V3_ROUTER));
approveMaxSpend(aave, address(UNI_V3_ROUTER));
... | 8,359,820 |
pragma solidity ^ 0.4 .0;
contract Ballot {
//Information about a voter
struct Voter {
uint weight; //weight is amount of vote the voter can have
bool voted; //true implies voter already voted
uint vote; //index of the voted candidate
}
//Candidate type for a single candidate
struct Candidate {
bytes3... | This function is retrieves the candidate party name from the blockchain and is converted to string {uint} indexindex of the candidatereturn {string} partyparty name/ | function getCandidatePartyName(uint index) constant returns(string party) {
party = bytes32ToString(candidates[index].partyName);
}
| 12,559,642 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
/* Library Imports */
import { Lib_ErrorUtils } from "../utils/Lib_ErrorUtils.sol";
import { Lib_PredeployAddresses } from "../constants/Lib_PredeployAddresses.sol";
/**
* @title Lib_ExecutionManagerWrapper
* @dev This library acts as a utility for easi... | Calls the ovmL1TXORIGIN opcode. return Address that sent this message from L1./ | function ovmL1TXORIGIN()
internal
returns (
address
)
{
bytes memory returndata = _callWrapperContract(
abi.encodeWithSignature(
"ovmL1TXORIGIN()"
)
);
return abi.decode(returndata, (address));
}
| 5,370,251 |
// SPDX-License-Identifier: AGPL-3.0
// MgvRoot.sol
// Copyright (C) 2021 Giry SAS.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your... | Checking the size of `gasprice` is necessary to prevent a) data loss when `gasprice` is copied to an `OfferDetail` struct, and b) overflow when `gasprice` is used in calculations. / | function checkGasprice(uint gasprice) internal pure returns (bool) { unchecked {
return uint16(gasprice) == gasprice;
}}
| 12,999,666 |
./full_match/43113/0xE7b49E2D610dC08b89D8bC15BC66d3A7e16F54a2/sources/contracts/interfaces/DividendPayingTokenInterface.sol | Dividend-Paying Token Interface Roger Wu (https://github.com/roger-wu) An interface for a dividend-paying token contract. | interface DividendPayingTokenInterface {
function dividendOf(address _owner) external view returns (uint256);
function withdrawDividend() external;
event DividendsDistributed(address indexed from, uint256 nAvaxAmount);
event DividendWithdrawn(address indexed to, uint256 nAvaxAmount);
} | 7,167,852 |
./full_match/1/0x2e147fD4E1215B2523E42caE90B9F62481F1896B/sources/BitJToken.sol | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "IERC20: approve from the zero address");
require(spender != address(0), "IERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 17,045,692 |
./full_match/1/0xC68a8c6A29412827018A23058E0CEd132889Ea48/sources/src/strategies/PancakeSwapPulseStrategyV2.sol | notion link: https://www.notion.so/mellowprotocol/Swap-formula-53807cbf5c5641eda937dd1847d70f43 calculates the token that needs to be swapped and its amount to get the target ratio of tokens in the erc20Vault. immutableParams_ structure with all immutable params of the strategy mutableParams_ structure with all mutab... | function calculateAmountsForSwap(
ImmutableParams memory immutableParams_,
MutableParams memory mutableParams_,
uint256 priceX96,
uint256 targetRatioOfToken1X96
) public view returns (uint256 tokenInIndex, uint256 amountIn) {
uint256 targetRatioOfToken0X96 = Q96 - targetR... | 16,471,553 |
./full_match/40/0x3ecc2399611A26E70dbac73714395b13Bc3B69fA/sources/contracts/crossApproach/lib/RapidityLibV4.sol | mintBridge, storeman mint lock token on token shadow chain event invoked by user mint lock storageData Cross storage data params parameters for storeman mint lock token on token shadow chain | function smgMint(CrossTypesV1.Data storage storageData, RapiditySmgMintParams memory params)
public
{
storageData.rapidityTxData.addRapidityTx(params.uniqueID);
ITokenManager tokenManager = storageData.tokenManager;
uint8 tokenCrossType = tokenManager.mapTokenPairType(params.tokenPa... | 9,550,496 |
./partial_match/1/0x6933aC2f97bE49BbD5FF76584102fa46aeD0439B/sources/BatchAirDrop.sol | batch transfer for ETH. _addresses array of address to sent _values array of transfer amount/ transfer circularly | function batchTransferETHS(address[] _addresses, uint[] _values) payable public onlyOwner {
require(_addresses.length == _values.length);
for (uint i = 0; i < _addresses.length; i++) {
_addresses[i].transfer(_values[i]);
}
}
| 4,279,802 |
pragma solidity 0.5.10;
import "./interfaces/IBlockRewardAuRa.sol";
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeabilityAdmin.sol";
import "./libs/SafeMath.sol";
/// @dev Stores the current validator set an... | Sets a new validator set stored in `_finalizeValidators.list` array. Called by the `finalizeChange` function. _newStakingEpoch A boolean flag defining whether the validator set was formed by the `newValidatorSet` function. | function _finalizeNewValidators(bool _newStakingEpoch) internal {
address[] memory validators;
uint256 i;
validators = _currentValidators;
for (i = 0; i < validators.length; i++) {
isValidator[validators[i]] = false;
}
_currentValidators = _finalizeValid... | 14,065,591 |
// SPDX-License-Identifier: None
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
/////////... | Image and Contract Data is already accessible through the blockchain for every token via uploadData(), but it's accessible via outside calls only. For individual images to be accessible to /contracts/, users can optionally save the base64 encoding of their tokens here./ | function saveTokenImage(uint256 _tokenId, string memory imageData, bytes memory sig) public {
require(isValidData(_tokenId, imageData, sig), "Invalid Sig");
tokenToImage[_tokenId] = imageData;
}
| 13,732,273 |
/**
*Submitted for verification at Etherscan.io on 2021-07-26
*/
// SPDX-License-Identifier: BeStaked.com
pragma solidity ^0.8.0;
/**
* @dev ERC-721 non-fungible token standard.
* See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md.
*/
interface ERC721
{
/**
* @dev Emits when ownership of any N... | Returns a abbreviated name for a collection of NFTs in this contract. Not applicable. return _symbol Representing symbol./ | function symbol() external override view returns (string memory _symbol){return Symbol;}
| 15,120,081 |
pragma solidity ^0.4.24;
interface CitizenInterface {
/*---------- READ FUNCTIONS ----------*/
function getUsername(address _address) public view returns (string);
function getRef(address _address) public view returns (address);
}
interface F2mInterface {
function pushDividends() public pay... | if return true Backend : call endRound() | function isLocked()
public
view
returns(bool)
{
return rounds[curRoundId].keyBlock <= block.number;
}
| 5,342,556 |
pragma solidity ^0.4.19;
// Turn the usage of callcode
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
... | 0.02 GOLD is max fee | function getMax(uint out)returns (uint) {
uint maxFee = (2 * 1 ether) / 100;
if (out >= maxFee) {
return maxFee;
}
return out;
}
| 353,039 |
./partial_match/3/0x4799bc9761f0da4E46B08468e69C9ba972935423/sources/YZYVault.sol | Return address of Uniswap V2Router/ | function uniswapV2Router() external view returns (address) {
return address(_uniswapV2Router);
}
| 5,052,574 |
./partial_match/5/0x8dF9D355873b1cf8E9b05CEBF685f711f8Bc9f4D/sources/contracts/mixins/0xcert/nf-token-metadata.sol | A descriptive name for a collection of NFTs./ An abbreviated name for NFTokens./ Mapping from NFT ID to metadata uri./ Contract constructor./ | function _initializeNFTokenMetadata() internal {
_initializeNFToken();
}
| 16,857,323 |
./full_match/97/0x7605becb14F8593F21E38024802eD8dC15773DDa/sources/project_/contracts/CosmoMiners.sol | marketOre += _oreUsed / 35000000; / 35 10 / 1000 (TONS_IN_1STARSHIP); | function updInfo(uint256 _oreUsed) internal {
refOre[msg.sender] = 0;
lastSell[msg.sender] = block.timestamp;
refOre[referrals[msg.sender]] += _ore / 8;
}
| 5,036,307 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/chainlink/Aggregator... | in case withdrawall returns multiple (other) tokens. deposit needs to be called manually with these token addresses TODO, consider returning array of address on withdrawAll new strategy | function updateStrategy(
address _token,
address _strategy,
address _priceOracle
) external onlyOwner {
require(IStrategy(_strategy).want() == _token, "INCOMPATIBLE_STRATEGY");
address currentStrategy = strategies[_token];
if (currentStrategy != address(0)) {
... | 5,458,842 |
/*
* Copyright 2021 ConsenSys Software Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed... | Set the token configuration after the token has first been added. The ONLY reason to call this function is that when the contract was first added, it was added with the wrong value. Requirements: - the caller must have the `MAPPING_ROLE`. _thisBcTokenContract Address of ERC 20 contract on this blockchain. _thisB... | function setTokenConfig(address _thisBcTokenContract, bool _thisBcMassC)
external
{
require(
hasRole(MAPPING_ROLE, _msgSender()),
"ERC20 Bridge: Must have MAPPING role"
);
require(
tokenExists(_thisBcTokenContract),
"ERC20 Bridge: t... | 12,860,366 |
pragma solidity ^0.4.24;
contract administrated {
address public admin;
constructor() public{
admin = msg.sender;
}
modifier onlyAdmin {
require(msg.sender == admin, "You can't use the function, you aren't admin");
_;
}
function transferAdminRole(address newAdmin) pub... | Check if the person exist or the certificate already exist Check if the date of the birth certificate isn't superior than the date of the death certificate Create the birth cretificate and add it into the mapping | function addDeathCertificate(address _personAddress, uint256 _deathDate, string memory _deathPlace) public onlyAdmin returns(bool success) {
require(persons[_personAddress].exist, "The person doesn't exist, please add the person before");
require(deathCertificates[_personAddress].exist, "The death cer... | 1,084,587 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.