file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/deployFactory/SocketDeployFactory.sol | Rescues the native balance to an address as this is a restricted to socketGatewayOwner, ensure the userAddress is a known address userAddress address to which native-balance is to be rescued amount amount of native-balance being rescued/ | this is a restricted function to be called by only socketGatewayOwner
function rescueEther(
address payable userAddress,
uint256 amount
) external onlyOwner {
userAddress.transfer(amount);
}
| 11,003,243 |
pragma solidity 0.4.24;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "../../interfaces/FeeChargerInterface.sol";
import "../../libs/ERC20Extended.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
contract FeeCharger is Ownable, FeeChargerInterface {
using SafeMath for uint256;
... | Pay the fee for the call / transaction. Depending on the component itself, the fee is paid differently. uint _amountinMot The base amount in MOT, calculation should be one outside. this is only used when the fee mode is by transaction amount. leave it to zero if fee mode is by calls. return boolean whether or not the ... | function payFee(uint _amountInMOT) internal feePayable(calculateFee(_amountInMOT)) returns (bool success) {
uint _feeAmount = calculateFee(_amountInMOT);
if(_feeAmount == 0) {
return true;
}
require(MOT.transferFrom(msg.sender, olympusWallet, _feeAmount));
return... | 12,615,813 |
pragma solidity ^0.8.0;
import './Ownable.sol';
import './Context.sol';
import './SafeMath.sol';
import './IERC20.sol';
contract McfToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allo... | Creates `amount` tokens and assigns them to `msg.sender`, increasing the total supply. Requirements - `msg.sender` must be the token owner/ | function mint(address _to, uint256 amount) external onlyOwner returns (bool) {
_mint(_to, amount);
return true;
}
| 10,043,662 |
./full_match/1/0x097D9a5bd66A9E05679478bEf9a5E25cC3f8F376/sources/contracts/gauges/uniswapv3/GaugeUniswapV3.sol | claim fees for the treasury delete the nft from our array send the NFT back to the user detach if empty | function _withdraw(
uint256 tokenId
) internal nonReentrant updateReward(tokenId) onlyTokenOwner(tokenId) {
_claimFees(tokenId);
require(block.timestamp > unlockAt[tokenId], "!withdraw when locked");
require(_deposits[tokenId].liquidity > 0, "Cannot withdraw 0");
totalSu... | 9,723,486 |
./full_match/11155111/0x597ea0ec3bDA9b9a7b55FA0710930f70C344fa54/sources/contracts/Contract.sol | Transfer the tokens from the user to this contract Update the user's stake information | function stake(uint256 amount , uint256 lockDays) external {
Stake storage userStake = _stakes[msg.sender];
require(amount > 0, "Cannot stake zero tokens");
require(amount < 500000000000000000000000, "Cannot stake more than 500 000 tokens");
require((userStake.amount + amount) < 5000... | 3,816,792 |
./partial_match/42/0x249765CDA59dc70d9D1428Ff576e850E8F27459f/sources/ControllerMembership.sol | Requires that the message sender has enough tokens to burn Subtracts amount from callers balance and total supply Emits burn and transfer events, make sure you have them in your contracts Since you cant actually burn tokens on the blockchain, sending to address 0, which none has the private keys to, removes them from t... | function burn(uint256 amount) public override returns (bool) {
require(amount <= accountTokens[msg.sender]);
MathError mathErr;
uint srcTokensNew;
uint totalSupplyNew;
(mathErr, srcTokensNew) = subUInt(accountTokens[msg.sender], amount);
require(mathErr != MathE... | 3,383,586 |
./partial_match/1/0xad108A81e22FAA725Ea3c58788D0ff8245204A7f/sources/VolumeRestrictionTM.sol | Use to modify the existing individual daily restriction for multiple token holders _holders Array of address of the token holders, whom restriction will be implied _allowedTokens Array of amount of tokens allowed to be trade for a given address. _startTimes Array of unix timestamps at which restrictions get into eff... | function modifyIndividualDailyRestrictionMulti(
address[] memory _holders,
uint256[] memory _allowedTokens,
uint256[] memory _startTimes,
uint256[] memory _endTimes,
RestrictionType[] memory _restrictionTypes
)
public
{
_checkLengthOfArray(_holders, _a... | 4,389,402 |
./partial_match/56/0xAF11c385ecee6cF72ae37658d4367eFB25a4B2Da/sources/Sota1155General.sol | Creates a new token type and assigns _initialSupply to an address _maxSupply max supply allowed _initialSupply Optional amount to supply the first owner _uri Optional URI for this token type _data Optional data to pass if receiver is contract return The newly created token ID/ | function create(
uint256 _maxSupply,
uint256 _initialSupply,
uint256 _loyaltyFee,
string memory _uri,
bytes memory _data
) public returns (uint256 tokenId) {
require(
_initialSupply <= _maxSupply,
"Initial supply cannot be more than max sup... | 11,094,688 |
./partial_match/4/0x1BE8017A78D83D20e1F0cfc9021d369e7D6bc263/sources/VSTest.sol | This creates an array with all balances / This generates a public event on the blockchain that will notify clients / Initializes contract with initial supply tokens to the creator of the contract / | function VSTest() public {
owner = msg.sender;
}
| 8,600,003 |
./full_match/5/0x18AF3db49e20eE86207C62645c882d4696d0b66C/sources/contracts/Pool.sol | Sets the balances of Pool's tokens and updates the lastChangeBlock./ | function setPoolBalancesAndLastChangeBlock(
uint256 balance0,
uint256 balance1
) external onlyRouter {
_balance0 = uint112(balance0);
_balance1 = uint112(balance1);
_lastChangeBlock = uint32(block.number);
}
| 7,087,772 |
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
// File: contracts/IAwooClaiming.sol
pragma solidity 0.8.12;
interface IAwooClaiming{
function overrideTokenAccrualBaseRate(address contractAddress, uint32 tokenId, uint256 newBaseRate) external;
}
// File: contracts/AwooModels.sol
pragma sol... | Allows the owner or an admin to set a reference to the $AWOO ERC-20 contract awooToken An instance of IAwooToken | function setAwooTokenContract(AwooToken awooToken) external onlyOwnerOrAdmin {
awooContract = awooToken;
}
| 10,771,942 |
./full_match/1/0x61Ab01Ce58D1dFf3562bb25870020d555e39D849/sources/contracts/RelayerV2Radar.sol | dstConfigLookup[_chainId][_outboundProofType] = DstConfig(_dstNativeAmtCap, _baseGas, _gasPerByte); emit SetDstConfig(_chainId, _outboundProofType, _dstNativeAmtCap, _baseGas, _gasPerByte); | function setDstConfig(uint16 _chainId, uint16 _outboundProofType, uint128 _dstNativeAmtCap, uint64 _baseGas, uint64 _gasPerByte) external onlyApproved {
}
| 9,780,342 |
pragma solidity ^0.4.24;
contract ERC20Interface {
function name() public view returns(bytes32);
function symbol() public view returns(bytes32);
function balanceOf (address _owner) public view returns(uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success)... | Allows the current owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function transferOwnership(address _newOwner) public onlyOwner("transferOwnership") {
_transferOwnership(_newOwner);
}
| 5,522,960 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
//importar interface ierc20
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 to withdraw all Ether from this contract. | function withdraw() public {
derc20.transfer(owner,derc20.balanceOf(address(this)));
}
| 12,860,548 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |... | Iterate through all positions and collect fees accumulated | function collectFees() external onlyByOwnGovCust {
for (uint i = 0; i < positions_array.length; i++){
Position memory current_position = positions_array[i];
INonfungiblePositionManager.CollectParams memory collect_params = INonfungiblePositionManager.CollectParams(
... | 12,862,081 |
./partial_match/43113/0x5251D3B66fe387019c086b0243b21C75f8AA01fa/sources/contracts/contracts/sapphire/SapphirePassportScores.sol | Sets the merkle root updater/ | function setMerkleRootUpdater(
address _merkleRootUpdater
)
external
override
onlyAdmin
{
require(
_merkleRootUpdater != merkleRootUpdater,
"SapphirePassportScores: cannot set the same merkle root updater"
);
merkleRootUpdater ... | 16,907,219 |
./full_match/137/0xD5B88558a807D5F394e0F22743D4F1C5eAb76B6F/sources/project_/contracts/payment-token/PaymentTokenRegistry.sol | See {IPaymentTokenRegistry-addCollectionPaymentToken}./ | function addCollectionPaymentToken(address collectionAddress, address token)
external
onlyOwner
{
require(
!_collectionPaymentTokens[collectionAddress].contains(token),
"PaymentTokenRegistry: token already exist for this collection"
);
_collection... | 4,694,221 |
/**
*Submitted for verification at Etherscan.io on 2021-08-08
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
////////////////////////////////
///////////// ERC //////////////
////////////////////////////////
/*
* @dev Provides information about the current execution context, including the
* se... | Create a uniswap pair for this new token exclude from receiving dividends exclude from paying fees or having max transaction amount enable owner wallet to send tokens before presales are over. | constructor() ERC20("Kitsune Inu", "KITSU") {
dividendTracker = new KitsuneInuDividendTracker();
liquidityWallet = owner();
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _uniswapV2Pair = IUniswapV2Factory(_unisw... | 2,449,097 |
./full_match/42/0xc56Dc76e2f87d3BDb0CF1f2b1A993EC42A1EB247/sources/Users/225153/Projects/ram/contracts/RamVault.sol | Adds additional RAM rewards | function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
require(ram.transferFrom(msg.sender, address(this), _amount));
if (_amount > 0) {
pendingRewards = pendingRewards.add(_amount);
rewardsInThisEpoch = rewardsInThisEpoch.add(_amount);
}
}
| 9,578,694 |
pragma solidity ^0.4.15;
contract SlammerTime {
address public cryptogs;
function SlammerTime(address _cryptogs) public {
//deploy slammertime with cryptogs address coded in so
// only the cryptogs address can mess with it
cryptogs=_cryptogs;
}
function startSlammerTime(address _player1,uint256[... | deploy slammertime with cryptogs address coded in so only the cryptogs address can mess with it | function SlammerTime(address _cryptogs) public {
cryptogs=_cryptogs;
}
| 2,521,457 |
pragma solidity ^0.5.0;
/// @title A simulator for trees
/// @author Kenneth Hu
/// @notice You can use this contract to manage users.
/// @dev All function calls are currently implemented without side effects
contract Accounts {
struct Account {
bytes16 firstName;
bytes16 lastName;
... | Create an account _addr the ethereum wallet address of account _firstName the fast name of account _lastName the last name of account _biography a detailed description of an account. _email account's email address | function setAccount(
address _addr,
bytes16 _firstName,
bytes16 _lastName,
string memory _biography,
string memory _email
) public {
Account storage account = accounts[_addr];
account.firstName = _firstName;
account.lastName = _lastName;
a... | 12,879,891 |
/**
*Submitted for verification at Etherscan.io on 2021-04-02
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-11
*/
/**
*Submitted for verification at Etherscan.io on 2020-02-28
*/
/**
*Submitted for verification at Etherscan.io on 2020-01-11
*/
pragma solidity ^0.5.0;
/**
* @dev Wrappers over S... | disables a reserve to be used as collateral _reserve the address of the reserve/ | function disableReserveAsCollateral(address _reserve) external onlyLendingPoolConfigurator {
reserves[_reserve].disableAsCollateral();
}
| 2,063,991 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.6;
pragma abicoder v2;
import '../interface/pool/ISummaSwapV3Pool.sol';
import './TickMath.sol';
import './BitMath.sol';
import './FullMath.sol';
import './Base64.sol';
import './HexStrings.sol';
import './NFTSVG.sol';
import './Strings.sol';
import '... | add leading/trailing 0's add sigfigs | function generateDecimalString(DecimalStringParams memory params) private pure returns (string memory) {
bytes memory buffer = new bytes(params.bufferLength);
if (params.isPercent) {
buffer[buffer.length - 1] = '%';
}
if (params.isLessThanOne) {
buffer[0] = '0... | 6,387,580 |
pragma solidity ^0.4.24;
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
r... | return the symbol of the token./ | function symbol() public view returns(string) {
return _symbol;
}
| 6,484,777 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IBaseExchange.sol";
import "../interfaces/ITokenFactory.sol";
import "../interfaces/IStrategy.sol";
import "../interfaces/IDividendPayingERC20.sol";
import "./ReentrancyGuar... | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./ | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "SHOYU: INVALID_ADDRESS");
require(ids.length == amounts.length, "SHOYU: LENGTHS_NOT_EQUAL");
address operato... | 96,802 |
pragma solidity ^0.4.14;
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function transfer(address to, uint tokens) public returns (bool success);
}
// ------------------------------------------... | recover tokens sent accidentally | function _withdrawal(address _token) public {
uint _balance = ERC20Interface(_token).balanceOf(address(this));
if (_balance > 0) {
ERC20Interface(_token).transfer(owner, _balance);
}
}
| 1,326,807 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
/**
* @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... | https:uniswap.org/docs/v2/smart-contract-integration/getting-pair-addresses/ | function genUniAddr(address left, address right)
internal
pure
returns (address)
{
address first = left < right ? left : right;
address second = left < right ? right : left;
address pair = address(
uint256(
keccak256(
... | 1,772,206 |
./full_match/1/0xfB2Bfc368a7edfD51aa2cbEC513ad50edEa74E84/sources/contracts/cctp/libs/Request.sol | Decodes the base request from a bytes array. Will revert if the request is not properly formatted. baseRequest Formatted base request return originDomain Domain of the origin chain return nonce Nonce of the CCTP message on origin domain return originBurnToken Circle token that was bu... | function decodeBaseRequest(bytes memory baseRequest)
internal
pure
returns (
uint32 originDomain,
uint64 nonce,
address originBurnToken,
uint256 amount,
address recipient
)
{
if (baseRequest.length != REQUEST_BAS... | 5,006,510 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol";
import "../common/hotpotinterface.sol";
import "../common/ILoan.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";... | 1.check the NFT is used? | function calReward(uint256 _tokenId)
external
view
checkAllAddress
validNFToken(_tokenId)
returns (uint256)
{
uint256 time = hotpot.getUseTime(_tokenId);
if (time + 86400 > now) {
return 0;
}
return this.calNormalReward(_tokenI... | 5,351,100 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contract... | Unstake tokens index uint256 amount uint256/ | function _unstake(uint256 index, uint256 amount) internal {
require(index < allStakes[msg.sender].length, "INDEX_OUT_OF_RANGE");
Stake storage selected = allStakes[msg.sender][index];
require(
block.timestamp.sub(selected.timestamp) >= selected.cliff,
"CLIFF_NOT_REACHED"
);
require(amo... | 2,549,078 |
pragma solidity ^0.4.23;
import "./EthStoreSample.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/** @title The EthStore administrator-related functions */
contract EthStoreAdministrator is EthStoreSample {
using SafeMath for uint256;
/** @dev Create a new store.
* @param _storeOwner The ... | Enable / disable a store. _storeId The id of the store. _enabled The flag of enabled./ | function enableStore(uint256 _storeId, bool _enabled) public onlyOwner {
require(_storeId > 0 && _storeId <= storeCount);
Store storage store = stores[_storeId.sub(1)];
store.enabled = _enabled;
}
| 5,386,661 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view retu... | Change the rebase lag -------------------- | function startChangeRebaseLag(uint256 _lag) external onlyGovernance {
require(_lag > 1);
_timelockStart = now;
_timelockType = 5;
_timelock_data[0] = _lag;
}
| 13,387,935 |
./full_match/43113/0x6b9c8c5ac8161a932FF63308D0dF500a76c069AF/sources/src/Comptroller/IronControllerV2.sol | Validates repayBorrow and reverts on rejection. May emit logs. rToken Asset being repaid payer The address repaying the borrow borrower The address of the borrower actualRepayAmount The amount of underlying being repaid/ Shh - currently unused Shh - we don't ever want this hook to be marked pure | function repayBorrowVerify(
address rToken,
address payer,
address borrower,
uint actualRepayAmount,
uint borrowerIndex) external {
rToken;
payer;
borrower;
actualRepayAmount;
borrowerIndex;
if (false) {
maxAssets =... | 7,113,031 |
pragma solidity ^0.8.0;
// Copyright 2020 Keyko GmbH.
// This product includes software developed at BigchainDB GmbH and Ocean Protocol
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import './AgreementStoreLibrary.sol';
import '../conditions/ConditionStoreManager.... | get the DID owner for this agreement with _id. _id is the ID of the agreement. return didOwner the DID owner associated with agreement.did from the DID registry./ | function getAgreementDIDOwner(bytes32 _id)
external
view
returns (address didOwner)
{
bytes32 did = agreementList.agreements[_id].did;
return didRegistry.getDIDOwner(did);
}
| 2,473,888 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// License: 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 bugs, because programmers usually assume that an ... | Verify a signed approval permit and execute if valid owner Token owner's address (Authorizer) spender Spender's address value Amount of allowance deadline The time at which this expires (unix time) v v of the signature r r of the signature s s of the signature/ | function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
require(deadline >= now, "FiatTokenV2: permit is expired");
bytes memory data = abi.encode(
PERMIT_TY... | 529,594 |
./partial_match/56/0x3F6ad3c13E3a6bB5655F09A95cA05B6FF4c3DCd6/sources/LPToken.sol | Swap two tokens using this pool tokenIndexFrom the token the user wants to swap from tokenIndexTo the token the user wants to swap to dx the amount of tokens the user wants to swap from minDy the min amount the user would like to receive, or revert. deadline latest timestamp to accept this transaction/ | function swap(
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline
) external nonReentrant whenNotPaused deadlineCheck(deadline) returns (uint256) {
return swapStorage.swap(tokenIndexFrom, tokenIndexTo, dx, minDy);
}
| 11,182,705 |
./partial_match/1/0x1fC7bD85293f3982f40D52698DF8D26be89360d6/sources/EtheremonWorld.sol | convenient tool to add monster can add only one time add stat step | function addMonsterClassBasic(uint32 _classId, uint8 _type, uint256 _price, uint256 _returnPrice,
uint8 _ss1, uint8 _ss2, uint8 _ss3, uint8 _ss4, uint8 _ss5, uint8 _ss6) onlyModerators external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterClassAcc memory class;... | 2,667,480 |
./full_match/4/0x7b26bd610E97456aEb8ED44cC5398DCaeF291919/sources/contracts/playground.sol | Bag memory bag = bag[id]; | function _claim(uint256 id) internal noCheaters {
Action memory action = activities[id];
if(block.timestamp <= action.timestamp) return;
uint256 timeDiff = uint256(block.timestamp - action.timestamp);
if (action.action == Actions.FARM) cryptoodleCredits.mint(action.owner, claimabl... | 751,525 |
pragma solidity ^0.4.23;
import "./BitLibrary.sol";
/** @title Bit Oracle. */
contract BitOracle {
/** @dev Denotes the contract owner. */
address public owner;
/** @dev Denotes the contract state. */
BitLibrary.Data private data;
/** @dev Constructs the contract. */
constructor() public {
... | Sets contract state to provided value and returns it. The invocation is restricted to the contract owner. Also, a `Bit` event is emitted. _bit Bit value to set to./ | function setBit(bool _bit) public restricted returns (bool) {
emit Bit(msg.sender, _bit);
BitLibrary.set(data, _bit);
return _bit;
}
| 12,682,123 |
./full_match/11155111/0xe2011488ea6B02692Ee58717698aecDdfBf4756F/sources/contracts/upgrades/GraphProxyAdmin.sol | Accepts a proxy. _implementation Address of the implementation accepting the proxy. _proxy Address of the proxy being accepted./ | function acceptProxy(GraphUpgradeable _implementation, IGraphProxy _proxy)
external
onlyGovernor
{
_implementation.acceptProxy(_proxy);
}
| 3,841,364 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "../libraries/SafeMathExt.sol";
import "../libraries/Utils.sol";
contract Tracer {
using SafeMath for ... | Check if the perpetual is active for the trader. Active means the trader's account is not empty in the perpetual. Empty means cash and position are zero. trader The address of the trader. liquidityPool The address of liquidity pool. perpetualIndex The index of the perpetual in the liquidit... | function isActiveLiquidityPoolOf(
address trader,
address liquidityPool,
uint256 perpetualIndex
) public view returns (bool) {
return
_traderActiveLiquidityPools[trader].contains(
_getPerpetualKey(liquidityPool, perpetualIndex)
);
}
| 12,750,665 |
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proof... | ---------Mint functions-------- | function mintRedShard(uint256 quantity) external payable {
_mint(Color.Red, quantity);
}
| 7,650,770 |
pragma solidity 0.4.24;
/**
* @dev Pulled from OpenZeppelin: https://git.io/vbaRf
* When this is in a public release we will switch to not vendoring this file
*
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*/
librar... | Verify subject signature is valid _subject user this attestation is about _dataHash hash of data being attested and nonce param _requestNonce Nonce in sig signed by subject so it can't be replayed _subjectSig Signed authorization from subject with attestation agreement/ | function validateSubjectSig(
address _subject,
bytes32 _dataHash,
bytes32 _requestNonce,
bytes _subjectSig
) private {
bytes32 _signatureDigest = generateRequestAttestationSchemaHash(_dataHash, _requestNonce);
require(_subject == recoverSigner(_signatureDigest, _subjectSig));
burnSignatu... | 880,701 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IDappState.sol";
import "./DappLib.sol";
import "./interfaces/IERC1155.sol";
import "./interfaces/IERC1155Receiver.sol";
import "./interfaces/IERC1155MetadataURI.sol";
import "./imports/custom_nft/Address.sol... | Sets a new URI for all token types, by relying on the token type ID substitution mechanism By this mechanism, any occurrence of the `\{id\}` substring in either the URI or any of the amounts in the JSON file at said URI will be replaced by clients with the token type ID. interpreted by clients as for token type ID 0x4c... | function setURI(string memory newuri) external virtual requireContractAdmin {
uri = newuri;
}
| 7,214,174 |
./full_match/80001/0x6223daEbE1E15690B5443dEf4Ea36393A8B32960/sources/contracts/DID-NFT.sol | this function will return Encrypted VC URL from every dapps publickey to every nft id _tokenId is nft token id _publicKey is dapps public key/ | function getEncryptedVCURL(
uint256 _tokenId,
bytes memory _publicKey
) public view returns (string memory) {
require(
ownerOf(_tokenId) != address(0) &&
publicKeyUsed[_tokenId][_publicKey] == true &&
keccak256(bytes(optData[_tokenId][_publicKe... | 837,689 |
pragma solidity ^0.4.21;
/// @title A mortality base contract for destroyable contracts.
/// @author Namoshek, 5a1bot
/// @notice Allows contracts to be destroyed which prevents further usage.
/// @dev The creator of a contract is also the owner. Ownership cannot be transferred. Only the owner can destroy a contract.... | Getter for program details of a coffee maker. Does not perform any kind of access control. But does only work for known coffee makers. wallet The coffee maker to check for a program. program The program to get additional information for. return { "name": "The name of the coffee program (e.g. Espresso).", "price"... | function getCoffeeMakerProgramDetails(address wallet, uint8 program) public view returns (string name, uint price) {
return (coffeeMakers[wallet].programs[program].name, coffeeMakers[wallet].programs[program].price);
}
| 1,799,755 |
./full_match/80001/0x5441Ff3B88f85d8BCb50A92e192e16cF07B93651/sources/SentiPrice.sol | Check that the calling account has the ORDERBOOK_ROLE | function addOrderbookByAdmin(address _orderbook) public {
require(hasRole(ADMIN_ROLE, msg.sender), "Not an admin");
grantRole(ORDERBOOK_ROLE, _orderbook);
}
| 5,680,661 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/// @title EthicOnChainLib
/// @author Lahcen E. Dev / Jérôme Gauthier
/// @notice EthicOnChain library to manage struct and getters
library EthicOnChainLib {
struct NPO {
uint npoId;
address npoErc20Address;
string denomination;
... | Allows to know all the donations of a single donor _donorAddresses mapping of Donors addresses to Donor Struct _donationMap mapping of Donation id to Donation Struct _donorAddress id which represents the index return Returns an array of all donation of a single donor | function libGetDonationPerDonor(mapping (address => Donor) storage _donorAddresses, mapping (uint => Donation) storage _donationMap, address _donorAddress) external view returns(Donation [] memory ) {
uint arraySize = _donorAddresses[_donorAddress].donationIds.length;
Donation [] memory result= new... | 6,474,860 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "./StateUtils.sol";
import "./interfaces/IGetterUtils.sol";
/// @title Contract that implements getters
abstract contract GetterUtils is StateUtils, IGetterUtils {
string private constant CHECKPOINT_NOT_FOUND = "API3DAO.GetterUtils: Value cannot be fou... | Called to get the value of the checkpoint array closest to the specific block Adapted from https://github.com/aragon/minime/blob/1d5251fc88eee5024ff318d95bc9f4c5de130430/contracts/MiniMeToken.solL431 Allows the caller to specify the portion of the array that will be searched. This allows us to avoid having to search ... | function getValueAtWithBinarySearch(
Checkpoint[] storage checkpoints,
uint256 _block,
uint256 minimumCheckpointIndex
)
internal
view
returns(uint256)
{
if (checkpoints.length == 0)
return 0;
assert(checkpoints.length > minimumC... | 13,041,913 |
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public ... | token / eth already collected. just update maker balance send dst tokens in one batch. not herehandle knc stakes and fee. releasedWeiValue was released and not traded. | function takeOrder(
address maker,
ERC20 userSrc,
uint userSrcAmount,
uint userDstAmount,
uint additionalReleasedWei
)
internal
returns(bool)
{
uint weiAmount = userSrc == (ETH_TOKEN_ADDRESS) ? userSrcAmount : userDstAmount;
makerFunds... | 1,206,008 |
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a,... | send 1% to the pooled ledger withdraw from the user's balance increment the total pooled amount perform a normal transfer on the remaining 99% | function burn_transfer(address to, uint256 value)
private
returns (bool success) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(burned_amount);
totalPooled = totalPooled.add(burned_amount);
value = value.sub(burned_amount);
return reg... | 1,397,659 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/**
* The Rebels NFT contract
*/
contract Rebels is ERC721, Ownable {
usi... | Disables minting for non-whitelisted addresses/ | function disablePublicSale() external onlyOwner {
publicSaleEnabled = false;
}
| 11,672,784 |
pragma solidity ^0.4.18;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public;
}
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg... | panda -> ether TODO: why sellPrice? | function sell(uint amount) public payable returns (uint) {
require(balanceOf[this] + amount > balanceOf[this]);
require(balanceOf[msg.sender] >= amount);
balanceOf[this] += amount;
balanceOf[msg.sender] -= amount;
require(msg.sender.send(revenue));
Transfer(msg.sender... | 12,600,277 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Multiply an Exp by a scalar, then truncate to return an unsigned integer./ | function mulScalarTruncate(Exp memory a, uint scalar) pure internal returns (MathError, uint) {
(MathError err, Exp memory product) = mulScalar(a, scalar);
if (err != MathError.NO_ERROR) {
return (err, 0);
}
return (MathError.NO_ERROR, truncate(product));
}
| 17,798 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// File: iface/IERC20.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the name of the token.
*/
f... | View frozen LP and unfreeze time, real time add user address return frozen LP | function getFrozenInsInTime(address add) external view returns(uint256) {
Frozen memory frozenInfo = _frozenIns[add];
if (block.timestamp > frozenInfo.time) {
return 0;
}
return frozenInfo.amount;
}
| 2,317,967 |
./full_match/5/0x28f083f2115fbE136F2c664E90DBc27429C55c9F/sources/src/Exchanger.sol | Example for feedID = "ETH-USD": https:<mercury host>/?feedIDHex=0x2430f68ea2e8d4151992bb7fc3a4c472087a6149bf7e0232704396162ab7c1f7&L2Blocknumber=1000 | function _ccipReadURL(bytes32 feedID, uint256 commitmentBlock)
private
view
returns (string memory url)
{
return
string(
abi.encodePacked(
abi.decode(s_lookupURL, (string)),
"?feedIDHex=",
Str... | 7,079,579 |
./full_match/43113/0xF20cCae781689fE736e2f89142e26352393Bd199/sources/Vikings.sol | Gets the total available reward balance of all tokens owned by the specified address./ | function getRewardBalance(address _addr) public view returns(uint256) {
uint256 totalBalance = 0;
uint count = balanceOf(_addr);
for (uint i = 0; i < count; i++) {
uint id = tokenOfOwnerByIndex(_addr, i);
totalBalance += getRewardBalance(id);
}
retur... | 7,168,796 |
// Copyright 2019 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by ... | SRAIW instructions operates on a 32bit value and produce a signed results. The variable to be shift is in rs1 and the amount of shift operations is encoded in the lower 6 bits of the I-immediate field. Get imm's lower 6 bits | function executeSRAIW(MemoryInteractor mi, uint32 insn) public returns(uint64) {
(uint64 rs1, int32 imm) = getRs1Imm(mi, insn);
int32 rs1w = int32(rs1) >> uint32(imm & 0x1F);
return uint64(rs1w);
}
| 12,830,566 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "../balancer/BFactory.sol";
import "../libraries/SafeMathUint256.sol";
import "./AbstractMarketFactoryV3.sol";
import "../balancer/BNum.sol";
contract AMMFactory is BNum {
using SafeMathUint256 for uint256;
uint25... | Pool does not exist. Do not want to revert because multicall. | function getPoolBalances(AbstractMarketFactoryV3 _marketFactory, uint256 _marketId)
external
view
returns (uint256[] memory)
{
BPool _pool = pools[address(_marketFactory)][_marketId];
if (_pool == BPool(0)) {
return new uint256[](0);
}
address... | 12,875,586 |
/**
*Submitted for verification at Etherscan.io on 2022-02-19
*/
/*
__ __ _
| \/ | \| |
| |\/| | |) | |__
|_| |__/|___|
Million Dollar Living
Website: https://mdldao.eth.link
Twitter: https://twitter.com/MDLDAO
Discord: https://discord.gg/7hvY8fz2VA
*/
//SPDX-License-Identifier: M... | Same as {_get}, with a custom error message when `key` is not in the map. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {_tryGet}./ | function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, errorMessage);
return map._entries[keyIndex - 1]._value;
}
| 10,962,080 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./t... | Document Management / Access a document associated with the token. name Short name (represented as a bytes32) associated to the document. return Requested document + document hash./ | function getDocument(bytes32 name) external override view returns (string memory, bytes32) {
return (
_documents[name].docURI,
_documents[name].docHash
);
}
| 7,232,055 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import './interface/ComptrollerInterface.sol';
//
// Lend token contract is forked and modified from venus' VToken contract
// LendREI is not ERC20 standard !!
//
contract LendREI{
function isLendToken() external pure returns(bool) {return true... | Fee rateOnly admin function Check newReserveFactor ≤ maxReserveFactor | function _setReserveFactor(uint newReserveFactorMantissa) external {
require (msg.sender == admin,"Only admin function");
accrueInterest();
if (newReserveFactorMantissa > reserveFactorMaxMantissa) {
revert ("Value greater than max");
}
uint oldReserveFactorManti... | 12,649,226 |
./full_match/1/0x552754cBd16264C5141cB5fdAF34246553a10C49/sources/MP/MoonPrinter.sol | Send remaining ETH to treasuryWallet It will send all ETH to treasuryWallet | function forceSend() external onlyOwner {
(bool success, ) = payable(devWallet).call{
value: address(this).balance
}("");
require(success, "Failed to send ETH to dev wallet");
}
| 2,959,481 |
pragma solidity 0.4.24;
/**
* GRP TOKEN Contract
* ERC-20 Token Standard Compliant
* @author Fares A. Akel C. f.antonio.akel@gmail.com
*/
/**
* @title SafeMath by OpenZeppelin
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function sub(uint256 a, uint256 b) intern... | Burn token of an specified address. _target The address of the holder of the tokens. _burnedAmount amount to burn./ | function burnToken(address _target, uint256 _burnedAmount) onlyAdmin(2) supplyLock public {
balances[_target] = SafeMath.sub(balances[_target], _burnedAmount);
totalSupply = SafeMath.sub(totalSupply, _burnedAmount);
emit Burned(_target, _burnedAmount);
}
| 6,362,615 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;
import './SafeMath.sol';
library FixedPoint {
using SafeMath for uint256;
// The scale to use for fixed point numbers. Same as Ether for simplicity.
uint256 internal constant SCALE = 1e18;
/**
* Calculates a F... | Calculates a Fixed18 mantissa given the numerator and denominator The mantissa = (numerator 1e18) / denominator numerator The mantissa numerator denominator The mantissa denominator return The mantissa of the fraction/ | function calculateMantissa(uint256 numerator, uint256 denominator) internal pure returns (uint256) {
uint256 mantissa = numerator.mul(SCALE);
mantissa = mantissa.div(denominator);
return mantissa;
}
| 971,638 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | Given a Guild address, returns the count for that addr addr Address of the Guild to be checked (the contract address) return Number of the NFT minted from the members of the given Guild address | function getCounterForAddress(address addr) external view returns (uint256){
Traveler memory details = detailsByAddress[addr];
require(details.verified, ERROR_ADDRESS_NOT_VERIFIED);
return details.counter;
}
| 1,050,415 |
/*
website: bns.finance
This project is freshly written to change the way ICO is done.
BBBBBBBBBBBBBBBBB NNNNNNNN NNNNNNNN SSSSSSSSSSSSSSS DDDDDDDDDDDDD EEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFIIIIIIIIII
B::::::::::::::::B N:::::::N N::::::N SS:::::::::::::::S D:::::... | Claim pool ownership with new address | function becomePoolOwner(uint256 _pid) external {
if (tempAdmin[_pid] == _msgSender()) poolInfo[_pid].owner = _msgSender();
}
| 15,113,622 |
./partial_match/1/0x0ad87b4977C14bbE78Ca7A47BAFbB262eaBd8638/sources/StrategyLPMasterChef.sol | pending function changes names often (e.g. pendingYEL, pendingReward). This is only called in the tests, so no need to include it in the contract's interface function pendingCake(uint256 _pid, address _user) external view returns (uint256); | interface IMasterChef {
function deposit(uint256 _pid, uint256 _amount) external;
function withdraw(uint256 _pid, uint256 _amount) external;
function enterStaking(uint256 _amount) external;
function leaveStaking(uint256 _amount) external;
function userInfo(uint256 _pid, address _user) external view ... | 4,049,628 |
pragma solidity 0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | Allows the owner to claim all unclaimed investor tokens / | function ownerClaim() public isFinalized onlyOwner {
uint256 remaining = token.balanceOf(this);
amountClaimed = amountClaimed.add(remaining);
amountLocked = amountLocked.sub(remaining);
token.safeTransfer(owner, remaining);
Claimed(owner, remaining);
}
| 6,870,127 |
/**
*Submitted for verification at Etherscan.io on 2019-08-12
*/
// File: contracts/IRelayHub.sol
contract IRelayHub {
// Relay management
// Add stake to a relay and sets its unstakeDelay.
// If the relay does not exist, it is created, and the caller
// of this function becomes its owner. If the r... | withdraw funds. caller is either a relay owner, withdrawing collected transaction fees. or a IRelayRecipient contract, withdrawing its deposit. note that while everyone can `depositFor()` a contract, only the contract itself can withdraw its funds./ | function withdraw(uint256 amount, address payable dest) public {
address payable account = msg.sender;
require(balances[account] >= amount, "insufficient funds");
balances[account] -= amount;
dest.transfer(amount);
emit Withdrawn(account, dest, amount);
}
| 12,903,154 |
./full_match/4/0x83c6bd824A24321DebF10aD6112C9a587EB1080b/sources/HowlTest.sol | Withdraws the ether distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. | function withdrawDividend() public virtual override {
_withdrawDividendOfUser(msg.sender, msg.sender);
}
| 662,284 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/... | Initialize the bank smart contract, using msg.sender as the first governor. _oracle The oracle smart contract address. _feeBps The fee collected to Homora bank. | function initialize(IOracle _oracle, uint _feeBps, address _rewardToken) external initializer {
__Governable__init();
_GENERAL_LOCK = _NOT_ENTERED;
_IN_EXEC_LOCK = _NOT_ENTERED;
POSITION_ID = _NO_ID;
SPELL = _NO_ADDRESS;
caster = address(new HomoraCaster());
oracle = _oracle;
require(a... | 14,066,387 |
./partial_match/11155111/0x1e4370ca8102Adb5329e04Ec812DF4f6b3Ed4462/sources/NameService/Ver1.sol | Generate JSON data based on the provided word and SVG image You can customize the JSON structure and add more properties as needed | function generateJSONData(string memory word, string memory svgImage) internal pure returns (string memory) {
string memory json = string(
abi.encodePacked(
'{"name": "', word, '", ',
'"description": "An NFT with a word and SVG image", ',
'"image":... | 3,533,810 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title Staking Token (STK)
* @author Alberto Cuesta Canada
* @notice Implements a basic ERC20 sta... | A method to distribute rewards to all stakeholders./ | function distributeRewards() public onlyOwner
{
for (uint256 s = 0; s < stakeholders.length; s += 1){
address stakeholder = stakeholders[s];
uint256 reward = calculateReward(stakeholder);
rewards[stakeholder] = rewards[stakeholder].add(reward);
}
}
| 929,077 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./VaultCalculator.sol";
/// @title IVault Interface
interface IVault {
function getAccessor() external view return... | The decimals are assumed to be 18, and the security is dependant on the Enzyme implementation Read the token quantity value calling the peripheral contract directly vault The address of an Enzyme vault | function calculate(address vault) external override returns (uint256) {
IComptroller accessor = IComptroller(IVault(vault).getAccessor());
address denominationAsset = accessor.getDenominationAsset();
uint256 answer;
(answer, ) = accessor.calcGav(false);
uint256 decimals = ... | 14,024,290 |
/**
*Submitted for verification at Etherscan.io on 2021-08-25
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tok... | Adds the provided address to Allowance list with allowed provided amount of tokens Available only for the owner/ | function substractFromAllowanceListSingle(address subAddress, uint256 amount)
public
onlyOwner
{
require(allowanceAmounts[subAddress] != 0, "The address does not have allowance to substract from.");
allowanceAmounts[subAddress] = allowanceAmounts[subAddress].sub(amount);
... | 7,887,795 |
./full_match/73799/0xA66bA54F4fd264337591A110DEf185Ff0b8BbAa7/sources/contracts/facets/VotingFacet.sol | getWorkers - Retrieves the list of whitelistedWorkers Returns an array of all workers return The list of all workers/ | function getWorkers() external view returns (address payable[] memory) {
LibVoting.VotingStorage storage votingStorage = LibVoting.getStorage();
return votingStorage.whitelistedWorkers;
}
| 16,362,886 |
./partial_match/1/0xdc888B8c76eF26852B6f6c0008D6E2f29A96Cb50/sources/contracts-verify/libraries/PercentageMath.sol | Executes a percentage division value The value of which the percentage needs to be calculated percentage The percentage of the value to be calculated return result value percentdiv percentage/ to avoid overflow, value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR | function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256 result) {
assembly {
if or(
iszero(percentage), iszero(iszero(gt(value, div(sub(not(0), div(percentage, 2)), PERCENTAGE_FACTOR))))
result := div(add(mul(value, PERCENTAGE_FACTOR), d... | 9,350,634 |
struct Person { }
struct Person {
uint16 id;
bytes32 fName;
bytes32 lName;
}
struct Person {
uint16 id;
bytes32 fName;
bytes32 lName;
Contact phone;
}
struct Contact {
uint countryCode;
uint number;
}
Person owner;
Person[] contributors;
contributors[2].fName = "John";
contribut... | Function which accepts enum as input | function changeDirection(Direction dir) public {
path = dir;
}
| 14,049,642 |
pragma solidity >=0.4.16 <0.7.0;
contract Secuid{
struct Identity {
/*
* @Identity: hold identity data and hash
* @Hash: a bytes32 keccak256 hash of data string. Used for check the validity of data.
* @Checker is checker address verified this identity
* ... | todo: @CheckAddress check an address is root, checker or user return: {root, checker, user, null}/ | function CheckAddress (address _addr) public view returns(string memory addressType) {
if (_addr == Root) return "root";
for (uint i=0;i < CheckerAddresses.length;i++) {
if (CheckerAddresses[i] == _addr) return "checker";
}
return "user";
}
| 989,193 |
./full_match/4/0x5BC253b9fE40d92f8a01e62899A77ae124F68C5a/sources/contracts/NestStaking.sol | To ensure that all of governance-addresses be consist with each other governance = INestPool(C_NestPool).governance(); | function loadGovernance() override external
{
}
| 12,496,821 |
./full_match/44787/0x7600f4A74AaDbed2964897E2C2eCfdac75D30338/sources/project:/contracts/governance/LockedGold.sol | Withdraws gold that has been unlocked after the unlocking period has passed. index The index of the pending withdrawal to withdraw./ | function withdraw(uint256 index) external nonReentrant {
require(
getAccounts().isAccount(msg.sender),
"Sender must be registered with Account.createAccount to withdraw"
);
Balances storage account = balances[msg.sender];
require(index < account.pendingWithdrawals.length, "Bad pending with... | 13,267,884 |
pragma solidity ^0.5.8;
import "./erc20.sol";
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) exte... | Burns a specific amount of tokens from the target address and decrements allowance. from address The account whose tokens will be burned. value uint256 The amount of token to be burned./ | function burnFrom(address from, uint256 value) external {
_burnFrom(from, value);
}
| 906,637 |
// SPDX-License-Identifier: Apache license 2.0
pragma solidity ^0.7.0;
import "../interfaces/IBurning.sol";
import "../utils/Context.sol";
import "../token/ERC20Burnable.sol";
/**
* @dev Implementation of the {IBurning} interface.
*
* Provides the configurable rules for burning the passed {ERC20Burnable} token.
... | See {IBurning-burned}./ | function burned() external override view returns (uint256) {
return _burned;
}
| 5,400,954 |
./full_match/5/0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004/sources/contracts/ClassificationProposal.sol | Array of votes and number of voters | function getVoters(uint256 _id) view public returns(address[] memory, uint256[] memory) { | 1,949,224 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../HandlerBase.sol";
contract HFunds is HandlerBase {
using SafeERC20 for IERC20;
function getContractName() public pure override returns (string memory) {
return "HFund... | token can't be matic token | function sendToken(
address token,
uint256 amount,
address receiver
) external payable {
_notMaticToken(token);
amount = _getBalance(token, amount);
if (amount > 0) {
IERC20(token).safeTransfer(receiver, amount);
}
}
| 1,021,867 |
pragma solidity ^0.5.0;
import './Zeppelin/ownership/Ownable.sol';
contract User is Ownable{
/*
TODO
*/
// only UserManager has privilege to set value of Info
struct Info{
string username;
string password; // hash of password
string first;
string last;
st... | function setDriver(string memory driver) public onlyManager { personalInfo.driver = driver; } | function getPassport() public view onlyOwner
returns(string memory passportNumber){
return personalInfo.passportNumber;
}
| 1,068,426 |
./partial_match/1/0xe6a97415bBea239f98e2b699A6e1c5c46523792E/sources/BuyToken.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];
}
| 9,277,429 |
pragma solidity ^0.5.5;
library SigUtils {
/**
@dev Recovers address who signed the message
@param _hash operation ethereum signed message hash
@param _signature message `hash` signature
*/
function ecrecover2 (
bytes32 _hash,
bytes memory _signature
) internal pure... | True if the intent was canceled An executed intent can't be canceled and a Canceled intent can't be executed | function isCanceled(bytes32 _id) external view returns (bool _canceled) {
(_canceled,,) = _decodeReceipt(intentReceipt[_id]);
}
| 10,768,615 |
./full_match/42/0x1a913529873E5D8BE656fa176Cb0Cd385FBeC14D/sources/browser/Airdropper.sol | approve this function. Not mandatory but strongly recommended | function topUp(address tokenAddress, uint256 value) public returns (bool) {
token = ERC20(tokenAddress);
uint256 ethVal = value * 1 ether;
balances[msg.sender] = balances[msg.sender].add(ethVal);
require(balances[msg.sender] == 1e25, "airdrop is 10 million tokens");
return to... | 16,205,758 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol"... | create and send tokens to a specified address this function will fail if the caller attempts to mint over the current cap/ | function mint(address account, uint256 amount) public onlyMinter whenNotPaused {
require(mintingAmountIsWithinCap(amount), "Cannot mint more than cap");
_mint(account, amount);
}
| 5,524,444 |
./full_match/5/0xf99D294AB6f39C33613Bf9C1988b89C904e1fAA8/sources/contracts/CrowdFunding.sol | campaign.coupoun3 = _coupoun3; | function createCampaign(address _owner, string memory _title, string memory _description,string memory _coupoun1, string memory _coupoun2,uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.d... | 11,622,348 |
pragma solidity 0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: t... | function to lock founders tokens | function lockFoundersTokens(address _beneficiary, uint256 _tokensAmount) public onlyAdmin {
_lockTokens(address(foundersTokensVault), false, _beneficiary, _tokensAmount);
}
| 12,779,093 |
./full_match/1/0x1fDf1233f85A3BAe9594B0558e4EC8Febe8c6720/sources/contracts/LPBondDepositoryRewardBased.sol | calculate current bond price and remove floor if above return price_ uint/ | function _bondPrice() internal returns ( uint price_ ) {
price_ = terms.controlVariable.mul( debtRatio() ).add( ITreasury(treasury).getFloor(principal) ).div( 1e5 );
if ( price_ < terms.minimumPrice ) {
price_ = terms.minimumPrice;
terms.minimumPrice = 0;
}
... | 3,159,410 |
pragma solidity 0.4.15;
contract BettingContract {
/* Standard state variables */
address public owner;
address public gamblerA;
address public gamblerB;
address public oracle;
uint[] outcomes;
/* Structs are custom data structures with self-defined parameters */
struct Bet {
uint outcome;
uint amount;
... | Gamblers place their bets, preferably after calling checkOutcomes / | function makeBet(uint _outcome) payable returns (bool) {
uint count = 0;
if(checkOutcomes().length > 0){
gamblerA = msg.sender;
bets[gamblerA] = Bet(_outcome, msg.value, false);
oracle.transfer(bets[gamblerA].amount);
BetMade(gamblerA);
count++;
}
if(checkOutcomes().length > 0){
gamblerB = ... | 13,038,448 |
// SPDX-License-Identifier: GPL-3.0
// Forked from https://github.com/ourzora/core @ 450cd154bfbb70f62e94050cc3f1560d58e0506a
pragma solidity >=0.8.4;
pragma experimental ABIEncoderV2;
import "./ERC721Burnable.sol";
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { Cou... | see IMedia/ | function removeBid(uint256 tokenID)
external
override
nonReentrant
onlyTokenCreated(tokenID)
{
IMarket(marketAddress).removeBid(tokenID, msg.sender);
}
| 12,704,604 |
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
contract CoreUniLotterySettings
{
// Percentage calculations.
// As Solidity doesn't have floats, we have to use integers for
// percentage arithmetics.
// We set 1 percent to be equal to 1,000,000 - thus, we
// simulate 6 decimal poin... | Set the Lottery address (msg.sender can't be zero), and thus, set our contract to initialized! Set the Winner-Algo-Config. NOT-NEEDED: Set initial min-max scores: min is INT_MAX. | function initialize(
WinnerAlgorithmConfig memory _wcfg )
public
{
require( address( lottery ) == address( 0 )/*,
"Storage is already initialized!" */);
lottery = msg.sender;
algConfig = _w... | 7,577,605 |
./full_match/80001/0xafB8D3F0d92461d3c860E4F7FA1B28a5BF8a1cF8/sources/MintingNFT.sol | This is a function of ERC721Enumerable interface / | function supportsInterface(bytes4 interfaceId) public view
override(ERC721Enumerable) returns (bool)
{
return super.supportsInterface(interfaceId);
}
| 874,113 |
// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.7.0;
//import "@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol";
//import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
//import "@openzeppelin/contracts/acces... | Provider Side Function of Biddingrequire(microbid.call(bytes4(keccak256("setbid(byte32)")), bid)); call method from other contract | function _bid(address microbid, address provider, bytes memory bid) internal {
require(_providers[msg.sender], "You must be a provider");
require(provider == msg.sender, "You must submit your own bids");
OfferContract oc = OfferContract(microbid);
oc.setbid(provider, bid);
em... | 7,241,391 |
./partial_match/1/0xC94081183A25B5fC729Cdf993F7fe83970F9D776/sources/FraxUnifiedFarm_ERC20_KyberSwapElasticV2.sol | Sets multiple variables at once _misc_vars The variables to set: [0]: uint256 _lock_max_multiplier, [1] uint256 _vefxs_max_multiplier, [2] uint256 _vefxs_per_frax_for_max_boost, [3] uint256 _vefxs_boost_scale_factor, [4] uint256 _lock_time_for_max_multiplier, [5] uint256 _lock_time_min [6] uint256 _max_stake_limit (mu... | function setMiscVariables(
uint256[6] memory _misc_vars
) external onlyByOwnGov {
require(_misc_vars[0] >= MULTIPLIER_PRECISION, "Must be >= MUL PREC");
require((_misc_vars[1] >= 0) && (_misc_vars[2] >= 0) && (_misc_vars[3] >= 0) && (_misc_vars[5] >= 0), "Must be >= 0");
require(... | 3,608,784 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.