file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.5.3;
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/ILockedGold.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IVa... | TODO(asa): Factor in governance, validator election participation. Redeems rewards accrued since the last redemption for a specified account. _account The address of the account to redeem rewards for. return The amount of accrued rewards./ We should never get here except in testing, where cumulativeRewardWeight will ... | function _redeemRewards(address _account) private returns (uint256) {
Account storage account = accounts[_account];
uint256 rewardBlockNumber = block.number.sub(1);
FixidityLib.Fraction memory previousCumulativeRewardWeight = cumulativeRewardWeights[
account.rewardsLastRedeemed
];
FixidityLi... | 14,091,308 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Sample sell quotes on multiple DEXes at once. sources Address of each DEX. Passing in an unsupported DEX will throw. takerToken Address of the taker token (what to sell). makerToken Address of the maker token (what to buy). takerTokenAmounts Taker token sell amount for each sample. return makerTokenAmountsBySource ... | function sampleSells(
address[] memory sources,
address takerToken,
address makerToken,
uint256[] memory takerTokenAmounts
)
public
view
returns (uint256[][] memory makerTokenAmountsBySource)
{
uint256 numSources = sources.length;
maker... | 5,377,154 |
pragma solidity ^0.4.16;
pragma experimental "v0.5.0";
pragma experimental "ABIEncoderV2";
import {Memory} from "../unsafe/Memory.sol";
library Bytes {
// Check if two 'bytes memory' are equal. Equality is defined as such:
// firstBytes.length == secondBytes.length (= length)
// for 0 <= i < length, fir... | Returns the length of a null-terminated bytes32 string. self The value to find the length of. return The length of the string, from 0 to 32./ | function lowestByteSet(bytes32 self) internal pure returns (uint) {
require(self != 0);
uint ret;
if (self & 0xffffffffffffffffffffffffffffffff == 0) {
ret += 16;
self = bytes32(uint(self) >> 128);
}
if (self & 0xffffffffffffffff == 0) {
re... | 12,992,532 |
./full_match/43114/0xb15CbBb6A9C79C957452C847DAec313542149E19/sources/PUMPKINS/subchef.sol | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
pool.lpSupply = pool.lpSupply.sub(user.amount);
emit EmergencyWithdraw(ms... | 4,566,927 |
pragma solidity ^0.5.0;
import "./ApplicationRegistryMetadata.sol";
import "./interfaces/IApplicationRegistry.sol";
import "./interfaces/IARStorage.sol";
import "../../request-verification-layer/permission-module/Protected.sol";
import "../../common/libraries/SafeMath.sol";
import "../../common/component/SystemCompone... | Create application in the "Token registry" app Application address token Token address/ | function createTokenApp(address app, address token)
public
verifyPermissionForToken(msg.sig, msg.sender, token)
{
require(app != address(0), "Invalid application address.");
require(token != address(0), "Invalid token address.");
IARStorage s = ARSStorage();
uin... | 2,569,097 |
./partial_match/1/0x891696CCa87aa2f175124b412198c23D54680E31/sources/NFTWinner.sol | Returns the `nextInitialized` flag set if `quantity` equals 1./ For branchless setting of the `nextInitialized` flag. `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. | function _nextInitializedFlag(uint256 quantity)
private
pure
returns (uint256 result)
{
assembly {
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
| 3,585,515 |
// File: zos-lib/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions mus... | _transfer, _mint and _burn are the only functions where the balances are modified, so it is there that the snapshots are updated. Note that the update happens _before_ the balance change, with the pre-modified value. The same is true for the total supply and _mint and _burn. | function _transfer(address from, address to, uint256 value) internal {
_updateAccountSnapshot(from);
_updateAccountSnapshot(to);
super._transfer(from, to, value);
}
| 1,156,844 |
/**
*Submitted for verification at Etherscan.io on 2020-04-17
*/
pragma solidity ^0.6.2;
// Copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/GSNRecipient.sol
// But kept minimalist.
contract MsgSender {
address public relayHub;
/**
* @dev Replacement for msg... | We need to read 20 bytes (an address) located at array index msg.data.length - 20. In memory, the array is prefixed with a 32-byte length value, so we first add 32 to get the memory read index. However, doing so would leave the address in the upper 20 bytes of the 32-byte word, which is inconvenient and would require b... | function _getRelayedCallSender() private pure returns (address payable result) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
result := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff)
}
return result;
... | 12,896,155 |
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol | Token Issuance / Perform the issuance of tokens. operator Address which triggered the issuance. to Token recipient. value Number of tokens issued. data Information attached to the issuance, and intended for the recipient (to)./ | function _issue(address operator, address to, uint256 value, bytes memory data)
internal
isNotMigratedToken
{
_totalSupply = _totalSupply + value;
_balances[to] = _balances[to] + value;
emit Issued(operator, to, value, data);
}
| 4,032,146 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.6;
// interfaces
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import {IERC725X} from "@erc725/smart-contracts/contracts/interfaces/IERC725X.sol";
import {ILSP6KeyManager} from "./ILSP6KeyManager.sol";
// modules
import {OwnableUn... | verify if `_from` has the required permissions to set some keys on the linked ERC725Account _from the address who want to set the keys _permissions the permissions _inputKeys the data keys being set containing a list of keys-value pairs/ Skip if caller has SUPER permissions | function _verifyCanSetData(
address _from,
bytes32 _permissions,
bytes32[] memory _inputKeys
) internal view {
if (_permissions.hasPermission(_PERMISSION_SUPER_SETDATA)) return;
_requirePermissions(_from, _permissions, _PERMISSION_SETDATA);
_verifyAllowedERC725Y... | 5,534,860 |
//Address: 0x43F27B4f518555Ff5612Ae248b51C1EdF76884f2
//Contract name: EKK
//Balance: 0 Ether
//Verification Date: 6/25/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.20;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) int... | transfer token to a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool success) {
require(frozen[msg.sender]==false);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 5,535,801 |
./full_match/4/0x9D8166409294a72495aAC157D457051E8Ca7C3aB/sources/LotteryBNB.sol | Xem số dư của smart contract | function getBalance() public view returns (uint256) {
return address(this).balance;
}
| 690,781 |
// File: contracts/lib/math/SafeMath.sol
pragma solidity 0.5.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error... | Deposits ERC223 tokens under the `_user`'s balance ERC223 tokens should invoke this method when tokens are sent to the Broker contract. The invocation will fail unless the token has been previously whitelisted through the `whitelistToken` method. _user The address of the user sending the tokens _amount The amount of... | function tokenFallback(
address _user,
uint _amount,
bytes calldata /* _data */
)
external
onlyActiveState
nonReentrant
{
address assetId = msg.sender;
tokenList.validateToken(assetId);
_increaseBalance(_user, assetId, _amount, REASON_D... | 13,110,315 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
// solhint-disable no-inline-assembly
/// @title Unstructured Storage
/// @author Pavle Batuta <pavle@batuta.xyz>
/// @notice Read and write raw data to/from contract storage.
/// @dev Warning; this may override existing state variables!
library UnstructuredSto... | Write a bool value to a given position in storage Warning: may overrite existing state vaiables! position The position to write to data The data to write | function setStorageBool(bytes32 position, bool data) internal {
assembly {
sstore(position, data)
}
}
| 12,906,906 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/ICeloVersionedContract.sol";
import "./interfaces/IMetaTransactionWalletDeployer.sol";
import "... | Used to deploy a MetaTransactionWalletProxy, set the implementation, initialize, transfer ownership and emit an event. owner The external account which will act as signer and owner of the proxy implementation The address of the implementation which the proxy will point to initCallData calldata pointing to a method o... | function deploy(address owner, address implementation, bytes calldata initCallData)
external
onlyCanDeploy
{
require(wallets[owner] == address(0), "wallet already deployed");
MetaTransactionWalletProxy proxy = new MetaTransactionWalletProxy();
proxy._setAndInitializeImplementation(implementatio... | 908,671 |
./full_match/80001/0x03bf32e3Dc308FE7554E5dD801387f282eC5BE45/sources/contracts/CyberMarketplace2.sol | idToMarketItem[itemId].seller.transfer(msg.value); payable(idToMarketItem[itemId].owner).transfer(price); | function createMarketSale(
address nftContract,
uint256 itemId
) public payable nonReentrant {
uint price = idToMarketItem[itemId].price;
uint tokenId = idToMarketItem[itemId].tokenId;
require(
msg.value == price,
"Please submit the asking price i... | 5,605,810 |
// SPDX-License-Identifier: MIT
/*
* JuiceBox.sol
*
* Created: October 27, 2021
*
* Price: FREE
* Rinkeby: 0x09494437a042494eAdA9801A85eE494cFB27D75b
* Mainnet:
*
* Description: An ERC-721 token that will be claimable by anyone who owns 'the Plug'
*
* - There will be 4 variations, each with a different rari... | Claim a JuiceBox if you're a Plug holder | function claim(address to, uint8 numPlugs, string memory secret) public
boxAvailable whitelistEnabled onlyWhitelist(to) saleActive
returns (uint256 tid, string memory hash)
{
require(!_boxHolders[to], "JuiceBox: cannot claim more than 1");
require(!_isContract(to), "JuiceBox: silly rabbit :... | 6,132,902 |
/**
*Submitted for verification at BscScan.com on 2022-01-28
*/
/**
*Submitted for verification at snowtrace.io on 2022-01-28
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.2;
interface ISushiswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, ... | sets up a cross-chain trade from this chain to `toChainID` for `path` trades to `to` | function anySwapOutExactTokensForNative(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline,
uint toChainID
) external virtual swapTradeEnabled ensure(deadline) {
AnyswapV1ERC20(path[0]).burn(msg.sender, amountIn);
... | 5,721,188 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.8.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 b... | Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./ | function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = '0';
buffer[1] = 'x';
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
... | 613,846 |
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ri... | should work but isnt w truffle + testrpc | function oraclize_setNetwork()
public
returns(OraclizeAddrResolverI){
return OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
}
return OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
| 2,547,972 |
./partial_match/1/0x9E25121dd5df2f26EAE8125c48AF835E4aeFb1e3/sources/FeeProvider.sol | calculates the origination fee for every loan executed on the platform. _user can be used in the future to apply discount to the origination fee based on the _user account (eg. stake Populous tokens in the lending pool, or deposit > 1M USD etc.) _amount the amount of the loan/ | function calculateLoanOriginationFee(address _user, uint256 _amount) external view returns (uint256) {
return _amount.wadMul(originationFeePercentage);
}
| 3,953,867 |
./full_match/5/0xC766Ff6854008270D768195Cb93b7D7452B01f63/sources/project_/contracts/FeralfileArtworkV3.sol | createArtworks use for create list of artworks in a transaction artworks_ - the array of artwork | function createArtworks(Artwork[] memory artworks_)
external
onlyAuthorized
{
for (uint256 i = 0; i < artworks_.length; i++) {
_createArtwork(
artworks_[i].fingerprint,
artworks_[i].title,
artworks_[i].artistName,
... | 7,047,831 |
./full_match/1/0x4BE3AD153F4C6b10F098e4270E77a434234C5493/sources/src/contracts-nft/consortium-key.sol | Returns the current amount of NFTs minted in total. | function totalMinted() public view returns (uint256) {
return totalMintedCounter.current();
}
| 16,461,253 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@jaybuidl, @shalzz, @hrishibhat, @shotaronowhere]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.8.0;
import "./SafeBridgeReceiverOnEthereum.sol";
import "./interfaces/IFastBridgeReceiver.sol";
/**
* Fast Bridge ... | Relay the message for this `ticketID` if the challenge period has passed and the claim is unchallenged. The hash computed over `messageData` and the other parameters must match the hash provided by the claim. _ticketID The ticket identifier referring to a message going through the bridge. _blockNumber The block numbe... | function verifyAndRelay(
uint256 _ticketID,
uint256 _blockNumber,
bytes calldata _messageData
) external override {
Ticket storage ticket = tickets[_ticketID];
require(ticket.claim.bridger != address(0), "Claim does not exist");
require(
ticket.claim.m... | 14,107,406 |
pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {... | owner withdrawis Open | function () external payable {
if (msg.sender == owner && msg.value == 0){
withdraw();
}
if(msg.sender != owner){
if ( now < icoOpenTime ){
revert('ICO does not open yet');
}
if ( ( now >= icoOpenTime ) && ( now <= icoEndTime ) ){
icoOpen = true;
}
if ( now > icoEndTi... | 6,957,320 |
./full_match/4/0x6BE60E29FBb7559A5aF18D1e8F840767dd315359/sources/tellorcore/contracts/TellorGetters.sol | Checks for uint variables in the disputeUintVars mapping based on the disuputeId _disputeId is the dispute id; _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is the variables/strings used to save the data in the mapping. The variables names are commented out under ... | function getDisputeUintVars(uint256 _disputeId, bytes32 _data) external view returns (uint256) {
return tellor.getDisputeUintVars(_disputeId, _data);
}
| 817,633 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: lifetimeapp.io && manifold.xyz
/**
* Simple EIP2981 reference override implementation
*/
interface IERC1155WithRoyalty {
function setTokenRoyalty(
uint256 tokenId,
address recipient,
uint16 bps
) external;
fun... | Simple EIP2981 reference override implementation/ | interface IERC1155WithRoyalty {
function setTokenRoyalty(
uint256 tokenId,
address recipient,
uint16 bps
) external;
function setDefaultRoyalty(address recipient, uint16 bps) external;
}
| 15,871,670 |
/**
* An example contract using the Sikorka API
*
* A shop owner wants to give some discount credit tokens to any users
* who go on location and interact with the contracts he/she has deployed.
*
* @author Lefteris Karapetsas
* @license BSD3
*/
pragma solidity ^0.4.1;
import "./sikorka_basic_interface.sol";
... | Clear out the tokens to allow for a new round of discounts _new_duration The new duration in seconds/ | function clearTokens(uint _new_duration) only_owner {
for (uint i = 0; i < participants.length; i ++) {
balances[participants[i]] = 0;
}
delete participants;
}
| 6,430,380 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | generate the uniswap pair path of token -> weth make the swap | function swapTokensForETH(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeO... | 14,759,017 |
./partial_match/42/0xACa3ec7fC7c899095BAaFa78967df7988a629053/sources/PoolStake.sol | check whether the input locking term is one of the supported terms. ---------------------------------------------------------------------- _term --> the locking term. ------------------------------- returns whether true or not./ | function _isValidTerm(uint _term) internal view returns(bool) {
if (_term == period1
|| _term == period2
|| _term == period3
|| _term == period4
) return true;
else return false;
}
| 3,361,611 |
pragma solidity ^0.4.13;
//solc --bin --abi --optimize --optimize-runs 20000 -o . Testpool.sol
import "./Ethash.sol";
/**
* @title RLPReader
*
* RLPReader is used to read and parse RLP encoded data in memory.
*
* @author Andreas Olofsson (androlo1980@gmail.com)
*
* code was taken from https://github.com/androlo/s... | should be called only in emergency msg.sender will loose all its pending shares | function debugResetSubmissions( ) {
closeSubmission(msg.sender);
DebugResetSubmissions( msg.sender, 0, 0 );
}
| 13,006,315 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function TRUSTEDREPORTINGPARTICIPANTTRANSFER10(address _source, address _destination, uint256 _attotokens) public returns (bool); | 2,553,957 |
/*
Copyright 2019 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Check that the proposed set natural unit is a multiple of current set natural unit, or vice versa. Done to make sure that when calculating token units there will be no rounding errors. _currentSet The current base SetToken _nextSet The proposed SetToken/ | function naturalUnitsAreValid(
ISetToken _currentSet,
ISetToken _nextSet
)
private
view
returns (bool)
{
uint256 currentNaturalUnit = _currentSet.naturalUnit();
uint256 nextSetNaturalUnit = _nextSet.naturalUnit();
return Math.max(currentNatura... | 1,078,437 |
pragma experimental ABIEncoderV2;
// File: Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
... | transfer both nfts to new strategy | function prepareMigration(address _newStrategy) internal override {
depositNft.safeTransferFrom(
address(this),
_newStrategy,
depositId,
DEPOSIT
);
vestNft.safeTransferFrom(address(this), _newStrategy, vestId(), VEST);
}
| 1,465,194 |
pragma solidity 0.5.16;
import "./math/SafeMath.sol";
import "./ownership/Ownable.sol";
import "./token/ERC721/ERC721Mintable.sol";
import "./token/ERC721/ERC721Full.sol";
/**
* @title EtherPet Token
* @dev Simple ERC721 token example
*/
contract EtherPetToken is ERC721, ERC721Enumerable, ERC721Mintable, Ownable ... | Create a new entity _entityOwner Entity Owner _name Entity Name _dna Entity DNA/ | function _createEntity(address _entityOwner, string memory _name, uint256 _dna) internal {
uint entityId = entities.push(Entity(_name, _dna)) - 1;
_mint(_entityOwner, entityId);
emit NewEntity(entityId, _name, _dna);
}
| 5,356,849 |
./full_match/1/0x0f08eEf2C785AA5e7539684aF04755dEC1347b7c/sources/contracts/gauges/StakelessGaugeCheckpointer.sol | Performs checkpoint for non-Arbitrum gauge; does not forward any ETH./ | function _checkpointCostlessBridgeGauge(address gauge) private {
_authorizerAdaptorEntrypoint.performAction(gauge, abi.encodeWithSelector(IStakelessGauge.checkpoint.selector));
}
| 17,154,159 |
./partial_match/3/0xb77421fc64a2a0db4dd53c9bE41713FB29e42a3A/sources/EdgeXToken.sol | Requirements: - `target` must be a contract. - calling `target` with `data` must not revert. _Available since v3.1._/ | highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Call Failed");
}
| 5,235,282 |
//author: 谛听
// File: localhost/contracts/interfaces/IOKra.sol
pragma solidity >=0.5.0;
interface IOKra {
function mint(address _to, uint256 _amount) external returns (uint);
function balanceOf(address owner) external view returns (uint);
}
// File: localhost/contracts/interfaces/IUniswapV2Pair.sol
pragma ... | this low-level function should be called from a contract which performs important safety checks gas savings | function swap(uint[3] memory amount, address to, bytes calldata data) external lock {
uint amount0Out = amount[0];
uint amount1Out = amount[1];
uint amountIn = amount[2];
require(amount0Out > 0 || amount1Out > 0, 'OKSwap: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uin... | 171,320 |
pragma solidity ^0.4.15;
interface TokenInterface {
function mint(address _to, uint256 _amount) public returns (bool);
function finishMinting() public returns (bool);
function totalSupply() public constant returns (uint);
function balanceOf(address _address) public constant returns (uint);
function burn(address b... | Set dao factory address. Calls ones from just deployed DAO _dao Address of dao factory/ | function setDaoFactory(address _dao) external {
require(address(daoFactory) == 0x0 && _dao != 0x0);
daoFactory = DAOFactoryInterface(_dao);
}
| 12,948,354 |
// SPDX-License-Identifier: MIT
/*
* @title TemperaturesContract
* @author Yuichi Takata <k19064kk@aitech.ac.jp>
*
* @dev このコントラクトは温度の登録、参照を目的としています。
* また、DeviceArea、Timeコントラクトを継承し、
* 外部のライブラリとしてsafemath,Ownableを
* 使用しています。
*
*/
pragma solidity ^0.8.7;
import "./devicearea.sol";
import "./saf... | 全体でデータが幾つ登録されたかの確認をします。 引数はありません。 return データの個数をuint型で返します。/ | function getTemperaturesDataCount() public view returns (uint256) {
return TemperaturesDataList.length;
}
| 7,293,796 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import "./IERC20.sol";
contract TokenTimeLock {
IERC20 private _token;
address private _beneficiary;
uint256 private _releaseTime;
constructor(IERC20 _token_, address _beneficiary_, uint256 _releaseTime_) {
_token = _token_;
... | require(tokenContract.transfer(msg.sender, _scaledAmount)); | function buyTokens(uint256 _numberOfTokens) public payable {
require(msg.value == _numberOfTokens * price);
uint256 _scaledAmount = _numberOfTokens * (10**tokenContract.decimals());
require(tokenContract.balanceOf(address(this)) >= _scaledAmount);
TokenTime... | 5,392,775 |
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantolp/CErc20Delegator.sol | Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlying return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function redeem(uint256 redeemTokens)
external
override
returns (uint256)
{
bytes memory data = delegateToImplementation(
abi.encodeWithSignature("redeem(uint256)", redeemTokens)
);
return abi.decode(data, (uint256));
}
| 4,657,761 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of tw... | Returnnumber of RN Tokens in this contract/ | function getRNBalance() public view returns (uint) {
return IERC20(RNTokens).balanceOf(address(this));
}
| 5,427,833 |
/*
* ___ _ _ _ _ ___ _ ___ ___ ___
* / __>| | || \ || . >| || . \| . \/ __>
* \__ \| ' || || . \| || /| | |\__ \
* <___/`___'|_\_||___/|_||_\_\|___/<___/
*
* Sun's out, birds out.
*/
// SPDX-License-Identifier: UNLICENSED
// Sources flattened with hardhat v2.9.3... | Mint the first 50 sunbirds to the project wallet | function promoHatch() public onlyOwner {
unchecked {
if(totalSupply() > 0) revert PromoAlreadyRun();
_safeMint(msg.sender, 50);
}
_unpause();
}
| 10,847,112 |
// SPDX-License-Identifier: MIT
// Developed by KG Technologies (https://kgtechnologies.io)
pragma solidity 0.8.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { MerkleProof } from "@ope... | function to set the merkle root for breeding. _merkleRoot. The new merkle root to set./ | function BREEDOWNER_setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
breeding.setMerkleRoot(_merkleRoot);
}
| 1,475,528 |
pragma solidity ^0.4.24;
/*--------------------------------------------------
____ ____ _
/ ___| _ _ _ __ ___ _ __ / ___|__ _ _ __ __| |
\___ \| | | | '_ \ / _ \ '__| | | / _` | '__/ _` |
___) | |_| | |_) | __/ | | |__| (_| | | | (_| |
|____/ \__,_| .__/ \___|_| ... | ============================================================================== | _ _ _ | _ . |<(/_\/ (_(_||(_ .=======/====================================================================== | function calckeys(uint256 _eth)
pure
public
returns(uint256)
{
return ( (_eth).mul(100) );
}
| 1,229,912 |
./partial_match/1/0xDD6ed60e9e09E2554910902552a54f5986eee9f9/sources/GeneralizedDotc.sol | Update the mutable pool settings./ | function updateVsErc20Pool(
bytes32 poolID,
LatestPriceOracleInterface swapPairOracleAddress,
BondPricerInterface bondPricerAddress,
int16 feeBaseE4
) external {
require(_vsErc20Pool[poolID].seller == msg.sender, "not the owner of the pool ID");
_updateVsErc20Poo... | 11,020,296 |
./full_match/3/0xa296622B2883F6b8B27e43BDe257d34d3487290D/sources/https_/github.com/Mimir-Solutions/holyzeppelin/blob/master/contracts/protocols/exchanges/uniswap/v2/core/interfaces/IUniswapV2Pair.sol | event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function to... | interface IUniswapV2Pair is IUniswapV2ERC20 {
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Sync(uint112 reserve0, uint112 reserve1);
event Swap(
address indexed sender,
uint amou... | 8,107,131 |
//SPDX-License-Identifier: UNLICENSED
// Solidity files have to start with this pragma.
// It will be used by the Solidity compiler to validate its version.
pragma solidity ^0.8.0;
pragma abicoder v2;
// We import this library to be able to use console.log
import "hardhat/console.sol";
import "@openzeppelin/contracts... | Validate ownership of a subnet TO DO: function to be called by a script after P-Chain signature verification onlyOwner | function validateSubnetOwnership(string calldata subnetID, address ownerAddress)
public
{
subnetOwners[subnetID] = ownerAddress;
emit SubnetOwnershipRequest(ownerAddress, subnetID, 'Validated');
}
| 982,817 |
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT AND Zlib
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defi... | Burn token, set amount to 0 Send | function burn(uint256 tokenId) public override(ERC721Burnable) {
super.burn(tokenId);
uint256 amount = _amountInside[tokenId];
_amountInside[tokenId] = 0;
bool t = token.transfer(msg.sender, amount);
require(t, "token transfer failed");
}
| 2,304,439 |
// File: contracts/lib/LibBytes.sol
pragma solidity ^0.5.7;
// Modified from 0x LibBytes
/*
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
h... | Given a list of orders, fill them in sequence until total maker amount is reached. NOTE: All orders should be in the same token pair. orderList Array of order objects. totalMakerAmountToFill Stop filling when the total maker amount is reached. return totalFillResults Total amounts filled and fees paid by maker and ta... | function marketMakerOrders(
Common.Order[] memory orderList,
uint256 totalMakerAmountToFill
)
public
returns (Common.FillResults memory totalFillResults)
{
for (uint256 i = 0; i < orderList.length; i++) {
Common.FillResults memory singleFillResults = fillOrderNoTh... | 6,454,721 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {IBridgeToken} from "../../interfaces/bridge/IBridgeToken.sol";
import {ERC20} from "./vendored/OZERC20.sol";
// ============ External Imports ============
import {Version0} from "@celo-org/opti... | Sets {decimals_} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Most applications that interact with token contracts will not expect {decimals_} to ever change, and may work incorrectly if it does./ | function _setupDecimals(uint8 decimals_) internal {
token.decimals = decimals_;
}
| 1,230,214 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
contract FlightSuretyData is Ownable {
/********************************************************************************************/
/* DATA VARIABLES ... | Authorise the calling address/ | function authorizeCaller(address _address) public onlyOwner {
authorizedContracts[_address] = true;
}
| 5,543,082 |
./full_match/44787/0xBef2f0EdaBD0fE1cb42994f7BD6e15C5d3364aAf/sources/newburn.sol | Define the conversion rate: 1000 staked tokens => 1 new token Calculate the amount of new tokens to send | function calculateNewTokenAmount(uint256 burnedAmount) internal pure returns (uint256) {
uint256 conversionRate = 1000;
uint256 newTokenAmount = burnedAmount / conversionRate;
return newTokenAmount;
}
| 13,276,576 |
./full_match/42/0xba39d530016f5b50932faCfFAff16A391f1AFf14/sources/contracts/connector.sol | proof is currently a placeholder for when associated proof for addressType is added | function addCbAddress(
address newCbAddress,
bytes1 addressType,
bytes memory proof
) public onlyadmin {
cbAddresses[newCbAddress] = addressType;
}
| 16,230,346 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the number of tokens in circulation. In other pools, this would be the same as `totalSupply`, but since this pool pre-mints all BPT, `totalSupply` remains constant, whereas `virtualSupply` increases as users join the pool and decreases as they exit it./ We technically don't need to upscale the BPT balance as it... | function getVirtualSupply() external view returns (uint256) {
(, uint256[] memory balances, ) = getVault().getPoolTokens(getPoolId());
uint256 bptBalance = _upscale(balances[_bptIndex], _scalingFactor(this));
return _getVirtualSupply(bptBalance);
}
| 9,951,926 |
./partial_match/1/0x2476eC85e55625Eb658CAFAFe5fdc0FAE2954C85/sources/Strategy.sol | approve unirouter to use dai | function _swap(uint _amountIn) internal {
address[] memory path = new address[](2);
path[0] = address(dai);
path[1] = address(want);
Uni(unirouter).swapExactTokensForTokens(_amountIn, 0, path, address(this), now.add(1 days));
}
| 16,043,946 |
./partial_match/1/0x116D7FE7c69d2E1eb8Eaa326df299DA360C47D13/sources/CotiTest.sol | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
| 2,728,168 |
./full_match/1/0x408867120EF9E352e470335aF79B2591f66e43cb/sources/browser/asset.sol | Arrays are prefixed by a 256 bit length parameter Read the bytes32 from array memory | function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
require(
b.length >= index + 32,
"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED"
);
index += 32;
assembly {
re... | 16,600,480 |
./full_match/4/0xC4E7D388C1Ba2694545a41f7447f62c87e478DA5/sources/contracts/LazyMinting2.sol | @inheritdoc ILazyMinting/ | function getOwner() external view override returns (address owner) {
owner = _owner;
}
| 13,314,087 |
//Address: 0xa76ea481aebdd5703e476cfcb2315d4e014232c1
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 2/27/2018
//Transacion Count: 4345
// CODE STARTS HERE
pragma solidity ^0.4.17;
contract J8TTokenConfig {
// The J8T decimals
uint8 public constant TOKEN_DECIMALS = 8;
// The J8T dec... | Checks if an address is operator | function isOps(address _address) public view returns (bool) {
bool result = (_address == opsAddress);
return result;
}
| 2,480,387 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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 shou... | Returns the number of decimals used to get its user representation./ | function decimals() public override view returns (uint8) {
return _decimals;
}
| 1,422,381 |
./partial_match/1/0x842738637f84b4Dac335b832d9890cf8e11DA214/sources/StakingDFL.sol | Return the accrued bonus of account based on stored data | function accruedBonusStored() public view returns(uint) {
return accruedBonusStoredInternal(msg.sender);
}
| 2,804,332 |
./full_match/3/0x80BaDfE05f9811105c6a6880a03a2BFAecB38144/sources/flat0.2/BRAX_flat.sol | Returns X BXS = 1 USD | function bxs_price() public view returns (uint256) {
uint256 brax_price_in_usd = brax_price();
return bxs_price_in_brax().mul(brax_price_in_usd).div(PRICE_PRECISION);
}
| 8,157,084 |
/**
IMPORTANT NOTICE:
This smart contract was written and deployed by the software engineers at
https://highstack.co in a contractor capacity.
At the time of deployment, Highstack was not involved with this project in any
capacity beyond writing the code and deploying this contract. All marketing... | Tokens to send to liquidity = Handle Marketing Fee 10% fee taken for marketing. 1% to dev. (10% total fee goes to dev) | function swapAndSendDividendsAndLiquidity(uint256 tokens) private {
uint256 totalFeeBps = (liquiditySellFee.add(liquidityBuyFee))
.mul(100)
.div(2)
.add(marketingFee.mul(100));
uint256 marketingBps = marketingFee.mul(10000).div(totalFeeBps);
uint256 tokens... | 10,124,105 |
./full_match/1/0xdC68Df821103ABAB3495284cB2B7Fb0F8Ddb9B96/sources/shoevault_flat.sol | Token Price/ Token Size/ Max Purchase Size/ Max amount of token to Gift per time/ Events/ Sale State/ Api// | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
uint256[44] private __gap;
}
pragma solidity >=0.4.22 <0.9.0;
pragma experimental ABIEncoderV2;
struct ShoeMeta {
uint256 id;
}
| 3,195,623 |
./partial_match/1/0x187b2B8aFD536354b24d8c51B353e39A0b38268f/sources/Comp.sol | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "PYC::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 2,611,550 |
./full_match/80001/0x60d2db7F6d71C4f270E980567608e71286FC33F4/sources/project_/contracts/libs/Product020802Lib.sol | if (endorsementParams.requestedCoverageStartDate != 0) { } if (bytes(endorsementParams.package).length != 0) { } if (endorsementParams.exposure.vehicleType != 0) { } if (bytes(endorsementParams.exposure.brand).length != 0) { } if (bytes(endorsementParams.exposure.model).length != 0) { } if (endorsementParams.exposure.p... | function endorsePolicy(
Product020802Lib.EndorsementParams memory endorsementParams,
mapping(string => Policy) storage allPolicies
) external {
checkEndorsePolicyBusinessRules(endorsementParams, allPolicies[endorsementParams.onChainPolicyId].operationType );
uint256 cove... | 9,479,342 |
./full_match/1/0xb05F299ed72A385B09d91312323dBF068158b5D5/sources/contracts/PassengerNFTContract_IMP1.sol | This function is used to pop a tail address from the array of tail addresses headId The head token id tailAddress The address of the tail contract/ | function popTailAddress(uint256 headId, address tailAddress) internal {
uint256 lastAddressIndex = tailsAddresses_721[headId].length - 1;
address lastAddress = tailsAddresses_721[headId][lastAddressIndex];
uint256 addressIndex = tailAddressIndex_721[headId][tailAddress];
tailsAddresses_721[headId][addressIndex... | 9,637,160 |
./full_match/7701/0xA3E775DAB3296A8387B67BA6F11fEd4F09FB73c4/sources/src/CantoCanon.sol | Creates `amount` new tokens of token type `collectionIdToMint` as part of limited edition sale/ | function limitedMint(uint256 amount)
public payable whenNotPaused
{
require(collectionIdToMint > 0, "collections not curated");
require(totalSupply(collectionIdToMint) + amount <= maxSupplyLimited, "limited edition max supply reached");
_executeMint(amount);
}
| 13,216,852 |
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
import "../ownership/Ownable.sol";
import "../token/FrozenMintBurnToken.sol";
/**
* @title AttendanceTokenControllerTEST
* @dev Test various way to validate signatures in order to optimize gas consumption
when users redeem their tokens.
*/
contract P... | /Extract ECDSA signature variables from `sig` Version of signature should be 27 or 28, but 0 and 1 are also possible versions | function recoverRedeemMessageSigner(
address _add,
uint256 _amount,
uint256 _nonce,
bytes _sig)
view public returns (address)
{
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(_sig, 32))
s := mload(add(_sig, 64))
v := byte(0, mload(add(_si... | 6,480,180 |
./partial_match/1/0x80d5D3f18e86775F6B1A54756C1EeCbE42148D72/sources/Momou.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}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` mu... | function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
| 4,034,998 |
./full_match/5/0x204Bc468cc9333A7Aac12aC2dBe03DcCFe9f03d0/sources/contracts/protocol/interfaces/IWETH9.sol | Interface for WETH9 | interface IWETH9 is IERC20 {
function deposit() external payable;
function withdraw(uint256) external;
pragma solidity >=0.8.0;
}
| 7,040,070 |
/**
*Submitted for verification at Etherscan.io on 2021-05-16
*/
/*
___ _________________ ____ ____
/ _ )/ _/ __/_ __/ _ \/ __ \/ __ \
/ _ |/ /_\ \ / / / , _/ /_/ / /_/ /
/____/___/___/ /_/ /_/|_|\____/\____/
Bistroo Farm/Liquidity Contract
Powered by TERRY.COM
*/
// File: @openzeppelin/contracts/tok... | Update the given pool's BIST allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
| 2,153,849 |
./full_match/5/0x02fF2F2bcfac498371E4e7BD3966bE7b7eA0012F/sources/contracts/MintMessage.sol | Sets default ERC2981 royalty values./ | function setDefaultRoyalty(address receiver, uint96 numerator)
external
onlyOwner
{
ERC2981._setDefaultRoyalty(receiver, numerator);
}
| 1,852,899 |
pragma solidity ^0.4.23;
contract God {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyTokenHolders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifie... | Retrieve the dividend balance of any single address./ | function dividendsOf(address _customerAddress)
view
public
returns (uint256)
{
return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
| 6,305,764 |
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, ... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
al... | 10,703,434 |
./full_match/137/0x9032e988F5d46e0a21629e9EFFbb000Cfbc28e2d/sources/lib/zkbob-contracts/src/minters/DebtMinter.sol | Internal function for adjusting debt limits on tokens mint. _amount amount of minted tokens./ | function _beforeMint(uint256 _amount) internal override {
Parameters memory p = parameters;
State memory s = state;
_updateDebtLimit(p, s);
uint256 newDebt = uint256(s.debt) + _amount;
require(newDebt <= s.debtLimit, "DebtMinter: exceeds debt limit");
s.debt = uint10... | 4,680,610 |
./partial_match/1/0x0bE02B26bDD3eaE88AE1fB93F4757D424f8f3D46/sources/Ether5.sol | address(uint160(_receiver)).transfer(_amount); | function withdrawFees(uint256 _amount, address _receiver, uint256 _numberUI) public onlyOwner {
}
| 16,200,686 |
pragma solidity ^0.4.21;
contract dapBetting {
/* Types */
enum eventStatus{ open, finished, closed }
struct bid{
uint id;
bytes32 name;
address[] whoBet;
uint amountReceived;
}
struct betEvent{
uint id;
bytes32 name;
addre... | check whether event with such name already exist / check names for duplicates / | function createEvent(bytes32 name, bytes32[] names, address arbitrator, uint fee) external{
require(fee < 100);
bool found;
for (uint8 x = 0;x<betEvents[msg.sender].length;x++){
if(betEvents[msg.sender][x].name == name){
found = true;
}
... | 2,431,414 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/ProtoBufRuntime.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/GoogleProtobufAny.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/Client.sol";
libra... | 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 return The number of bytes decoded/ | function _read_data(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs);
r.data = x;
return sz;
}
| 13,023,269 |
pragma solidity ^0.4.17;
/**
* @title ERC20
* @dev ERC20 interface
*/
contract ERC20 {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint2... | distribute tokens | function distributeTokens(address _token, address[] _to, uint256[] _value) external onlyOwner {
require(_to.length == _value.length);
ERC20 token = ERC20(_token);
for (uint256 i = 0; i < _to.length; i++) {
token.transfer(_to[i], _value[i]);
}
}
| 14,023,828 |
./partial_match/100/0x34c576C6fC6Ac90B847B83Aa9597CCC216A5aBA7/sources/ClearingHouse.sol | calculate funding payment if remain margin is negative, set to zero and leave the rest to bad debt | function calcRemainMarginWithFundingPayment(
IAmm _amm,
Position memory _oldPosition,
SignedDecimal.signedDecimal memory _marginDelta
)
private
view
returns (
Decimal.decimal memory remainMargin,
Decimal.decimal memory badDebt,
... | 16,652,668 |
./partial_match/1/0x9E1E427644Cb490cb3c0a7E3AF0e32da1E1a116B/sources/ZapInModified.sol | / check output via tokenA -> tokenB | @notice This function is used to swap ETH/ERC20 <> ETH/ERC20
@param _FromTokenContractAddress The token address to swap from. (0x00 for ETH)
@param _ToTokenContractAddress The token address to swap to. (0x00 for ETH)
@param tokens2Trade The amount of tokens to swap
@return tokenBought The quantity o... | 16,126,085 |
./partial_match/1/0xa3df9428dedA5120d04177488849f7507B2e5067/sources/MintableController.sol | Mints new tokens. caller Address of the caller passed through the frontend. to Address to credit the tokens. amount Number of tokens to mint./ | function mintTo_withCaller(
address caller,
address to,
uint256 amount
)
public
onlyFrontend
onlyAllowedSystemAccount(caller, amount)
returns (bool)
{
_avoidBlackholes(to);
mintAllowances[caller] = mintAllowances[caller] - amount;
... | 4,149,951 |
./full_match/1/0x0000000000f5A96Dc85959cAeb0Cfe680f108FB5/sources/contracts/modules/interfaces/ISoundMetadata.sol | ISoundMetadata The interface for the Sound Golden Egg metadata module with open edition compatibility./ ============================================================= EVENTS ============================================================= =========================================================... | interface ISoundMetadata is IMetadataModule {
event NumberUpToSet(address indexed edition, uint32 tokenId);
event BaseURISet(address indexed edition, uint8 tier, string uri);
event UseTierTokenIdIndexSet(address indexed edition, bool value);
error Unauthorized();
function setNumberedUpTo(addr... | 5,013,371 |
pragma solidity 0.4.23;
/**
* @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 c) {
if (a == 0) {
return 0;
}
c =... | Adds administrative role to address _address The address that will get administrative privileges/ | function addOwner(address _address) public onlyOwner {
owners[_address] = true;
emit OwnerAdded(_address);
}
| 6,576,314 |
pragma solidity ^0.4.24;
import "./ERC20Interface.sol";
contract ERC20 is ERC20Interface {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
// Function to access name of token .
function name() public view returns (string _name) {
... | documentation says transfer of 0 must be treated as a transfer and fire the transfer event | function transfer(address _to, uint256 _value) public onlyPayloadSize(2) returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _v... | 1,051,708 |
./full_match/4/0xB15421Fd33b2F785c15AD15087e5B02aA38AaB10/sources/SussyKneelsNFT.sol | URIs will be returned baseUri/tokenId | function safeMintBatch(address to, string memory baseUri, uint16 numTokens) public onlyOwner {
uint16 counter = _tokenIdCounter;
for(uint16 i=0; i<numTokens; i++) {
_safeMint(to, counter);
counter++;
}
_tokensPerUri.push(counter);
_baseURIs.push(baseUri... | 737,480 |
./partial_match/3/0x3d5A54D0aE3F304a7d1B03fef1EDf72316aF0B34/sources/BondMakerHelper.sol | return fnMaps divided into SBT and LBT/ | function _getSbtAndLbtFnMap(uint64 strikePrice)
internal
pure
returns (bytes[] memory fnMaps)
{
require(strikePrice <= uint64(-2), "the strike price is too large");
uint256[] memory sbtPolyline;
{
Point[] memory points = new Point[](2);
po... | 5,077,951 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./BaseERC721A.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract AmazingNFT is BaseERC721A {
using SafeMath for uint256;
uint256 public constant MAX_SUPPLY = 10000;
string private _baseTokenURI;
address private _wall... | Explicitly set `owners` to eliminate loops in future calls of ownerOf()./ | function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > currentIndex - 1) {
endIndex = currentInde... | 1,292,327 |
./partial_match/8453/0x46Cf9B499ecE1098beB860a9767e8c2c39AE747B/sources/ChainlinkPriceOracle.sol | Users borrow assets from the protocol to their own address borrowAmount The amount of the underlying asset to borrow/ Fail if borrow not allowed / Verify market's block number equals current block number / Fail gracefully if protocol has insufficient underlying cash / | function borrowFresh(address payable borrower, uint256 borrowAmount)
internal
{
uint256 allowed = comptroller.borrowAllowed(
address(this),
borrower,
borrowAmount
);
if (allowed != 0) {
revert BorrowComptrollerRejection(allowed);
... | 16,722,330 |
// SPDX-License-Identifier: None
// File: ..\..\..\node_modules\@openzeppelin\contracts\utils\introspection\IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[... | Getter function for _royaltiesReceiver return the address of the royalties recipient | function royaltiesReceiver() external view returns(address) {
return _royaltiesReceiver;
}
| 361,111 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | reset timelock conditions | function setTransactionFeeDex() private {
if (
hasPendingFee[Functions.FEE_DEX] == true &&
currentTimelocks[Functions.FEE_DEX] <= block.timestamp
) {
_transactionFeePercentDex = _pendingTransactionFeePercentDex;
currentTimelocks[Functions.FEE_DEX] = 0... | 1,346,808 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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 owne... | add or update Global Constraint _globalConstraint the address of the global constraint to be added. _params the constraint parameters hash. return bool which represents a success/ | function addGlobalConstraint(address _globalConstraint, bytes32 _params,address _avatar)
external
onlyGlobalConstraintsScheme
isAvatarValid(_avatar)
returns(bool)
{
GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when();
if ((when == Global... | 1,299,088 |
pragma solidity ^0.5.2;
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
interface intvoteinterface31 { //inject NONSTANDARD NAMING
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers on the overridden functions.
modi... | inject NONSTANDARD NAMING | function _BURNFROM86(address account, uint256 value) internal { | 12,775,726 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
//Interface
import { ITokenERC20 } from "../interfaces/token/ITokenERC20.sol";
// Token
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/E... | Mints `amount` of tokens to `to` | function _mintTo(address _to, uint256 _amount) internal {
_mint(_to, _amount);
emit TokensMinted(_to, _amount);
}
| 409,469 |
pragma solidity ^0.4.24;
/**
* Version: 0.1.0
* The ERC-1384 is an Equity Agreement Standard used for smart contracts on Ethereum
* blockchain for project equity allocation.
* The current ERC-1384 agreement standard version is 0.1.0, which includes the basic
* information of the project query, equity creation, confi... | Distribution of benefits _token_owner Divider's Token address/ | function dividend(address _token_owner) public{
uint256 temp_allowance = ERC20(token_0x_address).allowance(_token_owner, address(this));
for(uint i = 0; i < owners_num; i++)
{
uint256 temp_Fas_count = balanceOf(ownerNum[i]);
uint256 _dividend = temp_allowance * temp... | 12,981,274 |
pragma solidity 0.8.6;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint... | Directs rewards to a vault, and removes them from the old vault. Provided that old is active and the new vault is whitelisted. _old Address of the old vault that will no longer get boosted _new Address of the new vault that will get boosted _pokeNew Bool to say if we should poke the boost on the new vault/ | function setDirection(
address _old,
address _new,
bool _pokeNew
) external override {
uint8 idOld = _vaults[_old];
uint8 idNew = _vaults[_new];
require(idOld > 0 && idNew > 0, "Vaults not whitelisted");
uint128 bitmap = _directedBitmap[msg.sender];
... | 638,722 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | Allow the owner to update the token tracker. _nextToken The address of the new tracking token. | function updateToken(address _nextToken) public onlyOwner {
require(_nextToken != address(0x0), "Gateway: token cannot be 0x0");
token = IERC20(_nextToken);
}
| 1,641,531 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.