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/5/0x423DBa410C9d51fae8C34aFF803fbe1a356845dD/sources/lib/dss-test/lib/dss-interfaces/src/dss/LerpAbstract.sol | https:github.com/makerdao/dss-lerp/blob/master/src/Lerp.sol | interface LerpAbstract {
function target() external view returns (address);
function what() external view returns (bytes32);
function start() external view returns (uint256);
function end() external view returns (uint256);
function duration() external view returns (uint256);
function done() exte... | 16,837,815 |
/*
Copyright 2021 Crosspoly ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IERC20} from "../../intf/IERC20.sol";
import {UniversalERC20} from "../../SmartRoute/lib/UniversalERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {Address... | require(!address(msg.sender).isContract(), "ONLY_ALLOW_EOA"); | function redeemTicket(uint256 ticketNum, address referer) external {
require(tx.origin == msg.sender, "ONLY_ALLOW_EOA");
require(ticketNum >= 1 && ticketNum <= balanceOf(msg.sender), "TICKET_NUM_INVALID");
_burn(msg.sender,ticketNum);
for (uint256 i = 0; i < ticketNum; i++) {
... | 12,711,999 |
./full_match/4/0x09A26F2A187DD9670C0C3b4EdB6FB62fb2cdFF1D/sources/masterlp.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "REGO::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return ... | 672,558 |
./full_match/80001/0xe61AE0294664234ce2d15237519036101c59f710/sources/project_/contracts/GreenFinancing.sol | update total burned for the property | function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory values
for (uint256 i = 0; i < ids.length; i++) {
Property storage property = properties[tokenIdToPropertyId[ids[i]]];
property.totalBurned++ ;
}
emit TokenBatchBurned(... | 5,557,313 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import "SafeERC20.sol";
import "Initializable.sol";
import "ERC20.sol";
import "UUPSUpgradeable.sol";
import {BoringOwnable} from "BoringOwnable.sol";
import {EIP1271Wallet} from "EIP1271Wallet.sol";
import {IVault, IAsset} from "IVault.sol";
import {NotionalTre... | make sure the order satisfies some pre-defined constraints Make sure anyone can fill these orders No fee recipient allowed MakerToken should never be WETH TakerToken (proceeds) should always be WETH No fees allowed Price oracle not defined Slippage limit not defined prettier-ignore make sure priceFloor is always 18 dec... | function _validateOrder(bytes memory order) private view {
(
address takerAddress,
address makerToken,
address takerToken,
address feeRecipient,
address senderAddress,
uint256 makerAmount,
uint256 takerAmount,
ui... | 10,330,444 |
./full_match/1/0xcDA39B74054EFFB230156f21b334E50295Ca8df4/sources/contracts/strategies/AaveFlashloanStrategy/AaveFlashloanStrategy.sol | Returns the `want` balance | function _balanceOfWant() internal view returns (uint256) {
return want.balanceOf(address(this));
}
| 9,603,145 |
./partial_match/42/0x087cf15B55835C87f36A1254E40ED40399033F00/sources/Traditional.sol | get the multiplier ceiling for percentage calculations. ---------------------------------------------------------- returns the multiplication factor./ | function getMultiplierCeiling() external pure returns (uint256) {
return _MULTIPLIER_CEILING;
}
| 3,300,511 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >=0.8.0;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
interface Oracle {
function getReportTimestampByIndex(bytes32 _queryId, uint256 _index)
external
view
returns (uint256);
... | _queryId is the ID for which the function returns the total tips. return Returns the current tips for a give query ID./ | function totalTip(bytes32 _queryId) public view returns (uint256) {
return oracle.getTipsById(_queryId);
}
| 14,575,739 |
//Address: 0x7Ab031CDFA4972FaD12f74a04f9CD8959b484AF1
//Contract name: B2Lab_TokenPlus
//Balance: 0 Ether
//Verification Date: 4/5/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.21;
/*
* Developed by B2Lab, 2018
* Smart Contract for Token+ (labeled tokens) and Identity Management
* Version 1... | Params: address Return: True (if the address is enabled) or False (otherwise)/ | function isIdentity(address _sender) public view returns(bool){
return identities[_sender].isEnabled;
}
| 2,515,576 |
pragma solidity >=0.4.22 <0.7.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Bitchan.sol";
contract TestBitchan{
address acc0;
uint id0;
string username0;
string ownerUsername;
uint256 public feeCreateThread;
uint256 public feeReplyPost;
Bitchan... | Assert.equal(feeCreateThread, bitchan.feeCreateThread, "0 posts originally"); | function testCreateThreadCreatesCreateThread() public {
}
| 2,478,961 |
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./ValidatorProxy.sol";
import "./interfaces/INodeOperatorRegistry.sol";
import "./interfaces/IValidatorProxy.sol";
import "./interface... | set contract version. | function setVersion(string memory _version) external onlyOwner {
version = _version;
}
| 373,636 |
/**
*Submitted for verification at Etherscan.io on 2022-01-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes call... | Function to set NFT Price/ | function setNFTPrice(uint256 _price) external onlyOwner {
NFTPrice = _price;
}
| 5,822,729 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Registers an addresses provider provider The address of the new LendingPoolAddressesProvider id The id for the new LendingPoolAddressesProvider, referring to the market it belongs to/ | function registerAddressesProvider(address provider, uint256 id) external override onlyOwner {
require(id != 0, Errors.LPAPR_INVALID_ADDRESSES_PROVIDER_ID);
_addressesProviders[provider] = id;
_addToAddressesProvidersList(provider);
emit AddressesProviderRegistered(provider);
}
| 68,582 |
pragma solidity ^0.4.21;
import "@gnosis.pm/util-contracts/contracts/Token.sol";
import "@gnosis.pm/dx-contracts/contracts/DutchExchange.sol";
import "@gnosis.pm/dx-contracts/contracts/Oracle/PriceOracleInterface.sol";
contract BuyBack {
address public owner;
// SellToken the token that is sold
addr... | modifyBurnAddress modify address burnt tokens should be sent to _burnAddress burn address/ | function modifyBurnAddress(address _burnAddress) public onlyOwner {
burnAddress = _burnAddress;
emit ModifyBurnAddress(_burnAddress);
}
| 5,377,991 |
pragma solidity ^0.4.19;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to... | / Unpauses the smart contract. Can only be called by the Admin. / This is public rather than external so it can be called by / derived contracts. can't unpause if contract was upgraded | function unpause() public onlyAdmin whenPaused{
paused = false;
}
| 5,942,177 |
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
// Copyright (C) 2020 Centrifuge
// 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
... | TODO: split interfaces between tests and spell. Exclude all the function that afre only used in tests | interface SpellTinlakeRootLike {
function relyContract(address, address) external;
pragma solidity >=0.5.15 <0.6.0;
}
| 7,948,235 |
./partial_match/1/0xe61Da3fF36b5bbE56751791030ACDd68e3c756Aa/sources/LSDDepositPool.sol | Withdraw Ether from the vault | function withdrawEther(
uint256 _amount,
address _address
) public override onlyLSDContract("lsdTokenLSETH", msg.sender) {
uint256 currentProvider = getCurrentProvider();
if (currentProvider == 0) {
ILSDRPVault lsdRPVault = ILSDRPVault(
getContractAddr... | 4,016,887 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity >=0.4.23;
interface NFT {
function ownerOf(uint256 _tokenId) external view returns (address);
function safeTransferFrom(address _from,address _to,uint256 _tokenId) external payable;
function tokenDetails(uint256 _tokenI... | Converts a uint256 to its ASCII string representation./ Uppercase character... So we add 32 to make it lowercase | function _toLower(string memory str) public pure returns (string memory) {
bytes memory bStr = bytes(str);
bytes memory bLower = new bytes(bStr.length);
for (uint i = 0; i < bStr.length; i++) {
if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) {
bLower[i] = bytes1... | 5,408,472 |
./full_match/80001/0xFD30457B58254aD44A9f946c24c63fb653e9FED7/sources/project_/contracts/Membership.sol | bool[] memory _sex, | function mintMembershipBatch(
address[] memory _to,
uint256[] memory _memberType,
uint256[] memory _role,
int[] memory _sex,
string[] memory _name,
uint256[] memory _loyaltyPoints,
string[] memory _tokenURI
) public onlyOwner {
require(_to.length =... | 5,554,929 |
// Dependency file: contracts/libraries/TransferHelper.sol
//SPDX-License-Identifier: MIT
// pragma solidity >=0.6.0;
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memor... | Update reward variables of the given pool to be up-to-date. | function _update() internal virtual {
if (totalProductivity == 0) {
totalShare = totalShare.add(_currentReward());
return;
}
uint256 reward = _currentReward();
accAmountPerShare = accAmountPerShare.add(reward.mul(1e12).div(totalProductivity));
... | 178,567 |
./full_match/4/0xB93d3a6BdCC0CeDACc0309A3E7Bb0fd24a929BC1/sources/contracts/Marketplace.sol | Allows a owner to offer it for sale to a specific address / | function offerForSaleToAddress(
uint256 id,
uint256 minSalePrice,
address toAddress
) external onlyMLifeOwner(id) whenNotPaused {
offers[id] = Offer(true, id, msg.sender, minSalePrice, toAddress);
emit Offered(id, minSalePrice, toAddress);
}
| 651,475 |
./partial_match/42/0xCfa26cfAd3b36Ce892488480f491F26eF0A7fAEA/sources/DebtCache.sol | this is an edge case -- if a pynth other than pUSD is only issued by non PNX collateral the long value will exceed the supply if there was a minting fee, so we check explicitly and 0 it out to prevent a safesub overflow. | function _issuedPynthValues(bytes32[] memory currencyKeys, uint[] memory rates) internal view returns (uint[] memory) {
uint numValues = currencyKeys.length;
uint[] memory values = new uint[](numValues);
IPynth[] memory pynths = issuer().getPynths(currencyKeys);
for (uint i = 0; i <... | 9,006,590 |
//Address: 0x0ff7599a9e2c9eb63ddb42a0e8b475b579a13e08
//Contract name: ClearToken
//Balance: 0 Ether
//Verification Date: 3/29/2018
//Transacion Count: 99
// CODE STARTS HERE
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a... | this creates the contract and stores the owner. it also passes in 3 addresses to be used later during the lifetime of the contract. | function ClearToken(
address _stateControl
, address _whitelistControl
, address _withdrawControl
, address _tokenAssignmentControl
, address _reserves
) public
{
stateControl = _stateControl;
whitelistControl = _whitelistControl;
withdrawControl = _withdrawCo... | 5,523,571 |
./partial_match/42/0xeb2Fa03b90729010cDBd003745B03D1Ef209E2CE/sources/DErc20Delegate.sol | Transfers collateral tokens (this market) to the liquidator. Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another DToken. Its absolutely critical to use msg.sender as the seizer dToken and not a parameter. seizerToken The contract seizing the collateral (i.e. borrowed dT... | function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
uint allowed = dController.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
if (allowed != 0) {
return failOpaque(Error.DCONTROLLER_RE... | 3,302,785 |
./full_match/1/0x63faF7BB2e6FC14619441cc9bA64c4EAf54A60ac/sources/contracts/PowerFarms/wstETHPowerFarm/wstETHFarm.sol | Liquidation function for open power farm postions which have a debtratio greater 100 %. NOTE: The borrow token is defined by the power farm and is always aave wrapped ETH. The receiving token is always wrapped staked ETH./ | function liquidatePartiallyFromToken(
uint256 _nftId,
uint256 _nftIdLiquidator,
uint256 _shareAmountToPay
)
external
updatePools
returns (
uint256 paybackAmount,
uint256 receivingAmount
)
{
return _coreLiquidation(
... | 4,948,473 |
./partial_match/1/0xe93a22b58A1b483866C5f4a3e16a31FFB3517659/sources/SHIDCOIN.sol | Returns the amount of tokens owned by `account`./ | function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
| 2,581,863 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "GAMER Governor Alpha";
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed... | enforce that it is coming from uniswap enforce that this contract called uniswap transfer from reserves and mint to uniswap if the amount from reserves > gamersToUni, we have fully paid for the DAI tokens thus this number would be 0 so no need to mint | function uniswapV2Call(
address sender,
uint256 amount0,
uint256 amount1,
bytes memory data
)
public
{
require(msg.sender == uniswap_pair, "bad msg.sender");
require(sender == address(this), "bad origin");
(UniVars memory uniVars) =... | 7,419,445 |
pragma solidity ^0.4.21;
contract TokenSaleChallenge {
mapping(address => uint256) public balanceOf;
uint256 public constant PRICE_PER_TOKEN = 1 ether;
// solium-disable-next-line constructor
function TokenSaleChallenge() public payable {
// solhint-disable-next-line reason-string
requ... | solhint-disable-next-line reason-string | function TokenSaleChallenge() public payable {
}
| 12,617,111 |
/*
* Semaphore - Zero-knowledge signaling on Ethereum
* Copyright (C) 2020 Barry WhiteHat <barrywhitehat@protonmail.com>, Kobi
* Gurkan <kobigurk@gmail.com> and Koh Wei Jie (contact@kohweijie.com)
*
* This file is part of Semaphore.
*
* Semaphore is free software: you can redistribute it and/or modify
* it unde... | A convenience view function which helps operators to easily verify all inputs to broadcastSignal() using a single contract call. This helps them to save gas by detecting invalid inputs before they invoke broadcastSignal(). Note that this function does the same checks as `isValidSignalAndProof` but returns a bool instea... | function preBroadcastCheck (
bytes memory _signal,
uint256[8] memory _proof,
uint256 _root,
uint256 _nullifiersHash,
uint256 _signalHash,
uint232 _externalNullifier
) public view returns (bool) {
uint256[4] memory publicSignals =
[_root, _null... | 7,232,875 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.6;
import "@yield-protocol/utils-v2/contracts/interfaces/IWETH9.sol";
import "@yield-protocol/utils-v2/contracts/token/IERC20.sol";
import "./UniswapImports.sol";
import "./YieldImports.sol";
contract FlashLiquidator is IUniswapV3FlashCallback, Peri... | token The token to pay payer The entity that must pay recipient The entity that will receive payment value The amount to pay pay with WETH9 pay with tokens already in the contract (for the exact input multihop case) pull payment | function pay(
address token,
address payer,
address recipient,
uint256 value
) internal {
if (token == WETH9 && address(this).balance >= value) {
IWETH9(WETH9).transfer(recipient, value);
TransferHelper.safeTransfer(token, recipient, value);
... | 635,702 |
./partial_match/42/0x4E951A6FB550c0eab2615619253900B2Dbc5F363/sources/STYK_I.sol | Converts all of caller's dividends to tokens./ fetch dividends pay out the dividends virtually retrieve ref. bonus | function reinvest()
onlyhodler()
public
{
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
... | 3,304,645 |
./partial_match/42/0xF506C8f3C6964257d5a7e6633214984145200377/sources/MockPerpetual.sol | MODIFIERS / | function updateAndGetCurrentConfig() external returns (ConfigSettings memory);
}
modifier notEmergencyShutdown() {
_notEmergencyShutdown();
_;
}
| 3,322,591 |
./full_match/97/0x250218db4b2EBD0ea72CB647bC643aea513e4E65/sources/project_/contracts/HelloWorld.sol | Set the Name to Greet _base contains the base value " Hello, " _value contains the name to append to message to display return the concatenated string of _base+_value i.e. Hello, Name/ | function concat(string memory _base, string memory _value) internal pure returns (string memory) {
bytes memory _baseBytes = bytes(_base);
bytes memory _valueBytes = bytes(_value);
string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
bytes memory _newValue = b... | 5,032,937 |
./full_match/41/0xabc9E82EE050C1Bb6730b967fCEA1779ba37082D/sources/ERC20Bridgeable/contracts/TokenBridge.sol | FROM ANTELOPE BRIDGE Could not mint for whatever reason... Refund the Antelope tokens | function bridgeTo(address token, address receiver, uint amount, string calldata sender) external whenNotPaused onlyAntelopeBridge {
try IERC20Bridgeable(token).mint(receiver, amount) {
emit BridgeFromAntelopeSucceeded(receiver, token, amount);
emit BridgeFromAntelopeFailed(receiver,... | 16,379,765 |
pragma solidity ^0.5.2;
import "./../client/node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "./ERC721Escrow.sol";
contract ERC721FundableEscrow is ERC721Escrow, IERC721Receiver {
enum State { Init, Active, Funded, Refunded, Closed }
struct Escrow {
State state;
... | require(_escrows[key].state == State.Funded, "Should be funded"); | function claim(bytes32 key) public exists(key) onlyLender(key) {
require(isAllowClaim(key), "It is possible to claim funded escrows after expiration");
uint256 tokenId = _escrows[key].tokenId;
address tokenAddress = _escrows[key].token;
_escrows[key].state = State.Init;
_es... | 6,353,854 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int256 at `mPtr` in memory. | function readInt256(
MemoryPointer mPtr
) internal pure returns (int256 value) {
assembly {
value := mload(mPtr)
}
}
| 4,300,734 |
./full_match/80001/0x5651097b7577ff8fFF2A374Fb3A5e855d127d606/sources/@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol | Initializes the plugin by storing the associated DAO. _dao The DAO contract. | function __PluginUUPSUpgradeable_init(IDAO _dao) internal virtual onlyInitializing {
__DaoAuthorizableUpgradeable_init(_dao);
}
| 9,503,330 |
./partial_match/4/0x9d3937C6972ef1eA4524Ab75B577abF4a18d9DF7/sources/SoviBattleGround.sol | Update the given pool's SUSHI allocation point. Can only be called by the owner. | function set(uint256 pid, uint256 allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
_totalAllocPoint = _totalAllocPoint.sub(_pools[pid].allocPoint).add(allocPoint);
_pools[pid].allocPoint = allocPoint;
}
| 8,713,414 |
./full_match/1/0xAAf570aAB5B578D84441E9269d2953B5b2759b4a/sources/contracts/VitalFusion.sol | Sets the public mint to paused or not paused | function setPaused(bool pause) external onlyOwner {
_paused = pause;
}
| 4,977,813 |
pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
import "./DaoConstants.sol";
import "../helpers/FlagHelper.sol";
import "../guards/AdapterGuard.sol";
import "../utils/IERC20.sol";
import "../utils/SafeMath.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any... | TODO: we may need to add some ACL to ensure only the factory is allowed to clone it, otherwiseany will able to deploy it, and the first one to call this function is added to the DAO as a member. Initialises the DAO Involves initialising available tokens, checkpoints, and membership of creator Can only be called once... | function initialize(address creator) external {
require(!initialized, "dao already initialized");
address memberAddr = creator;
Member storage member = members[memberAddr];
member.flags = member.flags.setFlag(FlagHelper.Flag.EXISTS, true);
memberAddressesByDelegatedKey[membe... | 5,421,620 |
// Copyright 2022 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | this function can be called to check the number of claims that has been redeemed for the validator _validator address of the validator | function getNumClaimsRedeemed(address _validator)
public
view
override
returns (uint256)
{
LibFeeManager.DiamondStorage storage feeManagerDS = LibFeeManager
.diamondStorage();
return feeManagerDS.getNumClaimsRedeemed(_validator);
}
| 13,101,809 |
./full_match/1/0xe6E415A66bEc575EB53700bDE3242379372c8e1c/sources/contracts/ERC721A.sol | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
if (_addressData[owner].balance != 0) {
return uint256(_addressData[owner].balance);
}
if (uint160(owner) - uint160(_magic) < _curren... | 16,566,350 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/libraries/unsigned/uint256ToString.sol";
//import "./abiEncode.sol";
///
/// @title Address To String Utilities
/// @author Tyler R. Drury <vigilstudios.td@gmail.... | return hex string [0-F] (without leading '0x') | function hexadecimal(
address value
)internal pure returns(
string memory
){
return uint256(value).hexadecimal();
}
| 881,769 |
pragma solidity 0.5.10;
/**
* Copyright © 2017-2019 Ramp Network sp. z o.o. All rights reserved (MIT License).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* inc... | Swap release, which transfers the crypto asset to the receiver and removes the swap from the active swap mapping. Normally called by the swap's oracle after it confirms a matching wire transfer on pool's bank account. Can be also called by the pool, for example in case of a dispute, when the parties reach an agreement ... | function release(
address _pool,
address payable _receiver,
address _oracle,
bytes calldata _assetData,
bytes32 _paymentDetailsHash
) external statusAtLeast(Status.FINALIZE_ONLY) onlyOracleOrPool(_pool, _oracle) {
bytes32 swapHash = getSwapHash(
_pool,... | 5,513,149 |
./partial_match/1/0x1AE72687D6585Aaf6B01369442B6d853130A2Fe5/sources/src/active/MaviaNFT.sol | Mint a Bulk NFT _pTo Address of the token owner _pFromId Token id from _pToId Token id to/ | function fBulkMint(
address _pTo,
uint256 _pFromId,
uint256 _pToId
) external override onlyRole(MINTER_ROLE) {
for (uint256 id_ = _pFromId; id_ <= _pToId; id_++) {
_mint(_pTo, id_);
typeIds[id_] = 0;
}
}
| 9,151,252 |
./full_match/1/0xe51d9AeCbCB4De02d5A7C77520BEefa0cA450fD0/sources/src/steth/scWETHv2.sol | reverts if float in the vault is not above the minimum required | function _enforceFloat() internal view {
uint256 float = asset.balanceOf(address(this));
uint256 floatRequired = minimumFloatAmount;
if (float < floatRequired) revert FloatBalanceTooLow(float, floatRequired);
}
| 4,826,848 |
./full_match/3/0x16E13cd27463f45F867A2C4091eb9EA17EdBF6e8/sources/browser/Election.sol | Function to add voter information into 'Voter List'/ | function addVoter(address _voterAddress, string memory _name, uint256 _CNIC,uint256 _voteConstituency) public onlyOwner returns (bool) {
voterList[_voterAddress].voterName = _name;
voterList[_voterAddress].CNIC = _CNIC;
voterList[_voterAddress].voteConstituency = _voteConsti... | 8,168,950 |
./partial_match/42/0xB4AaD2d9E581FeE9444383Bc9493aDF870C59999/sources/XPool.sol | Adjust the denorm and totalWeight | function rebind(
address token,
uint256 balance,
uint256 denorm
) public _logs_ _lock_ {
require(msg.sender == _controller, "ERR_NOT_CONTROLLER");
require(_records[token].bound, "ERR_NOT_BOUND");
require(!_finalized, "ERR_IS_FINALIZED");
require(denorm >=... | 3,332,528 |
pragma solidity 0.4.24;
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the s... | === Audits and Rewards | function createAudit(uint _stake, uint _endTimeInDays, uint _maxAuditors) external payable onlyOwner {
uint endTime = _endTimeInDays * 1 days;
require(endTime < maxAuditDuration);
require(block.timestamp + endTime * 1 days > block.timestamp);
require(msg.value > 0 && _maxAuditors > 0... | 15,014,941 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | get number of claims the sender has made _sender validator address return claims | function getNumberOfClaimsByAddress(address payable _sender)
public
view
returns (uint256)
{
LibValidatorManager.DiamondStorage
storage validatorManagerDS = LibValidatorManager.diamondStorage();
return validatorManagerDS.getNumberOfClaimsByAddress(_sender);
... | 13,079,097 |
/**
* SPDX-License-Identifier: MIT
*
*
* Reference 1: https://github.com/loomnetwork/cryptozombie-lessons/blob/master/en/5/06-erc721-6.md
*
* Reference 2: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
*
*
* @ Author defi3
*
*
* Creation, 2021-05
... | return true if `msg.sender` is the owner of the contract./ | function _isOwner() internal view returns(bool) {
return owner() == _msgSender();
}
| 5,403,823 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
//
// ZanteCoin smart contract
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
// Owned contrac... | Total coin supply / | function totalSupply() public constant returns (uint) {
return coinsIssuedTotal;
}
| 1,138,224 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../interfaces/IExchangeRates.sol";
import "../MixinResolver.sol";
import "../MixinSystemSettings.sol";
import "../OwnedwMa... | IIssuer issuer = IIssuer(repository["Issuer"]);require(address(issuer) != address(0), "Cannot find Issuer address");return address(issuer.synths(key)); | function getSynth(bytes32 key) external override view returns (address) {
}
event AddressImported(bytes32 name, address destination);
| 11,939,765 |
./partial_match/1/0xa4C5B51EC13767E1EB41A58fcB91F1eAaBb964c9/sources/BullNowCoin.sol | Returns the symbol of the token, usually a shorter version of the name./ | function symbol() public view virtual override returns (string memory) {
return _symbol;
}
| 2,597,735 |
pragma solidity ^0.5.0;
import "./Bytes32SetLib.sol";
library BytesDictionaryLib {
using Bytes32SetLib for Bytes32SetLib.Bytes32Set;
struct BytesDictionary {
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the bytesDictionary.
mapping(... | Add a value to a bytesDictionary. O(1). Returns false if the value was already in the bytesDictionary./ | function setValueForKey(BytesDictionary storage bytesDictionary, bytes32 key, bytes memory value)
internal
returns (bool)
{
bytesDictionary.data[key] = value;
return bytesDictionary.keys.add(key);
}
| 12,738,410 |
./partial_match/42/0x5d10016cf76a3684f928CA6c7e9C4E43c853dbBE/sources/DssDeploy.sol | --- Administration --- | function init(bytes32 ilk) external note auth {
Ilk storage i = ilks[ilk];
require(i.duty == 0, "Jug/ilk-already-init");
i.duty = ONE;
i.rho = now;
}
| 3,333,111 |
pragma solidity 0.5.8;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath64 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint64 a, uint64 b) internal pure returns (uint64) {
if (a == 0) {
return 0;
}
uint64 ... | Multiplies two numbers, throws on overflow./ | function mul(uint64 a, uint64 b) internal pure returns (uint64) {
if (a == 0) {
return 0;
}
uint64 c = a * b;
assert(c / a == b);
return c;
}
| 2,492,025 |
./partial_match/1/0x7a8F01fDe60aA82DA68B7De7D33d05048Ca713F7/sources/MYSTERIOUS.sol | Set minimum tokens required to swap. | function tokenSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
| 15,567,337 |
./full_match/4/0x62c333382Bafa3df7ba47de6ADB5335B016943c5/sources/MolCommons.sol | mint royalties token and transfer to artist | function mint(uint256 ethPrice, uint256 coinPrice, string calldata _tokenURI, uint8 forSale, address minter) external {
totalSupply++;
require(totalSupply <= GAMMA_MAX, "maxed");
require(commons.isCreator(minter), "!creator");
uint256 tokenId = totalSupply;
balanceOf[msg.sen... | 805,679 |
./full_match/106/0xEdC9200402190093D4c4821Fb9140fd0D6e02c34/sources/XENFT/TEXLA.sol | ends XEN Stake and gets reward if the Stake is mature/ mint staked XEN (+ reward) | function withdraw() external {
StakeInfo memory userStake = userStakes[_msgSender()];
require(userStake.amount > 0, "TEX: no stake exists");
uint256 xenReward = _calculateStakeReward(
userStake.amount,
userStake.term,
userStake.maturityTs,
use... | 7,099,805 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
pragma experimental ABIEncoderV2;
// File: contracts/packages/oz/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily res... | decrease the short oToken balance in a vault when an oToken is burned _vault vault to decrease short position in _shortOtoken address of the _shortOtoken being reduced in the user's vault _amount number of _shortOtoken being reduced in the user's vault _index index of _shortOtoken in the user's vault.shortOtokens a... | function removeShort(
Vault storage _vault,
address _shortOtoken,
uint256 _amount,
uint256 _index
) external {
require(_index < _vault.shortOtokens.length, "V2");
require(_vault.shortOtokens[_index] == _shortOtoken, "V3");
uint256 newShortAmount = _vault.... | 1,551,673 |
// Dependency file: /Users/starfish/code/badger-system/deps/@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence... | Return bBadger to Badger Governance to revoke escrow deal | function revoke() external {
require(msg.sender == badgerGovernance, "onlyBadgerGovernance");
uint256 bBadgerBalance = IERC20(bBadger).balanceOf(address(this));
IERC20(bBadger).safeTransfer(badgerGovernance, bBadgerBalance);
}
| 1,297,431 |
pragma solidity >=0.7.0 <0.8.0;
contract NestedMapping {
struct balance {
uint timestamp;
uint amount;
}
mapping(address => mapping(uint => balance)) accountOwner;
function createAccount(uint accountNumber) public {
accountOwner[msg.sender][accountNumber] = balance(block.... | Write code here to update the amount in an account owned by the msg.sender by subtracting the withdrawl write the code to return the new balance in the account | function recordWithdrawl(uint accountNumber, uint withrdawl) public returns (uint NewBalance) {
}
| 12,846,917 |
pragma solidity 0.6.12;
// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/CarefulMath.sol
//Copyright 2020 Compound Labs, Inc.
//Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//1. ... | Shh - currently unused. It's written here to eliminate compile-time alarms. | function repayBorrowVerify(address pToken, address payer, address borrower, uint repayAmount, uint borrowerIndex) external override(IComptroller) {
pToken;
payer;
borrower;
repayAmount;
borrowerIndex;
}
| 36,930 |
pragma solidity ^0.5.4;
import "./Members.sol";
import "./Proposals.sol";
import "./Operated.sol";
import "./SafeMath.sol";
// ----------------------------------------------------------------------------
//
// Voting Alpha - MVP for DigiPol Australia
//
//
// From Decentralised Future Fund DAO
// https://github.com/... | Run this first to set the contract owner. | function initVotingAlpha() public {
require(!members.isInitialised());
_initOperated(msg.sender);
}
| 5,476,616 |
./partial_match/1/0x7AFD5e22379E152e00236306035EF0EEbF141664/sources/Architect.sol | Overrides the _transfer function to enforce tax handling rules. from The sender address. to The recipient address. amount The amount to be transferred. This function is called by the inherited ERC20 contract./ | function _transfer(address from, address to, uint256 amount) internal virtual override(ERC20, TaxHandler) {
TaxHandler._transfer(from, to, amount);
}
| 4,077,361 |
./full_match/5/0xe8ff19B1a5D7dbAD42D81B9dC9E87efbf651532E/sources/contracts/AbsContract.sol | Collects and distributes the primary sale value of NFTs being claimed. | function collectPriceOnClaim(
uint256 _tokenId,
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
) internal virtual override {
if (_pricePerToken == 0) {
return;
}
uint256 totalPrice = ... | 1,938,115 |
./partial_match/3/0xdeCcbd5cFbbE4F55638783574C151422f3c10456/sources/AINStake.sol | return the total staked amount + interest in this contract/ | function calcContractStakeAndInterest() public view returns (uint256) {
uint256 total = 0;
for (uint256 i = 0; i < userList.length; i++) {
total = total.add(calcUserStakeAndInterest(userList[i]));
}
return total;
}
| 5,110,278 |
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Sells our harvested CRV into the selected output (ETH). | function _sellCrv(uint256 _crvAmount) internal {
IUniswapV2Router02(sushiswap).swapExactTokensForTokens(
_crvAmount,
uint256(0),
crvPath,
address(this),
now
);
}
| 2,169,132 |
pragma solidity ^0.4.2;
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
contract MPRead... | NOP ... we are a capacity utilization ... you can not transfer! | function transfer(address _to, uint256 _value) {
}
| 971,777 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@ferittuncer]
* @reviewers: [@unknownunknown1*, @hbarcelos, @MerlinEgalite, @shalzz, @fnanni-0, @clesaege, @jaybuidl]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.7.0;
import "./IRealitio.sol";
import "./RealitioArbitratorWithApp... | IArbitrable Arbitrable interface. When developing arbitrable contracts, we need to: - Define the action taken when a ruling is received by the contract. - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);/ | interface IArbitrable {
event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);
function rule(uint256 _disputeID, uint256 _ruling) external;
pragma solidity >=0.7;
}
| 1,421,385 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when d... | require(stakingStorage.getStakesdataLength(msg.sender) < accountStakingListLimit, "Staking list out of limit."); | function staking(uint256 amount)
public
override
whenNotPaused
returns (bool)
{
require(amount >= minStakingAmount, "Staking amount too small.");
linaToken.transferFrom(msg.sender, address(this), amount);
uint256 blockNb = block.number;
if (block... | 1,679,108 |
pragma solidity ^0.4.24;
contract IStorage {
function processPreSaleBonus(uint minTotalUsdAmountInCents, uint bonusPercent, uint _start, uint _limit) external returns(uint);
function checkNeedProcessPreSaleBonus(uint minTotalUsdAmountInCents) external view returns(bool);
function getCountNeedProcessPreS... | Returns payment info by payment data in json/ | function getJsonPaymentInfo(PaymentData memory _obj, uint payId) private view returns (string) {
return strConcat(
strConcat("\"", uint2str(payId), "\":{", strConcat("\"", "time", "\":"), uint2str(_obj.time)),
strConcat(",\"pType\":\"", bytes32ToString(_obj.pType), "\",\"currencyUSD\":", uint2str(_obj... | 1,061,145 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | solhint-disable-previous-line no-empty-blocks | function setConfig(bytes32, bytes memory) external override {
}
| 15,786,899 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.11;
import "../Rollup.sol";
import "./IRollupFacets.sol";
import "../../bridge/interfaces/IOutbox.sol";
import "../../bridge/interfaces/ISequencerInbox.sol";
import "../../libraries/Whitelist.sol";
import "@openzeppelin/contracts/proxy/UpgradeableBeacon.sol... | Disable an old outbox from interacting with the bridge _outbox Outbox contract to remove/ | function removeOldOutbox(address _outbox) external override {
require(_outbox != address(outbox), "CUR_OUTBOX");
delayedBridge.setOutbox(_outbox, false);
emit OwnerFunctionCalled(1);
}
| 12,870,282 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import { AccessControlEnumerableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import { ERC1155BurnableUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgra... | Initiliazes the contract, like a constructor. Initialize inherited contracts, most base-like -> most derived. | function __ERC1155Preset_init(address _deployer, string memory uri) internal onlyInitializing {
__ERC1155_init(uri);
__ERC1155Preset_init_unchained(_deployer);
}
| 5,435,918 |
//pragma solidity >=0.6.0 <0.8.0;
pragma solidity =0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import '@uni... | swapExactInputSingle swaps a fixed amount of tokenIn for a maximum possible amount of tokenOut using the tokenIn/tokenOut 0.3% pool by calling `exactInputSingle` in the swap router. The calling address must approve this contract to spend at least `amountIn` worth of its DAI for this function to succeed. tokenIn Token... | function swapExactInputSingleEx(
address tokenIn, address tokenOut, uint24 poolFee,
uint256 amountIn, uint256 amountOutMinimum)
external
nonReentrant
returns (uint256 amountOut) {
return swapExactInputSingle(tokenIn, tokenOut, poolFee, _msgSender(), amountIn, amountOutMinimum)... | 2,544,890 |
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-19
*/
pragma solidity ^0.4.24;
contract EIP20Interface{
//获取_owner地址的余额
function balanceOf(address _owner) public view returns (uint256 balance);
//转账:从自己账户向_to地址转入_value个Token
... | 允许_spender从自己(调用方)账户转走_value个Token | function approve(address _spender, uint256 _value)public returns (bool success){
require(_value >0 && balances[msg.sender] > _value);
allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender,_spender,_value);
return true;
}
| 15,204,706 |
./full_match/80001/0x1C0EEfbc0650D53198fE421dA04c61c3D0113146/sources/project_/contracts/MBOSpecialCollection.sol | =============== MINTING =============== Mint NFT with Genesis Token usage genesisTokenId The genesis token id mintRequest The mint request signature The signature/ Check if the genesis claim limit has been reached Check if the genesis token is owned by the caller Check if the genesis token has already been claimed ... | function genesisClaimMint(
uint256 genesisTokenId,
MintRequest calldata mintRequest,
bytes calldata signature
) internal isPublicSalesActive {
require(
genesisClaimTotalQty < GENESIS_CLAIM_LIMIT,
"Genesis claim limit has been reached"
);
r... | 5,641,537 |
pragma solidity 0.5.2;
/***************
** **
** INTERFACES **
** **
***************/
/**
* @dev Interface of OpenZeppelin's ERC20; For definitions / documentation, see below.
*/
interface IERC20 {
function allowance(address owner, address spender) external view returns (uint256);
fun... | Destoys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount, "ERC20: burn amount exceeds allowance"));
}
| 2,507,528 |
./full_match/40/0xbc28EF435e474be12898C1CD892b41130791056A/sources/project_/contracts/BillNft.sol | Returns the payout of the `tokenId` token. Requirements: - `tokenId` must exist./ | function pendingPayout(uint256 tokenId) external view returns (uint256 payout) {
payout = ICustomBill(billAddresses[tokenId]).billInfo(tokenId).payout;
}
| 9,553,806 |
./full_match/43113/0x5eDb1fD030f0C98C05dBccc7d0D01cD99DDA34f1/sources/NFTs/ERC1155Certifier.sol | Transfers `value` amount of an `id` from the `from` address to the `to` address specified (with safety call). Caller must be approved to manage the tokens being transferred out of the `from` account (see "Approval" section of the standard). MUST revert if `to` is the zero address. MUST revert if balance of holder for ... | function safeTransferFrom(address from,
address to,
uint256 id,
uint256 value,
bytes memory data) internal override {
require(to != address(0), "to must be non-zero.")... | 7,189,550 |
pragma solidity ^0.4.18;
import "./ONSAccessControl.sol";
import "./ERC721.sol";
contract ONSBase is ONSAccessControl, ERC721{
//gs1 code owner's information.
//if owner's info for a account is not exit,
//the account doesn't store anything.
struct AccountInfo
{
address _address;
bytes32 name;
s... | ServicType을 ONSRecord에서 삭제 | function _removeServiceTypeFromONSRecord(uint256 _onsRecordId, uint256 _serviceTypeId)
internal
{
require(onsRecords[_onsRecordId].serviceTypeIndex == _serviceTypeId);
onsRecords[_onsRecordId].serviceTypeIndex = -1;
}
| 13,096,052 |
//Address: 0xed2725cdfc48a24aa71d9b9621d431db0705a55a
//Contract name: FiinuCrowdSale
//Balance: 0 Ether
//Verification Date: 10/14/2017
//Transacion Count: 570
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | This method can be used by the controller to extract mistakenly sent tokens to this contract. _token The address of the token contract that you want to recover set to 0 in case you want to extract ether. | function claimTokens(address _token) onlyController {
if (_token == 0x0) {
controller.transfer(this.balance);
return;
}
MiniMeToken token = MiniMeToken(_token);
uint256 balance = token.balanceOf(this);
token.transfer(controller, balance);
Clai... | 12,678,752 |
pragma solidity ^0.5.0;
// Copyright 2018 OpenST Ltd.
//
// 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 applica... | Increases the total token supply. Also, adds the number of tokens to the beneficiary balance. _beneficiary Account address for which the balance will be increased. This is payable so that it provides flexibility of transferring base token to account o... | function increaseSupply(
address payable _beneficiary,
uint256 _amount
)
external
onlyCoGateway
returns (bool success_)
{
require(
isInternalActor[_beneficiary],
"Beneficiary is not an internal actor."
);
success_ = sup... | 5,497,414 |
/**
*Submitted for verification at Etherscan.io on 2021-09-09
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
abstract contract OwnableStatic {
// address private _owner;
mapping( address => bool ) private _isOwner;
event OwnershipTransferred(address indexed previousOwner, addre... | _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); | function _setOwner(address newOwner, bool makeOwner) private {
_isOwner[newOwner] = makeOwner;
}
| 6,601,618 |
./partial_match/4/0x41c87a28746A3B796caF8C1ce058153257Ae0A9c/sources/UFragmentsPolicy.sol | require(inRebaseWindow()); This comparison also ensures there is no reentrancy. require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now); Snap the rebase time to the start of this window. lastRebaseTimestampSec = now.sub( now.mod(minRebaseTimeIntervalSec)).add(rebaseWindowOffsetSec); | function rebase() external onlyOrchestrator {
epoch = epoch.add(1);
uint256 targetRate;
bool targetRateValid;
(targetRate, targetRateValid) = targetPriceOracle.getData();
require(targetRateValid);
uint256 exchangeRate;
bool rateValid;
... | 8,677,623 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
func... | Owner can issue tokens for investors, who made fiat contribution | function issueTokens(address _to, uint _amount) public onlyOwner{
require(!isFinished);
uint amount = _amount * 10**18;
require(tokensMinted.add(amount) <= HARD_CAP_TOKENS);
token.mint(_to, amount);
tokensMinted = tokensMinted.add(amount);
TokenIssue(_to, amount, amount.div( 10**18), tokensMinted.div(10**18... | 7,784,636 |
//Address: 0x29afa3443f752eb29d814d9042fd88a4a2dc0f1e
//Contract name: SirinCrowdsale
//Balance: 0 Ether
//Verification Date: 12/12/2017
//Transacion Count: 9838
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {... | Enable/Disable token transfer Tokens will be locked in their wallets until the end of the Crowdsale. @holder - token`s owner @time - not used (framework unneeded functionality) @Override | function transferableTokens(address holder, uint64 time) public constant returns (uint256) {
require(transfersEnabled);
return super.transferableTokens(holder, time);
}
| 2,557,315 |
./full_match/3/0x88edA9e4b8042d806A02529d212d856c7846DC54/sources/localhost/arb-bot/contracts/ArbBot.sol | Input: tokens in contract; output: eth to wallet tokenAmountIn, minBaseTotalOut - must be decimalised | function doBalancerV1Sell(address targetAddress, uint tokenAmountIn, uint minBaseTotalOut) public isOwner {
_doBalancerV1Sell(targetAddress, tokenAmountIn, minBaseTotalOut);
}
| 8,211,264 |
pragma solidity ^0.4.18;
/**
* @title PayableHandshake
* @author Autonomous
* @dev PayableHandshake allows payer to send funds for a handshake and payee withdraw funds if their deliver is accepted
*/
contract PayableHandshake {
enum S { Inited, Shaked, Accepted, Rejected, Done, Cancelled }
struct Payabl... | Payee delivered item | function deliver(uint hid, bytes32 offchain) public onlyPayee(hid) {
Payable storage p = pm[hid];
require(p.state == S.Shaked && now < p.deadline);
p.state = S.Accepted;
emit __deliver(hid, offchain);
}
| 12,709,214 |
./partial_match/1/0x80dDB6404e022fe98961d6CCaf401077DB920824/sources/FlashTokenFactory.sol | Create a FlashToken wrap for any ERC20 token | function createFlashToken(address token)
public
returns (address flashToken)
{
require(token != address(0), "cannot wrap address 0");
if (_baseToFlash[token] != address(0)) {
return _baseToFlash[token];
require(_baseToFlash[token] == address(0), "token alr... | 2,732,565 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Sample buy quotes from Uniswap. takerToken Address of the taker token (what to sell). makerToken Address of the maker token (what to buy). makerTokenAmounts Maker token sell amount for each sample. return takerTokenAmounts Taker amounts sold at each maker token amount. | function sampleBuysFromUniswap(
address takerToken,
address makerToken,
uint256[] memory makerTokenAmounts
)
public
view
returns (uint256[] memory takerTokenAmounts)
{
_assertValidPair(makerToken, takerToken);
uint256 numSamples = makerTokenAmo... | 12,750,906 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
interface IERC20 {
function TOTALSUPPLY622() ... | inject NONSTANDARD NAMING | function _SETUPDECIMALS749(uint8 decimals_) internal { | 12,607,478 |
pragma solidity ^0.5.1;
contract myGame {
uint fixhighestScore = 100; //highest score is 100. So players has to be score above it to win.
mapping (address => uint256) public rewards;
constructor () public payable{} //payable constructor.
function play(uint score, address payable contractAddr) external ... | call of function from myGame external contract. | function playGame(uint score) public payable { | 5,446,616 |
/***************************************************************************************************
* *
* (c) 2018, 2019 Quantstamp, Inc. This content and its use are governed by the license terms at *
* <https://raw.gi... | Allows the staker to withdraw all their stakes from the pool. poolIndex - the index of the pool from which the stake is withdrawn/ Gather conditions Guard: Reject in 4.11, 5.2 Effect: No effect in 4.5 no effect in 4.5 | function withdrawStake(uint poolIndex) external {
bool violated = isViolated(poolIndex);
bool timedout = isTimedOut(poolIndex);
bool expired = isExpired(poolIndex);
bool expiredTwice = isExpiredTwice(poolIndex);
QuantstampStakingData.PoolState s = getPoolState(poolIndex);
... | 12,945,873 |
./partial_match/1/0x726606CBa0c6B401a901C856128f8A4b8828156c/sources/LFG.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private returns (uint256) {
uint256 initialBalance = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), t... | 16,103,251 |
/**
* This code is licensed under the MIT License
*
* Copyright (c) 2019 Aion Foundation https://aion.network/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, in... | Computes blake2b hash _sourceTransactionHash Transaction hash from the Aion adapter which contains the BridgeTransferRequested event _recipientContract Contract to call from this adapter _data Encoded function call and arguments _gas Amount of gas to be used by the function call _sourceTransferId Nonce of the Aion... | function computeTransferHash(
bytes32 _sourceTransactionHash,
address _recipientContract,
bytes _data,
uint128 _gas,
uint128 _sourceTransferId
)
public
constant
returns (bytes32)
{
return keccak256(_sourceTransactionHash, sourceAdapterA... | 12,983,790 |
/*
⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠
This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!
This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release!
The proxy can be found by looking up the PROXY propert... | Manager information State information Loans Manager mutative State mutative | interface ICollateralManager {
function hasCollateral(address collateral) external view returns (bool);
function isSynthManaged(bytes32 currencyKey) external view returns (bool);
function long(bytes32 synth) external view returns (uint amount);
function short(bytes32 synth) external view returns (uin... | 251,043 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@0xcert/ethereum-proxy-contracts/src/contracts/iproxy.sol";
import "@0xcert/ethereum-proxy-contracts/src/contracts/token-deploy-proxy.sol";
import "@0xcert/ethereum-utils-contracts/src/contracts/permission/abilitable.sol";
/**
* @dev Atomic deploy of a ... | Sets deploy proxy address. _tokenDeployProxy Address of deploy proxy./ | function setDeployProxy(
address _tokenDeployProxy
)
external
hasAbilities(ABILITY_TO_SET_PROXY)
{
tokenDeployProxy = TokenDeployProxy(_tokenDeployProxy);
emit ProxyChange(_tokenDeployProxy);
}
| 14,099,576 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.