file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.25;
contract ERC721 {
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
// ownerof
// deploy: public ->externa... | @Dev league ๋ฐ grandprix ๊ตฌ์กฐ์ฒด ์ด๊ธฐํ | function _leagueGrandprixInit() internal{
DerbyPersonalResult memory _league = DerbyPersonalResult({
first : 0,
second : 0,
third : 0,
lucky : 0
});
DerbyPersonalResult memory _grandPrix = DerbyPersonalResult({
first :... | 6,425,172 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Mints part of the repaid interest to the reserve treasury as a function of the reserveFactor for the specific asset. reserve The reserve reserve to be updated scaledVariableDebt The current scaled total variable debt previousVariableBorrowIndex The variable borrow index before the last accumulation of the interest ... | function _mintToTreasury(
DataTypes.ReserveData storage reserve,
uint256 scaledVariableDebt,
uint256 previousVariableBorrowIndex,
uint256 newLiquidityIndex,
uint256 newVariableBorrowIndex,
uint40 timestamp
) internal {
MintToTreasuryLocalVars memory vars;
vars.reserveFactor = reserv... | 68,362 |
// File: contracts/libraries/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function ADD545(uint x,... | inject NONSTANDARD NAMING | function TOKEN0432() external view returns (address); | 7,324,422 |
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//import "hardhat/console.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole`... | Redeems an NFTVoucher for an actual NFT, creating it in the process. redeemer The address of the account which will receive the NFT upon success. voucher A signed NFTVoucher that describes the NFT to be redeemed. make sure signature is valid and get the address of the signer make sure that the signer is authorized to... | function redeem(address redeemer, NFTVoucher calldata voucher,address creator,address admin,uint256 amount,uint256 adminpersent) public payable returns (uint256) {
address signer = _verify(voucher);
_mint(signer, voucher.tokenId);
_setTokenURI(voucher.tokenId, voucher.uri);
_transfer(sign... | 2,049,428 |
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
function balanceOf(address _owner) external returns (uint256);
function transfer(address _to, uint256 _amount) external;
function transferFrom(address _from, address... | Native token ERC20 token | function withdraw(address _token, uint256 _amount) external onlyOperator1 returns (bool) {
if(_token == address(0)) {
require(address(this).balance >= _amount, 'insufficient balance');
treasury[_token].transfer(_amount);
IERC20 token = IERC20(_token);
require(... | 10,498,932 |
./full_match/62320/0x47388847a874472b5615EEBcee416c8Fb4FC12a4/sources/contracts/Broker.sol | Transfer a specified Mento asset to the given address. If the specified asset is a stable asset it will be minted directly to the address. If the asset is a collateral asset it will be transferred from the reserve to the given address. to The address receiving the asset. token The asset to transfer. amount The amoun... | function transferOut(
address payable to,
address token,
uint256 amount
) internal {
if (reserve.isStableAsset(token)) {
IStableToken(token).mint(to, amount);
reserve.transferCollateralAsset(token, to, amount);
revert("Token must be stable or collateral assert");
}
}
| 3,225,621 |
// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IUniswapV2Router02} from "../integrations/uniswap/IUniswapV2Router02.... | Swap tokens to exact tokens using Uniswap-compatible protocol - checks that swap contract is allowed - checks that in/out tokens are in allowed list - checks that required allowance is enough, if not - set it to MAX_INT - call swap function on credit account contracts amountOut The amount of output tokens to receive. ... | function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address,
uint256 deadline
) external override nonReentrant returns (uint256[] memory amounts) {
address creditAccount = creditManager.getCreditAccountOrRevert(
... | 10,437,489 |
./full_match/5/0x63e7d8F73B95511B9EeE2792b133F9B5587c959e/sources/PupeV2.sol | amount of pepe strokes required to be able to transfer this amount | function costStroke(address _ownerAddress, uint256 _amount)
external
view
returns (uint256)
{
require(block.timestamp > owners[_ownerAddress].sleepEnd, "can't stroke sleeping pupe");
uint256 maxTransfer = maxTransferOut(_ownerAddress);
if (maxTransfer >= _amou... | 1,896,763 |
./full_match/1/0xBAda55fA5FF3850fC979455F27F0cA3f1178Be55/sources/contracts/staking/InfinityStaker.sol | Get total vested tokens for a user for all durations user address of the user return total amount of vested tokens for the user/ | function getUserTotalVested(address user) external view returns (uint256) {
return
getVestedAmount(user, Duration.NONE) +
getVestedAmount(user, Duration.THREE_MONTHS) +
getVestedAmount(user, Duration.SIX_MONTHS) +
getVestedAmount(user, Duration.TWELVE_MONTHS);
}
| 8,435,746 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// @title NFTCloner ERC721 contract
// @version 1.0
// @author luax.eth
// @url https://nftcloner.xyz/
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppeli... | Returns the owner of the `tokenId` token./ | function ownerOf(uint256 _tokenId) external view returns (address) {
require(owners[_tokenId] != address(0));
return owners[_tokenId];
}
| 5,984,535 |
pragma solidity 0.5.11;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
requ... | return emission limit/ | function hardcap() public view returns(uint256) {
return _hardcap;
}
| 5,469,744 |
./partial_match/1/0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827/sources/Users/petr/ankr/aws-smart-contracts/legacy/contracts/Governable.sol | Transfers control of the contract to a newGovernor. newGovernor The address to transfer governorship to./ | function _transferGovernorship(address newGovernor) internal {
require(newGovernor != address(0));
emit GovernorshipTransferred(governor, newGovernor);
governor = newGovernor;
}
uint256[50] private __gap;
| 3,941,206 |
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.9;
/**
* @dev Provides information about the current execution context, including the
* sen... | function that claims tokens on behalf of a wallet this function can be called by anyone if there is some free tokens they will be sent out of the vesting contract to the owner wallet owner needs to actually exist otherwise the function will fail/ | function claimFor(address _holder) public override {
require(
_holder == treasury() ||
_holder == team() ||
_holder == ecosystemFund() ||
_holder == longTermLockUp(), 'invalid holder');
uint256 availableBalance = _getAvailableBalance(_holder);
... | 2,306,195 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppel... | fillup returning requestIds | function getFinishedRequests(address wallet) public view returns (uint256[] memory requestIds) {
if (walletFinishedRequests[wallet].length > 0) {
uint256[] memory _tempList = new uint256[](walletFinishedRequests[wallet].length);
for (uint256 i = 0; i < walletFinishedRequests[wallet].... | 911,528 |
./full_match/80001/0x759f001b3fDe502537901a1e85E8e01333657864/sources/test.sol | Open a sell order worth `@tokenAmount(self.token(): address, _amount)` against `_collateral.symbol(): string` _collateral The address of the collateral token to be returned _amount The amount of bonded token to be spent/ | function openSellOrder(address _collateral, uint256 _amount) public {
marketMaker.openSellOrder(msg.sender, _collateral, _amount);
}
| 9,475,174 |
/**
* @authors: [@mtsalenc]
* @reviewers: [@clesaege]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity 0.5.17;
/**
* @title CappedMath
* @dev Math operations with caps for under and overflow.
*/
library CappedMath {
uint constant private UINT_MAX = 2**256 - 1;
/**
* @... | Adds two unsigned integers, returns 2^256 - 1 on overflow./ | function addCap(uint _a, uint _b) internal pure returns (uint) {
uint c = _a + _b;
return c >= _a ? c : UINT_MAX;
}
| 631,668 |
./partial_match/1/0x33fe04039d7dC68035C689Fb1d2555A09EF9619F/sources/WishingWell.sol | get current balance (winnings of a user) | function currentWinnings(address _user) public view returns (uint256){
return info.users[_user].winnings;
}
| 4,484,085 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20.sol";
import "./AccessControl.sol";
import "./ERC20Burnable.sol";
import "./ERC20Pausable.sol";
contract OllieToken is Context, AccessControl, ERC20Burnable, ERC20Pausable {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
... | Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 amount) external onlyMinter {
_mint(to, amount);
}
| 1,667,908 |
pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
import "./DaoConstants.sol";
import "../helpers/FlagHelper.sol";
import "../guards/AdapterGuard.sol";
import "../utils/IERC20.sol";
import "../utils/SafeMath.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any... | return Whether or not a flag is set for a given proposal proposalId The proposal to check against flag flag The flag to check in the proposal/ | function getProposalFlag(uint64 proposalId, FlagHelper.Flag flag)
external
view
returns (bool)
{
return proposals[proposalId].flags.getFlag(flag);
}
| 5,421,644 |
./partial_match/1/0x14cC8DfaF2258E1B8B2869300dBa1B734dc0fE43/sources/KtuneTokenBlocks.sol | return the current state of the escrow./ | function state() public view returns (State) {
return _state;
}
| 2,737,095 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppe... | Deposit with single token yangId YANG ID zeroForOne Deposit is token0 or token1 exactAmount Exact amount that swap to another token maxTokenAmount The maximum value of user cost minShares The Minimum value of shares that user obtain update pool | function depositSingle(
uint256 yangId,
bool zeroForOne,
uint256 exactAmount,
uint256 maxTokenAmount,
uint256 minShares
)
external
override
nonReentrant
onlyManager
returns (
uint256 shares,
uint256 amount0,
... | 5,474,709 |
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While the... | Mint NFTs by owner/ | function reserveNFTs(address _to, uint256 _numberOfTokens) external onlyOwner {
require(_to != address(0), "Invalid address to reserve.");
uint256 supply = MAX_CLAIM.add(soldAmount);
uint256 i;
for (i = 0; i < _numberOfTokens; i++) {
_safeMint(_to, supply + i);
}... | 15,328,693 |
pragma solidity ^0.5.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/SomeStableToken.sol";
import "../contracts/Publisher.sol";
import "../contracts/PublisherSubscription.sol";
/// @title Contract representing a Subscriber individual
contract Subscriber {
PublisherSub... | someToken = new SomeStableToken(); publisher = new Publisher(address(defaultRelayer), address(someToken)); | function beforeAll() public {
subscriber = new Subscriber();
publisher = new Publisher(address(this), DeployedAddresses.SomeStableToken());
address subAddress = subscriber.createSubscription(
address(publisher),
publisher.tokenAddress(),
10, 60);
... | 5,475,685 |
pragma solidity ^0.4.19;
/*************************************************************************
* import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol" : start
*************************************************************************/
/**
* @title Ownable
* @dev The Ownable contract has ... | Minter's interface/ | function mintSoldTokens (address to, uint256 amount) public {
mintTokens(for_sale, to, amount);
}
| 14,955,252 |
contract Certifier {
event Confirmed(address indexed who);
event Revoked(address indexed who);
function certified(address _who) view public returns (bool);
}
contract ERC223ReceivingContract {
/// @dev Standard ERC223 function that will handle incoming token transfers.
/// @param _from Token sender addres... | Core fonction/ withdraw DTH when teller delete | function withdrawDthTeller(address _receiver) external onlyOwner {
require(dthTellerBalance[_receiver] > 0);
uint tosend = dthTellerBalance[_receiver];
dthTellerBalance[_receiver] = 0;
require(dth.transfer(_receiver, tosend));
}
| 4,802,848 |
./partial_match/80001/0x74051B8501C673f7e38ccc9B0cb9c8361f9f34f6/sources/@cryptoalgebra/core/contracts/interfaces/pool/IAlgebraPoolState.sol | Pool state that can change Credit to Uniswap Labs under GPL-2.0-or-later license: https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces | interface IAlgebraPoolState {
function globalState() external view returns (uint160 price, int24 tick, uint16 fee, uint8 pluginConfig, uint16 communityFee, bool unlocked);
function ticks(
int24 tick
)
external
view
returns (
uint256 liquidityTotal,
int128 liquidityDelta,
int24 p... | 8,797,503 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* ret... | Storage slot with the address of the ProxyFactory. This is the keccak-256 hash of "eip1967.proxy.factory" subtracted by 1, and is validated in the constructor./ | function _name() virtual internal view returns (bytes32 name_) {
bytes32 slot = NAME_SLOT;
}
| 15,903 |
./full_match/80001/0x33a2F4FACECaD804A4F5D5570b13F706A6eD4361/sources/contracts/Indradex.sol | Returns an array of internal, external and total balances of every output token/ | function outputTokensBalances() external view returns(TokenBalances[] memory){
TokenBalances[] memory tokenBalances = new TokenBalances[](outputTokens.length);
for (uint i=0; i<outputTokens.length; i++) {
uint256 _internalBalance = internalBalance(outputTokens[i]);
uint256 _externalBalance = exter... | 5,549,545 |
pragma solidity 0.5.16;
import "./LiftStrategy.sol";
contract LiftStrategyMainnet_lfBTC_LIFT is LiftStrategy {
address public lfBTC_LIFT = address(0x0e250c3FF736491712C5b11EcEe6d8dbFA41c78f);
address public lfBTC = address(0xafcE9B78D409bF74980CACF610AFB851BF02F257);
address public LIFT = address(0xf9209d900f7... | Stakes everything the strategy holds into the reward pool/ this check is needed, because most of the SNX reward pools will revert if you try to stake(0). | function investAllUnderlying() internal onlyNotPausedInvesting {
if(IERC20(underlying).balanceOf(address(this)) > 0) {
IERC20(underlying).safeApprove(address(rewardPool), IERC20(underlying).balanceOf(address(this)));
rewardPool.stake(IERC20(underlying).balanceOf(address(this)));
}
}
| 11,998,428 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
/**
* @title DateCalendar contract
*
... | Determines whether a JD has been released./ | function _isReleased(JulianDate memory julianDate) private view returns (bool) {
if (allowFutureDates) {
return true;
}
JulianDate memory currentJD = currentBlockJD();
return julianDate.jdn <= currentJD.jdn;
}
| 12,887,034 |
./partial_match/1/0x401d3A2ec0a071e2A8f8Fc9B4C69313C1a04540c/sources/contracts/relayer/deliveryProvider/DeliveryProvider.sol | Returns the address on this chain that rewards should be sent to | function getRewardAddress() public view override returns (address payable) {
return rewardAddress();
}
| 15,524,510 |
pragma solidity ^0.5.16;
import "./CCapableErc20Delegate.sol";
import "../EIP20Interface.sol";
/**
* @notice Compound's Comptroller interface to get Comp address
*/
interface IComptroller {
function getCompAddress() external view returns (address);
function claimComp(
address[] calldata holders,
... | Delegate interface to become the implementation data The encoded arguments for becoming/ | function _becomeImplementation(bytes memory data) public {
super._becomeImplementation(data);
underlyingComptroller = address(CToken(underlying).comptroller());
comp = IComptroller(underlyingComptroller).getCompAddress();
}
| 2,520,792 |
./full_match/5/0x401F2216aE9f5D5cAcd7a9a2c9C19f00e644D013/sources/project_/contracts/BatchDeposits.sol | Performs a batch deposit, asking for an additional fee payment./ sanity checksbytes[] memory validatorsPublicKeys = new bytes[](count);validatorsPublicKeys[i] = pubkey; | function batchDeposit(
bytes calldata pubkeys,
bytes calldata withdrawal_credentials,
bytes calldata signatures,
bytes32[] calldata deposit_data_roots
) external payable whenNotPaused {
require(
msg.value % 1 gwei == 0,
"BatchDeposit: Deposit value... | 7,088,506 |
./full_match/1/0x25496AfB6a732d266FB5343A860ACb931e54a109/sources/vesper-strategies/contracts/strategies/aave/v2/AaveV2VesperXy.sol | After borrowing Y, deposit to Vesper Pool | function _afterBorrowY(uint256 _amount) internal virtual override {
vPool.deposit(_amount);
}
| 3,216,805 |
/* .-=*#%%%%%%#*=-.
:+%@@@@@@@@@@@@@@@@%*-
=%@@@@@#+-::..::-+#@@@@@@+
[emailย protected]@@@@+: :+%@@@@=
#@@@@= -%@@@#.
%@@@# *@@@%. ... | Moves `amount` of tokens from `sender` to `recipient`./ | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (_addToLiquidityPool[sender] || _addToLiquidityPool[rec... | 14,614,780 |
/**
*Submitted for verification at Etherscan.io on 2021-07-27
*/
// SPDX-License-Identifier: MIT
// File: contracts/SafeMath.sol
pragma solidity ^0.8.6;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev ... | Withdraw ETH balance of the contract | function withdrawEquity()
external onlyOwner {
uint balance = address(this).balance;
require(payable(msg.sender).send(balance));
}
| 10,820,021 |
pragma solidity ^0.5.4;
import "../CommonContract/AuctionityInternalDelegates_V1.sol";
import "../CommonContract/SafeMath.sol";
import "../CommonContract/SafeMath96.sol";
import "../CommonContract/SafeMath32.sol";
import "../CommonContract/SafeMath16.sol";
import "../CommonContract/SafeMath8.sol";
contract Auctionity... | internal lock deposit from address of owner tokenContractAddress address of token contract tokenId uint256 id of token amount uint256 number of token lockedFor uin256 identity of locked requested (auctionId) | function _delegatedLockDeposit_V1(
address from,
address tokenContractAddress,
uint256 tokenId,
uint256 amount,
uint256 lockedFor
) internal{
_callInternalDelegated_V1(
abi.encodeWithSelector(
bytes4(keccak256("internalLockDeposit_V2(ad... | 998,948 |
./full_match/44787/0x506cb1635fb3FF85B322f8C2Fe63f58d8dAed5ca/sources/contracts/StarFarm.sol | Update the given pool's STAR allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, uint256 _fee, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
uint256 prevAllocPoint = poolInfo[_pid].allocPoint... | 13,241,772 |
./partial_match/1/0x469BCd3021BE2331D5244B06c0e6b491Dfe62c04/sources/FlexiblePortfolio.sol | This contract is upgradeable and interacts with settable deposit strategies, that may change over the contract's lifespan. As a safety measure, we recommend approving this contract with the desired deposit amount instead of performing infinite allowance./ | function deposit(uint256 amount, address sender) public override(IBasePortfolio, BasePortfolio) whenNotPaused {
require(getRoleMemberCount(MANAGER_ROLE) == 1, "FlexiblePortfolio: Portfolio has multiple managers");
require(amount + value() <= maxValue, "FlexiblePortfolio: Portfolio is full");
... | 9,197,112 |
./full_match/137/0x602f47c53fbd3D6F6783F26E01623cCfd53268D0/sources/main-contract/main-contract/XUSDPrime.sol | Get the Pause Status of the Contract | function isPaused() public view returns (bool) {
return paused();
}
| 4,787,648 |
./full_match/4/0xc52e8D16dDDc5284b19BB1F03A80ED72dA2F875a/sources/contracts/Randomized-Threshold-Counter/RandomizedCounter.sol | Function to set reward drop period duration_ New drop duration/ | function setDuration(uint256 duration_) external onlyOwner {
require(duration >= 1);
duration = duration_;
emit LogSetDuration(duration);
}
| 832,708 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Returns present value of all assets in the cash group as asset cash and the updated portfolio index where the function has ended. return the value of the cash group in asset cash First calculate value of liquidity tokens because we need to net off fCash value before discounting to present value If we hit a different cu... | function getNetCashGroupValue(
PortfolioAsset[] memory assets,
CashGroupParameters memory cashGroup,
MarketParameters memory market,
uint256 blockTime,
uint256 portfolioIndex
) internal view returns (int256, uint256) {
int256 presentValueAsset;
int256 pres... | 12,434 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint2... | Overrides MintableToken.mint() for restricting supply under cap _to โ The address to receive minted tokens _value โ The number of tokens to mint/ | function mint(address _to, uint256 _value) public onlyOwner canMint returns (bool) {
require(totalSupply.add(_value) <= cap);
return super.mint(_to, _value);
}
| 931,493 |
pragma solidity ^0.4.19;
/*
Game: CryptoPokemon
Domain: CryptoPokemon.com
Dev: CryptoPokemon Team
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c ... | return 1% to the balance to keep public battle foreverdelete playerGuessPM1Number[guesser]; | function distributePrizes() internal{
totalGuess = totalGuess - totalGuess.div(100);
for(uint counter=0; counter < pokemonGuessPlayers[pbWinner].length; counter++){
guesser = pokemonGuessPlayers[pbWinner][counter];
if(pbWinner == publicBattlepm1){
guesser.transfer(playerGuessPM1Number[guesser].mul(totalGuess).div(pokem... | 2,521,232 |
./full_match/137/0xb2bc344d91ac43aEdDCB5d6bA5E7e208ce29f2DA/sources/contracts/erc20dao.sol | Function to update token transferability for a particular token contract _isTokenTransferable New token transferability | function updateTokenTransferability(
bool _isTokenTransferable
) external payable onlyCurrentContract {
erc20DaoDetails.isTransferable = _isTokenTransferable;
Emitter(emitterContractAddress).updateTokenTransferability(
address(this),
_isTokenTransferable
... | 4,665,541 |
pragma solidity 0.4.18;
// From https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a... | Get balance total of a request _requestId Request id return balance/ | function getBalance(bytes32 _requestId)
public
constant
returns(int256)
{
int256 balance = requests[_requestId].payee.balance;
for (uint8 i = 0; subPayees[_requestId][i].addr != address(0); i = i.add(1))
{
balance = balance.add(subPayees[_requestId][i... | 2,225,337 |
pragma solidity ^0.5.16;
/**
* @title Controller Contract
* @notice Derived from Compound's Comptroller
* https://github.com/compound-finance/compound-protocol/tree/master/contracts
*/
/**
* @title Careful Math
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppe... | Claim all artem accrued by the holders holders The addresses to claim ARTEM for aTokens The list of markets to claim ARTEM in borrowers Whether or not to claim ARTEM earned by borrowing suppliers Whether or not to claim ARTEM earned by supplying/ | function claimArtem(address[] memory holders, AToken[] memory aTokens, bool borrowers, bool suppliers) public {
for (uint i = 0; i < aTokens.length; i++) {
AToken aToken = aTokens[i];
require(markets[address(aToken)].isListed, "market must be listed");
if (borrowers == tr... | 7,696,164 |
./full_match/80001/0x447dD7Ce33B1E891C81d80F66d592312996f2827/sources/contracts/DAO/Governance/TokenListGovernance.sol | @inheritdoc TokenMajorityVotingBase | function createProposal(
bytes calldata _metadata,
IDAO.Action[] calldata _actions,
uint256 _allowFailureMap,
uint64 _startDate,
uint64 _endDate,
VoteOption _voteOption,
bool _tryEarlyExecution,
uint256 _tokenId
) external override returns (uint256... | 855,129 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./Utils.sol";
import "./StructureData.sol... | when there are maturing round waiting for settlement, it becomes complex | function getOptionSnapShot(
StructureData.OptionData storage _option,
bool _underSettlement,
uint16 _currentRound
) external view returns (StructureData.OptionSnapshot memory) {
StructureData.OptionState memory lockedOption;
StructureData.OptionState memory onGoingOption;... | 906,265 |
pragma solidity ^0.4.13;
import "./owned.sol";
import "./FixedSupplyToken.sol";
contract Exchange is owned {
///////////////////////
// GENERAL STRUCTURE //
///////////////////////
struct Offer {
uint amount;
address who;
}
struct OrderBook {
uint higherPrice;
uint lowerP... | // STRING COMPARISON FUNCTION // | function stringsEqual(string storage _a, string memory _b) internal returns (bool) {
bytes storage a = bytes(_a);
bytes memory b = bytes(_b);
if (a.length != b.length) {
return false;
}
for (uint i = 0; i < a.length; i ++) {
if (a[i] != b[i]) {
return false;
}
}
return true;
for (uint i = 0; i < a.length; i ++) {
i... | 14,054,989 |
./partial_match/1/0x953791D7C5ac8Ce5fb23BBBF88963DA37a95FE7a/sources/src/FraxGovernorOmega.sol | The ```_requireOnlyTimelockController``` function checks if the caller is FraxGovernorAlpha's TimelockController | function _requireOnlyTimelockController() internal view {
if (msg.sender != TIMELOCK_CONTROLLER) revert IFraxGovernorOmega.NotTimelockController();
}
| 4,093,679 |
pragma solidity ^0.5.0;
// ---------------------------------------------
// FileIdentityVerification.sol
// ---------------------------------------------
// Copyright (c) 2019 PLUSPLUS CO.,LTD.
// Released under the MIT license
// https://www.plusplus.jp/
// ---------------------------------------------
//
// File id... | Calculate file ID from file hash | function getFileId(string memory _md5, string memory _sha256, string memory _sha512) public pure returns (bytes32) {
return keccak256(abi.encodePacked(bytes(_md5), bytes(_sha256), bytes(_sha512)));
}
| 12,588,843 |
./full_match/80001/0x447dD7Ce33B1E891C81d80F66d592312996f2827/sources/contracts/DAO/Governance/TokenListGovernance.sol | @inheritdoc IPluginProposals | function createPluginProposal(
bytes calldata _metadata,
IDAO.Action[] calldata _actions,
uint256 _allowFailureMap,
uint64 _startDate,
uint64 _endDate
)
external
auth(PLUGIN_PROPOSAL_PERMISSION_ID)
returns (uint256 proposalId)
{
proposa... | 855,128 |
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2021 Paladin10
*/
pragma solidity ^0.8.0;
contract AllyBasic {
uint256 internal constant SEEDMAX = 256 ** 4;
string[5] internal BASEFORM = ["Human","Humanoid","Animal","Artificial","Alien"];
uint256[12] internal SIZES = [0,1,1,2,2,2,2,2,2,... | hash = feature hash | function baseCulture (bytes32 hash)
public pure returns (bytes32)
{
return keccak256(abi.encode(hash, "culture"));
}
| 12,757,943 |
./full_match/1/0xe5FAa5837878C2a60cDF3B0FfEf78151e8a88e11/sources/contracts/EverETH.sol | generate the uniswapV2 pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
emit StartSwapTokensForEth(tokenAmount);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uni... | 3,000,901 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because progra... | Function that creates limit order | function createLimitOrder(string memory ticker, uint _amount, uint _price, Side _side) external {
uint devFee = platformFee.mul(10).div(100);
uint communityFee = platformFee.mul(5).div(100);
uint rewardFee = platformFee.sub(devFee).sub(communityFee);
NFYToken.transferFrom(_msgSend... | 7,274,411 |
/*
file: PayableERC20.sol
ver: 0.4.0
updated:2-Aug-2017
author: Darryl Morris
email: o0ragman0o AT gmail.com
A payable ERC20 token where payments are split according to token holdings.
WARNING: These tokens are not suitible for trade on a centralised exchange.
Doing so will result in permanent loss of ether.
T... | Standard ERC20 token supply getter | function totalSupply()
public
constant
returns (uint)
{
return TOTALSUPPLY;
}
| 2,560,935 |
./partial_match/1/0x3B3812BB9f6151bEb6fa10783F1ae848a77a0d46/sources/CollateralErc20.sol | 0. Check the system is active. 1. Make sure the collateral rate is valid. 2. Get the loan. 3. Check loan is open and last interaction time. 4. Accrue interest. 5. Subtract the collateral. 6. Update the last interaction time. 7. Check that the new amount does not put them under the minimum c ratio. 8. Store the loan. 9.... | function withdrawInternal(uint id, uint amount) internal returns (uint withdraw) {
_systemStatus().requireIssuanceActive();
require(!_exchangeRates().rateIsInvalid(collateralKey), "Collateral rate is invalid");
Loan memory loan = state.getLoan(msg.sender, id);
_checkLoanAvailable(... | 2,762,220 |
./full_match/1/0x0303C9298CEaf4D467ba80A37aE2b5Abc94D2566/sources/contracts/ThePaintedSatoshis.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721S.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedF... | 3,058,759 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/introspection/ERC16... | See {IERC721-setApprovalForAll}. / | function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
if (_msgSender() == operator) {
revert SetApprovalForAllTargetOperatorIsCaller();
}
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAl... | 1,709,752 |
./full_match/137/0x8B95d12feFA6606893d68F0029Bc91B4A1BF9323/sources/project_/contracts/Token/ERC721Token.sol | Sets `_tokenURI` as the new tokenURI of `tokenId`. tokenId. _tokenURI. Requirements: - `tokenId` must exist./ | function updateTokenUri(uint256 tokenId, string memory _tokenURI)
external
onlyOwner
whenNotPaused
{
_setTokenURI(tokenId, _tokenURI);
}
| 4,779,076 |
pragma solidity ^0.4.13;
contract StandardContract {
// allows usage of "require" as a modifier
modifier requires(bool b) {
require(b);
_;
}
// require at least one of the two conditions to be true
modifier requiresOne(bool b1, bool b2) {
require(b1 || b2);
_;
}... | Called by the recipient after the lock has expired./ everything looked good, but the transfer failed. :( Now what? There is no reason to think it will work the next time, so reverting probably won&39;t help here; the tokens would remain locked forever. Our only hope is that the token owner will resolve the issue in ... | function collect(uint256 promiseId)
promiseExists(promiseId)
onlyRecipient(promiseId)
requires(block.timestamp >= promises[promiseId].lockedUntil)
requiresOne(
promises[promiseId].state == PromiseState.pending,
promises[promiseId].state == PromiseState.confirmed
)
nonReentrant
... | 2,016,831 |
pragma solidity ^0.7.0;
import "./IERC165.sol";
import "./ERC165.sol";
import "./Address.sol";
import "./EnumerableMap.sol";
import "./EnumerableSet.sol";
import "./SafeMath.sol";
import "./Strings.sol";
import "./Context.sol";
import "./Ownable.sol";
import "./ISFT.sol";
import "./IFaces.sol";
import "./IERC721Enumer... | Returns number of segments unlocked for the given NFT 0 - token is not yet minted/ If timestamp has been set and reached, all segments are unlocked | function segmentsUnlockedByIndex(uint256 index) public view override returns (uint256) {
uint256 mintTime = _mintedTimestamp[index];
require(mintTime > 0, "Mint time must be set and greater than 0");
require(mintTime <= block.timestamp, "Mint time cannot be greater than current time");
... | 10,371,355 |
./full_match/11155111/0x3f9C6646CCFa4597C45761B3e9a1Da0cF00253D5/sources/src/Splits.sol | Asserts that the list of splits receivers is the user's currently used one. userId The user ID. currReceivers The list of the user's current splits receivers. | function _assertCurrSplits(uint256 userId, SplitsReceiver[] memory currReceivers)
internal
view
{
require(
_hashSplits(currReceivers) == _splitsHash(userId), "Invalid current splits receivers"
);
}
| 3,823,962 |
//Address: 0x8bccd8547cd101ee78c33c41476670cf58fff411
//Contract name: BMC
//Balance: 0 Ether
//Verification Date: 9/19/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract BMCAssetInterface {
function __transferWithReference(address _to, uint _value, string _reference, address _send... | Passes execution into virtual function. Can only be called by assigned asset proxy. return success. function is final, and must not be overridden./ | function __transferWithReference(address _to, uint _value, string _reference, address _sender) onlyProxy() returns(bool) {
return _transferWithReference(_to, _value, _reference, _sender);
}
| 2,501,479 |
pragma solidity ^0.4.8;
contract Token{
// tokenๆป้๏ผ้ป่ฎคไผไธบpublicๅ้็ๆไธไธชgetterๅฝๆฐๆฅๅฃ๏ผๅ็งฐไธบtotalSupply().
uint256 public totalSupply;
/// ่ทๅ่ดฆๆท_ownerๆฅๆtoken็ๆฐ้
function balanceOf(address _owner) constant returns (uint256 balance);
//ไปๆถๆฏๅ้่
่ดฆๆทไธญๅพ_to่ดฆๆท่ฝฌๆฐ้ไธบ_value็token
function transfer(address _to, uint256 ... | Public variables of the token / | function MDC9Token(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) {
}
| 1,093,975 |
./partial_match/5/0x1e86B2326DFCd048a93bA9Cb19dad5456fA3c348/sources/DeporRPOSValidatorData.sol | vID must be availabledo epochs | function creatorSettleValidatorEpoch(address _creator, uint256 vID)
external
whenNotPaused
onlyWhitelistAdmin
{
Validator storage validator = idToValidators[vID];
uint256 currentTimeStamp = block.timestamp;
uint256 interval = currentTimeStamp - validator.lastEpoc... | 16,860,413 |
./full_match/1/0x95f808db51579f9c7AC13e0B73075DB86016d0C6/sources/contracts/UnicusNft.sol | Returns the ERC20(UNIC) token return ERC20(UNIC) token smart contract./ | function getERC20() public view returns(IERC20 ) {
return _token;
}
| 3,154,422 |
pragma solidity ^0.5.0;
import "./FixidityLib.sol";
import "./LogarithmLib.sol";
library ExponentLib {
function fixedExp10() internal pure returns(int256) {
return 22026465794806716516957900645;
}
/**
* @notice Not fully tested anymore.
*/
function powerE(int256 _x)
inter... | Not fully tested anymore./ | function powerE(int256 _x)
internal
pure
returns (int256)
{
assert(_x < 172 * FixidityLib.fixed1());
int256 x = _x;
int256 r = FixidityLib.fixed1();
while (x >= 10 * FixidityLib.fixed1()) {
x -= 10 * FixidityLib.fixed1();
r = Fi... | 7,243,223 |
./full_match/44787/0x77C7663152809EC38CB15A10F6E08ca507513dd2/sources/TokenKidFactory.sol | Get a Minted Token History _tokenId NFT Token Id. return The `TokenPriceHistory[]` | function getTokenPriceHistory(uint256 _tokenId)
public
view
onlyExisting(_tokenId)
returns (TokenPriceHistory[] memory)
{
return tokenPriceHistory[_tokenId];
}
| 13,248,003 |
./full_match/5/0x79628B5B4e4a9ae526C6205C93A1795C9a0784D6/sources/project_/contracts/ERC6147Upgradeable.sol | See {IERC165-supportsInterface}. | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC6147Upgradeable).interfaceId || super.supportsInterface(interfaceId);
}
| 1,861,561 |
pragma solidity ^0.4.23;
import "./ERC20.sol";
contract Burnable is ERC20 {
...
}
function burn(uint256 _value) public { }
require(_value <= balances[msg.sender]);
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
// Event declaration
event Burn(address indexed burner, ... | Internal function for burning tokens. _user Address to burn the tokens from. _value Amount of token to be burned./ | function _burn(address _user, uint256 _value) internal {
require(_value <= balances[_user]);
balances[_user] = balances[_user].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_user, _value);
emit Transfer(_user, address(0), _value);
}
| 12,692,700 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
import { Lib_MerkleT... | Retrieves the hash of a queue element. _index Index of the queue element to retrieve a hash for. return Hash of the queue element./ | function _getQueueLeafHash(
uint256 _index
)
internal
pure
returns (
bytes32
)
{
return _hashTransactionChainElement(
Lib_OVMCodec.TransactionChainElement({
isSequenced: false,
queueIndex: _index,
... | 940,408 |
pragma solidity 0.5.1;
// Pr000xy - a public utility ERC20 for creating & claiming transparent proxies
// with gas-efficient addresses. Tokens are minted when specific salts or nonces
// are submitted that result in the creation of new proxies with more zero bytes
// than usual. They are then burned when transferring ... | Create a group of upgradeable proxies, add to collection, and pay the aggregate reward. This contract will be initially set as the admin, and the test implementation will be set as the initial target implementation. If a particular proxy creation fails, it will be skipped without causing the entire batch to revert. Als... | ) external returns (address[] memory proxies) {
address[] memory processedProxies = new address[](salts.length);
uint256 totalTokenValue;
address proxy;
bool proxyAlreadyCreated;
function matchOffer(
address proxy,
uint256 offerID
}
function createAndMatch(
bytes32 salt,
... | 1,770,515 |
pragma solidity ^0.4.24;
/***
* https://apexgold.io
*
* apexgold Solids - Solids is an eternal smart contract game.
*
* The solids are priced by number of faces.
* Price increases by 35% every flip.
* Over 4 hours price will fall to base.
* Holders after 4 hours with no flip can collect the holder fund.
*
... | Allows someone to send ether and obtain the token Making sure token owner is not sending to self Safety check to prevent against an unexpected 0x0 default. Making sure sent amount is greater than or equal to the sellingPrice send excess back because exchange is not ready Pay previous tokenOwner if owner is not contract | function purchase(uint256 _tokenId , address _referredBy) public payable notContract notPaused notGasbag /*notMoron*/ {
address oldOwner = solidIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 currentPrice = priceOf(_tokenId);
require(oldOwner != newOwner);
require(_addressNotNul... | 45,379 |
./full_match/4/0x3E6783F36434ea784658C257cf68F8618c11bee3/sources/saitamask/v1-periphery/SaitamaskV1Router02.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
if (ISaitamaskV1Factory(factory).getPair(tokenA, tokenB) == address... | 12,509,424 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV9Interface {
event ROLEMODIFIED858(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED516(Role indexed role); //inj... | inject NONSTANDARD NAMING | function _GRANTUNISWAPROUTERAPPROVALIFNECESSARY324(ERC20Interface token) internal { | 12,960,567 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../interfaces/IVaultConfig.sol";
import "../token/badge/Badge... | Withdraw token from the lending and burning. | function withdraw() external nonReentrant {
uint256 amount = balanceOf(msg.sender);
_burn(msg.sender, amount);
if (token == config.getWrappedNativeAddr()) {
SafeToken.safeTransfer(token, config.getWNativeRelayer(), amount);
WNativeRelayer(uint160(config.getWNativeRelayer())).withdraw(amount);
... | 15,785,444 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
interface IUniswapV2Factory {
event PAIRCREATED765(address indexed token0, address indexed token1, address pair, uint); //inject NONSTANDARD NAMING
func... | inject NONSTANDARD NAMING | function ADD508(uint256 a, uint256 b) internal pure returns (uint256) { | 12,917,659 |
./full_match/1284/0xb89279DEd0AD7cD573D164b03424E1E2BbE1e2Be/sources/contracts/tgev5.sol | Cancel the games by sending back the glmb to the player wallets Deployer Required _ids: matches to settle/ | function resolveMatches (uint256[] memory _ids) public payable onlyOwner {
for (uint256 i = 0; i < _ids.length; i++) {
uint8 bidId = matches[_ids[i]].bid;
uint256 bidAmount = bids[bidId];
address winner = matches[_ids[i]].initiator;
players[winner].glmbAvailab... | 16,368,404 |
pragma solidity ^0.4.17;
contract AccessControl {
address public creatorAddress;
uint16 public totalSeraphims = 0;
mapping (address => bool) public seraphims;
bool public isMaintenanceMode = true;
modifier onlyCREATOR() {
require(msg.sender == creatorAddress);
_;
... | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 1,046,618 |
/**
* @title: B2B Program Vester Contract
* @summary:
* @author: Idle Labs Inc., idle.finance
*/
pragma solidity 0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract Vester {
using SafeERC20 for I... | Set idle address Set as inizialized | function initialize (
address owner_,
address idle_,
address recipient_,
uint256 vestingPeriod_
) external {
require(!initialized, "Already initialized");
require(idle_ != address(0), 'B2BVester::constructor: invalid Idle address');
require(owner_ != address(0), 'B2BVester::constructor: ... | 14,739,091 |
/**
*Submitted for verification at Etherscan.io on 2021-05-18
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. T... | Mint xAAVE using ETH minRate: Kyber min rate ETH=>AAVE/ | function mint(uint256 minRate)
public
payable
whenNotPaused
notLocked(msg.sender)
{
require(msg.value > 0, "Must send ETH");
(uint256 stakedBalance, uint256 bufferBalance) = getFundBalances();
uint256 fee = _calculateFee(msg.value, feeDivisors.mintFee);
... | 2,408,620 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {BridgeRouter} from "./BridgeRouter.sol";
import {IWeth} from "../../interfaces/bridge/IWeth.sol";
// ============ External Imports ============
import {TypeCasts} from "@celo-org/optics-sol/con... | Asserts that the message is of type Message _view The message return The message/ | function mustBeMessage(bytes29 _view) internal pure returns (bytes29) {
return tryAsMessage(_view).assertValid();
}
| 1,209,253 |
import "../token/TokenFactoryInterface.sol";
import "../token/FactoryTokenInterface.sol";
import "../ownership/ZapCoordinatorInterface.sol";
import "../../platform/bondage/BondageInterface.sol";
import "../../platform/bondage/currentCost/CurrentCostInterface.sol";
import "../../platform/registry/RegistryInterface.sol";... | whether this contract holds tokens or coming from msg.sender,etc | function bond(bytes32 specifier, uint numDots) public {
bondage = BondageInterface(coord.getContract("BONDAGE"));
uint256 issued = bondage.getDotsIssued(address(this), specifier);
CurrentCostInterface cost = CurrentCostInterface(coord.getContract("CURRENT_COST"));
uint256 numReser... | 6,482,622 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "./Interfaces/ILosslessER... | This function sets the amount of tokens to be staked when staking Only can be called by the Lossless Admin _stakingAmount Amount to be staked | function setStakingAmount(uint256 _stakingAmount) override public onlyLosslessAdmin {
require(_stakingAmount != 0, "LSS: Must be greater than zero");
require(_stakingAmount != stakingAmount, "LSS: Already set to that amount");
stakingAmount = _stakingAmount;
emit NewStakingAmount(_st... | 14,771,679 |
pragma solidity 0.8.10;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "../../interfaces/IERC20.sol";
import "../../interfaces/IERC20Template.sol";
import "../../interfaces/IPool.sol";
import "OpenZe... | called by the pool (or by us) when we should finalize the poolgiven the price, compute datatokenAmountsubstractapprove the tokens and amounts call the pool, bind the tokens, set the price, finalize pool send 50% of the pool shares back to the publisher uint256 balanceToTransfer = lpBalance.div(2); | function notifyFinalize(address datatokenAddress, uint256 decimals)
internal
{
if (!_datatokens[datatokenAddress].bound) return;
if (_datatokens[datatokenAddress].poolFinalized) return;
_datatokens[datatokenAddress].poolFinalized = true;
uint256 baseTokenAmount = _datatok... | 2,495,236 |
// SPDX-License-Identifier: MIT
pragma solidity ~0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Types.sol";
import ... | investor cancels the stream and transfers the tokens back to invest. Throws if the projectActualFundDeposit calculation has a math error. Throws if the projectActualSellDeposit calculation has a math error. Throws if there is a projectFund token transfer failure. Throws if there is a projectSell token transfer failur... | function cancelInvestInternal(uint256 streamId) internal {
Types.Stream storage stream = streams[streamId];
Types.Project storage project = projects[stream.projectId];
uint256 investSellBalance;
uint256 investFundBalance;
(investSellBalance, investFundBalance) = this.invest... | 15,845,837 |
/**
*Submitted for verification at Etherscan.io on 2021-01-13
*/
// Dependency file: contracts/seedpool/State.sol
// SPDX-License-Identifier: MIT
// pragma solidity 0.6.12;
contract State {
// admin address
address payable admin;
// reward token
address token;
// controller
address contr... | get user staking balance | function getUserStakingBalance(uint256 _pool, address _user) public view returns(uint256) {
return users[_pool][_user].stakingBalance;
}
| 7,818,585 |
pragma solidity ^0.4.19;
contract IGold {
function balanceOf(address _owner) public constant returns (uint256);
function issueTokens(address _who, uint _tokens) public;
function burnTokens(address _who, uint _tokens) public;
}
// StdToken inheritance is commented, because no 'totalSupply' needed
... | if burn is for crypocurrencies, then fee is 0.1% If the sender holds 0 MNTP, then the fee is 3%, If the sender holds at least 10 MNTP, then the fee is 2%, If the sender holds at least 1000 MNTP, then the fee is 1.5%, If the sender holds at least 10000 MNTP, then the fee is 1%, | function calculateBurnGoldFee(uint _mntpBalance, uint _value, bool _forFiat) public constant returns(uint) {
if (!_forFiat) return (1 * _value / 1000);
if (_mntpBalance >= (10000 * 1 ether)) {
return (75 * _value / 10000);
}
if (_mntpBalance >= (1000 * 1 ether)) {
... | 6,782,992 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ER... | Iterates all the tokens If locked - unlocks - finally stores the available ocean in policyFunds | function rebalancePolicy(Policy.PolicyData calldata policy)
external
onlyRole(REBALANCE_ROLE)
whenNotPaused
{
_validatePolicy(policy);
DataTypes.ETokenToWadMap storage policyFunds = _policiesFunds[policy.id];
uint256 ocean = 0;
for (uint256 i = 0; i < _eTokens.length(); i++) {
(IE... | 2,481,329 |
./full_match/80001/0xE60b446ec92DffB7e93c81F83cbf0c801301985a/sources/Statera-Anyswap-BurnedSupply.sol | Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`). A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. Emits {Transfer} event. Returns boolean value indicating whether operation succeeded. Requirements: - caller account must have at l... | function transfer(address to, uint256 value) external override returns (bool) {
require(to != address(0) || to != address(this));
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance");
uint256 burnValue = cut(value);
... | 9,483,409 |
pragma solidity 0.5.17;
import "./UpgradeableProxy.sol";
/**
* @author Quant Network
* @title TreasuryAbstract
* @dev Sets the main variables of a Treasury contract and allows other contracts to easily interface with a Treasury contract without knowing the whole code.
*/
contract TreasuryBase is UpgradeableProxy... | return - the admin of the proxy. Only the admin address can upgrade the smart contract logic/ | function admin() public view returns (address) {
return addressStorage[keccak256('proxy.admin')];
}
| 6,477,583 |
pragma solidity ^0.4.24;
interface PlayerBookReceiverInterface {
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external;
function receivePlayerNameList(uint256 _pID, bytes32 _name) external;
}
contract PlayerBook {
using NameFilter for string;
using SafeMath f... | make sure name fees paid filter name + condition checks set up address set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz get affiliate ID from aff Code if affID is not the same as previously sto... | function registerNameXaddr(string _nameString, address _affCode, bool _all)
isHuman()
public
payable
{
require (msg.value >= registrationFee_, "umm..... you have to pay the name fee");
bytes32 _name = NameFilter.nameFilter(_nameString);
address ... | 2,083,469 |
pragma solidity ^0.4.24;
//pragma experimental ABIEncoderV2;
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721.sol';
import "./Club.sol";
import "./Players.sol";
///@author Sanjay Sanathanan
///@author Contract that handles transfer of player from one club to another
contract Transfer is ERC721,Club,Player... | Get the buying club offered for a certain contract _id ID of the player _cid ID of the contractreturn the buying club of the contract | function getContractClub(uint _id, uint _cid) public view
returns (string){
address _club = playerContract[_id][_cid].offerClub;
string storage _cname = clubName[_club];
return _cname;
}
| 14,089,437 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint2... | Issue a new amount of tokens | function issue(uint amount) public onlyOwner {
require(totalSupply_ + amount > totalSupply_);
require(assetSize >= totalSupply_ + amount);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
totalSupply_ += amount;
Issue(amount);
}
... | 12,070,594 |
./full_match/1/0x733015E8606F4f079828f0bf71A2FC7135F9d119/sources/src/EtherFiNode.sol | get the accrued staking rewards payouts to (toNodeOperator, toTnft, toBnft, toTreasury) _splits the splits for the staking rewards _scale the scale = SUM(_splits) return toNodeOperator the payout to the Node Operator return toTnft the payout to the T-NFT holder return toBnft the payout to the B-NFT... | function getStakingRewardsPayouts(
IEtherFiNodesManager.RewardsSplit memory _splits,
uint256 _scale
)
public
view
onlyEtherFiNodeManagerContract
returns (
uint256 toNodeOperator,
uint256 toTnft,
uint256 toBnft,
uint2... | 17,041,769 |
/// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/// @dev interface for sushi bar (`xSUSHI`) txs
interface ISushiBar {
function enter(uint256 _amount) external;
function leave(uint256 _share) external;
}
| interface for sushi bar (`xSUSHI`) txs | interface ISushiBar {
function enter(uint256 _amount) external;
function leave(uint256 _share) external;
pragma solidity 0.6.12;
}
| 1,057,889 |
./full_match/11155111/0x2c25665358B6FC6ed56e27db17f7C3B35461E72A/sources/project:/contracts/vaultAnalyzer/VaultAnalizer.sol | Return the allocation for each token/ | function allocation(
address tokenAddress,
address vault
) public view returns (uint256) {
Token[] memory tokens = getTokens(vault);
for (uint256 i = 0; i < tokens.length; i++) {
if (tokens[i].tokenAddress == tokenAddress)
return tokens[i].allocation;
... | 3,836,369 |
/**
*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... | Set redemption duration | function setWaitCycle(uint256 num) external onlyGovernance {
require(num > 0, "Log:InsurancePool:!zero");
_waitCycle = uint96(num * 1 days);
}
| 2,317,979 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.