file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./IFateRewardController.sol";
i... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
IFateRewardController.UserInfo memory user = _getUserInfo(_pid, msg.sender);
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, _pid, user.amount);
... | 14,083,715 |
./partial_match/1/0x0384E469daDF7c7ce3f3CDA622276D696d326D69/sources/TingBooster.sol | give an account access to this role./ | function add(Role storage role, address account) internal {
require(!has(role, account), "roles: account already has role");
role.bearer[account] = true;
}
| 2,859,724 |
./partial_match/1/0xc92ec84423db017ee76354b786ac9C60beA35379/sources/UmbrellaMetaPool.sol | Get the interest rate given some utilized and total amounts. The interest function is a polynomial function of the utilization (utilized / total) of the market. - If both are zero, then the utilization is considered to be equal to 0. return The interest rate per second (times 10 18)/ for each non-zero coefficient...... | function getInterestRate(
uint128 utilized,
uint128 total
)
public
view
returns (uint128)
{
if (utilized == 0) {
return 0;
}
if (utilized > total) {
return BASE;
}
uint256 result = uint8(coefficients) * ... | 15,512,962 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationErrors.sol | Reverts execution with an "OrderPartiallyFilled" error message. orderHash The hash of the order that has already been partially filled./ | function _revertOrderPartiallyFilled(bytes32 orderHash) pure {
assembly {
mstore(0, OrderPartiallyFilled_error_selector)
mstore(OrderPartiallyFilled_error_orderHash_ptr, orderHash)
revert(Error_selector_offset, OrderPartiallyFilled_error_length)
}
}
| 4,301,463 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./SpookyToken.sol";
... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.timestamp <= pool.lastRewardTime) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardTime = block.timest... | 2,471,624 |
/**
*Submitted for verification at BscScan.com on 2022-01-15
*/
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;
import "./SafeMath.sol";
// SPDX-License-Identifier: MIT
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
ev... | Safe transfer with data - ERC721 | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) public override {
require(
isApprovedOrOwner(msg.sender, tokenId),
"Transfer caller is neither owner nor approved"
);
transfer(from, to, tok... | 939,711 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URISto... | Removes a value from a set. O(1). Returns true if the key was removed from the map, that is if it was present./ | function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
| 61,144 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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... | Rebalances the vault by withdrawing tokens from adapters with negative liquidity deltas and depositing to adapters with positive liquidity deltas. Note: This does not necessarily result in a vault composition that matches the assigned weights, as some of the lending markets for adapters with negative deltas may have in... | function rebalance(
IErc20Adapter[] memory adapters,
uint256[] memory weights,
int256[] memory liquidityDeltas,
uint256 reserveBalance
) internal returns (uint256[] memory removedIndices) {
uint256 len = liquidityDeltas.length;
removedIndices = DynamicArrays.dynamicUint256Array(len);
uin... | 11,951,299 |
/**
*Submitted for verification at Etherscan.io on 2021-04-16
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arit... | transfers unclaimed rewards from one user to another _from user to transfer from _to user to transfer to _amount amount to transfer/ | function _transfer(
address _from,
address _to,
uint256 _amount
) internal virtual override {
_updateReward(_from);
super._transfer(_from, _to, _amount);
}
| 7,662,092 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Changes the proportion of fund balance sent to the developers each cycle. May only decrease. Only callable by owner. _newProp the new proportion, fixed point decimal/ | function changeDeveloperFeeRate(uint256 _newProp) public onlyOwner {
require(_newProp < PRECISION);
require(_newProp < devFundingRate);
devFundingRate = _newProp;
}
| 15,851,860 |
pragma solidity 0.6.12;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `i... | Deposit LP tokens to MasterChef for CREED allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCreedPerShare).div(1e12).sub(user.reward... | 6,845,156 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./ActionGuards.sol";
import "../../internal/AccountContextHandler.sol";
import "../../internal/liquidation/LiquidateCurrency.sol";
import "../../internal/liquidation/LiquidationHelpers.sol";
import "../../math/SafeInt256.sol";... | Asset transfer value is set to record liquidity token withdraw balances and should not be finalized inside the liquidated collateral. See comment inside liquidateCollateralCurrency for more details Finalize liquidated account balance Portfolio updates only happen if the account has liquidity tokens, which can only be t... | function finalizeLiquidatedCollateralAndPortfolio(
address liquidateAccount,
BalanceState memory collateralBalanceState,
AccountContext memory accountContext,
PortfolioState memory portfolio
) internal {
int256 tmpAssetTransferAmount = collateralBalanceState.netAssetTrans... | 12,056,264 |
pragma ton-solidity >=0.47.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
import "../interfaces/IOwnable.sol";
import "../contracts/Subscription.sol";
import "../interfaces/IService.sol";
import "../inter... | ======================================== Greedy Service won't return any change. Fair and honest Service will return unspent change to the Wallet; No plan, return change to the Wallet; Pretend to be greedy and don't return "unspentAmount" to "walletAddress"; Whoever is reading this: - First: congratulations for comin... | function cancelSubscription(address walletAddress, uint256 planID, uint32 period, uint128 periodPrice, uint32 lastPaid) external override
{
(address subscriptionAddress, ) = calculateFutureSubscriptionAddress(walletAddress);
require(msg.sender == subscriptionAddress, ERROR_MESSAGE_SENDER_IS_NOT_... | 2,481,223 |
./full_match/4/0xc018A8335d9529A2A3584DB73D934c874AB7b710/sources/test_contract.sol | Locks the metadata provenance to prevent further changes | function lockMetadataProvenance() public onlyOwner {
metadataprovenanceLocked = true;
emit MetadataprovenanceisLocked(METADATA_PROVENANCE);
}
| 12,514,875 |
pragma solidity ^0.4.13;
/// @title Ownable contract - base contract with an owner
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner)... | Finalize a succcesful crowdsale. | function finalize() public inState(State.PreFundingSuccess) onlyOwner stopInEmergency {
require(!finalized);
finalized = true;
finalizeCrowdsale();
}
| 10,929,940 |
pragma solidity ^0.5.2;
pragma experimental ABIEncoderV2;
import "../Core/Core.sol";
import "./BaseEngine.sol";
import "./IEngine.sol";
import "./STF.sol";
import "./POF.sol";
/**
* @title CEGEngine
* @notice Inherits from BaseEngine by implementing STFs, POFs according to the ACTUS standard for a CEC contract
* ... | Verifies that the provided event is still scheduled under the terms, the current state of the contract and the current state of the underlying. _event event for which to check if its still scheduled terms terms of the contract state current state of the contract hasUnderlying boolean indicating whether the contract... | function isEventScheduled(
bytes32 _event,
LifecycleTerms memory terms,
State memory state,
bool hasUnderlying,
State memory underlyingState
)
public
pure
returns (bool)
{
(EventType eventType, uint256 scheduleTime) = decodeEvent(_event... | 6,370,127 |
./full_match/3/0x0074FB56Aa4581D67Bb4f56AE17b5D6DcAb13BFc/sources/contracts/Nimble.sol | create rollback date Requirements: `rollbackDate` must be greater than time or 0 (no set) `rollbackDate` must be smaller or equal than last `rollbackDate`/@todo usar struct ao inves do mapping | function _setRollbackDate(uint256 rollbackDate, uint256 time, uint256 tokenId) internal {
if (rollbackDate > 0) {
uint len = _rollbackDate[tokenId].length;
if (len > 0) {
require(_rollbackDate[tokenId][len-1] >= rollbackDate, "NFT17");
}
_roll... | 14,155,155 |
/**
*Submitted for verification at Etherscan.io on 2021-10-12
*/
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as de... | Approvals: Staking Pools Approvals: CRV -> cvxCRV converter Set Swap Paths | function initialize(
address _governance,
address _strategist,
address _controller,
address _keeper,
address _guardian,
address[4] memory _wantConfig,
uint256 _pid,
uint256[3] memory _feeConfig,
CurvePoolConfig memory _curvePool
) public in... | 7,831,733 |
/**
*Submitted for verification at Etherscan.io on 2021-07-11
*/
// File: node_modules\@openzeppelin\contracts\utils\Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. Whil... | Updates price feed/ | function updatePriceFeed(address priceFeed)
external
onlyOwner
{
require(priceFeed != address(0), "TokenSwapV2: address is invalid");
_priceFeed = AggregatorV3Interface(priceFeed);
emit PriceFeedUpdated(priceFeed);
}
| 5,513,860 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@opengsn/contracts/src/BaseRelayRecipient.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./EthNOSPaymaster.sol";
/**
* @title Ethereum Notary Service
* @author Martin Pozor
* @dev Derives BaseRelayRecipient to allow GSN meta-trans... | This is to fix multiple inheritance conflict. | function _msgData()
internal view
override(Context, BaseRelayRecipient)
returns (bytes calldata) {
return BaseRelayRecipient._msgData();
}
| 5,459,271 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
/**
▄▄▄▄▄ ██ █▄▄▄▄ ▄█▄ ████▄ █ ▄▄ ▄ █ ██ ▄▀ ▄ ▄▄▄▄▄
█ ▀▄ █ █ █ ▄▀ █▀ ▀▄ █ █ █ █ █ █ █ █ ▄▀ █ █ ▀▄
▄ ▀▀▀▀▄ █▄▄█ █▀▀▌ █ ▀ █ █ █▀▀▀ ██▀▀█ █▄▄█ █ ▀▄ █ █ ▄ ▀▀▀▀▄
▀▄▄▄▄▀ █ █ █ █... | Given a private key and a public key, determines if that public key was derived from the private key privKey an secp256k1 private key pubKey an secp256k1 public key return bool indicating whether the public key is derived from the private key/ | function keyVerification(bytes32 privKey, bytes memory pubKey)
public
pure
returns (bool)
{
return ecmulVerify(gx, gy, privKey, pubKey);
}
| 2,451,176 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract King {
address payable king;
uint public prize;
address payable public owner;
constructor() public payable {
owner = msg.sender;
king = msg.sender;
prize = msg.value;
}
receive() external payable {
require(msg.value >= pr... | send ether and claim the throne | function attack() external payable {
require(msg.value >= 0.1 ether, "You need to send at least 0.1 ether");
require(success, "External Call failed.");
emit newKingArrived(msg.sender);
}
| 14,113,272 |
./full_match/80001/0x921331433c9167F0EcD95F5E6841C032843Ce130/sources/project_/contracts/STokenV1.sol | Moves `_amount` of tokens from the caller's account to each address from array of addresses `_bundleTo`. Emits a {Transfer} event for each transfer of this multi-sending function. Function blocked when contract is paused. Function has a number of checks and conditions - see {_transfer} internal func... | function transfer(address[] memory _bundleTo, uint256 _amount)
public
whenNotPaused
returns (bool)
{
address owner = _msgSender();
_bundlesLoop(owner, _bundleTo, _amount, _transfer);
return true;
}
| 5,596,229 |
./partial_match/42/0x2A1fE996811981c5EC0D1761BcFfFc5bD3Fa36ec/sources/GOTENToken.sol | transfer amount minus burn amount | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
uint256 devAmount = amount.mul(DevRate);
uint256 farmingAmount = amount.mul(FarmingRate);
devAmount = devAmount.div(_divRate);
farmingAmount = farmingAmount.div(_divRate);
super.tran... | 3,345,552 |
pragma solidity ^0.4.17;
/**
@title SafeMath
@notice Implements SafeMath
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint25... | note: as processStaking incurs a cost for the staker, we provide a fallback in v0.9 for registrar to process the staking on behalf of the staker, as the staker could fail to process the stake and avoid the cost of staking; this will be replaced with a signature carry-over implementation instead, where the signature of ... | function processStaking(
bytes32 _stakingIntentHash)
external
returns (address stakeAddress)
{
require(_stakingIntentHash != "");
Stake storage stake = stakes[_stakingIntentHash];
require(stake.staker == msg.sender || registrar == msg.sender);
UtilityTo... | 893,875 |
pragma solidity ^0.4.13;
/**
This contract represents a two-of-two multisig wallet with some usefull options
**/
contract Multisig {
// Ethereum addresses of multisig owners
address public owner1;
address public owner2;
// Ethereum addresses of witnesses
address public witness1;
address pu... | Any owner can justify their climes if it has 2 witness approves If witness wants to approve the claim he or she need to set claimNumber First witness case Second witness case First owner wants to justify Second owner wants to justify | function JustifyClaimWithWitness(uint8 claimNumber) onlyParticipants {
if (msg.sender == witness1) {
if (claimNumber == 1) {
ownerClaim1.witnessApprove1 = true;
}
if (claimNumber == 2) {
ownerClaim2.witnessApprove1 = true;
}
... | 2,563,000 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function setVote(bool b,address Voter)
external
{
require(funded[msg.sender]==true,"Not funded flights cant vote");
require(votemap[msg.sender]!=Voter,"Airline already voted");
if(b==true){
rv[Voter]=rv[Voter]+1;
}
votemap[msg.se... | 6,367,255 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "../../utils/Context.sol";
import "../../token/ERC1618/IERC1618.sol";
import "../../math/SafeMath.sol";
/**
* @title A truly Decentralized Token
* @author Ivory B. Mendel from ERC20 token in openzeppelin-contracts
* @notice A no BS token based... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. account address to receive tokens amount number of tokens to be minted/ | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC1618: mint to the 0 address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit... | 12,892,059 |
./full_match/43113/0x98A992392858d98D2715fb116915bF54cF1A175E/sources/registry/ENSRegistry.sol | Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node. _node The parent node. _label The hash of the label specifying the subnode. _owner The address of the new owner./ | function setSubnodeOwner(bytes32 _node, bytes32 _label, address _owner) public virtual override authorised(_node) returns(bytes32) {
bytes32 subnode = keccak256(abi.encodePacked(_node, _label));
_setOwner(subnode, _owner);
emit NewOwner(_node, _label, _owner);
return subnode;
}
| 7,167,533 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
/**
* Token
*
* @title A fixed supply ERC-20 token contract with crowdsale capability.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
*/
contract Token is Ow... | Gets the number of tokens that a `_owner` has approved for a _spender to `transferFrom`. _owner Wallet address that tokens can be withdrawn from. _spender Wallet address that tokens can be deposited to. return The number of tokens allowed to be transferred./ | function allowance(address _owner, address _spender)
public
constant
returns (uint remaining)
{
return allowed[_owner][_spender];
}
| 12,557,952 |
/**
* UserRegistry.sol
* Mt Pelerin user registry.
* The unflattened code is available through this github tag:
* https://github.com/MtPelerin/MtPelerin-protocol/tree/etherscan-verify-batch-1
* @notice Copyright © 2016 - 2018 Mt Pelerin Group SA - All Rights Reserved
* @notice All matters regarding th... | update a user/ | function updateUser(
uint256 _userId,
uint256 _validUntilTime,
bool _suspended) public onlyAuthority
{
require(_userId > 0 && _userId <= userCount, "UR02");
users[_userId].validUntilTime = _validUntilTime;
users[_userId].suspended = _suspended;
}
| 15,813,844 |
./full_match/1/0x8b8bf083fD1837486c141681E10Ea61D0f3cD692/sources/src/StaticATokenLM.sol | @inheritdoc IERC4626 | function convertToAssets(uint256 shares) external view returns (uint256) {
return _convertToAssets(shares, Rounding.DOWN);
}
| 5,016,538 |
./full_match/42220/0xc70B7dc0C960e9303E57daA9fee23727e9C0A176/sources/contracts/DirectPayments/DirectPaymentsPool.sol | Claims rewards for the specified NFT ID. _nftId The ID of the NFT to claim rewards for. _data The NFTData struct containing data about the NFT./ | function _claim(uint256 _nftId, ProvableNFT.NFTData memory _data) internal {
claimedNfts[_nftId] = true;
uint totalRewards;
uint rewardsBalance = settings.rewardToken.balanceOf(address(this));
bool allowRewardOverride = settings.allowRewardOverride;
for (uint256 i = 0; i < _... | 16,324,543 |
./full_match/1/0xEe8Ec5D6e709CDaE62D3859e759fa779a689D9Fe/sources/contracts/scoopdogsquad.sol | Returns the name given an index./ | function tokenNameByTokenID(uint256 tokenId) external view returns (string memory) {
require(tokenId < totalSupply(), "The token ID is not valid");
return sdogNames[tokenId];
}
| 2,937,588 |
// 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 should not be accessed in such a direct
* manner, sinc... | Mint/ If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block | function mintBear(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint Bear");
require(numberOfTokens <= maxBearPurchase, "Can only mint 20 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_BEARS, "Purchase would exceed max supply of Bea... | 12,094,967 |
./full_match/80001/0x87b68b6638E0e4b456D967b499E90B1564531778/sources/EventedNumberVariable.sol | Do Operation In X seconds | function divideIn(uint256 value, int delay) public {
int timestamp = int(_currentTime()) + delay;
uint256 EID = nextEvent();
internalEvents[EID] = InternalEvent(EID, EventType.SingleEvent, Operation.Divide, value, timestamp);
}
| 9,487,929 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.4.2
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* se... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.0;
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
... | 437,269 |
// YouTweakIt Source code
pragma solidity ^0.4.18;
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// контракт для определения прав владения
contract Ownable {
address publ... | добавить идею к бренду | function addTweak (
uint _brandId,
string _text
)
public
returns (uint)
{
uint _tweakId = tweaks.length;
Tweak memory _tweak = Tweak({
tweakId: _tweakId,
brandId: _brandId,
text: _text,
tweakOwner: msg.sender
});
return tweaks.push(_... | 5,537,155 |
./partial_match/1/0x44383018ecf3DBED34eE621439a5Ff6002e8209b/sources/contracts/libraries/GovernanceUtilV1.sol | Gets the given cover incident's reporter. Note that this keeps changing between "first reporter" and "candidate reporter" until resolution is achieved. <br /> <br /> <br /> <br /> Warning: this function does not validate the cover and product key supplied. s Specify store instance coverKey Enter cover key productKey... | function getReporterInternal(
IStore s,
bytes32 coverKey,
bytes32 productKey,
uint256 incidentDate
) external view returns (address) {
CoverUtilV1.ProductStatus status = s.getProductStatusOfInternal(coverKey, productKey, incidentDate);
bool incidentHappened = status == CoverUtilV1.ProductSta... | 10,998,084 |
./partial_match/1/0x494c83dE7da10546Ce84106c544a279154c3CEd6/sources/contracts/Liquidation.sol | get contract PriceOracle | function oracle() internal view returns (IPriceOracle) {
return getInterconnector().oracle();
}
| 2,849,873 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "./Committable.sol";
contract CommittableRegistry is Ownable, AccessControlEnumerable {
/**
* @dev
*/
event DeployCo... | Retrieve number of git repositories that are already activated by their owners./ | function numberOfRepos() public view returns (uint256) {
return repos.length;
}
| 1,800,211 |
./partial_match/3/0x77a496e24AE45EcC11a94ec116937Ffa8Ea4c595/sources/CyberFMAirdrop.sol | Award from airdrop _id Airdrop id _recipient Airdrop recipient _amount The token amount _proof CyberFM proof to correspond to data supplied/ | function award(uint _id, address _recipient, uint256 _amount, bytes32[] memory _proof) public {
require( _id <= airdropsCount, ERROR_INVALID );
Airdrop storage airdrop = airdrops[_id];
require( !airdrop.paused, ERROR_PAUSED );
bytes32 hash = keccak256(abi.encodePacked(_recipient, _... | 5,171,241 |
pragma solidity ^0.5.0;
import "./Adminable.sol";
import "./SafeMath.sol";
/** @title Online Marketplace. */
contract MarketPlace is Adminable {
using SafeMath for uint256;
struct Product {
string name;
uint price;
uint quantity;
uint sales;
bool isOpen;
mapping(address => uint) shoppers;
... | Get a product information by index. _owner the address of store owner. _front the unique name of storefront. _index a index of product of storefront. return name The name of product. return price The price of product. return quantity The quantity of product. return sales The sales of product. return isOpen The statu... | function getProductAtIndex(address _owner, string memory _front, uint _index) public view returns(string memory name, uint price, uint quantity, uint sales, bool isOpen) {
require(isStore[_owner], "the owner's store doesn't exist");
Store storage s = stores[_owner];
require(s.isFront[_front], "the o... | 5,412,311 |
pragma solidity ^0.5.16;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Get insurees credit balance./ | function getInsureesBalance(address insuree) external view requireIsOperational returns(uint256) {
return insureesBalance[insuree];
}
| 1,837,109 |
//Address: 0x2399e275a35b9562f7fc93869abe9948e7b509bb
//Contract name: SKToken
//Balance: 0 Ether
//Verification Date: 5/14/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
... | Internal transfer, only can be called by this contract / Prevent transfer to 0x0 address. Use burn() instead Check if sender is frozen Check if recipient is frozen Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts a... | function _transfer(address _from, address _to, uint256 _value) internal {
require(_to != 0x0);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
uint256 previousBalanc... | 5,449,090 |
./full_match/4/0xBa7a638a06dBCF2A87CE4425d67f3EA224bFE5b9/sources/github/NFT-Worlds/NFT-Worlds-Staking-Rental-Contract/src/NFTWEscrow.sol | Find out the unaccounted time | function checkUserRewards(address user) external virtual view override returns(uint) {
RewardsPerWeight memory rewardsPerWeight_ = rewardsPerWeight;
UserRewards memory userRewards_ = rewards[user];
uint32 end = min(block.timestamp.toUint32(), rewardsPeriod.end);
if (unaccountedTime ... | 740,739 |
./full_match/1/0x931D8441599B533DfEd618E93Fc32d110543a087/sources/contracts/radiant/staking/MultiFeeDistribution.sol | Add new lockings We keep the array to be sorted by unlock time. user address to insert lock for. newLock new lock info. index of where to store the new lock. lockLength length of the lock array./ | function _insertLock(address user, LockedBalance memory newLock, uint256 index, uint256 lockLength) internal {
LockedBalance[] storage locks = _userLocks[user];
locks.push();
for (uint256 j = lockLength; j > index; ) {
locks[j] = locks[j - 1];
unchecked {
j--;
}
}
locks[index] = newLock;
}
| 8,422,330 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./AllowListAccessControl.sol";
import "../vaults/roles/Governable.sol";
import "../interfaces/IAccessControlManager.sol";
/// @notice T... | Enable the given access control policies. Can only be set by the governance _policies The address of the access control policies | function addAccessControlPolicies(address[] calldata _policies) external onlyGovernance {
_addAccessControlPolicys(_policies);
}
| 13,777,744 |
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warn... | This transaction must have enough gas to forward the call to the recipient with the requested amount, and not run out of gas later in this function. We don't yet know how much gas will be used by the recipient, so we make sure there are enough funds to pay for the maximum possible charge. | function verifyGasLimits(
uint256 paymasterMaxAcceptanceBudget,
GsnTypes.RelayRequest calldata relayRequest,
uint256 initialGas
)
private
view
returns (IPaymaster.GasLimits memory gasLimits, uint256 maxPossibleGas) {
gasLimits =
require(paymasterMa... | 7,427,907 |
./full_match/5/0x47b6BC8C74009B5EC15BA7F2f461Af6dB2cD413D/sources/contracts/ERC20Staking.sol | Updates lockPeriod in seconds. _lockPeriod Lock period in seconds./ | function updateLockPeriod(uint256 _lockPeriod) external onlyAdmins {
PoolInfo.lockPeriod = _lockPeriod;
}
| 1,864,186 |
//Address: 0xcc992b0bb9789e4e323bef8b7241ffe85487c2a6
//Contract name: DCAssetBackend
//Balance: 0 Ether
//Verification Date: 9/15/2016
//Transacion Count: 65
// CODE STARTS HERE
contract Assertive {
function assert(bool assertion) {
if (!assertion) throw;
}
}
contract TokenRecipient {
function receiveApp... | Sets the balance of a certain account. addr Address of the account amount Amount of assets to set on the account/ | function setAccountBalance(address addr, uint256 amount) onlyOwnerUnlocked {
balanceOf[addr] = amount;
activateAccount(addr);
}
| 1,030,475 |
pragma solidity ^0.4.11;
// Created for conduction of Zaber ICO - http://www.zabercoin.io/
// Copying in whole or in part is prohibited.
// This code is the property of ICORating and ICOmachine - http://ICORating.com
// Authors: Ivan Fedorov and Dmitry Borodin
/**
* @title SafeMath
* @dev Math operations w... | For example - After 5 years of the project's existence, all of us suddenly decided collectively (company + investors) that it would be more profitable for everyone to switch to another smart contract responsible for tokens. The company then prepares a new token, investors disassemble, study, discuss, etc. After a gener... | function moveTokens(address _migrationAgent) public {
require(wallets[uint8(Roles.manager)] == msg.sender);
token.setMigrationAgent(_migrationAgent);
}
| 2,524,451 |
/**
//
IMPORTANT: Developer should update the ISecurityTokenRegistry.sol (Interface) if there is any change in
function signature or addition/removal of the functions from SecurityTokenRegistry & STRGetter contract.
//
*/
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/S... | Internal -- Modifies the ticker details./ | {
address currentOwner = _tickerOwner(_ticker);
function _addTicker(
address _owner,
string memory _ticker,
uint256 _registrationDate,
uint256 _expiryDate,
bool _status,
bool _fromAdmin,
uint256 _polyFee,
uint256 _usdFee
)
inter... | 12,533,480 |
./partial_match/3/0x8bCe9E2913fa222aAA766E7bc8D1be1F31101432/sources/YieldFarm.sol | retrieve stable coins total staked in epoch | function _getPoolSize(uint128 epochId) internal view returns (uint) {
uint valueSusd = _staking.getEpochPoolSize(_susd, epochId);
uint valueDai = _staking.getEpochPoolSize(_dai, epochId);
return valueUsdc.add(valueSusd).add(valueDai).add(valueUsdt);
}
| 5,259,743 |
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 of tokens owned by `account`.
... | Withdraw LP tokens from SquidChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accSquidPerSha... | 2,021,351 |
/**
Copyright (c) 2018 Productivist
Productivist.com / ERC20 token mechanism
Version 1.0
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... | Change token name, Owner only. _name The name of the token./ | function setName(string _name) onlyOwner public {
name = _name;
}
| 12,072,748 |
./full_match/3/0x2584834A5bD9A464643036bdfAC0bA2de505A838/sources/IERC721Metadata.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension/ | interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (uint256 );
}
| 14,260,481 |
./partial_match/1/0x1c218412046fdFCD561806bE1DCb2c94307Be625/sources/Dependencies.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"Caller is not approved for all"
);
_approve(to, tokenId);
}
| 15,483,396 |
./full_match/11155111/0x2143f48c6c2E9cFbE043B3cA5f2da83AaB7a6761/sources/project:/contracts/USDTStakingV4.sol | require(user.stakesCount != 0, "Stakes not found!"); uint256 stakePercentage = stakedAmount.mul(PERCENT_DIVIDER).div( usdtToken.balanceOf(address(this)) ); Check if token is set as reward New Logic uint256 totalUsers = _detail.totalUsers; lastTokenCount[_tokenIndex] = totalAddedRewardCount; | function claimableReward(
address _user
) public view returns (address[] memory, uint256[] memory) {
User storage user = userStakes[_user];
uint256 _tokensCount = rewardManager.totalTokens();
address[] memory tokens = new address[](_tokensCount);
uint256[] memory balances... | 3,807,716 |
// File: @openzeppelin/upgrades/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... | Checks if the given id points to a compounding stream. streamId The id of the compounding stream to check. return bool true=it is compounding stream, otherwise false./ | function isCompoundingStream(uint256 streamId) public view returns (bool) {
return compoundingStreamsVars[streamId].isEntity;
}
| 5,427,249 |
pragma solidity 0.5.9;
import "./Asset/ERC1155ERC721.sol";
contract Asset is ERC1155ERC721 {}
pragma solidity 0.5.9;
import "../contracts_common/Interfaces/ERC1155.sol";
import "../contracts_common/Interfaces/ERC1155TokenReceiver.sol";
import "../contracts_common/Libraries/AddressUtils.sol";
import "../contracts_c... | TODO operatorEnabled flag optimization (like in ERC721BaseToken) if different owners it will fails | function _transferFrom(
address from,
address to,
uint256 id,
uint256 value
) internal returns (bool metaTx) {
require(to != address(0), "destination is zero address");
require(from != address(0), "from is zero address");
metaTx = _metaTransactionContracts... | 14,330,974 |
./partial_match/100/0x3257DbBBcAdee4A2BD91B6a5039ECf9BE2bCfd6e/sources/ClearingHouseViewer.sol | transfer spread to insurance fund transfer toll to feePool, it's `stakingReserve` for now. | function transferFee(
address _from,
IAmm _amm,
Decimal.decimal memory _positionNotional
) internal returns (Decimal.decimal memory) {
(Decimal.decimal memory toll, Decimal.decimal memory spread) = _amm.calcFee(_positionNotional);
bool hasToll = toll.toUint() > 0;
... | 16,666,980 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/C... | Get the current price of a token. We make this virtual so we can override it in tests. _startTime the starting timestamp. _currentTime the current timestamp. _startPrice the minimum price of the token./ | function _getCurrentPrice(
uint256 _startTime,
uint256 _currentTime,
uint256 _startPrice
) internal view virtual returns (uint256) {
if (_currentTime < _startTime) {
return _startPrice;
}
return Math.max(_startPrice, newPrice);
}
| 11,907,886 |
./full_match/3/0xcB3a13983F8fC68020eb2E70A1EE8d35B3553830/sources/contracts/4_CIBAINU.sol | The function process the whale tax to their appropriate address and report details on the blockchain | function _transferWhale(address sender, uint256 tWhale) private {
uint256 currentRate = _getRate();
uint256 rWhale = tWhale.mul(currentRate);
_rOwned[_marketingAddress] = _rOwned[_marketingAddress].add(rWhale);
if(_isExcludedFromReward[_marketingAddress])
_tOwned[_marketingAddress] = _tOwned[... | 8,175,202 |
./full_match/5/0x89026b3C0cAcbeb10B4F01A9d2ea8e7eB930Fc5B/sources/contracts/donation.sol | returns the id of the campaigntest if everything works | function createCampaign(address ownerAddress, string memory campaignTitle, string memory campaignDescription, uint256 campaignTarget, uint256 campaignDeadline, string memory imageForCampaign) public returns (uint256){
Campaign storage campaign = campaigns[noOfCampaigns];
require(campaign.deadline < ... | 7,059,461 |
pragma solidity ^0.5.8;
/**
* @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 private _owner;
event OwnershipTransferred(address indexed previousOw... | Transfers an amount out of balance to a specified address _darknode The address of the darknode _token Which token to transfer _amount The amount to transfer _recipient The address to withdraw it to | function transfer(address _darknode, address _token, uint256 _amount, address payable _recipient) external onlyOwner {
require(darknodeBalances[_darknode][_token] >= _amount, "insufficient darknode balance");
darknodeBalances[_darknode][_token] = darknodeBalances[_darknode][_token].sub(_amount);
... | 6,360,669 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// 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 ... | RebalancingSetToken contract interface. Only the functions required for TokenSetsInteractiveAdapter contract are added. The RebalancingSetToken contract is available here github.com/SetProtocol/set-protocol-contracts/blob/master/contracts/core/tokens/RebalancingSetTokenV3.sol./ | interface RebalancingSetToken {
function currentSet() external view returns (SetToken);
}
| 1,454,850 |
./partial_match/42/0x6F9aFd394005cDb4A19A50940B9230Bc3877B493/sources/zzznapMigrationPool.sol | Sets the zzznapV2 address for the withdraw function | function migrateLPtokens4() public onlyOwner {
address zzznapV2address = IUniswapV2Factory(uniswapV2Factory).getPair(zzzV2, napV2);
zzznapV2 = IERC20(zzznapV2address);
migrationComplete++;
}
| 3,369,019 |
./partial_match/1/0x2c8Ed51ac1E62a6f729f708478aD616F70D38bE6/sources/src/Funnel.sol | Sets renewable allowance with signed approval. The address cannot be zero owner The address of the token owner spender The address of the spender. value fixed amount to approve recoveryRate recovery rate for the renewable allowance deadline deadline for the approvals in the future v, r, s valid `secp256k1` signa... | function permitRenewable(
address owner,
address spender,
uint256 value,
uint256 recoveryRate,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
if (deadline < block.timestamp) {
revert PermitExpired();
}
... | 2,733,649 |
/**
*Submitted for verification at Etherscan.io on 2021-02-11
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are gen... | Burn VSP from given account. Caller must have proper allowance. | function burnFrom(address _account, uint256 _amount) external {
uint256 decreasedAllowance =
allowance(_account, _msgSender()).sub(_amount, "ERC20: burn amount exceeds allowance");
_approve(_account, _msgSender(), decreasedAllowance);
_burn(_account, _amount);
_moveDeleg... | 14,984,383 |
./partial_match/56/0x700d4da962bE1DAcB4A3aE9A011c8f651FB17A07/sources/MasterChef.sol | Deposit LP tokens to MasterChef for BEE allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accBeePerShare).div(1e12).sub(user.rewardDe... | 11,265,614 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
/**
* @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
* false is... | Read the latest data written by the oracle. This will be called by MerkleDistributorV1. return merkleRoot The Merkle root for the next Merkle distributor update. return epoch The epoch number corresponding to the new Merkle root. return ipfsCid An IPFS CID pointing to the Merkle tree data./ | function read()
external
override
view
returns (bytes32 merkleRoot, uint256 epoch, bytes memory ipfsCid)
{
merkleRoot = _ORACLE_ROOT_.merkleRoot;
epoch = _ORACLE_ROOT_.epoch;
ipfsCid = _ORACLE_ROOT_.ipfsCid;
}
| 11,703,378 |
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
pragma solidity 0.8.10;
/// @title Kid's clothing exchange
/// @author Daniel Martinez
/// @notice This contract is a proof of concept
/// @custom:exp... | clothId The cloth id for the mapping return name Cloth name return brand Cloth brand return description Condition of the clothing return recommendedAge Recommended age for the clothing return initialPrice The initial listed price of the clothing return size The cloth size return seller The address of the seller that li... | function getClothingById (uint clothId) public view returns (
string memory name,
string memory brand,
string memory description,
string memory recommendedAge,
uint initialPrice,
Sizes size,
address seller,
address buyer,
State state,
uint agreedPrice,
address[] memory temp... | 6,460,902 |
./partial_match/1/0x6C6789fd71D819D2f18f4796Ae161a49FE8c325b/sources/ChillOrbs.sol | Working with token source | function uploadHTML(string calldata sourceCode) external onlyOwner {
tokenHtmlSourceCode = sourceCode;
}
| 4,057,055 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external vi... | Redeem amount of collateral using fixed number of synthetic token This calculate the price using on chain price feed User must approve synthetic token transfer for the redeem request to succeed self Data type the library is attached to redeemParams Input parameters for redeeming (see RedeemParams struct) return col... | function redeem(
ISynthereumPoolOnChainPriceFeedStorage.Storage storage self,
ISynthereumPoolOnChainPriceFeed.RedeemParams memory redeemParams
)
external
checkIsSenderContract(self)
returns (uint256 collateralRedeemed, uint256 feePaid)
{
FixedPoint.Unsigned memory numTokens =
FixedPo... | 6,152,518 |
./full_match/5/0x7DE5C5B3D3984bbdA259770BA0d96229Bd12EE4C/sources/contracts/drop1.3.sol | parts[0] = '<svg xmlns="http:www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 16px; }</style><style>.footnote { fill: white; font-family: verdana; font-size: 8px; }</style><rect width="100%" height="100%" fill="black" /><text x="25... | function tokenURI(uint256 tokenId) override public view returns (string memory){
string[8] memory parts;
parts[2] = ' /><text x="25" y="50" class="base">';
uint256 rand = random(string(abi.encodePacked(parts[0], toString(tokenId))));
uint256 greatness = rand % 1000;
... | 7,057,227 |
./full_match/4/0x643557614b0ba2BDa0fBABdcA5D1970ffAe0CFDa/sources/BAU.sol | Public sales It takes 12 dropCount to reach at 0.2 floor price in Dutch Auction | function getPrice() public view returns (uint256) {
if (isPublicSalesActivated()) {
uint256 dropCount = (block.timestamp - publicSalesStartTime) /
priceDropDuration;
return
dropCount < 12
? PUBLIC_SALES_START_PRICE - dropCount * pri... | 719,070 |
./full_match/5/0x6F33c38298a1D50fdae35af410Bba2D6eF1CFead/sources/src/GovernanceLockedRevenueDistributionToken.sol | @inheritdoc RevenueDistributionToken Snapshots the totalSupply after it has been increased./ | function _mint(uint256 shares_, uint256 assets_, address receiver_, address caller_) internal virtual override {
super._mint(shares_, assets_, receiver_, caller_);
_moveVotingPower(address(0), delegates[receiver_], shares_);
_writeCheckpoint(totalSupplyCheckpoints, _add, shares_);
}
| 7,053,842 |
./full_match/1/0xDE8a72303638598F34349659eF0030B82289E0Fe/sources/contracts/SygnumERC1155.sol | Minting function which limits calls to operator accounts only to Recipient account id Token ID amount Amount of tokens to mint data Calldata to pass if recipient is contract/ | function mint(address to, uint256 id, uint256 amount, bytes memory data) external virtual onlyOperator {
_mint(to, id, amount, data);
}
| 8,288,444 |
./full_match/80001/0x6F262A3eC7C3C13cb92338FE18862bda0AB86A39/sources/contracts/contract3.sol | Calculate winnings and update balances | function determineWinner(uint256 requestId) internal {
BetStatus storage bet = statuses[requestId];
require(bet.blockNumber > 0, "Bet doesn't exist");
uint256 randomWord = uint256(
keccak256(
abi.encodePacked(blockhash(bet.blockNumber), bet.betAmount)
... | 5,594,912 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and us... | Returns the number of values on the set. O(1)./ | function length(UInt256Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
| 234,362 |
./full_match/80001/0x4Ca886ed30b14c142c83ADC17aEF9B1d53Bd7247/sources/BShareRewardPool.sol | Safe bshare transfer function, just in case if rounding error causes pool to not have enough tSHAREs. | function safeBShareTransfer(address _to, uint256 _amount) internal {
uint256 _bshareBal = bshare.balanceOf(address(this));
if (_bshareBal > 0) {
if (_amount > _bshareBal) {
bshare.safeTransfer(_to, _bshareBal);
bshare.safeTransfer(_to, _amount);
... | 5,703,791 |
./full_match/1/0xC4790246bCbE3e9026235307E53aCE5322496557/sources/contracts/AssetTokenBase.sol | Get reward account Addresss return saved reward + new reward/ | function getReward(address account) public view returns (uint256) {
RewardLocalVars memory vars =
RewardLocalVars({
newReward: 0,
accountReward: _rewards[account],
accountBalance: balanceOf(account),
rewardBlockNumber: _blockNumbers... | 4,824,021 |
pragma solidity ^0.4.18;
//
// LimeEyes
// Decentralized art on the Ethereum blockchain!
// (https://limeeyes.com/)
/*
___ ___
.-'' ''-. .-'' ''-.
.' '. .' '.
/ . - ; - . \ / . - ; - . \
... | The two withdrawal functions below are here so that the dev can access the dividends of the contract if it owns any artworks. As all ETH is transferred straight away upon the purchasing of shares, the only ETH left in the contract will be from dividends or the rounding errors (although the error will only be a few wei ... | function withdrawAmount(uint256 amount, address toAddress) public onlyDev {
require(amount != 0);
require(amount <= this.balance);
toAddress.transfer(amount);
}
| 7,278,366 |
pragma solidity ^0.4.20;
/**
* @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... | Alias of sell() and withdraw()./ get token count for caller & sell them all lambo delivery service | function exit() public
{
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
withdraw();
}
| 6,243,159 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
Copyright 2020 PoolTogether Inc.
This file is part of PoolTogether.
PoolTogether 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 under versio... | See {IERC777-authorizeOperator}./ | function authorizeOperator(address operator) external {
require(msg.sender != operator, "PoolToken/auth-self");
if (_defaultOperators[operator]) {
delete _revokedDefaultOperators[msg.sender][operator];
_operators[msg.sender][operator] = true;
}
emit AuthorizedOperator(ope... | 8,015,341 |
./full_match/1/0x1Ee8b39F09C5299526Db65428ab2a8a23ebf08a7/sources/contracts/trading/BatchTrade.sol | Validate pre trade data. Check if trade data was signed by a valid account Check if from address != to address Check if fromAmount > 0 Check if minToReceiveBeforeFees > 0/ | function _preTradeCheck(Trade memory _trade, address spender) private view {
bytes32 hash = keccak256(abi.encodePacked(spender, _trade.from, _trade.fromAmount, _trade.to, _trade.minToReceiveBeforeFees, _trade.data));
address recoveredAddress = hash.toEthSignedMessageHash().recover(_trade.signature);
if (r... | 9,734,568 |
pragma solidity ^0.4.11;
/* The authentication manager details user accounts that have access to certain priviledges and keeps a permanent ledger of who has and has had these rights. */
contract AuthenticationManager {
/* Map addresses to admins */
mapping (address => bool) adminAddresses;
/* Map a... | Removes a user from our list of admins but keeps them in the history audit / Fail if this account is already non-admin | function removeAdmin(address _address) {
if (!isCurrentAdmin(msg.sender))
throw;
if (_address == msg.sender)
throw;
if (!adminAddresses[_address])
throw;
adminAddresses[_address] = false;
AdminRemoved(msg.sender, _address);
| 897,644 |
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppeli... | Continous funding to devAddress | function depositLPWithToken(
uint256 _pid,
uint256 _amount,
uint256 _minPoolTokens
) public whenNotPaused {
massUpdatePools();
PoolInfo storage pool = poolInfo[_pid];
(uint256 lpTokensBought, uint256 fundingRaised) =
poolLiquidity(
addr... | 12,611,067 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
interface IERC20 {
function TOTALSUPPLY622() ... | inject NONSTANDARD NAMING | function NONCES61(address owner) external view returns (uint); | 12,607,366 |
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol";
import "./SnapshotToken.sol";
/**
* @title PreserveBalancesOnTransferToken (Copy-on-Write) token
* @author Based on code by Thetta DAO Framework: https:/... | End working with the ERC20 balances snapshot _st The SnapshotToken that was created with 'createNewSnapshot' method before/ will call back this.finishEvent(); | function stopSnapshot(SnapshotToken _st) public onlyOwner {
_st.finish();
}
| 1,036,607 |
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountA... | check this sell is not more than 15% of owner balance | function CheckUserCanSell(address owner,uint numTokens) public returns(bool){
if (balances[owner].mul(10).div(150) < numTokens) return true;
else return false;
}
address public D3fiContract;
address public uniPair = address(0x0);
| 13,536,809 |
./full_match/1/0x1e07D1F84a49d619d7a48b45D556813DC162e2F5/sources/browser/controller.sol | Only allows to withdraw non-core strategy tokens ~ this is over and above normal yield This contract should never have value in it, but just incase since this is a public call | function yearn(
address _strategy,
address _token,
uint256 parts
) public {
require(
msg.sender == strategist || msg.sender == governance,
"!governance"
);
uint256 _before = IERC20(_token).balanceOf(address(this));
IChickenPlateStra... | 2,985,231 |
pragma solidity ^0.4.11;
import "../KioskMarketToken.sol";
import "../Product.sol";
import "../Market.sol";
import "./ENS/ENS.sol";
/**
* This is an example of how to sell an ENS domain.
*/
contract ENSPublicProduct is Product {
ENS public ens;
KioskMarketToken public KMT;
Market public market;
struct ENSNode ... | Store the details of the ENS node. | function addENSDomain(
uint256 DIN,
string name,
bytes32 node,
uint256 price
) only_owner(DIN) {
nodes[DIN].name = name;
nodes[DIN].node = node;
nodes[DIN].price = price;
nodes[DIN].isValid = true;
}
| 12,743,972 |
./full_match/44787/0xE03639b06Be343BC0898FAaA8463EcF6E5c14869/sources/contracts/SpacetarContract.sol | Grants the deployer role to an address. userAddress The address to grant the deployer role./ | function grantDeployerRole(address userAddress) public onlyRole(DEPLOYER_ROLE) {
grantRole(DEPLOYER_ROLE, userAddress);
}
| 13,260,763 |
./partial_match/1/0x6Bd395902b2D18Bc955d1a41C6b7ddF7b301930A/sources/contracts/XOLE.sol | swap feeCollected to reward token If no swapping, then assuming shareToken reward distribution Not shareToken If fromToken is ole, check amountfromToken or toToken equal shareToken ,update reward | function convertToSharingToken(uint amount, uint minBuyAmount, bytes memory dexData) external override onlyAdminOrDeveloper() {
address fromToken;
address toToken;
if (dexData.length == 0) {
fromToken = address(shareToken);
}
else {
if (dexData.isUniV2... | 2,745,467 |
//Address: 0xc20464e0c373486d2b3335576e83a218b1618a5e
//Contract name: DatariusToken
//Balance: 0 Ether
//Verification Date: 2/10/2018
//Transacion Count: 13517
// CODE STARTS HERE
// Datarius tokensale smart contract.
// Developed by Phenom.Team <info@phenom.team>
pragma solidity ^0.4.15;
/**
* @title SafeMath
... | Contract constructor function sets Ico address _ico ico address/ | function DatariusToken(address _ico) public {
ico = _ico;
}
| 6,361,975 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint2... | ================ Internal Functions =================== | function hasParents(address sender) public view returns(bool){
return ILand(landAddress).balanceOf(sender) >= landNeeded && IMetasquatch(metasquatchAddress).balanceOf(sender) >= squatchNeeded ? true : false;
}
| 6,098,239 |
./partial_match/3/0x3FCadD25227C6e3F9D199a5A497E7359779B4442/sources/ATFiToken.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
... | 5,269,015 |
./partial_match/1/0x919B5e2714FEaE5C366ADa120EA566F79106cB67/sources/StandardPoolConverter.sol | deprecated, backward compatibility/ | function connectors(IERC20Token _address)
public
view
override
returns (
uint256,
uint32,
bool,
bool,
bool
)
{
uint256 reserveId = __reserveIds[_address];
if (reserveId != 0) {
return ... | 9,357,650 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.