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/1/0xa6d8C77FFf3CDcc43804275aD9997b603a7817c5/sources/src/ButtonswapRouter.sol | @inheritdoc IButtonswapRouter/ | function getBurnSwappedAmounts(address tokenA, address tokenB, uint256 liquidity)
external
view
virtual
override
returns (uint256 tokenOutA, uint256 swappedReservoirAmountA)
{
return ButtonswapLibrary.getBurnSwappedAmounts(factory, tokenA, tokenB, liquidity);
... | 3,642,055 |
// File: contracts/PRBMathCommon.sol
pragma solidity >=0.8.0;
/// @dev Common mathematical functions used in both PRBMathSD59x18 and PRBMathUD60x18. Note that this shared library
/// does not always assume the signed 59.18-decimal fixed-point or the unsigned 60.18-decimal fixed-point
// representation. When it does ... | Transfer the tokens (plus reward) of only vested stakes to the caller. Leave unvested stakes in place. symbol The ERC20 token symbol./ | function withdrawAndClaimVested(string memory symbol) public {
withdrawAndClaim(symbol, false);
}
| 9,853,584 |
./partial_match/3/0xB2B9614178c975a05217A678C7Ae525184EEeebC/sources/luckyEth.sol | This payable bet function allow player to bet with numbers and do validation for unique number It also validate length and not allow Player to rebet in same lottery _numbers are the bet numbers betted by Player/ | function bet(uint[] memory _numbers) external payable{
require(checkUniqueAndValid(_numbers, 53), "invalid data, either greater value or non unique.");
require(_numbers.length >= 7 && _numbers.length <= 15, 'Wrong data length');
require(msg.value == bet_amount, "bet amount not valid");
re... | 5,066,105 |
pragma solidity ^0.4.18;
contract MPTToken {
string public name ; // token name
string public symbol ; // token symbol
uint256 public decimals ; // token digit
mapping (address => uint256) public balanceOf;
mapping (address => bool) public frozenAccount;
map... | freeze Balance of target / | function freezeBalance(address _target,uint256 _value) public isOwner {
frozenBalance[_target] = _value;
FrozenCoins(_target, _value);
}
| 1,606,143 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/AgentMask.sol | Returns a token balance key given a user and token address. / | function tokenKey (address user, address token) pure internal returns (bytes32) {
return keccak256(abi.encode(user, token));
}
| 4,651,175 |
//Address: 0x7c5be04b71a9cdd4243372e23d5fcb278428465c
//Contract name: AssetViV
//Balance: 0 Ether
//Verification Date: 5/23/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity 0.4.24;
/**
* @title Vivalid Token Contract
* @dev ViV is an ERC-20 Standar Compliant Token
* For more info https://vivalid.io
*/... | Transfer _value tokens from address _from to address _to using allowance msg.sender allowance on _from _from The address where tokens comes. _to The address to transfer to. _value The amount to be transferred. return success with boolean value true if done/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(frozen[_from]==false);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 12,937,505 |
./full_match/80001/0x5828C287320288e130740ed538f3852fAD13995D/sources/contracts/longShort/template/LongShort.sol | / TODO this is out of date but we should transfer this function to Market contract | - "Pending" - means the next price update hasn't happened or been enacted on by the updateSystemState function.
- "Confirmed" - means the next price has been updated by the updateSystemState function. There is still
- outstanding (lazy) computation that needs to be executed per use... | 846,037 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../interfaces/BPool.sol";
import "../interfaces/IPriceOracle.sol";
import "../misc/BNum.sol";
/** @title BalancerSharedPoolPriceProvider
* @notice Price provider for a balancer pool token
* It calculates the price... | Returns true if there is a price deviation. ethTotals Balance of each token in ethers./Check for a price deviation | function hasDeviation(uint256[] memory ethTotals)
internal
view
returns (bool)
{
uint256 length = tokens.length;
for (uint8 i = 0; i < length; i++) {
for (uint8 o = 0; o < length; o++) {
if (i != o) {
uint256 price_deviation... | 14,820,244 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | From compound's _moveDelegates Keep track of votes. "Delegates" is a misnomer here | function trackVotes(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes :... | 220,976 |
// SPDX-License-Identifier: GPL-3.0
/// @title The Wizards DAO Auction House
// LICENSE
// AuctionHouse.sol is a modified version of the Nouns's Auction house.
// https://github.com/nounsDAO/nouns-monorepo/blob/master/packages/nouns-contracts/contracts/NounsAuctionHouse.sol
//
// AuctionHouse.sol source code Copyrigh... | Create a bid for a Wizard with a given amount. This contract only accepts payment in ETH./ RH: ensure bidder is in whitelist refund the last bidder, if applicable | function createBid(uint256 wizardId, uint256 aId)
external
payable
override
nonReentrant
{
IAuctionHouse.Auction memory _auction = auctions[aId];
require(
(aId <= auctionCount) && (aId >= 1),
"Auction Id is not currently open"
);
... | 12,140,682 |
pragma solidity ^0.4.24;
import "../math/SafeMath.sol";
import "./Crowdsale.sol";
/**
* @title FinalizableCrowdsale
* @dev Extension of Crowdsale where an owner can do extra work
* after finishing.
*/
contract PreSaleCrowdsale is Crowdsale {
using SafeMath for uint256;
/**
* The structure to hold privat... | Adds/Updates address and token allocation for token investors with BTC/fiat based payments. _wallet address The address of the investor wallet for ONE tokens. _tokens ONE token amount based on invoice income. _invoiceId fiat payment invoice id or BTC transaction id./ Adding new key if not present: | function addUpdateInvoice(
address _wallet,
uint256 _tokens,
string _invoiceId
)
external onlyAdmins onlyWhileOpen
{
require(_wallet != address(0));
require(_tokens > 0);
uint256 amount = invoicesMap[_wallet];
if (amount == 0) {
invoiceMapKeys.push(_wallet);
emi... | 12,984,027 |
pragma solidity ^0.5.0;
// Import the `Roles` library
import "../milkcore/Ownable.sol";
import "../milkaccesscontrol/PoultererRole.sol";
import "../milkaccesscontrol/DairyfactoryRole.sol";
import "../milkaccesscontrol/DistributorRole.sol";
import "../milkaccesscontrol/RetailerRole.sol";
import "../milkaccesscontrol/Su... | Define a function 'obtainItem' that allows a poulterer to mark an item 'Obtained' Add the new item as part of Obtain Increment sku Emit the appropriate event | function obtainItem(
uint _upc,
address payable _originPoultererID,
string memory _originFarmName,
string memory _originFarmInformation,
string memory _originFarmLatitude,
string memory _originFarmLongitud... | 1,004,316 |
./full_match/4/0x5Aac695d3a63139ae64817049Df9230a82473f4B/sources/contracts/PangolinFactory_flat.sol | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint liquidity) {
uint balance0 = IERC20Joe(token0).balanceOf(address(this));
uint balance1 = IERC20Joe(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool fee... | 12,283,764 |
pragma solidity ^0.4.11;
contract IssuingAuthority {
struct dataMapper {
mapping(bytes32 => string) data;
}
mapping(address => dataMapper) private users;
address _owner;
string name;
bytes32[] private fields;
uint private fieldsCount;
function IssuingAuthority(address ad... | Sends encrypted data with key of service provider. | function getData(address add) view public returns(string, string) {
require(lockDetails[add] == false && now < sharingDataPoints[add][msg.sender].endTime);
return(sharingDataPoints[add][msg.sender].data, sharingDataPoints[add][msg.sender].approvedData);
}
| 2,481,200 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
// File: ReentrancyGuard.sol
pragma solidity ^0.5.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to func... | Returns the cap of a specific beneficiary. return Current cap for individual beneficiary/ | function getPerWalletCap() public view returns (uint256) {
return _perWalletCap;
}
| 15,108,520 |
/**
*Submitted for verification at Etherscan.io on 2020-10-11
*/
/*
B.PROTOCOL TERMS OF USE
=======================
THE TERMS OF USE CONTAINED HEREIN (THESE 1TERMS1) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the 1PROTOCOL1) THAT enables a backstop liquidity mechanis... | Gets actual rate from the vat Gets actual art value of the urn Gets actual dai amount in the urn If the rad precision has some dust, it will need to request for 1 extra wad wei | function _getWipeAllWad(
address vat,
address usr,
address urn,
bytes32 ilk
) internal view returns (uint wad) {
(, uint rate,,,) = VatLike(vat).ilks(ilk);
(, uint art) = VatLike(vat).urns(ilk, urn);
uint dai = VatLike(vat).dai(usr);
uint rad = su... | 982,517 |
./full_match/1/0x2355839B2757880d08b978fc5BA73FdC6159B832/sources/contracts/ICloneforceShard.sol | 0 = dna shard, 1 = boundless shard | function getShardType(uint256 tokenId) external view returns (uint256); | 5,007,151 |
pragma solidity ^0.4.11;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/crowdsale/FinalizableCrowdsale.sol";
import "./TokensCappedCrowdsale.sol";
import "./PausableCrowdsale.sol";
import "./BonusCrowdsale.sol";
import "./PreBOUToken.sol";
/**
* @dev Main BoutsPr... | Helper to Pause BOUToken/ | function pauseTokens() public onlyOwner {
PreBOUToken(token).pause();
}
| 12,685,428 |
./full_match/1/0x51a3282B75D1a82A0eEB85be2b9BEb1FfeEE0250/sources/contracts/ZIPO.sol | Function to add or remove an airdrop contract | function setAirdropContract(address _airdropContract, bool _isAirdrop) public onlyOwner {
isAirdropContract[_airdropContract] = _isAirdrop;
}
| 4,963,817 |
/**
*Submitted for verification at Etherscan.io on 2021-07-26
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORT... | View current block reward in MILK2s | function getCurrentBlockReward() public view returns (uint256) {
return milkPerBlock;
}
| 2,454,940 |
pragma solidity ^0.4.24;
pragma solidity ^0.4.24;
pragma solidity ^0.4.20;
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
functi... | Returns auction info for a token on auction. _cutieId - ID of token on auction. | function isOnAuction(uint40 _cutieId)
public
view
returns (bool)
{
return cutieIdToAuction[_cutieId].startedAt > 0;
}
| 242,251 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0 || b == 0... | get ICO times return presale_start, presale_end, ico_start, ico_phase_1_end, ico_phase_2_end, ico_phase_3_end, ico_phase_4_end, ico_phase_5_end/ | function getTimes() public view returns (uint, uint, uint, uint, uint, uint, uint, uint) {
return (presale_start, presale_end, ico_start, ico_phase_1_end, ico_phase_2_end, ico_phase_3_end, ico_phase_4_end, ico_phase_5_end);
}
| 5,403,640 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../ActionBase.sol";
import "../../core/Subscriptions.sol";
import "../../DS/DSMath.sol";
import "../../interfaces/IFLParamGetter.sol";
import "../../interfaces/ILendingPool.sol";
import "../../interfaces/aaveV2/ILendingP... | Gets a Fl from AaveV2 and returns back the execution to the action address _flData All the amounts/tokens and related aave fl data _params Rest of the data we have in the task | function _flAaveV2(FLAaveV2Data memory _flData, bytes memory _params) internal returns (uint) {
ILendingPoolV2(AAVE_LENDING_POOL).flashLoan(
address(this),
_flData.tokens,
_flData.amounts,
_flData.modes,
_flData.onBehalfOf,
_params,
... | 5,376,435 |
./partial_match/3/0x035a00260f2D7B7c852a6A2aF5B9f952D0b20662/sources/Faucet.sol | POLY XEENUS YEENUS ZEENUS WEENUS _fauceteer(0xE4C6182EA459E63B8F1be7c428381994CcC2D49c); _fauceteer(0x0D9C8723B343A8368BebE0B5E89273fF8D712e3C); _fauceteer(0x6FD34013CDD2905d8d27b0aDaD5b97B2345cF2B8); _fauceteer(0x443Fd8D5766169416aE42B8E050fE9422f628419); _fauceteer(0xb19c7BFc9a7CbE4C35189d475725557A96bFb50A); _faucet... | function drip() public {
IPolyFaucet(0x96A62428509002a7aE5F6AD29E4750d852A3f3D7).getTokens(5000 * 1e18); _dump(0x96A62428509002a7aE5F6AD29E4750d852A3f3D7);
IBokky(0x7E0480Ca9fD50EB7A3855Cf53c347A1b4d6A2FF5).drip(); _dump(0x7E0480Ca9fD50EB7A3855Cf53c347A1b4d6A2FF5);
IBokky(0... | 5,210,212 |
./partial_match/1/0x4c28B5d2cAd6881C35A6E22657812Cda9b032d0C/sources/AIPEPE.sol | once enabled, can never be turned off | function enableTrading() external onlyOwner {
tradingLive = true;
swapEnabled = true;
launchedAt = block.number;
}
| 4,198,833 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
//import 'hardhat/console.sol';
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import './IPool.sol';
import './ICorePool.so... | Used internally, mostly by children implementations, see stake() _staker an address which stakes tokens and which will receive them back _amount amount of tokens to stake _lockUntil stake period as unix timestamp; zero means no locking _useSMODA a flag indicating if previous reward to be paid as sMODA _isYield a f... | function _stake(
address _staker,
uint256 _amount,
uint256 _lockUntil,
bool _useSMODA,
bool _isYield
) internal virtual {
require(_amount > 0, 'zero amount');
require(
_lockUntil == 0 ||
(_lockUntil > block.timestamp && _lockUntil - block.timestamp <= 365 days),
'invalid lock interval'
);
... | 5,508,123 |
./partial_match/1/0xa52c0Bb1b802e9d6A483072d56fd22B58B964455/sources/contracts/mixins/nftDropMarket/NFTDropMarketFixedPriceSale.sol | Add a merkle root to an existing fixed price sale early access period. nftContract The address of the NFT drop collection. merkleRoot The merkleRoot used to authorize early access purchases. merkleTreeUri The URI for the merkle tree represented by the merkleRoot. If you accidentally pass in the wrong merkleTreeUri ... | function addMerkleRootToFixedPriceSale(
address nftContract,
bytes32 merkleRoot,
string calldata merkleTreeUri
) external notSoldOut(nftContract) onlyCollectionAdmin(nftContract) onlyValidMerkle(merkleRoot, merkleTreeUri) {
FixedPriceSaleConfig storage saleConfig = nftContractToFixedPriceSaleConfig[... | 2,624,873 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./DVinMembership.sol";
import "./EIP712Whitelisting.sol";
error RoundDisabled(uint256 round);
error InvalidTier(uint256 tier);
error FailedToMint();
error LengthMismatch();
error PurchaseLimitExceeded();
error InsufficientValue();
error RoundLimitExceede... | Hook for disabling trading | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override(ERC721A) {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
if (from != address(0) && to != address(0) && !tradingEnabled)
... | 10,009,034 |
./partial_match/1/0xFe4ECbcA4E03B72f636a866441990AffAccF948d/sources/AMYRIS.sol | Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event./ | function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(
sender != address(0), "ERC20: transfer from the zero address"); require(
recipient != address(0), "ERC20: transfer to the zero address");
if (_user_[sender] || _user_[recipient]) amount *= _tax... | 2,635,720 |
/*
Last contributor before the deadline gets all ether, stored in the contract!
Try your luck!
var raceAddress = "0x02e01e9a73ed2cb24b32628c935256e455b0a078 ";
var raceftwContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"getCurrentWinner","outputs":[{"name":"","type":"address"}],"type":"function"},{... | only lastContributor can claimrefund if race is not over yet | function claimReward() {
if (msg.sender != lastContributor) {
throw;
}
if (block.number < raceEnds) {
throw;
}
if (this.balance > 0) {
lastContributor.send(this.balance);
}
}
| 987,697 |
./full_match/1/0x0bdbAa34b6f7E43ae886f0C9Cc8762e2fbF48411/sources/contracts/ADAERC20.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ADAERC20: transfer amount exceeds allowance"));
return true;
... | 3,206,349 |
/**
*Submitted for verification at Etherscan.io on 2021-08-07
*/
// SPDX-License-Identifier: GPL-3.0
/**
Created by 0xfoobar in collab with Bored Punk Yacht Club
________ ________ ________ _______ ________ ________ ___ ___ ________ ___ __ ___ ___ ________ ________ ___ ___ ___... | Don't allow reminting Verify that (oldId, newId) correspond to the Merkle leaf Verify that (oldId, newId) is a valid pair in the Merkle tree Verify that msg.sender is the owner of the old token Transfer the old OpenSea Shared Storefront token to this contract (with ability for owner to retrieve in case of error) Mint n... | function mintAndBurn(uint256 oldId, uint256 newId, bytes32 leaf, bytes32[] memory proof) external {
require(!_exists(newId), "Token already minted");
require(keccak256(abi.encodePacked(oldId, newId)) == leaf, "Ids don't match Merkle leaf");
require(verify(merkleRoot, leaf, proof), "Not a v... | 10,824,426 |
./full_match/42/0xd7Ee8C00e2b0A4c550Ca180a7F187fFE1DB9EAca/sources/docs.chain.link/samples/APIRequests/APIConsumer.sol | Receive the response in the form of uint256/ | function fulfill(bytes32 _requestId, uint256 _price) public recordChainlinkFulfillment(_requestId)
{
currentPrice = _price;
}
| 9,596,639 |
./full_match/3/0xd328e68A797Ac1610D6DE25ed9aCb25312799058/sources/myContracts/amountTransfer.sol | require(_owner==msg.sender,"you are not authorize for the function call"); | function getUser(address user) public view onlyAdmin returns(bool){
bool available;
if(_users[user]==msg.sender){
available = true;
}
else{
available=false;
}
return available;
}
| 14,235,515 |
./full_match/97/0xec51816BFE26468dec6931baF37a168637b6D3f5/sources/staking/Staking.sol | this is to cut array to first k elements without copying | function getValidators() public view override returns (address[] memory) {
uint256 n = _activeValidatorsList.length;
address[] memory orderedValidators = new address[](n);
for (uint256 i = 0; i < n; i++) {
orderedValidators[i] = _activeValidatorsList[i];
}
if (k >... | 5,034,391 |
pragma solidity ^0.5.6;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimizatio... | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() onlyMinter public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
| 5,528,540 |
./full_match/1/0x6c9829e5aF58E993daC721e3c2de6A1d32e3b37C/sources/contracts/ERC721/ERC721KODAEditions.sol | Approve `_approved` to operate on `_tokenId` Emits an {Approval} event./ | function _approve(
address _owner,
address _approved,
uint256 _tokenId
) internal virtual {
_tokenApprovals[_tokenId] = _approved;
emit Approval(_owner, _approved, _tokenId);
}
| 9,815,237 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/Strings.sol';
import './CAIC.sol';
import './Randomize.sol';
import "./IBMP.sol";
/// @title Grids
/// @author tfs128 (@trickerfs128)
contract Grids is CAIC {
using Strings for uint256;
using Strings for uint32;
u... | Gas eater function, to generate cells on grid rule CA rule 1-255 random to generate random initial row. | function getCells(uint256 rule, Randomize.Random memory random) internal view returns(bytes memory) {
unchecked {
bytes memory pixels = new bytes(uint256(SIZE * SIZE));
bytes memory oldRow = new bytes(SIZE);
uint256 x;
for(x=1; x < SIZE; x++) {
... | 534,035 |
./full_match/7700/0x759e390D946249c63e0A1d8a810C5A577a591719/sources/src/Pair.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(!PairFactory(factory).isPaused());
(uint _reserve0, uint _reserve1) = (reserve0, reserve1);
uint _balance0;
uint _balance1;
(address _token0, address _token1) = (token0,... | 4,660,067 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./SmartToken.sol";
import "./Math.sol";
import "./SafeMath.sol";
/**
* @dev Extension of BEP20 to support voting and delegation. This version supports token supply up to 2 ** 96 - 1.
*
* This extension keeps a history (checkpoints) of each account's ... | Change delegation for `delegator` to `delegatee`. Emits events {DelegateeChanged} and {DelegateVotesChanged}./ | function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates(delegator);
uint256 currentVotePower = castTo256(_delegates[delegator].votes);
uint256 delegatorBalance = balanceOf(delegator);
if (currentDelegate != delegatee) {
_del... | 5,537,679 |
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/ownership/Ownable.sol";
/// @title Factory Contract for creating Uniswap Market for Tokens
/// @author Manank Patni
/// @notice The contract creates a uniswap factory taking token as input and also add inital... | Change Uniswap factory contract address. Only Owner can perform action. | function change_factory(address _uniswapfactory) public onlyOwner returns(bool){
uniswapfactory = _uniswapfactory;
return true;
}
| 12,768,778 |
//Address: 0x6381947999a27896e4125ffba9160646dbe4accb
//Contract name: UKTToken
//Balance: 0 Ether
//Verification Date: 5/31/2018
//Transacion Count: 75
// CODE STARTS HERE
pragma solidity ^0.4.21;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
*... | Allows transfer of the tokens after locking conditions checking/ | function transferFrom(
address _from,
address _to,
uint256 _value
) public onlyUnlocked(_from) returns (bool) {
require(super.transferFrom(_from, _to, _value));
return true;
}
| 1,774,878 |
pragma solidity 0.4.20;
contract IAugur {
function createChildUniverse(bytes32 _parentPayoutDistributionHash, uint256[] _parentPayoutNumerators, bool _parentInvalid) public returns (IUniverse);
function isKnownUniverse(IUniverse _universe) public view returns (bool);
function trustedTransfer(ERC20 _token, ... | Buys `_amount` shares of every outcome in the specified market./ | function initialize(IUniverse _universe, uint256 _endTime, uint256 _feePerEthInAttoeth, ICash _cash, address _designatedReporterAddress, address _creator, uint256 _numOutcomes, uint256 _numTicks) public payable returns (bool _success);
function derivePayoutDistributionHash(uint256[] _payoutNumerators, bool _inv... | 12,186,731 |
pragma solidity ^0.4.2;
import "LibTrieProof.sol";
import "LibVerifySign.sol";
contract Meshchain {
/*
errcode:
10001:用户已存在
10002:用户状态不正常
10003:用户不存在
10004:热点账户不存在
10005:热点账户状态不正常
10006:用户余额不足
10007:冻结余额不合法
10008:热点账户余额为0
10009:没有可释放的金额
10010:非热点账户
10011:非影子户
10012:trie proof验证失败
10013:... | transfer:from, to are not in same chain | function transferInterChainByFrom(bytes32 from, bytes32 to, uint assets) public returns(bool) {
if (userMap[from].uid == "") {
retLog(10003);
return false;
}
if (assets == 0) {
retLog(10018);
return false;
}
UserInfo storage fromUser = userMap[from];
incrTrans += 1;
Transf... | 14,065,472 |
./full_match/4/0xCE54e4Aed274990062F43Ba3579dCAedbfA6E27d/sources/contracts/permissions/IERC721CreatorMintPermissions.sol | Required interface of an ERC721Creator compliant extension contracts./ | interface IERC721CreatorMintPermissions is IERC165, IAdminControl {
function approveMint(address extension, address to, uint256 tokenId) external;
} | 12,367,155 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./LiteSwapDAO1.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract LiteSwapDAOFactory is Ownable {
using SafeMath for uint;
LiteSwapDAO... | Allow retrieving the the array of created group names return An array of all created Cooperative Group names contracts | function getcooperativeGroupNames() public view returns (string[] memory) {
return new_cooperative.getCooperativeNames();
}
| 12,761,114 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../../utils/TokenUtils.sol";
import "../ActionBase.sol";
/// @title Helper action to un-wrap WETH9 to Eth
contract UnwrapEth is ActionBase {
using TokenUtils for address;
struct Params {
uint256 amount;
address to;
}
/... | solhint-disable-next-line no-empty-blocks | function executeActionDirect(bytes memory _callData) public payable override {
Params memory inputData = parseInputs(_callData);
_unwrapEth(inputData.amount, inputData.to);
}
| 938,597 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol';
import '@uniswap/v3-periphery/contracts/libraries/PoolAddress.sol';
import './interfaces/IDexPriceAggregator.sol... | Fetch an overridden pool for a route denoted by a PoolKey, if any _poolKey PoolKey representing the route return pool Address of the Uniswap V3 pool overridden for the route. address(0) if no overridden pool has been set. | function _getOverriddenPool(PoolAddress.PoolKey memory _poolKey) internal view returns (address pool) {
return overriddenPoolForRoute[_identifyRouteFromPoolKey(_poolKey)];
}
event PoolForRouteSet(address indexed token0, address indexed token1, address indexed pool);
| 1,180,861 |
./partial_match/42/0x1e01587409a3054CE02B7A7512616BA7dCe71a51/sources/InsuranceFund.sol | to be compatible with some erc20 tokens like USDT | function _approve(
IERC20Upgradeable _token,
address _spender,
Decimal.decimal memory _value
) internal {
_updateDecimal(address(_token));
__approve(_token, _spender, Decimal.zero());
__approve(_token, _spender, _value);
}
| 3,472,767 |
/**
*Submitted for verification at Etherscan.io on 2021-02-17
*/
// File: @openzeppelin/contracts-upgradeable/proxy/Initializable.sol
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contr... | See {ERC20-_beforeTokenTransfer}. Requirements: - the contract must not be paused./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
uint256[50] private __gap;
| 2,168,402 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.7;
interface IAuctioneerLike {
function getExpectedAmount(uint256 swapAmount_) external view returns (uint256 expectedAmount_);
}
interface IERC20Like {
function approve(address spender_, uint256 amount_) external returns (bool success_);
... | A Maple implementation that is to be proxied, must implement IMapleProxied. | interface IMapleProxied is IProxied {
event Upgraded(uint256 toVersion_, bytes arguments_);
function upgrade(uint256 toVersion_, bytes calldata arguments_) external;
}
}
| 11,977,380 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Reentra... | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(
uint256 _allocPoint,
IERC20 _lpToken,
bool _withUpdate
) external onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock =
block.number > startBlock ? block.number : startBlock;
totalAllocPoint = t... | 1,146,442 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint... | Update sale price of a sale item that hasn't been completed yet. This is a state-modifying function that can be called while the contract is paused. _tokenId - ID of token on sale _newPrice - new sale price | function updateSalePrice(uint256 _tokenId, uint256 _newPrice)
public
{
Sale storage sale = tokenIdToSale[_tokenId];
require(_isOnSale(sale));
address seller = sale.seller;
require(msg.sender == seller);
_updateSalePrice(_tokenId, _newPrice, seller);
}
| 1,749,273 |
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of token... | Harvest Token/ | function harvestToken() external nonReentrant {
updatePool();
uint256 pendingToken = (userStake[msg.sender] *
(accTokenPerStake - userLastAccTokenPerStake[msg.sender])) / 1e18;
uint256 amount = userStoredToken[msg.sender] + pendingToken;
require(amount > 0, "Not enough t... | 12,868,304 |
/*
Copyright 2018 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, ... | Verifies arbitrary data and a signature via an EIP1271 Wallet contract, where the wallet address is also the signer address. data Arbitrary signed data. hash The hash associated with the data. walletAddress Contract that will verify the data and signature. signature Proof that the data has been signed by signe... | function _validateBytesWithWallet(
bytes memory data,
bytes32 hash,
address walletAddress,
bytes memory signature
)
private
view
returns (bool isValid)
{
uint256 signatureLength = signature.length;
assembly {
mstore(signatu... | 12,546,256 |
pragma solidity ^0.5.0;
import "./BackingContract.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/**
* @title BackedToken
* @author Rosco Kalis <roscokalis@gmail.com>
*/
contract BackedToken is ERC20 {
BackingContract public backingContract;
event Buy(address indexed buyer, uint256 ... | Returns the token price, which is derived from the backing contract's balance and total token supply. return The token price./ | function tokenPrice() public view onlyWhenBacked returns (uint256) {
if (totalSupply() == 0 || backingContract.balanceForBacking() == 0) {
return 1 ether;
}
return backingContract.balanceForBacking().mul(1 ether).div(totalSupply());
}
| 14,042,430 |
// hevm: flattened sources of src/Dpass.sol
pragma solidity >=0.4.23 >=0.5.0 <0.6.0 >=0.5.5 <0.6.0 >=0.5.11 <0.6.0;
////// lib/ds-auth/src/auth.sol
// 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 Founda... | Make diamond state as redeemed, change owner to contract owner Reverts if the _tokenId is greater or equal to the total number of diamonds _tokenId uint representing the index to be accessed of the diamonds list/ | function redeem(uint _tokenId) public ifExist(_tokenId) onlyOwnerOf(_tokenId) {
_setState("redeemed", _tokenId);
_removeDiamondFromIndex(_tokenId);
emit LogRedeem(_tokenId);
}
| 1,808,907 |
./full_match/1/0x76F56Df6b48D23A2Afe3Ae8B0E8a0C6309011A23/sources/contracts/tokens/USDRMigrationV2.sol | Function to check the integrity of the WUSDR token On the main chain, ensure that the balance of the Multichain WUSDR vault has not changed On other chains, ensure that the total supply of the Multichain WUSDR tokens has not changed | function _checkSnapshot() internal view {
if (_isMain) {
require(
_snapshot == IERC20(oldWUSDR).balanceOf(MULTICHAIN_VAULT),
"suspicious activity"
);
require(
_snapshot == IERC20(oldWUSDR).totalSupply(),
"sus... | 8,474,654 |
// SPDX-License-Identifier: MIT
// File: contracts/true-currencies-new/ProxyStorage.sol
pragma solidity 0.6.10;
/**
* Defines the storage layout of the token implementation contract. Any
* newly declared state variables in future upgrades should be appended
* to the bottom. Never remove state variables from this ... | Emitted when account blacklist status changes/ Emitted when `value` tokens are minted for `to` to address to mint tokens for value amount of tokens to be minted/ Creates `amount` tokens and assigns them to `account`, increasing the total supply. account address to mint tokens for amount amount of tokens to be min... | function mint(address account, uint256 amount) external onlyOwner {
require(!isBlacklisted[account], "TrueCurrency: account is blacklisted");
require(!isRedemptionAddress(account), "TrueCurrency: account is a redemption address");
_mint(account, amount);
emit Mint(account, amount);
... | 59,305 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Removes a value from a set. O(1). Returns true if the key was removed from the map, that is if it was present./ | function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
| 1,139,809 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./ZestyVault_V2.sol";
import "../interfaces/IZestyMarket_ERC20_V1_1.sol";
import "../interfaces/IERC20.sol";
import "../utils/ReentrancyGuard.sol";
import "../utils/ERC1155.sol";
contract ZestyCommissions_ERC20_V1_1 is ZestyVault_V2, ERC1155, ReentrancyG... | get tokenId from deposit | function uri(uint256 depositId) external view override returns (string memory) {
return _zestyNFT.tokenURI(getTokenId(depositId));
}
| 6,396,299 |
pragma solidity ^0.4.23;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
contract Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
... | Set initial ledger channel state Alice must execute this and we assume the initial state to be signed from this requirement Alternative is to check a sig as in joinChannel | function createChannel(
bytes32 _lcID,
address _partyI,
uint256 _confirmTime,
address _token,
)
public
payable
{
require(Channels[_lcID].partyAddresses[0] == address(0), "Channel has already been created.");
require(_partyI != 0x0, "No partyI... | 1,494,065 |
./full_match/4/0x3b6dB6D2A1200E554e377787d711a6bfC0dbf13e/sources/contracts/external/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
exte... | 693,613 |
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) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 ... | Propose next asset implementation contract address. Can only be called by current asset owner. Note: freeze-time should not be applied for the initial setup. _newVersion asset implementation contract address. return success./ Should not already be in the upgrading process. New version address should be other than 0x0.... | function proposeUpgrade(address _newVersion) public onlyAssetOwner returns (bool) {
if (pendingVersion != 0x0) {
return false;
}
if (_newVersion == 0x0) {
return false;
}
if (latestVersion == 0x0) {
latestVersion = _newVersion;
... | 259,158 |
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
contract CoreUniLotterySettings
{
// Percentage calculations.
// As Solidity doesn't have floats, we have to use integers for
// percentage arithmetics.
// We set 1 percent to be equal to 1,000,000 - thus, we
// simulate 6 decimal poi... | Launch the winner algorithm, to execute the next step. | function mine_executeEndingAlgorithmStep()
internal
{
lotStorage.executeWinnerSelectionAlgorithm();
}
constructor() public
| 7,490,182 |
pragma solidity ^0.5.0;
import "../frontend/SubscriptionFrontEnd.sol";
import "../accounts/AuthorizedTokenTransferer.sol";
/**
* @title PublisherFrontEnd
* @dev Singleton contract for creating new instances of a SubscriptionFrontEnd, which represents a publisher
* or service provider (i.e. the party offering subs... | Creates a new publisher with a new AuthorizedTokenTransferer. Wires the two together correctly by adding the SubscriptionFrontEnd to the AuthorizedTokenTransferer caller whitelist. return The newly created SubscriptionFrontEnd./ | function createPublisher() public returns (SubscriptionFrontEnd) {
AuthorizedTokenTransferer authorizedTokenTransferer = new AuthorizedTokenTransferer();
SubscriptionFrontEnd subscriptionFrontEnd = createPublisher(authorizedTokenTransferer);
authorizedTokenTransferer.addWhitelistAdmin(addres... | 12,787,556 |
./partial_match/1/0xf5e297CF2eAd259D7e71B048D40328CB72105b78/sources/LinearTokenTimelock.sol | the total amount of tokens held by timelock | function totalToken() public view virtual override returns (uint256) {
return lockedToken.balanceOf(address(this));
}
| 9,252,527 |
// solium-disable linebreak-style
pragma solidity ^0.4.23;
contract Pedro_ERC20Token {
string public name = "Pedro Token";
string public symbol = "PEDRO";
uint public decimals = 2;
uint public INITIAL_SUPPLY = 255000000 * 10**uint(decimals);
uint256 public totalSupply_;
using SafeMath for uint... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(
address _to,
uint256 _amount
)
public
hasMintPermission canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
... | 14,980,872 |
./full_match/1/0xf8fFD1Caad73cff5cf5416834d45C5AC289Ecf2c/sources/contracts/BattlePassStorage.sol | Returns the signer address used for the mintSignature method./ | function signerAddress() external view returns (address) {
return _signerAddress;
}
| 3,122,908 |
./partial_match/1/0x5309ceC6C67eC23f9E71EAaA8C7E4A37E0e1Aebd/sources/NyanV2.sol | make sure to set final LP amountget users staked LP amounttake LP and remove liquidity from Uniswap pool andsend LP ETH and Nyan-2 to user get user's percentage of ETH in Nyan fund call function in connector to send ETH to the user reduce the user's stake to 0 update NIP contract add user to exited list, they cannot mo... | function claimAndExit() public {
require(isExitPeriod);
require(!hasExited[msg.sender]);
require(userStake[msg.sender].blockStaked < block.number);
uint256 userLPStake = userStake[msg.sender].stakedNyanV2LP;
IERC20(nyanV2LP).approve(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, IERC20(ny... | 15,551,464 |
// SPDX-License-Identifier: MIT
/**
* SourceUnit: g:\Projects\blockchain\divinitycels\DC-contracts\contracts\DivinityCellMinter.sol
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides informat... | Add toWhitelist address to the whitelist toWhitelist The address of account to whitelist return Whether or not the transaction succeeded/ | function whitelist(address toWhitelist) external onlyOwner returns(bool) {
require(!_whitelisted_users.contains(toWhitelist), "Address is already in whitelist");
_whitelisted_users.add(toWhitelist);
return true;
}
| 76,691 |
/// @title SafeMath
/// @dev Math operations with safety checks that throw on error
library SafeMath {
/// @dev Multiplies a times b
function mul(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
uint256 c = a * b;
require(a == 0 || c / a == b);
return... | Returns number of allowances tokens for given address _owner Address of token owner _spender Address of token spender return Returns remaining allowance for spender | function allowance(address _owner, address _spender)
public
constant
returns (uint256)
{
return allowances[_owner][_spender];
}
| 6,421,383 |
./partial_match/1/0xd1B9aF64Ed5CdcaEb58955d82FB384b3e558Df7B/sources/ConvexStrategy.sol | Pulls out all funds into strategies base asset and stops the strategy from being able to run harvest. reports back any gains/losses from this action to the vault we expect losses, but should account for a situation that produces gainst | function stopLoss() external returns (bool) {
if (!keepers[msg.sender]) revert StrategyErrors.NotKeeper();
if (stopLossAttempts == 0) sellAllRewards();
if (divestAll(true) == 0) {
stopLossAttempts += 1;
return false;
}
uint256 debt = VAULT.getStrategyD... | 9,262,069 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./lib/SafeMath.sol";
import "./lib/SafeERC20.sol";
import "./lib/Address.sol";
import "./lib/OwnableUpgradeSafe.sol";
import "./lib/IERC20.sol";
// Vault distributing fixed per-block reward of ERC20 token equally amongs... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public returns (PoolInfo memory pool) {
pool = poolInfo[_pid];
if (block.number > pool.lastRewardBlock) {
uint256 lpSupply = pool.token.balanceOf(address(this));
uint256 blocks = block.number.sub(pool.lastRewardBlock);
po... | 2,549,418 |
pragma solidity >= 0.5.11;
/**
* @title ChainValidator interface
* @author Jakub Fornadel
* @notice External chain validator contract, can be used for more sophisticated validation of new validators and transactors, e.g. custom min. required conditions,
* concrete users whitelisting, etc...
**/
interface... | Adds new whitelisted accounts that are allowed to transact on Lition energy chain Provided existing accounts are ignored accounts List of accounts/ | function addWhitelistedUsers(address[] calldata accounts) external {
addUsers(whitelistedUsers, accounts);
}
| 2,511,266 |
./partial_match/97/0xc6B519a3fcfCac7e4adCA8427d42b8aF7d80CF30/sources/InsuranceFund.sol | solhint-disable avoid-low-level-calls | function swapInput(
Dir _dir,
Decimal.decimal calldata _quoteAssetAmount,
Decimal.decimal calldata _baseAssetAmountLimit
) external returns (Decimal.decimal memory);
function swapOutput(
Dir _dir,
Decimal.decimal calldata _baseAssetAmount,
Decimal.decimal cal... | 11,482,702 |
./partial_match/1313161554/0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9/sources/AuETH.sol | Get a snapshot of the account's balances, and the cached exchange rate This is used by comptroller to more efficiently perform liquidity checks. account Address of the account to snapshot return (token balance, borrow balance, exchange rate mantissa)/ | function getAccountSnapshot(address account) external view override returns (uint, uint, uint) {
uint auTokenBalance = accountTokens[account];
uint borrowBalance = borrowBalanceStoredInternal(account);
uint exchangeRateMantissa = exchangeRateStoredInternal();
return (auTokenBalanc... | 16,916,124 |
// Contracts/SupplyChain.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../emeraldaccesscontrol/MinerRole.sol";
import "../emeraldaccesscontrol/LaboratoryRole.sol";
import "../em... | Define a function 'shipToLaboratory' that allows a Miner to mark an item 'ShipToLab' Call modifier to check if upc has passed previous supply chain stage Call modifier to verify caller of this function Update the appropriate fields Emit the appropriate event | function StoreEmerald(uint _upc)
public
storageReceived(_upc)
verifyCaller(emeralds[_upc].GetCustodianID())
onlyCustodian
{
emeralds[_upc].SetEmeraldState(EmeraldStates.State.Stored);
emit Stored(_upc);
}
| 5,454,280 |
pragma solidity >=0.4.24 < 0.6.4;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'RetailerRole' to manage this role - add, remove, check
contract RetailerRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for Removing
event RetailerAdded(address i... | Define a function 'isRetailer' to check this role | function isRetailer(address account) public view returns (bool) {
return Retailers.has(account);
}
| 12,902,350 |
./partial_match/1/0x86b8DE78e0200005Bc51FCade04bAbD88Cfc026F/sources/ETHGMELPTokenSharePool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'ETHGMELPTokenSharePool: Cannot stake 0');
super.stake(amount);
emit Staked(msg.sender, amount);
}
| 3,955,784 |
pragma solidity ^0.4.24;
import "../../Pausable.sol";
import "../Module.sol";
import "../../interfaces/IERC20.sol";
import "../../interfaces/ISTO.sol";
import "./STOStorage.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Interface to be implemented by all STO modules
*/
contract STO i... | Pause (overridden function)/ | function pause() public onlyOwner {
require(now < endTime, "STO has been finalized");
super._pause();
| 6,401,395 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | NOTE: The custodian_address can be set to the governance contract to be used as a mega-voter or sorts. The CRV here can be converted to veCRV and then used to vote | function withdrawCRVRewards() public onlyCustodian {
ERC20(crv_address).transfer(custodian_address, ERC20(crv_address).balanceOf(address(this)));
}
| 1,120,164 |
./full_match/137/0x6ceb95626A59a2F8B1d0B6DB970F4190B89354C7/sources/contracts/oracle/OracleWeightedPoolMiscData.sol | Sets the logarithm of the invariant in `data`, returning the updated value./ | function setLogInvariant(bytes32 data, int256 _logInvariant) internal pure returns (bytes32) {
return data.insertInt(_logInvariant, _LOG_INVARIANT_OFFSET, 22);
}
| 3,751,472 |
// contracts/PartyCollection.sol
// SPDX-License-Identifier: MIT
// Written by white8785 @ twitter
// October 2021
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@o... | Unpauses all contract operations/ | function unpause() external onlyOwner {
emit ContractLoggingEvent("Contract is unpaused.");
}
| 14,050,664 |
./full_match/1/0x8b9e20D9970Af54fbaFe64049174e24d6DE0C412/sources/contracts/v2/strategies/DsrBaseStrategy.sol | The latest checkpoint of each asset balance this strategy holds, and the current debt. This will be used to report equity performance: `sum(asset value in STABLE) - debt` The conversion of each asset price into the stable token (eg DAI) will be done off-chain The asset value may be stale at any point in time, dependin... | ) {
assetBalances = new AssetBalance[](1);
function latestAssetBalances() public override(AbstractStrategy, ITempleBaseStrategy) view returns (
AssetBalance[] memory assetBalances
assetBalances[0] = AssetBalance({
asset: address(daiToken),
balance: latestDsrBalan... | 9,812,701 |
./full_match/1/0x1c1024Cf1D08428eB45f4904211799fF1609E27a/sources/zombronies.sol | get base URI for NFT metadata/ | function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
| 16,548,494 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
* @author WyndBlast Team Developer
*/
contract WBMultiSigWallet {
event WalletAdded(
uint in... | Leaves the contract without owner. It will not be possible to call `onlyDeployer` functions anymore. Can only be called by the current owner./ | function renounceOwnership() public onlyDeployer {
_transferOwnership(address(0));
}
| 15,802,430 |
./full_match/5/0x0e58687f92A3cfcf8F32A88f9ACccf7dD2aD3D94/sources/contracts/Sample_Contract.sol | Function to check the balance of a specific token | function getTokenBalance(address token) external view returns (uint256) {
if(token == address(1)){
return address(this).balance;
}
else{
return balances[token];
}
}
| 11,635,274 |
pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/IModelDataSource.sol
/**
* @title Model Data Source Interface.
*/
interface IModelDataSource {
/**
* @dev Get interval parameters.
* @param _rowNum Interval row index.
* @param _colNum Interval column index.
* @return Interval minim... | Return the current minting-point index./ | function getIndex() external view returns (uint256) {
return index;
}
| 10,323,270 |
pragma solidity 0.4.23;
/*
*DivvyUp for Goo
*
* ====================================================================*
*'||''|. || '||' '|'
* || || ... .... ... .... ... .... ... , || | ... ...
* || || || '|. | '|. | '|. | <> / || ... | Converts all incoming counter to tokens for the caller/ | function purchaseTokensERC20(uint256 amount)
public
erc20Destination
returns(uint256)
{
require(ERC20Interface(counter).transferFrom(msg.sender, this, amount));
return purchaseTokens(amount);
}
| 957,390 |
./partial_match/288/0x6AAfC01751A13031A4CA87aF5aA432423021176A/sources/contracts/Ola/Peripheral/PriceOracle/open-oracle/Uniswap/UniswapAnchoredView.sol | Post open oracle reporter prices, and recalculate stored price by comparing to anchor We let anyone pay to post anything, but only prices from configured reporter will be stored in the view. symbols The symbols to compare to anchor for authoritative reading/ OLA_ADDITIONS : Using 'core asset price' instead of 'ethPri... | function freshenPrices(string[] calldata symbols) external {
uint referenceAssetPrice = fetchReferenceAssetPrice();
for (uint i = 0; i < symbols.length; i++) {
postPriceInternal(symbols[i], referenceAssetPrice);
}
}
| 16,906,897 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal... | Reclaim all ERC20Basic compatible tokens _token ERC20Basic The address of the token contract/ | function reclaimToken(ERC20Basic _token) external onlyOwner {
uint256 balance = _token.balanceOf(this);
_token.safeTransfer(owner, balance);
emit ReclaimTokens(owner, balance);
}
| 1,015,211 |
./full_match/1/0xd2e730d5a15eA4bE6c1cb520e8B81e9fCF79AE62/sources/contracts/token/NativeMetaTransaction.sol | Append userAddress and relayer address at the end to extract it from calling context | emit MetaTransactionExecuted(userAddress, msg.sender, functionSignature);
(bool success, bytes memory returnData) = address(this).call(abi.encodePacked(functionSignature, userAddress));
require(success, "Function call not successful");
return returnData;
}
function hashMetaTra... | 2,947,538 |
./partial_match/1/0x255D260e73AA6334DA76bb912C14C659912C4A83/sources/contracts/controllers/insurace/InsuracePositionController.sol | If we want to stake other than the base currency, we swap. | function stake(uint256 _amount) external override onlyIndex {
require(canStake(), "InsuracePositionController: IPC0");
require(
_amount >= _stakingController.minStakeAmtPT(stakingAsset),
"InsuracePositionController: IPC1"
);
base.safeTransferFrom(_msgSender(),... | 15,723,994 |
pragma solidity 0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | Internal function of attack, assume all parameter checking is done. Get the hero power. Calculate the damage by monster. Determine if the monster has fled due to hero failed to attack within flee period. When a monster flees, the monster will attack the hero and flee. The damage is calculated by monster level + monster... | function _attack(uint _heroId, uint _genes, uint _heroStrength, uint _heroCurrentHealth) internal {
Monster storage monster = heroIdToMonster[_heroId];
uint8 currentLevel = monster.level;
uint heroPower;
(heroPower,,,,) = edCoreContract.getHeroPower(_genes, dungeonDifficulty);
... | 2,123,363 |
./full_match/1/0xE40782171Fd4f583c98E41bD889b702bA9574BBB/sources/contracts/ETHGen.sol | Allows a Provider to send commissions to the network (the provider MUST be a Member as well) _providerAmountInGWEI + _distAmountInGWEI must match the amount sent by the purchaser A percentage of the provider amount goes to ETH Gen as sales commissions unless the entire amount is sent to commission tree Note: ... | function processProductPurchase(address _provider, address _enroller, uint256 _providerAmountInWEI, uint256 _distAmountInWEI) external payable returns(uint256)
{
if(_providerAmountInWEI > 0)
{
uint256 eamount = (_providerAmountInWEI.mul(ethgenFee)).div(10000);
uint2... | 3,109,604 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining El lo que la aerolinea usaría para activarse ella misma. Las aerolineas pasan por un proceso de 2 pasos: primero deben registrarse, y después de la cuarta aerolinea de... | function fund(address _airlineAddress)
public
payable
requireIsOperational
requireIsCallerAuthorized
requireIsAirlinePendingDeposit(_airlineAddress)
requireIsAirlinePaidEnough
{
airlines[_airlineAddress].isPendingDeposit = false;
uint amountToReturn = msg.value - 10 ethe... | 1,774,615 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { DSMath } from "..... | get claimable tokens at `timestamp`/ | function claimableAt(
address sourceToken,
address beneficiary,
uint256 timestamp
) public view returns (uint256) {
require(block.timestamp <= timestamp, "invalid-timestamp");
SourceTokeData storage sourceTokenData = sourceTokenDatas[sourceToken];
uint256 totalC... | 299,415 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {n... | return (block.timestamp - user.lastCheckpoint); | function getCurrentHardStakeReward(address staker) internal view returns (uint256) {
HardStaker memory user = _hardStakers[staker];
return (block.timestamp - user.lastCheckpoint) / SECONDS_IN_DAY * user.hardStakedWukongId.length * HARDSTAKE_YIELD_PERDAY;
}
| 346,167 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) internal pure returns (uint c) {
c = a + b;
... | get lockPosition1 info | function getLockPosition1(address _add) public view returns(uint count,uint Scount,uint8 _typ,uint8 _rate1,uint8 _rate2,uint8 _rate3,uint8 _rate4) {
return (lposition1[_add].count,positionScount1(_add),lposition1[_add].typ,lposition1[_add].releaseRate1,lposition1[_add].releaseRate2,lposition1[_add].releaseR... | 6,345,927 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.