file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/97/0xc204aD2e7B78b5B33a2606b8Fd0945963d7A30A5/sources/project_/contracts/ERC20Deflationary.sol | Performs all the functionalities that are enabled./ Burn Reflect | function _afterTokenTransfer(ValuesFromAmount memory values) internal virtual {
if (_autoBurnEnabled) {
_tokenBalances[address(this)] += values.tBurnFee;
_reflectionBalances[address(this)] += values.rBurnFee;
_approve(address(this), _msgSender(), values.tBurnFee);
... | 3,288,485 |
./full_match/137/0xa4f9BDcD96C48A276Cc686870A3e0d2de534Ba57/sources/ArkenDexV3.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path,
uint256 amountAfterFee
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint256[](path.length);
... | 3,738,334 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @dev Integer division o... | Devevloper&39;s cut which is left in contract and accesed by `withdrawAll` and `withdrawAmountTo` methods. Transfer payment to old owner minus the developer&39;s cut. | function buy (uint256 _tokenId) payable public {
require(priceOf(_tokenId) > 0);
require(ownerOf(_tokenId) != address(0));
require(msg.value >= priceOf(_tokenId));
require(ownerOf(_tokenId) != msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
require(now >= ... | 6,644,908 |
// SPDX-License-Identifier: MIT
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol
// Subject to the MIT license.
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its d... | Can be called at any stage before or during the presale to cancel it before it ends. If the pair already exists on plasmaswap and it contains the presale token as liquidity the final stage of the presale 'addLiquidity()' will fail. This function allows anyone to end the presale prematurely to release funds in such a ca... | function forceFailIfPairExists () external {
require(!STATUS.LP_GENERATION_COMPLETE && !STATUS.FORCE_FAILED);
if (SPACEPORT_LOCK_FORWARDER.plasmaswapPairIsInitialised(address(SPACEPORT_INFO.S_TOKEN), address(SPACEPORT_INFO.B_TOKEN))) {
STATUS.FORCE_FAILED = true;
emit spaceportForceFailIfPairE... | 6,972,949 |
//Address: 0xad56c554f32d51526475d541f5deaabe1534854d
//Contract name: GenevieveCrowdsale
//Balance: 0 Ether
//Verification Date: 1/20/2018
//Transacion Count: 205
// CODE STARTS HERE
pragma solidity ^0.4.15;
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data){
... | Standard function transfer similar to ERC20 transfer with no _data. Added due to backwards compatibility reasons. | function transfer(address _to, uint _value) isUnlocked isUnfreezed(_to) returns (bool success) {
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
| 7,278,554 |
pragma solidity 0.4.23;
//
// This source file is part of the current-contracts open source project
// Copyright 2018 Zerion LLC
// Licensed under Apache License v2.0
//
// @title Abstract ERC20 token interface
contract AbstractToken {
function balanceOf(address owner) public view returns (uint256 balance);
functi... | Decreases approved amount of tokens for spender. Returns success. | function decreaseApproval(address _spender, uint256 _value) public returns (bool success) {
uint256 oldValue = allowed[msg.sender][_spender];
if (_value > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = sub(oldValue, _value);
}
emit Approval(msg.sender, _spender, allowed[ms... | 489,369 |
./partial_match/56/0xDca31a4d1cA28080B0b6a02DEAd39AaA602CaF8C/sources/JetfuelVaultV2.sol | The entrypoint of funds into the system. People deposit with this function into the vault. The vault is then in charge of sending funds into the strategy./ | function deposit(uint256 _amount) public nonReentrant {
uint256 _pool = balance();
token.safeTransferFrom(msg.sender, address(this), _amount);
earn();
uint256 _after = balance();
uint256 shares = 0;
if (totalSupply() == 0) {
shares = _amount;
s... | 11,164,095 |
pragma solidity ^0.4.24;
// File: node_modules\zeppelin-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) i... | / Refund event when ICO didn't pass soft cap and we refund ETH to investors + burn ERC-20 tokens from investors balances/ | function burnAfterRefund(address _who) public onlyOwner {
uint256 _value = balances[_who];
_burn(_who, _value);
}
| 6,432,566 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// OrboVerse is the coolest bar in town. You come in with some Orbo, and leave with more! The lo... | Leave the bar. Claim back your ORBOs. Unlocks the staked + gained Orbo and burns xOrbo Gets the amount of xOrbo in existence Calculates the amount of Orbo the xOrbo is worth | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(orbo.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
orbo.transfer(msg.sender, what);
}
| 14,094,175 |
./full_match/42220/0x050CBccf11F1403787b5AC34fb5144162EAD3340/sources/project:/contracts/ReserveController.sol | removes supplied address from array of addresses value - Address to look up and remove element/ | function removeByValue(address value) private {
uint i = find(value);
removeByIndex(i);
}
| 16,319,061 |
pragma solidity ^0.4.21;
contract QuantumCoin {
/* Le mot clé "public" rend ces variables
visibles depuis l'extérieur
Toutes les variables sont expliquées dans le constructeur */
address public minter;
uint public powDifficulty;
uint public numberOfTransactionsInLedger;
bytes32 public lastTransactionHash;... | Envoi de coins entre deux utilisateurs / On vérifie que l'utilisateur ne s'envoit pas de coins à lui-même On vérifie que l'expéditeur peut bien envoyer ce montant / On vérifie que l'expéditeur est bien celui qu'il prétend être (on ajoute lastTransactionToBeMined pour ne pas que quelqu'un qui intercepte la signature soi... | function send(bytes32 receiver, uint amount, uint8 _v, bytes32 _r, bytes32 _s) public {
bytes32 senderResolved = resolveAddress[msg.sender];
User storage usr = users[senderResolved];
(peut créer des incohérences) */
require(senderResolved != receiver);
require(usr.coins >= amount);
uint tmp = uint(sende... | 13,108,357 |
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
* @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 dea... | Returns the number of decimals used for the token/ SPDX-License-Identifier: GPL-3.0-only solhint-disable-next-line max-line-length Adapted from https:github.com/Uniswap/merkle-distributor/blob/c3255bfa2b684594ecd562cacd7664b0f18330bf/contracts/interfaces/IMerkleDistributor.sol. Enables the transfer of GFI rewards (ref... | interface IMerkleDirectDistributor {
function gfi() external view returns (address);
function merkleRoot() external view returns (bytes32);
function isGrantAccepted(uint256 index) external view returns (bool);
function acceptGrant(
uint256 index,
uint256 amount,
bytes32[] calldata merkleProof
)... | 10,394,022 |
./partial_match/80001/0x9f84EaeA0155A17C5eea7F3579ac4783a51E7B14/sources/GAME_Master.sol | Grants a group of tokens from a group of base cards, using the cards' metadata (if any) recipient_ - the account who will own this token on creation game_ - the of the game that the token comes from set_ - the of the set within the game that the token comes from cards_ - the array of card s of the card within the... | returns(uint[] memory _tokenIds) {
_tokenIds = new uint[](cards_.length);
function getTokenIdsFromPurchaseId(uint game_, bytes32 purchaseId_)
external
view
}
function grantTokensFromCards(
bytes32 recipient_, uint game_, uint set_, uint[] calldata cards_,
bytes32 purchaseId_)
external
... | 8,821,577 |
//etherate v.2.0
//EtheRate – is the first in the world, an honest pool of crypto-rates, based on absolute randomness!
//Official WEB-client: etherate.org
//Talk to us on Discord.gg/nEnApvF
/*
╔═══╗╔════╗╔╗─╔╗╔═══╗╔═══╗╔═══╗╔════╗╔═══╗
║╔══╝║╔╗╔╗║║║─║║║╔══╝║╔═╗║║╔═╗║║╔╗╔╗║║╔══╝
║╚══╗╚╝║║╚╝║╚═╝║║╚══╗║╚═╝║║║─║║╚╝║║╚╝║╚══... | ORACLIZE QUERIESCONSTRUSTOR | function Game()
{
oraclize_setProof(proofType_Ledger);
}
| 2,302,446 |
./full_match/84531/0x3b2Da38EeE92a0Ce9E8642f272a5bCa2a6Ac3A3c/sources/contracts/guild-core/GuildOracle.sol | Gets the address of the Chainlink oracle. return The address of the Chainlink oracle./ | function getOracle() external view returns (address) {
return _oracle;
}
| 14,312,987 |
./full_match/80001/0xB59b1C4aeF63ef7B5fE446F1b51c798db1b08108/sources/contracts/OasisUser.sol | Create new user and store in mapping for specified account | function _createUser(address _account, string memory _name)
external
onlyOwner
{
address account = _account;
require(
!allUsers[account].registered,
"You have already created an account!"
);
allUsers[account] = User(true, _name);
}
| 5,669,223 |
pragma solidity >=0.5.17 <0.8.4;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/utils/math/Math.sol';
import '../BaseStrategy.sol';
import './../../en... | 10000表示100%,当前apy的算法是一直累计过去的变化,有待改进 | function apy() public view returns (uint256) {
if (basisProfitRate <= BASIS_PRECISION) {
return 0;
}
if (effectiveTime == 0) {
return 0;
}
return (31536000 * (basisProfitRate - BASIS_PRECISION) * 10000) / (BASIS_PRECISION * effectiveTime);
}
| 6,894,693 |
./full_match/1/0x3883500A0721c09DC824421B00F79ae524569E09/sources/@gearbox-protocol/core-v2/contracts/adapters/AbstractAdapter.sol | Approves a token from the Credit Account to the target contract token Token to be approved amount Amount to be approved | function _approveToken(address token, uint256 amount) internal {
creditManager.approveCreditAccount(
msg.sender,
targetContract,
token,
amount
);
}
| 17,154,357 |
pragma solidity ^0.4.25;
contract Conquest {
/*=================================
= EVENTS =
=================================*/
event onHiveCreated (
address indexed player,
uint256 number,
uint256 time
);
event onDroneCreated (
addres... | Player must have enough ether available in vault | function createDroneFromVault()
public
{
address _player = msg.sender;
uint256 _vault = pilots_[_player].vault;
require(_vault >= droneCost_);
pilots_[_player].vault = _vault - droneCost_;
_createDroneInternal(_player);
}
| 12,660,050 |
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/lib/prb-math/src/UD60x18.sol | Converts a simple integer to UD60x18 by multiplying it by `UNIT`. Requirements: - x must be less than or equal to `MAX_UD60x18` divided by `UNIT`. x The basic integer to convert. result The same number converted to UD60x18. | function toUD60x18(uint256 x) pure returns (UD60x18 result) {
if (x > uMAX_UD60x18 / uUNIT) {
revert PRBMathUD60x18__ToUD60x18Overflow(x);
}
unchecked {
result = wrap(x * uUNIT);
}
}
| 4,833,928 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function... | | This function acts as a contract constructor which is not currently supported in contracts deployed using create_with_code_of(). It is called once by the factory during contract creation./ | function setup(address token_addr) public {
require(
address(factory) == address(0) && address(token) == address(0) && token_addr != address(0),
"INVALID_ADDRESS"
);
factory = IUniswapFactory(msg.sender);
token = IERC20(token_addr);
name = 0x556e6973776170205631000000000000000000000000... | 6,356,037 |
./partial_match/1/0xB9DFFBb4ac8705A463D0FB76fBA4CFC8b2B075b6/sources/CVXStaker.sol | function get_balances() external view returns (uint256[] memory); | interface ICurvePool {
function balances(uint256 i) external view returns (uint256);
function remove_liquidity_one_coin(
uint256 burn_amount,
int128 coin_idx,
uint256 min_received
) external returns (uint256);
function remove_liquidity(
uint256 burn_amount,
uin... | 4,172,623 |
./full_match/5/0x3970800843Cd84dAA6CA114541A3d0Cba3b5b793/sources/contracts/Lottery.sol | FUNCIONES GET:Balance actual del contrato: | function getContractBalance() public view returns(uint){
return address(this).balance;
}
| 1,959,001 |
./partial_match/4/0x9c33DE22AA1764A8eE9563A1868741ACca2be3c4/sources/VotingContract.sol | Определение того, голосовал пользователь уже или еще нет/ | function areVoted(address elector) public view isBallotExist returns(bool) {
uint i = 0;
bool flag = false;
address[] memory electors = ballots[ballots.length - 1].areVotedElectors;
while (!flag && i < electors.length) {
if (electors[i] == elector) {
flag ... | 8,746,194 |
//Address: 0x2737e022e8bf733b05fa0706b0e80003a576ccb4
//Contract name: TokenValueRelayer
//Balance: 0 Ether
//Verification Date: 2/2/2018
//Transacion Count: 162
// CODE STARTS HERE
pragma solidity ^0.4.11;
/* The authentication manager details user accounts that have access to certain priviledges and keeps a perma... | Gets whether or not the specified address is currently an account minter / | function isCurrentAccountMinter(address _address) constant returns (bool) {
return accountMinterAddresses[_address];
}
| 6,347,070 |
//Address: 0x4a184673b7247ea15227d8f738a0627e0b17d72a
//Contract name: Minewar
//Balance: 0.045868561800982743 Ether
//Verification Date: 6/11/2018
//Transacion Count: 1981
// CODE STARTS HERE
pragma solidity ^0.4.2;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
funct... | -------------------------------------------------------------------------- BOOSTER-------------------------------------------------------------------------- | function buyBooster(uint256 idx) public payable
{
require(now <= deadline);
require(players[msg.sender].round == round);
require(idx < numberOfBoosts);
BoostData storage b = boostData[idx];
if(msg.value < getBoosterPrice(idx) || msg.sender == b.owner){
revert... | 5,496,003 |
./full_match/5/0x45c62d1BF6D7F1AEfBB92689752B609213fAc397/sources/contracts/StakingToken.sol | fromG converts a Governance Token balance to Staking Token terms. Staking Token is a 9 decimal token. balance given is in 9 decimal format. | function fromG(uint256 amount) external view override returns (uint256) {
return governanceToken.balanceFrom(amount);
}
| 7,078,783 |
/*
CyberLionz Cubz (https://www.cyberlionz.io)
Code crafted by Fueled on Bacon (https://fueledonbacon.com)
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/crypto... | Withdraw's contract's balance to stakeholders | function withdraw() external {
uint256 balance = address(this).balance;
require(balance > 0, "No balance");
uint256 payout1 = balance * 6500 / 10000;
uint256 payout2 = balance * 2500 / 10000;
uint256 payout3 = balance * 1000 / 10000;
payable(0xaff176E6bedDdF28cBBC... | 6,443,667 |
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0... | 185,310 |
./full_match/1/0x25245941137d9C85B5D48aE8d7788aA841BEB9aE/sources/contracts/staking/MasterBids.sol | Deposit LP tokens to masterbids for Bids allocation on behalf of user user must initiate transaction from masterbids _pid the pool id _amount amount to deposit _user the user being represented update pool in case user has deposited | function depositFor(uint256 _pid, uint256 _amount, address _user) external override nonReentrant whenNotPaused {
PoolInfoV3 storage pool = poolInfoV3[_pid];
UserInfo storage user = userInfo[_pid][_user];
_updatePool(_pid);
_updateUserAmount(_pid, _user, user.amount + _amount);
... | 3,100,032 |
./partial_match/1/0xab5aAd8a36B4F9BB5e526a16747Db51037dD1cAF/sources/TokenSale.sol | use of msg.sender in view function is not security measure (it doesnt work for view functions), it is used only for convinience here. And etherscan do not support it (limitation of etherscan view functions support, but web3 supports)./ | function checkRefBalance(address ref_wallet) external onlyOwner view returns (uint256) {
return ref_balances[ref_wallet];
}
| 2,650,698 |
/**
*Submitted for verification at Etherscan.io on 2020-06-08
*/
pragma solidity ^0.5.17;
// @notice SECURITY TOKEN CONTRACT
// @dev ERC-1404 with ERC-20 with ERC-223 protection Token Standard Compliant
// @author Geoffrey Tipton at AEN
// ----------------------------------------------------------------------------
/... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account function transferFrom(address _from, address _to, uint _value) public returns (bool success) { | function transferFrom(address _from, address _to, uint _value) public transferAllowed(_from, _to, _value) returns (bool) {
emit Transfer(_from, _to, _value);
return true;
}
| 956,716 |
pragma solidity ^0.5.16;
import "./v2SafeMath.sol";
import "./v2TellorStorage.sol";
/**
* @title Tellor Transfer
* @dev Contains the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol
* reference this library for function's logic.
*/
library v2TellorTransfer {
using v2SafeMath for uint256;
... | _user address of party with the balance _spender address of spender of parties said balance return Returns the remaining allowance of tokens granted to the _spender from the _user/ | function allowance(v2TellorStorage.TellorStorageStruct storage self, address _user, address _spender) public view returns (uint256) {
return self.allowed[_user][_spender];
}
| 14,053,614 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// 买卖合约示例,通过状态机来实现买卖双方的确认机制。
contract Purchase {
uint public value;
address payable public seller;
address payable public buyer;
enum State {Created, Locked, Release, Inactive}
State public state;
// 条件限制
modifier cond... | 买家确认已经收到商品。 这会释放被锁定的以太币。 必须首先更改状态,然后调用transfer,避免transfer被调用多次 | function confirmReceived() public onlyBuyer inState(State.Locked) {
emit ItemReceived();
state = State.Release;
buyer.transfer(value);
}
| 1,063,764 |
pragma solidity 0.4.24;
import "@aragon/os/contracts/apps/UnsafeAragonApp.sol";
import "@aragon/os/contracts/common/EtherTokenConstant.sol";
import "@aragon/os/contracts/common/IsContract.sol";
import "@aragon/os/contracts/common/SafeERC20.sol";
import "@aragon/os/contracts/lib/math/SafeMath.sol";
import "@aragon/os/c... | if static price is zero let's consider that every slippage is valid | function _slippageIsValid(Batch storage _batch, address) internal view returns (bool) {
uint256 staticPricePPM = _staticPricePPM(_batch.supply, _batch.balance, _batch.reserveRatio);
uint256 maximumSlippage = _batch.slippage;
if (staticPricePPM == 0) {
return true;
}
... | 5,455,296 |
./full_match/1/0xe3a0701b5c8E7c256BEB5f9173620dAD00F46E2C/sources/inari.sol | - COMPOUND - / | function balanceToCompound(ICompoundBridge cToken) external {
cToken.mint(underlying.balanceOf(address(this)));
}
| 8,292,748 |
./partial_match/56/0xAb03a46A0e5cd32abF2071349B99Ba66cffCCc78/sources/MarketOracle.sol | Returns square root of `x`. Babylonian method for square root./ | function _sqrt(uint256 x) private pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
| 11,078,876 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by Martin McConnell
All the utility without the fluff.
*/
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (boo... | Internal Functions initialize the new tokenIncriment the allocation variableAdd the new token to the collection | function createDice(uint256 maxTokens, uint256 price, string memory uri_, uint256 maxPurchase) external onlyOwner reentryLock {
diceGroup memory newDice;
newDice.numTokens = 0;
newDice.maxTokens = maxTokens;
newDice.startId = totalTokensReserved;
newDice.payoutAddress = addre... | 1,472,003 |
// SPDX-License-Identifier: UNLICENSED
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
pragma solidity ^0.8.0;
/**
*... | Sets the prices for minting - in case of cataclysmic ETH price movements/ | function setPrices(uint256 single, uint256 discount1, uint256 discount2) external onlyOwner notLocked {
require(single >= discount1 && discount1 >= discount2 && discount2 > 0, "Invalid prices.");
donutPrice = single;
discountPrice1 = discount1;
discountPrice2 = discount2;
}... | 15,862,385 |
./partial_match/1/0xBB8F3F39B86D4e326A1C6e90e6FceED36EF03329/sources/BUNNYGIRLS.sol | Returns an array of token IDs owned by 'owner', in the range ['start', 'stop') (i.e. 'start <= tokenId < stop'). This function allows for tokens to be queried if the collection grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. Requirements: - 'start < stop'/ Set 'start = max(start, _startTokenId())'.... | function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view virtual override returns (uint256[] memory) {
unchecked {
if (start >= stop) revert InvalidQueryRange();
uint256 tokenIdsIdx;
... | 2,812,836 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/u... | get this contract balance to withdraw throw error if it requests more that in the contract balance | function payERC20(address erc20) internal {
IERC20 erc20c = IERC20(erc20);
uint balance = erc20c.balanceOf(address(this));
require(balance > 0, "Balance is Empty");
uint half = balance / 2;
emit RoyaltyPaidERC20( erc20, nifty, half);
erc20c.safeTransfer(ni... | 9,868,108 |
pragma solidity ^0.5.12;
library SafeMath {
function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
... | inject NONSTANDARD NAMING | function ALLOWANCE10(address _owner, address _spender) external view returns (uint256 remaining); | 5,544,607 |
./full_match/4/0x448b665D92a88Ec04Fb32553d0C8710397000B9C/sources/contracts/token.sol | tp get number of tokens in supply; | function balanceOf(address tokenOwner) public view override returns (uint balance){ | 12,360,092 |
./partial_match/1/0x1A3E5258A5d771Cff25ED6e65EBC8A94A6C0F1ee/sources/BoyCoin.sol | Destroys `amount` tokens from `account`, reducing the total supply. - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
function _transfer (address from,
... | 3,973,503 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@uniswap/v2-core/contracts/i... | PancakeSwap: 0x10ED43C718714eb63d5aA57B78B54704E256024E Uniswap V2: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D | function initContract() external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(
address(this),
_uniswapV2Router.W... | 324,918 |
pragma solidity 0.4.24;
import "../interfaces/TokenInterface.sol";
import "./AdminInteractor.sol";
/**
* @title For registry operations to set key data records on registry module on token.
*
* @dev String constants should be consistent with what is expected on the token side.
*/
contract RegistryInteractor is Adm... | Reject the burning whitelist status for address provided. Only admin can whitelist/blacklist. Only applicable if there is already a Pending Registry requested. _address Address to be added or removed from whitelist./ | function revokeWhitelistForBurn(address _address) public onlyAdmin {
PendingRegistry memory pendingRegistry = pendingWhitelistForBurn[_address];
emit RevokedWhitelistForBurn(
_address,
pendingRegistry.status,
msg.sender,
block.timestamp
);
... | 12,731,077 |
/**
*Submitted for verification at Etherscan.io on 2020-04-19
*/
/*
Copyright 2020 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/lic... | Sets a new value for the minimum collateralization percentage. Must be called by the PerpetualV1 admin. Emits the LogSetMinCollateral event. minCollateral The new value of the minimum initial collateralization percentage, as a fixed-point number with 18 decimals./ | function setMinCollateral(
uint256 minCollateral
)
external
onlyAdmin
nonReentrant
{
require(
minCollateral >= BaseMath.base(),
"The collateral requirement cannot be under 100%"
);
_MIN_COLLATERAL_ = minCollateral;
emit ... | 6,439,071 |
./full_match/1/0xDda46bF18eeb3E06E2F12975A3A184e40581A72f/sources/_prb/math/src/ud60x18/Casting.sol | Casts an UD60x18 number into uint128. This is basically a functional alias for the `unwrap` function. | function intoUint256(UD60x18 x) pure returns (uint256 result) {
result = UD60x18.unwrap(x);
}
| 3,094,347 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
interface IUTUToken {
function mint(address to, uint256 amount) external;
function burn(uint256 amount) external;
}
contract Distributor is Ownable {
usi... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint _value) public {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
Transfer(msg.... | 169,573 |
pragma solidity 0.4.24;
interface iERC20 {
function totalSupply() external constant returns (uint256 supply);
function balanceOf(address owner) external constant returns (uint256 balance);
function transfer(address to, uint tokens) external returns (bool success);
}
/// @title buying tokens with eth.... | Will transfer all ether in this account to the contract owner. | function withdraw() public ownerOnly {
owner.transfer(address(this).balance);
}
| 1,452,150 |
./full_match/80001/0x92114416F7029740a8aC1193CAA97541Fa0C7B6F/sources/contracts/Catalog.sol | / Emit event to track ContentURI | function mint(TokenData memory _data, ContentData memory _content)
public
onlyOwner
returns (uint256)
{
require(_data.royaltyBPS < 10000, "royalty !< 10000");
uint256 tokenId = _tokenIdCounter.current();
_mint(msg.sender, tokenId);
tokenData[tokenId] = _... | 5,649,763 |
./full_match/56/0x1a817F1D4E8a4CDd40b4c28F25e565e041954709/sources/project_/contracts/BEP20/__LEXToken.sol | Function to stop minting new tokens. NOTE: restricting access to owner only. See {BEP20Mintable-finishMinting}./ | function _finishMinting() internal override onlyOwner {
super._finishMinting();
}
using Arrays for uint256[];
using Counters for Counters.Counter;
| 3,243,615 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IWeth {
function deposit() external payable;
function withdraw(uint256 wad) external;
}
contract IERC20 {
string public... | pay outstanding interest to lender Handle back interest: calculates interest owned since the loan endtime passed but the loan remained open fixed-term loan, so need to query iToken for latest variable rate loanInterestLocal.owedPerDay doesn't change pay out backInterestOwed pay out gas rebate to caller the preceeding l... | function _rollover(
bytes32 loanId,
uint256 startingGas,
bytes memory loanDataBytes)
internal
{
Loan memory loanLocal = loans[loanId];
require(loanLocal.active, "loan is closed");
require(
block.timestamp > loanLocal.endTimestamp.sub(1 hours),
... | 382,331 |
./full_match/1/0xbD53415F6135019386f9e64b6811c4728A43655B/sources/contracts/project/kometh/rexroar/RexRoarIssue1.sol | @inheritdoc IKomethAppImplementation/ | function setStage(Stage _stage) external onlyOwner {
stage = _stage;
}
| 16,544,838 |
pragma solidity ^0.5.0;
import "../proxy/Proxy.sol";
import "../PolymathRegistry.sol";
import "../interfaces/IModule.sol";
import "./SecurityTokenStorage.sol";
import "../libraries/TokenLib.sol";
import "../interfaces/IDataStore.sol";
import "../interfaces/IUpgradableTokenFactory.sol";
import "../interfaces/IModuleFac... | Decreases totalSupply and the corresponding amount of the specified partition of msg.sender _partition The partition to allocate the decrease in balance _value The amount by which to decrease the balance _data Additional data attached to the burning of tokens/ | function redeemByPartition(bytes32 _partition, uint256 _value, bytes calldata _data) external {
_onlyModule(BURN_KEY);
_isValidPartition(_partition);
_redeemByPartition(_partition, msg.sender, _value, address(0), _data, "");
}
| 5,505,207 |
pragma solidity ^0.5.4;
import "./AuctionityStorage1.sol";
import "../CommonContract/AuctionityLibrary_V1.sol";
import "../CommonContract/AuctionityChainId_V1.sol";
import "../CommonContract/AuctionityLibraryDecodeRawTx_V1.sol";
import "../CommonContract/SafeMath.sol";
/// @title Auctionity Treasurer
contract Auction... | receive reward DepotEth Receive reward deposit of eth from livenet through oracle _user address _amount uint256 _transactionHashDeposit bytes32 : hash of transaction from livenet, for history only return bool For previous compatibility | function receiveRewardDepotEth_V1(
address _user,
uint256 _amount,
bytes32 _transactionHashDeposit
) public delegatedSendIsOracle_V1 returns (bool) {
_addDepotEth_V1(_user, _amount);
emit LogAddRewardDepotEth(
_user,
_amount,
getBalanc... | 7,224,441 |
// Dependency file: @chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bug... | Returns the combination of the two arrays A The first array B The second array return Returns A extended by B/ | function extend(uint256[] memory A, uint256[] memory B) internal pure returns (uint256[] memory) {
uint256 aLength = A.length;
uint256 bLength = B.length;
uint256[] memory newUint256s = new uint256[](aLength + bLength);
for (uint256 i = 0; i < aLength; i++) {
newUint256s[... | 225,574 |
./full_match/8217/0xe41066e28Ff95244741262Bd877015Edf3f8a9a0/sources/contracts/library/KIP7Upgradeable.sol | Internal function to invoke {IKIP7Receiver-onKIP7Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of transfer token amount to target address that will receive the tokens amount uint256 value to be transferred _data bytes op... | function _checkOnKIP7Received(
address from,
address to,
uint256 amount,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IKIP7Receiver(to).onKIP7Received(
_msgSender(),
from,
... | 13,229,608 |
pragma solidity 0.7.6;
pragma abicoder v2;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IArbitrator.sol";
// ht... | Propose and sign Agreement to title "`_title`" and content "`_content`", with arbitrator `_arbitrator` Initialization check is implicitly provided by the `auth()` modifier _arbitrator Address of the IArbitrator that will be used to resolve disputes _title String indicating a short description _content Link to a hum... | function proposeSetting(
IArbitrator _arbitrator,
string memory _title,
bytes memory _content
)
public
{
sign(_newSetting(_arbitrator, _title, _content));
}
| 1,760,104 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pu... | [9-0] [A-Z] [a-z] [-] / | function hasOnlyDomainLevelCharacters(string memory str) internal pure returns (bool) {
bytes memory b = bytes(str);
for(uint i; i<b.length; i++) {
bytes1 char = b[i];
if (! (
(char >= 0x30 && char <= 0x39) ||
(char >= 0x41 && char <= 0x5A) ||
(char >= 0x61 && char <= 0x7A)... | 5,371,870 |
pragma solidity >=0.5.10;
import 'ROOT/libraries/IERC1820Implementer.sol';
contract ERC1820Implementer is IERC1820Implementer {
bytes32 constant private ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC"));
mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
... | See `IERC1820Implementer.canImplementInterfaceForAddress`./ | function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32) {
return _supportedInterfaces[interfaceHash][account] ? ERC1820_ACCEPT_MAGIC : bytes32(0x00);
}
| 1,756,397 |
./partial_match/1/0x6BC1Ab049299cCbec1acF843D6cdbc530f0C8607/sources/JSUToken.sol | Returns the name of the token./ | function name() public view returns (string memory) {
return _name;
}
| 3,586,128 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/// @title An Ethereum library that contains information about all the instances of the Wonka rules engines in a blockchain
/// @author Aaron Kendall
/// @notice
/// @dev
contract WonkaRegistry {
/// @title Defines a rule grove
/// @notice This class w... | This method will return info about the specified grove | function getRuleGrove(bytes32 groveId) public view returns (bytes32 id, string memory desc, bytes32[] memory members, address owner, uint createTime){
require(ruleGroves[groveId].isValue == true, "Grove with ID does not exist.");
return (ruleGroves[groveId].ruleGroveId, ruleGroves[groveId].descrip... | 1,010,001 |
pragma solidity ^0.8.6;
//SPDX-License-Identifier: MIT
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
* ░░██░░██░░░████░░██░░░████░░░ *
* ░░██░░██░░░████░... | Start Auction with Default Params/ | function startAuction() public onlyOwner {
require(_tokenIds.current() < limit, "Only one.. wtf?");
require(_tokenIds.current() == 4, "initCollection first");
mintDeadline = block.timestamp + 6 days;
startAt = block.timestamp;
auctionStarted = true;
}
| 14,095,238 |
./full_match/11155111/0x77EB77aa90050682836dAE562760f97CCDdDCF97/sources/contracts/swap.sol | Fetches the unclaimed proceeds of a user user The address of the user whose unclaimed proceeds are to be fetched return The Proceeds struct of the specified user | function getUnclaimedProceeds(
address user
) public view returns (Proceeds memory) {
return unclaimedProceeds[user];
}
| 3,794,454 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/// On Tupac's Soul
import "./ERC721A.sol";
import "./Payable.sol";
contract FoodlesClubToken is ERC721A, Payable {
using Strings for uint256;
// Token values incremented for gas efficiency
uint256 private maxSalePlusOne = 5001;
uint256 privat... | Return sale claim info. saleClaims[0]: maxSale (total available tokens) saleClaims[1]: totalSupply saleClaims[2]: reserveClaimed saleClaims[3]: freeClaimed/ | function saleClaims() public view virtual returns (uint256[4] memory) {
return [maxSalePlusOne - 1, totalSupply(), reserveClaimed, freeClaimed];
}
| 12,229,524 |
./partial_match/42/0xfE0B1a1683d12297D3E9CEe3157e1aAd355Dc5d9/sources/IndexToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, ... | 3,389,767 |
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | Transfers ownership of the contract to a new account (`newOwner`)./ | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 2,009,700 |
pragma solidity ^0.8.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
let payloadStart := ... | Set provenance once it's calculated/ | function setProvenanceHash(string memory _provenanceHash) external onlyOwner {
PROVENANCE_HASH = _provenanceHash;
}
| 9,762 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
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 a... | Provides whether a drago is whitelisted _drago Address of the target drago return Bool is whitelisted | function isWhitelistedDrago(address _drago)
external view
returns (bool)
{
return accounts[_drago].groups[true].drago;
}
| 5,445,809 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./MUSIC_Schain.sol";
import "./MUSICWrapper.sol";
contract PayPerPlay is MUSICWrapper {
string public constant contractVersion = "v0.7"; //rw what version does this now need to be?
Music private musicToken;
//rw set all gas costs to zero for... | rw This will now be $MUSIC in _tipAmount not msg.value | function tip(uint _tipAmount) public payable {
distributePayment(_tipAmount);
tipCount++;
totalTipped += _tipAmount;
totalEarned += _tipAmount;
}
| 14,091,592 |
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
interface IERC20{
function name() ... | return the name of the token./ | function name() external override view returns(string memory){
return _name;
}
| 10,585,177 |
./partial_match/1/0xAF5078bCEE5B9DE9Bb9394207Ca48ac32648C45f/sources/Workspace.sol | Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth newSellPrice price the users can sell to the contract newBuyPrice price users can buy from the contract newUnitPrice to manage decimal issue 0,35 = 35 /100 (100 is unit)/ | function setPrices(uint256 newSellPrice, uint256 newBuyPrice, uint256 newUnitPrice)
public
onlyOwner
{
require (newSellPrice > 0 && newBuyPrice > 0 && newUnitPrice > 0, "wrong inputs");
marketplace.sellPrice = newSellPrice;
marketplace.buyPrice = newBuyPrice;
marketplace.unitPric... | 3,939,086 |
//SPDX-License-Identifier: CC-BY-NC-ND-4.0
pragma solidity 0.8.7;
import "abdk-libraries-solidity/ABDKMathQuad.sol";
/// @title Library for various useful (mostly) mathematical functions
library PoolSwapLibrary {
bytes16 public constant one = 0x3fff0000000000000000000000000000;
bytes16 public constant zero = ... | Calculates the loss multiplier to apply to the losing pool. Includes the power leverage ratio The ratio of new price to old price direction The direction of the change. -1 if it's decreased, 0 if it hasn't changed, and 1 if it's increased leverage The amount of leverage to apply return The multiplier/ If decreased: ... | function getLossMultiplier(
bytes16 ratio,
int8 direction,
bytes16 leverage
) public pure returns (bytes16) {
return
ABDKMathQuad.pow_2(
ABDKMathQuad.mul(leverage, ABDKMathQuad.log_2(direction < 0 ? ratio : ABDKMathQuad.div(one, ratio)))
);... | 12,612,185 |
/**
* Edgeless Casino Proxy Contract. Serves as a proxy for game functionality.
* Allows the players to deposit and withdraw funds.
* Allows authorized addresses to make game transactions.
* author: Julia Altenried
**/
pragma solidity ^0.4.17;
contract token {
function transferFrom(address sender, a... | in case close has been called accidentally./ | function open() onlyOwner public{
closeAt = 0;
}
| 12,636,034 |
./partial_match/3/0xb77421fc64a2a0db4dd53c9bE41713FB29e42a3A/sources/EdgeXToken.sol | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "multiplication overflow");
return c;
}
| 5,235,240 |
./full_match/80001/0xaD8e367d6C6D5083A931f93113F955274249A13b/sources/project_/contracts/laCollection-Anna-Ridler-Static-reversible-multiple.sol | Mutate can only be called by LC or token owner Should trigger an image baker to update the graphical result of the image | function mutate(uint256 iFlower, uint32 nMutations) public {
require(
hasRole(LACOLLECTION_ROLE, _msgSender()) ||
_isApprovedOrOwner(_msgSender(), iFlower),
"mutate: only LC or token owner"
);
require(nMutations > 0, "nMutations must be positive");
... | 838,694 |
// File: contracts\modules\Ownable.sol
pragma solidity =0.5.16;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the ... | Substract collateral balance. Only manager contract can modify database. collateral collateral address. amount the decrease amount./ | function subCollateralBalance(address /*collateral*/,uint256 /*amount*/)public{
delegateAndReturn();
}
| 13,779,840 |
./full_match/1/0x3D41675D0E5B610CfEA98998129780753bD664b5/sources/Unifarmv15.sol | Checks Balance check | function emergencyUnstake(
uint256 stakeId,
address userAddress,
address[] memory rewardtokens,
uint256[] memory amount
) external onlyOwner {
require(
stakingDetails[userAddress].stakedAmount[stakeId] > 0 &&
stakingDetails[userAddress].isActive[stakeId] == true,
"EMERGENCY :... | 4,817,190 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Adds two exponentials, returning a new exponential./ | function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {
(MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);
}
| 333,407 |
./full_match/80001/0x416E2d3E39dF69bBc30244eC90477fD042812E6B/sources/src/Interfaces/IHyphenRouter.sol | https:github.com/bcnmy/hyphen-contract/blob/master/contracts/hyphen/LiquidityPool.sol | interface IHyphenRouter {
function depositErc20(
uint256 toChainId,
address tokenAddress,
address receiver,
uint256 amount,
string calldata tag
) external;
function depositNative(
address receiver,
uint256 toChainId,
string calldata tag
) ... | 5,585,594 |
./partial_match/1/0x266c0b1ae2320C0E32059aCCB44Fd4B606Ff77c5/sources/LabRevSharing.sol | claim wETH from Staking Contract | function claim() public {
require(stakers[msg.sender].stakedAmount > 0, "No staked amount");
require(!stakers[msg.sender].claimed, "Already claimed");
require(stakers[msg.sender].shilled, "Not enough shilling");
require(block.timestamp >= stakers[msg.sender].stakingTime + minStakingD... | 2,666,274 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {IERC20} from './interfaces/IERC20.sol';
import {ILendingPoolConfiguratorV2} from './interfaces/ILendingPoolConfiguratorV2.sol';
import {IOverlyingAsset} from './interfaces/IOverlyingAsset.sol';
import {ILendingPoolAd... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
... | 5,711,934 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Returns the base URI set via {_setBaseURI}. This will be automatically added as a prefix in {tokenURI} to each token's URI, or to the token ID if no specific URI is set for that token ID./ | function baseURI() public view virtual returns (string memory) {
return _baseURI;
}
| 143,825 |
//SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Address} from "@openzeppe... | get the expected excess, burnAmount and bounty if Uniswap position token got burned this function will update the vault memory in-place return burnAmount amount of wSqueeth that should be burned return wPowerPerpExcess amount of wSqueeth that should be send to the vault owner return bounty amount of bounty should be p... | function _getReduceDebtResultInVault(
VaultLib.Vault memory _vault,
uint256 nftEthAmount,
uint256 nftWPowerperpAmount,
uint256 _normalizationFactor,
bool _payBounty
)
internal
view
returns (
uint256,
uint256,
uin... | 13,123,615 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
/// @title: David Ariew X Tatler China
import "../ERC721ProjectUpgradeable.sol";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | See {IProjectCore-registerManager}./ | function registerManager(address manager, string calldata baseURI)
external
override
adminRequired
nonBlacklistRequired(manager)
{
_registerManager(manager, baseURI, false);
}
| 12,006,203 |
pragma solidity ^0.5.10;
/** @title A contract for generating unique identifiers
*
* @notice A contract that provides an identifier generation scheme,
* guaranteeing uniqueness across all contracts that inherit from it,
* as well as the unpredictability of future identifiers.
*
* @dev This contract is i... | PRIVATE FUNCTIONS reject 1null1 results from the map lookup this can only be the case if an unknown `_lockId` is received | function getImplChangeReq(bytes32 _lockId) private view returns (ERC20Impl _proposedNew) {
ImplChangeRequest storage changeRequest = implChangeReqs[_lockId];
require(changeRequest.proposedNew != address(0), "reject 1null1 results from the map lookup");
return ERC20Impl(changeRequest.propos... | 12,961,502 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC165.sol";
import "./interfaces/IERC721.sol";
/*
Minting Function:
a. nft to point to an address
b. keep track of the token ids
c. keep track of token owners addresses to token ids
d. keep track of how many tokens an owner address... | Find the owner of an NFT NFTs assigned to zero address are considered invalid, and queries about them do throw. _tokenId The identifier for an NFT return The address of the owner of the NFT | function ownerOf(uint256 _tokenId)
external
view
_invalid_address(_tokenOwner[_tokenId])
returns (address)
{
return _tokenOwner[_tokenId];
}
| 12,814,723 |
// Contracts by dYdX Foundation. Individual files are released under different licenses.
//
// https://dydx.community
// https://github.com/dydxfoundation/governance-contracts
//
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import { SafeERC20 } from '../../dependencies/open-zeppelin... | Returns the revision of the implementation contract. return The revision number./ | function getRevision()
internal
pure
override
returns (uint256)
{
return 2;
}
| 203,797 |
pragma solidity ^0.4.24;
//
// .#########'
// .###############+
// ,####################
// `#######################+
// ;##########################
// #############################.
// #########... | Refund transaction Check that bet is in 'active' state. Check that bet has already expired. Move bet into 'processed' state, release funds.Maximum amount to be confirmedAmount unlockRefund | function refundBet(uint commit,uint8 machineMode) external {
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > bet.placeBlockNumber.add(BetExpirationBlocks));
bet.amount = 0;
... | 12,761,206 |
./full_match/3/0xAbDf627E4ce02F8204d8312c22812E6f0c158fad/sources/contracts/SigmoidLoan.sol | uint256 len=0; targetAuction[len] = auctionList[i]; | function getWalletInfo(uint256 _auctionType) view public returns(AUCTION[] memory) {
for (uint256 i = 0; i < auctionList.length; i++) {
if(_auctionType2 == myLoan[i].auctionType){
len++;
}
}
uint256 f = 0;
for (uint256 j = 0; j < myLoan.len... | 8,178,684 |
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import {IndexedOrderedSetLib} from "./IndexedOrderedSetLib.sol";
import {Authorized} from "./Authority.sol";
/// @title Database contract for a package index package data.
/// @author Tim Coulter <tim.coulter@consensys.net>, Piper Merriam <pipermerriam@gmail.com... | Hash Functions/ Returns name hash for a given package name. name Package name | function hashName(string name)
public
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(name));
}
| 1,039,829 |
// 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... | Apply withdraw fees to the amounts./ | function _applyStakeFees(
address _erc20Token,
uint256 _tokenRarity
) internal view returns (
uint256 _alohaAmountAfterFees,
uint256 _erc20AmountAfterFees
) {
uint256 alohaAmount = poolsMap[_erc20Token][_tokenRarity].alohaAmount;
uint256 alohaAmountAfterFees =... | 147,480 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/uti... | Check if can approve before approving/ | function setApprovalForAll(address operator, bool approved)
public virtual override canApprove
{
super.setApprovalForAll(operator, approved);
}
| 14,365,844 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
library Blake2b {
function digest208(bytes memory input208) internal view returns (bytes32 ret){
// solium-disable-next-line
assembly{
// reject not ckbinput
// 208 = 0xD0
if iszero(eq(mload(i... | solium-disable-next-linecopy 0x40 bytes in memory from input_ptr to 0x00 0x20 0x40 set to 0x00 0x60 set to 0x00 set t0,t1 to 128 0x80 watch that the data is Little.Endian t0 = 0x 80 00 00 00 00 00 00 00 t1 = 0x 00 00 00 00 00 00 00 00 final block, set f to 0x01 call F() pass memory to blake2b, get the result h at 0x80+... | function digest64Merge(bytes32 left, bytes32 right) internal view returns (bytes32 ret){
assembly{
let memory_ptr := mload(0x40)
mstore(0x40, add(memory_ptr,0x0E0))
mstore(memory_ptr, 0x0000000c28c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f)
mstore... | 12,991,454 |
pragma solidity >=0.4.24 <0.7.0;
/// @title Ethereum marriage contract
/// @author Witek Radomski
/// @notice This smart contract allows for marriage and divorce on the Ethereum blockchain with a monetary incentive to
/// stay married for the full term, as well as a prisoner's dilemma to update the contract if a ... | This will permanently change one partner's address their desired new address (Step 2). Run this function using the new account AFTER calling updatePartnerAddress from the original account. _partnerNumber Which partner is accepting their new address change (1 or 2) | function acceptUpdatePartnerAddress(uint256 _partnerNumber) public {
if(_partnerNumber == 1) {
if(msg.sender == partner1UpdateAddress) {
emit UpdatedAddress(_partnerNumber, partner1, partner1UpdateAddress);
partner1 = partner1UpdateAddress;
partner... | 1,086,857 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// Part: OpenZeppelin/[email protected]/Context
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are gen... | Remove a token, given by an index, from a staker in staking storage variables This function is significantly more gas efficient the greater the index is staker Address of the staker index Index of the SheetFighterToken in stakeToTokenIds[staker] being removed Reset all | function _remove(address staker, uint256 index) internal {
if (index >= stakerToTokenIds[staker].length) return;
for (uint256 i = index; i < stakerToTokenIds[staker].length - 1; i++) {
stakerToTokenIds[staker][i] = stakerToTokenIds[staker][i + 1];
}
stakerToTokenIds[stak... | 2,204,232 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library ExistenceProof {
//struct definition
struct Data {
bytes key;
bytes value;
LeafOp.Data leaf;
InnerOp.Data[] path;
}
// Decoder section
/**
* @dev The... | The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./ | function _read_leaf_spec(
uint256 p,
bytes memory bs,
Data memory r,
uint[5] memory counters
) internal pure returns (uint) {
(LeafOp.Data memory x, uint256 sz) = _decode_LeafOp(p, bs);
if (isNil(r)) {
counters[1] += 1;
r.leaf_spec = x;
if (counters[1] > 0) counters[1] -= 1... | 13,050,308 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is uns... | Verifies that a message is signed by a quorum among the signers. _msg signed message _sigs list of signatures sorted by signer addresses in ascending order _signers sorted list of current signers _powers powers of current signers/ Part: ICurve3Pool | interface ICurve3Pool {
function add_liquidity(
uint256[3] calldata amounts,
uint256 min_mint_amount)
external;
function remove_liquidity_one_coin(
uint256 token_amount,
int128 i,
uint256 min_amount
) external;
function get_virtual_price()
extern... | 11,721,618 |
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol | The Vault only requires the token list to be ordered for the Two Token Pools specialization. However, to make the developer experience consistent, we are requiring this condition for all the native pools. Note that for Pools which can register and deregister tokens after deployment, this property may not hold as tokens... | function registerComposablePool(
IVault vault,
IVault.PoolSpecialization specialization,
IERC20[] memory tokens,
address[] memory assetManagers
) internal returns (bytes32) {
InputHelpers.ensureArrayIsSorted(tokens);
IERC20[] memory composableTokens = new IERC20[... | 16,352,811 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.