file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x859eEE9f759493884b081C76ec4755cF07f0c342/sources/StakedPlayProtocol.sol | Returns calculation of gons for amount of sPLAY amount Amount of sPLAY to calculate gons for | function gonsForBalance(
uint256 amount
) public view override returns (uint256) {
return amount * _gonsPerFragment;
}
| 2,729,564 |
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;
... | Constructor _wallet Where to send ETH collected from the ico/ update global variable set Oraclize gas price (for __callback) | function Ico(address _wallet) public {
require(phiRate > 0 && startTime == 0);
require(_wallet != address(0));
wallet = _wallet;
owner = msg.sender;
currentStage = Stage.ToInitialize;
}
| 12,666,314 |
./partial_match/1/0xbe2f9706A8d546b2127A65841893D719C2879d76/sources/contracts/conduit/Conduit.sol | Execute a sequence of ERC20/721/1155 transfers. Only a caller with an open channel can call this function. Note that channels are expected to implement reentrancy protection if desired, and that cross-channel reentrancy may be possible if the conduit has multiple open channels at once. A... | function execute(
ConduitTransfer[] calldata transfers
) external override onlyOpenChannel returns (bytes4 magicValue) {
uint256 totalStandardTransfers = transfers.length;
for (uint256 i = 0; i < totalStandardTransfers; ) {
_transfer(transfers[i]);
unchecked {
... | 15,537,400 |
./partial_match/1/0x63A7Ceb30Be1d4b108F597B4A294DB2973e6772c/sources/contracts/core/Vault.sol | Calls Withdraw function on controller Burn shares amount | function _withdraw(
uint256 assets,
uint256 shares,
address receiver
) internal {
require(shares != 0, "SHARES_TOO_LOW");
(uint256 withdrawn, uint256 fee) = IController(controller).withdraw(
assets,
receiver
);
require(withdrawn > 0... | 3,680,756 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.... | Retrive the underlying assets from the investment. Only governance or strategist can call this function./ | function divest() public virtual override onlyStrategist {
uint256 _pool = IFarm(ACS_FARM).userInfo(ACS_BTCB, address(this)).amount;
IFarm(ACS_FARM).withdraw(ACS_BTCB, _pool);
}
| 13,039,786 |
./full_match/1/0x700d6d24A55512c6AEC08820B49da4e4193105B3/sources/src/CvxLocker.sol | Locks the tokens in the vlToken contract amount Amount to lock/ | function _lock(uint256 amount) internal override {
cvx.safeTransferFrom(msg.sender, address(this), amount);
if (cvx.allowance(address(this), address(vlCvx)) != 0) cvx.safeApprove(address(vlCvx), 0);
cvx.safeIncreaseAllowance(address(vlCvx), amount);
vlCvx.lock(address(this), amount, 0);
}
| 3,008,515 |
./full_match/80001/0xD55844766B40409bBeC2e4195d72c4D6F784c97c/sources/project_/contracts/RodoTitleNFTV2.sol | Check requirements before minting NFT Throws if `titleId` is already stored in `mintedTitles` titleId the Rodo title id of NFT to be minted | function _beforeMintNFT(string memory titleId) internal virtual {
require(mintedTitles[titleId] == 0, 'Already minted NFT for this title');
}
| 5,624,428 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | called by the owner to set lock state, triggers stop/continue state/ | function setLock(bool _value) onlyOwner public {
locked = _value;
emit onLock();
}
| 14,055,890 |
./full_match/1/0x640216Ea5b2aC018b1d1FDB3F0a206F652C92574/sources/contracts/CommunityRegistry/CommunityRegistry.sol | Sets authorized status for multiple accounts. Only the owner can call this function. accounts_ The list of accounts to set the authorized status for. states_ The list of states to set for each account. The length of this array must be the same as the accounts_ array./ | function setAuthorized(
address[] calldata accounts_,
bool[] calldata states_
) public onlyOwner {
if (accounts_.length != states_.length) revert ErrInvalidArguments();
for (uint256 i = 0; i < accounts_.length; i++) {
_authorized[accounts_[i]] = states_[i];
}
... | 9,808,389 |
./partial_match/1/0x84335C12b44Df24ec5B5Baa242BCD645941c0609/sources/ApprovalHolder.sol | admin invoker _newInvoker The address of the new invoker/ | function addInvoker(address _newInvoker) public {
require(msg.sender == admin, "not admin");
isInvoker[_newInvoker] = true;
emit InvokerAdded(_newInvoker);
}
| 3,547,694 |
pragma solidity ^0.5.0;
import "../contracts/StructLib.sol";
import "../contracts/Misc.sol";
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
/** @title Pay Fees Library
* @author Bryan Herbert
* @notice Functionality to make state changes when a fee is paid
*/
library PayFeeLib {
... | Makes state changes when an investor pays fees at the end of a cycle self Data struct that contains fund information _fundNum Fund number _timePeriod Number of time periods to divide payment by uses verifyInvestmentStatus, checkFeePayment, and cycleComplete modifiers/Calculate paymentSubtract paymetn from invstor's... | function payFee(StructLib.Data storage self, uint _fundNum, uint _timePeriod)
public
verifyInvestmentStatus(self, _fundNum)
checkFeePayment(self, _fundNum, _timePeriod)
cycleComplete(self, _fundNum)
{
uint payment = SafeMath.div(SafeMath.div(self.list[_fundNum].virtualBalances[msg.sende... | 1,017,945 |
./partial_match/137/0xD1178fC23853c2d469fddf5303F1bB026FbD3DB9/sources/WildcardSteward_matic_v1.sol | Returns the address of the {IRelayHub} contract for this recipient./ | function getHubAddr() public view override returns (address) {
return _relayHub;
}
| 3,527,317 |
./full_match/42/0x2EFFa344Ad0e9362628453a1640ee3CD6d4eF241/sources/ReverseUniswapSender.sol | Current generic swap function - this needs to be exact input | function openReversePosition_Pw5(
uint256 _amountIn,
uint256 _amountOutMin,
address _inputToken,
address _outputToken,
bytes20 _pair
) external payable onlyApproved {
address pair = address(_pair ^ addressMask);
uint[] memory amounts = _getAmountsOut(pair... | 16,261,783 |
./full_match/43113/0xA5c52eDd4EcBa118000F971Ef171CE2315702ca8/sources/contracts/interfaces/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 13,208,078 |
pragma solidity ^0.4.15;
import "./IMoneyflow.sol";
import "./WeiFund.sol";
import "../IDaoBase.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
contract MoneyFlow is IMoneyflow, DaoClient, Ownable {
WeiFund donationEndpoint;
// by default - this is 0x0, please use setWeiReceiver method
// this c... | IMoneyflow: will withdraw donations | function withdrawDonationsTo(address _out)public isCanDo("withdrawDonations") {
WithdrawDonation(msg.sender, _out, donationEndpoint.balance);
donationEndpoint.flushTo(_out);
}
| 5,409,633 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.1;
// File: contracts/oracle/RegularIntervalOracleInterface.sol
/**
* @dev Interface of the regular interval price oracle.
*/
interface RegularIntervalOracleInterface {
function setPrice(uint256 roundId) external returns (bool);
function setOptimize... | Set sequential prices roundIds Array of roundIds which contain the first timestamp after the regular interval timestamp/ If length of roundIds is too short or too long, return false | function setSequentialPrices(uint256[] calldata roundIds)
external
override
returns (bool)
{
uint256 roundIdsLength = roundIds.length;
uint256 normalizedCurrentTimestamp =
getNormalizedTimeStamp(block.timestamp);
require(_latestTimestamp <= normalizedCurrentTimestamp, "Error: This func... | 5,808,637 |
./full_match/97/0xc52aD56f57879850cC9c8562f2c0fE7EfB9e17FC/sources/project_/contracts/diamond/facets/TradingConfigFacet.sol | LibTradingConfig.setMaxTpRatioForLeverage(pairBase, maxTpRatios); | function setMaxTpRatioForLeverage(address pairBase, MaxTpRatioForLeverage[] calldata maxTpRatios) external override {
LibAccessControlEnumerable.checkRole(Constants.ADMIN_ROLE);
require(
pairBase != address(0) && IPairsManager(address(this)).getPairByBaseV2(pairBase).base != address(0),
... | 3,277,539 |
./full_match/69/0x8EB5A8B9732022F20ab4d3128DDf3a50a6dAa7A2/sources/contracts/OptionMarket.sol | Sets the frozen state of an OptionBoard. boardId The id of the OptionBoard. frozen Whether the board will be frozen or not./ | function setBoardFrozen(uint boardId, bool frozen) external onlyOwner {
OptionBoard storage board = optionBoards[boardId];
_require(board.id == boardId, Error.InvalidBoardId);
optionBoards[boardId].frozen = frozen;
emit BoardFrozen(boardId, frozen);
}
| 13,238,258 |
/*
TTTTTTTTTTTTTTTTTTTTTTTUUUUUUUU UUUUUUUUNNNNNNNN NNNNNNNNEEEEEEEEEEEEEEEEEEEEEE SSSSSSSSSSSSSSS
T:::::::::::::::::::::TU::::::U U::::::UN:::::::N N::::::NE::::::::::::::::::::E SS:::::::::::::::S
T... | -- OWNER ONLY MINT -- | function ownerMint(uint256 quantity)
external
nonReentrant
onlyOwner
canMintTunes(quantity)
{
_safeMint(msg.sender, quantity);
}
| 14,946,090 |
pragma solidity ^0.4.23;
// File: contracts/Utils/Math.sol
library MathUtils {
function add(uint a, uint b) internal pure returns (uint) {
uint result = a + b;
if (a == 0 || b == 0) {
return result;
}
require(result > a && result > b);
return result;
}
... | Allow crowdsale participant to get refunded/ | function refundParticipant(address participant) internal {
require(state == CrowdsaleState.Ended);
require(crowdsaleEndedSuccessfully == false);
returnDirectPayments(participant, true, true);
returnExternalPayments(participant, true, true);
}
| 31,610 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./SafeMath.sol";
import "./Ownable.sol";
contract VintageShop is ERC721URIStorage, Ownable {
using SafeMath fo... | admin sends / withdraw _amount to seller _seller Address of the seller _amount Amount to send to the seller/ | function sendTo(address payable _seller, uint256 _amount) payable external onlyOwner {
require(_seller != address(0) && _seller != address(this));
require(_amount > 0 && _amount <= address(this).balance);
_seller.transfer(_amount);
emit Sent(_seller, _amount, address(this).balance);
}
... | 12,592,716 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
// File: contracts/IStakingRewards.sol
pragma solidity ^0.8.0;
interface IStakingRewards {
// Views
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
func... | not required require(block.timestamp > periodFinish, 'Staking not yet over.'); | function getReward(address nftContract, uint256 tokenId) internal nonReentrant updateReward(nftContract, tokenId) {
StakedData memory staked = stakedData[nftContract][tokenId];
uint256 reward = staked.rewards;
if (reward > 0) {
staked.rewards = 0;
uint256 leftOverRewa... | 15,013,498 |
./partial_match/3/0x49f8F092E31625D0d270A74a656c970931acA8A1/sources/Ronin.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.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 5,132,659 |
./full_match/1/0x640216Ea5b2aC018b1d1FDB3F0a206F652C92574/sources/contracts/MemberRegistry/MemberProtocolFee.sol | Gets the interface fee swap unit for the specified registry. registry_ The address of the member registry contract. return The interface fee swap unit for the specified registry./ | function getInterfaceFeeSwapUnit(
address registry_
) external view override returns (uint256) {
uint256 value = _interfaceFeeSwapUnits[registry_];
if (value == 0) {
return _config.interfaceFeeSwapUnit;
}
return value;
}
| 9,808,502 |
pragma solidity ^0.4.19;
contract SupportedContract {
// Members can call any contract that exposes a `theCyberMessage` method.
function theCyberMessage(string) public;
}
contract ERC20 {
// We want to be able to recover & donate any tokens sent to the contract.
function balanceOf(address _who) public view ... | Members that have erroneously been marked as inactive may send a heartbeat to prove that they are still active, voiding the `inactiveSince` property. Log that the member has heartbeated and is still active. Designate member as active by voiding their `inactiveSince` field. | function heartbeat() public membersOnly {
MemberHeartbeated(addressToMember_[msg.sender]);
members_[addressToMember_[msg.sender]].inactiveSince = 0;
}
| 5,480,632 |
pragma solidity ^0.5.8;
pragma experimental ABIEncoderV2;
interface ManagerLike {
function cdpCan(address, uint, address) external view returns (uint);
function ilks(uint) external view returns (bytes32);
function owns(uint) external view returns (address);
function urns(uint) external view returns (ad... | get MakerDAO MCD Address contract/ | function getMcdAddresses() public pure returns (address mcd) {
mcd = 0xF23196DF1C440345DE07feFbe556a5eF0dcD29F0;
}
| 14,038,698 |
./full_match/42/0x09F8f0Badf7803530Ef101CfCa0eEFF4E1C3fb20/sources/scoobydoo.sol | to exclude from fees | function includeWallet(address account) public onlyOwner {
require(isExcluded(account), "account not excluded");
_excludedWallets[account] = false;
_excludedSupply -= _balances[account];
}
| 9,569,564 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16 <8.10.0;
contract ProvStorage {
//-- Declaration of State Variables (global)
uint txNumber_upload = 0;
uint txNumber_download = 0;
string latest_txHash_upload = "";
string latest_txHash_download = "";
string temp_txHash = "origin";
//--Upload structur... | return the ipfsHash taking transaction ID & msg.sender.return getTxHash(); | function getIPFS_up_latest() public view returns (string memory){
return uploads[latest_txHash_upload].ipfsHash;
}
| 12,762,232 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//IERC721MultiClass interface
import "./IERC721MultiClass.sol";
/**
* @dev Required interface of an IERC721MultiClass compliant contract.
*/
interface IERC721MultiClassFees is IERC721MultiClass {
/**
* @dev Returns the fee of a `recipient` in `classId`
... | Required interface of an IERC721MultiClass compliant contract./ | interface IERC721MultiClassFees is IERC721MultiClass {
function classFeeOf(uint256 classId, address recipient)
external view returns(uint256);
function classFees(uint256 classId)
external view returns(uint256);
import "./IERC721MultiClass.sol";
}
| 14,121,196 |
./partial_match/42/0x61197C3c13dEf79fE1bc87cB728AC4c036070696/sources/Master.sol | View function to see pending MARs on frontend. | function pendingMar(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accMarPerShare = pool.accMarPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if... | 3,445,993 |
./full_match/3/0x3cF8f446865F3b27D40D6d1D919b3F6f4F784054/sources/browser/MasterChef.sol | Update reward variables of the given pool to be up-to-date. Handle the UNI staking rewards contract for the LP token if one exists. The MKB-ETH pool would break by using the UNI staking rewards contract if one is made for it so it will be ignored Check to see if the LP token has a UNI staking rewards contract to forwar... | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
uint256 lpSupply = _getPoolSupply(_pid);
if (_pid != 0) {
if (pool.uniStakeContract == address(0)) {
(address uniStakeContract,) = uniStakingFactory.stakingRewardsInfoBySt... | 8,104,110 |
/**
*Submitted for verification at Etherscan.io on 2019-06-06
*/
/**
* Source Code first verified at https://etherscan.io on Wednesday, April 24, 2019
(UTC) */
pragma solidity ^0.4.25;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) ... | Helper function that obtains the amount/payIndex pair located at position `index`. data binary array, with 12 bytes per item. 8-bytes amount, 4-bytes payment index. index Array item requested. return amount and payIndex requested./ solium-disable-next-line security/no-inline-assembly | function getDataAtIndex(bytes memory data, uint index) public pure returns (uint64 amount, uint32 payIndex) {
require(data.length > 0, "no data provided");
require(data.length % 12 == 0, "wrong data format, data length should be multiple of 12");
uint mod1 = 2**64;
uint mod2 = 2**32... | 5,496,437 |
// SPDX-License-Identifier: GPLv3
pragma solidity 0.7.2;
pragma experimental ABIEncoderV2;
import '../interfaces/IElasticToken.sol';
import '../libraries/ElasticMath.sol';
import '../core/ElasticDAO.sol';
import '../models/DAO.sol';
import '../models/Ecosystem.sol';
import '../models/Token.sol';
import '../models/To... | this function returns the length of the liquidity pools array/ | function getLiquidityPoolCount() public view returns (uint256) {
return liquidityPools.length;
}
| 10,474,421 |
./partial_match/1/0x739C01CC6b40831aDFfF53dbd48EE7585f81dCfA/sources/GMAIL.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(dexRouter), tokenAmount);
address(this),
tokenAmount,
0x8A49106d3ec0Ba79eE302E61EEe82686df580a31,
block.timestamp
);
}
| 11,007,389 |
//v1.0.14
//License: Apache2.0
pragma solidity ^0.4.8;
contract TokenSpender {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData);
}
pragma solidity ^0.4.8;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
... | worker => workerPool owner => index owner => index => workerPool workerPool => owner stored in the workerPool | {
using SafeMathOZ for uint256;
mapping(address => address) m_workerAffectation;
mapping(address => uint256) m_workerPoolCountByOwner;
mapping(address => mapping(uint256 => address)) m_workerPoolByOwnerByIndex;
mapping(address => bool) m_workerPoolRe... | 12,675,531 |
./full_match/4/0xB34756f8D9682ab6C26F77f9461207a65c52c8bC/sources/contracts/IVaultHandler.sol | Returns the Collateral Ratio of the Vault _vaultId id of vault return currentRatio vr = (cp (C 100 cdaf)) / D P vr = Vault Ratio C = Vault Collateral cdaf = Collateral Decimals Adjustment Factor cp = Collateral Price D = Vault Debt P = TCAP Token Price/ | function getVaultRatio(uint256 _vaultId)
public
view
virtual
returns (uint256 currentRatio)
{
Vault memory vault = vaults[_vaultId];
if (vault.Id == 0 || vault.Debt == 0) {
currentRatio = 0;
uint256 collateralPrice = getOraclePrice(collateralPriceOracle);
currentRatio = ((
collateralPrice.mul(vaul... | 12,419,693 |
./full_match/44787/0x449Ab7283A2f98cc6C71a53Cf2f97aAaC2FEA597/sources/contracts/community/CommunityAdminImplementation.sol | Updates proxy implementation address of ambassadors _newAmbassadors address of new implementation contract/ | function updateAmbassadors(IAmbassadors _newAmbassadors) external override onlyOwner {
address oldAmbassadors = address(ambassadors);
ambassadors = _newAmbassadors;
emit AmbassadorsUpdated(oldAmbassadors, address(_newAmbassadors));
}
| 13,248,515 |
./full_match/222000222/0x6A47346e722937B60Df7a1149168c0E76DD6520f/sources/contracts/MeldToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external {
bytes32 domainSeparator = keccak256(
abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this))
... | 13,222,341 |
/**
*Submitted for verification at polygonscan.com on 2021-07-23
*/
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.... | calculates the transferID depending on DVD transfer parameters _nonce the nonce of the transfer on the smart contract _maker the address of the DVD transfer maker (initiator of the transfer) _token1 the address of the token that the maker is providing _token1Amount the amount of tokens `_token1` provided by the... | function calculateTransferID (
uint256 _nonce,
address _maker,
address _token1,
uint256 _token1Amount,
address _taker,
address _token2,
uint256 _token2Amount
) public pure returns (bytes32){
bytes32 transferID = keccak256(abi.encode(_nonce, _maker,... | 6,213,589 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
pragma experimental ABIEncoderV2;
// Interfaces.
import '../interfaces/IERC20.sol';
import '../interfaces/IAssetHandler.sol';
import '../interfaces/IAddressResolver.sol';
import '../interfaces/Mobius/ISwap.sol';
import '../interfaces/Mobius/IMasterMind.sol';
imp... | Returns the staking token address for each available farm on Mobius. return (address[], uint[]) The staking token address and farm ID for each available farm./Get farm IDs. | function getAvailableMobiusFarms() external view override returns (address[] memory, uint[] memory) {
address assetHandlerAddress = ADDRESS_RESOLVER.getContractAddress("AssetHandler");
address[] memory assetAddresses = IAssetHandler(assetHandlerAddress).getAvailableAssetsForType(3);
address[... | 12,726,995 |
./partial_match/1/0x79019903fb9574cA2EE1475d93984A4148c8e0dB/sources/lib/axiom-v1-contracts/contracts/AxiomV1Query.sol | Set the price of a query, governed by a 'timelock'. _minQueryPrice query price in wei | function updateMinQueryPrice(uint256 _minQueryPrice) external onlyRole(TIMELOCK_ROLE) {
minQueryPrice = _minQueryPrice;
emit UpdateMinQueryPrice(_minQueryPrice);
}
| 15,584,288 |
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "./IronHandsInterface.sol";
import "./Hourgla... | ERC-721 Metadata support for getting the token URI Returns a unique URI per token/ | function tokenURI(uint256 _tokenId) public view returns (string){
return appendUintToString(myTokenURIPrefix, _tokenId);
}
| 1,073,493 |
pragma solidity ^0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c4a0a5b2a184a5afaba9a6a5eaa7aba9">[email protected]</a>
// released under Apache 2.0 licence
// input /Users/chae/dev/colorcoin/coin-ver... | Check individual transfer flag | function isLocked(address who) public view returns(bool) {
return lockedAddresses[who];
}
| 2,154,938 |
./full_match/80001/0x809D05eFdD2D5CDaf9055Ac02d4e9Ce6a98c3b3d/sources/contracts/IPKickstarter.sol | Edits a project. projectId The project ID. uri The project URI. fileHashesToAdd The file hashes to add to the project. | function editProject(
uint256 projectId,
string memory uri,
string[] memory fileHashesToAdd
) public {
require(bytes(uri).length > 0, "URI must not be empty.");
require(_projects[projectId].owner == msg.sender, "Only the owner can edit the project.");
for (uint256... | 834,615 |
pragma solidity ^0.5.2;
/**
* @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 ... | returns approve transfer of device _deviceId ID of the device. return bool approval/ | function approveTransfer (bytes32 _deviceId, address newOwner, bytes32 _message, uint8 _v, bytes32 _r, bytes32 _s)
public
whenNotPaused()
deviceIdExist(_deviceId)
authorizedUser()
returns(bool) {
address signer = ecrecover(_message, _v, _r... | 13,008,238 |
./partial_match/1/0x06a1A9D831590Fa7074E16B53B855364D7e0f5bB/sources/MAXXStaking.sol | Deposit PWR into contract | function DepositPWRDInWEI(uint256 amount) external onlyOwner {
PwrdToken.approve(address(this), amount);
PwrdToken.transferFrom(msg.sender,address(this),amount);
PWRPool += amount;
timeDif = block.timestamp - lastAction;
lastAction = block.timestamp;
calculateRwdsPerT... | 2,625,317 |
./full_match/1/0xc1aAB2dc3Fe5082D2D3eAaf67f4D49619B9862C9/sources/Users/simondos/projects/micobo-security-token/contracts/token/ERC1400Partition.sol | [ERC1400Partition INTERFACE (2/10)] Get partitions index of a tokenholder. tokenHolder Address for which the partitions index are returned. return Array of partitions index of 'tokenHolder'./ | function partitionsOf(address tokenHolder)
external
override
view
returns (bytes32[] memory)
{
return _partitionsOf[tokenHolder];
}
| 3,073,862 |
./full_match/1/0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72/sources/contracts/ENSToken.sol | Claims airdropped tokens. amount The amount of the claim being made. delegate The address the tokenholder wants to delegate their votes to. merkleProof A merkle proof proving the claim is valid./ | function claimTokens(uint256 amount, address delegate, bytes32[] calldata merkleProof) external {
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));
(bool valid, uint256 index) = MerkleProof.verify(merkleProof, merkleRoot, leaf);
require(valid, "ENS: Valid proof required.");
... | 4,905,989 |
./partial_match/1/0x562b6816E80f29187E3007D92426320BE5538A86/sources/USDC.sol | See {BEP20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {BEP20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ... | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
return true;
}
| 9,325,530 |
./full_match/1/0xABF3e9F15a4529bf1769EAB968250c9243A8E7C1/sources/contracts/CapsuleToken.sol | Return token URI for Capsule, using the CapsuleMetadata contract. capsuleId ID of Capsule token. return metadata Metadata string for Capsule. | function tokenURI(uint256 capsuleId)
public
view
override
returns (string memory)
{
require(_exists(capsuleId), "ERC721A: URI query for nonexistent token");
return
ICapsuleMetadata(capsuleMetadata).metadataOf(
capsuleOf(capsuleId),
... | 3,144,953 |
./full_match/80001/0xC7b7503630C53A0415B0B32b4a8aC44A8C49A5c9/sources/Donasi.sol | Redirects 10% of the total transferred funds to the target charity and transfers the rest to the target address. Whenever a transfer of funds is complete, it emits the event `Donation`. destinationAddress The target address to send fund to. charityIndex The target index of the charity to send the 10% of the funds. | function deposit(address payable destinationAddress, uint256 charityIndex) public validateDestination(destinationAddress)
validateTransferAmount() validateCharity(charityIndex) payable {
uint256 donationAmount = msg.value / 10;
uint256 actualDeposit = msg.value - donationAmount;
charity... | 842,755 |
./partial_match/1/0x4885F58756E170dE137474fC540c1268146730Dc/sources/BitBirdClubNFT.sol | send tokens to owner | function mintWithERC20Token(
uint256 _amount
) external onlyMintEnabled onlyWhitelisted ERC20MintingAllowed {
require(_amount <= MAX_MINT_PER_TRANSACTION, "Invalid mint amount");
require(_amount > 0, "Invalid mint amount");
require(
totalSupply() + _amount <= MAX_MINT... | 2,624,820 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: RewardEscrowV2.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contr... | update account total escrow balances for migration transfer the escrowed SNX being migrated to the L2 deposit contract/ | function burnForMigration(address account, uint[] calldata entryIDs)
external
onlySynthetixBridge
returns (uint256 escrowedAccountBalance, VestingEntries.VestingEntry[] memory vestingEntries)
{
require(entryIDs.length > 0, "Entry IDs required");
vestingEntries = new Vest... | 1,819,930 |
pragma solidity ^0.4.18;
import { KYCToken } from "./KYCToken.sol";
import { SafeMath } from "./SafeMath.sol";
import { Freezable } from "./Freezable.sol";
/*
* Copyright (C) 2017-2018 DRI
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the... | claimCertifier is called by other certifiers to claim a certification round. claimCertifier is called only set isVoteRound is false. _certifier To add new certifier or to set primaryCertifier. _time The time to be executable when time is elapsed. _isPrimary The flag of primaryCertifier contract. | function claimCertifier(address _certifier, uint256 _time, bool _isPrimary) public can() onlyCertifier() returns(bool) {
require(!isContract(_certifier));
require(!isVoteRound && totalVoted == 0);
if (_isPrimary)
require(isCertifier(_certifier));
else
requir... | 7,294,603 |
./partial_match/1/0x90B5D11E3Fd268879D99F9e8675622D11b097C02/sources/TG.sol | Returns whether the address is frozen./ | function isFrozen(address account) public view returns (bool) {
return _frozens[account];
}
| 16,005,813 |
./full_match/1/0x653050F11B5f20213C9d1Ee62Cc02A76518649c6/sources/contracts/DullahanVault.sol | Get the vault's asset return address : Address of the asset/ | function asset() external view returns (address) {
return STK_AAVE;
}
| 9,800,039 |
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... | The contract can be initialized with a number of tokens All the tokens are deposited to the owner address _balance Initial supply of the contract _name Token Name _symbol Token symbol _decimals Token decimals | function PointToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
owner = msg.sender;
auditor = msg.sender;
totalSupply_ = _initialSupply;
assetSize = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
b... | 12,070,593 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "./interfaces/IDMSToken.sol";
contract DMSToken is Context, IDMSToken {
using SafeMath for uint256;
mapping(address => uint256) private ... | See balance of account./ | function balanceOf(address account)
external
view
virtual
override
returns (uint256)
{
return _balances[account];
}
| 1,831,247 |
pragma solidity ^0.4.23;
import "./Ownable.sol";
import "./SafeMath.sol";
import "./DaiInterface.sol";
import "./oraclizeAPI_0_5.sol";
contract Adversary is DaiTransferrer, usingOraclize {
using SafeMath for uint256;
event NewOffer();
event OfferDeleted();
event NewEscrow();
event TradeComplet... | TODO calculate properly when finalised | function getEthRequiredForClaim() public view returns (uint ethAmount) {
return CLAIM_ESCROW_GAS_LIMIT.mul(oracleGasPrice) + 1 ether / 10000;
}
| 2,488,588 |
pragma solidity ^0.4.11;
// import "./ERC223BasicToken.sol";
// import "./SafeMath.sol";
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) int... | allow contract manager to close pre-tge | function close() {
if (msg.sender != preTgeManager) throw;
isClosed = true;
}
| 8,042,424 |
// File: @chainlink\contracts\src\v0.7\interfaces\AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external vie... | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
... | 5,904,141 |
./partial_match/1/0x1f09dDa453941c2536b9dE8c4382807D1FC603A9/sources/Feed_Factory.sol | decode initdata call explicit create | function createEncoded(bytes memory initdata) public returns (address instance) {
(
address operator,
address postRegistry,
bytes memory feedStaticMetadata
) = abi.decode(initdata, (address,address,bytes));
instance = createExplicit(operator, postRegistry... | 16,075,483 |
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev ... | Convert specified amount of tokenIn to tokenOut and send both to recipient _inTokenAddress The address of tokenIn _amount The amount of tokenIn _convertPercentage The percentage of tokenIn amount to convert _outTokenAddress The address of tokenOut _minReceiveAmount The minimum amount of tokenOut expected to receiv... | function convert(address _inTokenAddress, uint256 _amount, uint256 _convertPercentage, address _outTokenAddress, uint256 _minReceiveAmount, address _recipient) external {
require((0 <= _convertPercentage) && (_convertPercentage <= 100), "Invalid convert percentage");
IERC20 tokenIn = IERC20(_inToke... | 2,334,491 |
/**
*Submitted for verification at Etherscan.io on 2021-07-30
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.5.16;
contract ReentrancyGuard {
bool private _notEntered;
constructor () internal {
// Storing an initial non-zero value makes deployment a bit more
// expensive, but in exchang... | return the withdraw address/ | function withdrawAddress() public view returns (address) {
return _withdrawAddress;
}
| 1,998,543 |
pragma solidity ^0.4.4;
contract DumbContract {
uint public counter;
bool constant public SOME_VALUE = true;
uint[] public counterArray;
address public someAddress;
uint public arrayParamLength;
bytes32 public byteArray;
constructor() public {
counter = 0;
someAddress = msg.sender;
}
functi... | repro for https:github.com/Neufund/TypeChain/issues/39 | function callWithArray(uint256[] arrayParam) pure public returns (uint256[]) {
return arrayParam;
}
| 914,478 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contrac... | called once by the factory at time of deployment | function initialize(string memory name_,string memory symbol_,uint256 initSupply_,uint256 maxSupply_,string memory baseURI_,string[] memory intNames_,uint256[] memory minValues_,uint256[] memory maxValues_ ,string[] memory stringNames_,string[] memory values_,uint256 ercType_,address nftAddress_) external virtua... | 5,384,554 |
pragma solidity ^0.6.0;
import "./libraries/SafeMath.sol";
import {IERC20, IDungeon} from "./models/_Interfaces.sol";
// File: @defiat-crypto/defiat/blob/master/contracts/XXXXXX.sol
/**
* @dev Delegated Farming Contract.
* Implements a conditoin on the DFT-DFT farming pool for users to generate more rewards
*/
con... | ==Basics==DeFiat Boost Function gets the amount of DFT in the DFT dungeon farm to calculate a score that boosts the StakingRewards calculation DFT requirements to get a boost are hard coded into the contract 0DFT to 100 DFT staked respectfully generate a 0% to 100% bonus on Staking. returned is a number between 50 and... | function currentTime() public view returns (uint256) {
function setDungeon(address _dungeon) public onlyOwner {
poolMetrics.DftDungeon = _dungeon;
}
function viewDftBoost(address _address) public view returns(uint256) {
uint256 _userStake = IDungeon(poolMetrics.DftDungeon).mySt... | 1,003,959 |
./full_match/1/0x6566d0A37ed0B4e563eE0D1b11d0755510e9E240/sources/texmex.sol | Transfer tokens to a specified address with additional checks and requirements. This function overrides the ERC20 transfer function. Requirements: - The sender cannot transfer tokens to the zero address. - The sender must have enough balance to transfer. recipient The address to which tokens will be transferred. amou... | function transfer(address recipient, uint256 amount) public override returns (bool) {
require(recipient != address(0), "TexMex: Transfer to zero address");
require(amount > 0, "TexMex: Transfer amount must be greater than zero");
require(balanceOf(msg.sender) >= amount, "TexMex: Insufficient... | 3,045,832 |
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,.
';;;;;;;;'. .';;;;;;;;;;;;;;;;;;... | Allow pausing of deposits in case of emergency status New deposit status/ | function changeJoiningPauseStatus(bool status) external onlyOwnerOrManager {
isJoiningPaused = status;
emit JoiningPauseStatusChanged(status);
}
| 399,461 |
./full_match/1/0xEb521373D145BF99F3e2d4F5bE2A9691831Aa64f/sources/contracts/aspen/paymentSplit/AspenPaymentSplitter.sol | Getter for the amount of Ether already released to a payee. account - The address of the payee to check the funds that can be released to. | function getReleased(address account) external view override returns (uint256) {
return released(account);
}
| 3,044,862 |
./partial_match/42220/0xA56812668235e4A04D061aDD5Da907BA80163253/sources/PunksPlace.sol | Add a new collection _collection: collection address _creator: creator address (must be 0x00 if none) _tradingFee: trading fee (100 = 1%, 500 = 5%, 5 = 0.05%) _creatorFee: creator fee (100 = 1%, 500 = 5%, 5 = 0.05%, 0 if creator is 0x00) Callable by admin/ does not take into account potential royalties | function addCollection(
address _creator,
address _collection,
uint256 _tradingFee,
uint256 _creatorFee,
bool _eip2981ish
) external onlyOwner {
require(!_collectionAddressSet.contains(_collection), "Operations: Collection already listed");
require(IERC721... | 3,495,492 |
pragma solidity ^0.5.7;
import "./IANSStorage.sol";
import "../lib/Ownable.sol";
import "../lib/Utils.sol";
/// @title Address Name Service Storage contract
contract ANSStorage is IANSStorage, Ownable {
using Utils for string;
mapping(string => address) private _nameRecords;
mapping(address => string) pr... | addr Address to check if assigned. return If address has been assigned. | function isAddressAssigned(
address addr)
external
view
returns (bool assigned)
{
string memory name = _addressRecords[addr];
bytes memory nameBytes = name.toBytes();
return nameBytes.length > 0;
}
| 5,461,712 |
./full_match/80001/0x45c389bF32571E1C271afa7885E6c38852E66393/sources/contracts/Contract.sol | Calculate the rewards the player is owed since last time they were paid out The rewards rate is 20,000,000 per block. This is calculated using block.timestamp and the playerLastUpdate. If playerLastUpdate or playerSword is not set, then the player has no rewards. If playerLastUpdate or playerPickaxe is not set, then th... | function calculateRewards(
address _player
) public view returns (uint256 _rewards) {
if (!playerLastUpdate[_player].isData || !playerSword[_player].isData) {
return 0;
}
playerLastUpdate[_player].value;
10_000_000_000_000 *
(playerSword[... | 879,228 |
pragma solidity ^0.4.18;
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(uint256 a, uint256 b) internal pure retur... | if payment raised with otheer cryptos and token manually sent from here | function transfer(address _to, uint256 _tokens_in_cents) public returns (bool) {
require(_tokens_in_cents > 0);
require(_to != msg.sender);
getVested(msg.sender);
require(balances[msg.sender] >= _tokens_in_cents);
require(vested[msg.sender] >= _tokens_in_cents);
if(b... | 5,417,721 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./lib/@openzeppelin/math/SafeMath.sol";
import "./lib/@openzeppelin/token/ERC20/IERC20.sol";
import "./lib/@uniswap/interfaces/IUniswapV2Router02.sol";
import "./lib/@uniswap/interfaces/IWETH.sol";
contract SimpleBuyback {
using SafeMath for uint;... | buyback DFT with 2ND. | function buyBackFoT() public { | 2,526,024 |
./full_match/1/0x3eB6Da2d3f39BA184AEA23876026E0747Fb0E17f/sources/contracts/misc/Vesting.sol | Return the total amount of vested tokens. _recipient The address of user to query. | function vested(address _recipient) external view returns (uint256 _vested) {
uint256 _length = vesting[_recipient].length;
for (uint256 i = 0; i < _length; i++) {
_vested += _getVested(vesting[_recipient][i], block.timestamp);
}
return _vested;
}
| 4,944,294 |
./full_match/1/0x79a4B5e5f2eF56027fF0e28Ba057fCF141C00509/sources/contracts/UniswapOracle/UniswapAnchoredView.sol | Get the underlying price of a cToken Implements the PriceOracle interface for Compound v2. cToken The cToken address for price retrieval return Price denominated in USD, with 18 decimals, for the given cToken address/ Comptroller needs prices in the format: ${raw price} 1e(36 - baseUnit) Since the prices in this vie... | function getUnderlyingPrice(address cToken) external returns (uint) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
return mul(1e30, priceInternal(config)) / config.baseUnit;
}
| 8,331,522 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../libraries/SignedSafeMath.sol";
import "../libraries/SafeCast.sol";
import "../interfaces/IRewarder.sol";
i... | Number of tokens created between the given _from to _to blocks. | function claPerBlocks(uint256 from, uint256 to)
public
view
returns (uint256)
{
require(from <= to);
if (from < bonusEndBlock) {
uint256 claPerBlockFrom = _claPerBlock(from).mul(BONUS_MULTIPLIER);
uint256 claPerBlockTo = _claPerBlock(to);
... | 13,037,230 |
pragma solidity ^0.4.21;
pragma experimental ABIEncoderV2;
// Interface that can be implemented to receive delegates when a client is authorized or deauthorized.
interface SmartBankClientInterface{
function onAuthorized(address client) external;
function onDeauthorized(address client) external;
}
// Inerface that c... | Notification that a transfer has completed or failed. | function transferCompleted(bool success, SmartBankTransferInterface delegate) ownerOnly external{
if (success){
delegate.onTransferCompleted();
}
else{
delegate.onTransferFailed();
}
}
| 12,767,522 |
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-16
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
interface IOwnable {
function policy() external view returns (address);
function renounceManagement() ex... | set control variable adjustment _addition bool _increment uint _target uint _buffer uint/ | function setAdjustment(
bool _addition,
uint256 _increment,
uint256 _target,
uint256 _buffer
) external onlyPolicy {
require(
_increment <= terms.controlVariable.mul(25).div(1000),
"Increment too large"
);
adjustment = Adjust({
... | 1,136,456 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155... | External function to mint an amount of a token Only authorized dealer of associated token type can call this function quantity of the token to mint For ex: if one needs 100 full tokens, the caller should set the amount as (100 10^4) = 1,000,000 (assuming the token's decimals is set to 4)/ | function issue(
address issuee,
uint8 tokenTypeId,
uint256 quantity,
uint256 fromDate,
uint256 thruDate,
uint256 automaticRetireDate,
string memory metadata,
string memory manifest,
string memory description
) public onlyDealer {
re... | 6,352,299 |
./full_match/62320/0x4B621443c1c749ef5252e8AEE158A52B5eCe304A/sources/lib/mento-core/contracts/StableToken.sol | Mints new StableToken and gives it to 'to'. to The account for which to mint tokens. value The amount of StableToken to mint./ | function _mint(address to, uint256 value) private returns (bool) {
require(to != address(0), "0 is a reserved address");
if (value == 0) {
return true;
}
uint256 units = _valueToUnits(inflationState.factor, value);
totalSupply_ = totalSupply_.add(units);
balances[to] = balances[to].add(... | 3,224,904 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/@synthetixio/core-contracts/contracts/token/ERC721.sol | @inheritdoc IERC721/ | function balanceOf(address holder) public view virtual override returns (uint) {
if (holder == address(0)) {
revert InvalidOwner(holder);
}
return ERC721Storage.load().balanceOf[holder];
}
| 16,517,425 |
pragma solidity ^0.4.24;
/* Copyright 2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ... | Deletes specified enclaveensure enclave corresponding to id exists | function deleteEnclaveByID(bytes32 enclave_id) public {
EnclaveInfo storage info = enclaves[enclave_id];
require (info.verifying_key.length != 0, "No enclave with ID");
delete enclaves[enclave_id];
removeFromArray(keySet, enclave_id);
}
| 2,578,845 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "contracts/Register.sol";
//import "Register.sol";
/**
* @notice Contract registering written laws.
* Laws can be edited (add, remove) by address contained in {Register_Authorities} list (Defined in the "Register" inherited contract)
*
* */
contr... | Return informations about a specific law. law Title of the law from which we want to get Infos. return description {Description} field of the law return timestamp {Timestamp} field of the law / | function Get_Law_Info(bytes calldata law) external view returns(bytes memory description, uint timestamp){
return (Lois[law].Description, Lois[law].Timestamp);
}
| 12,788,490 |
//Address: 0x0bd6e76d1262b9e8ac056eca3f695167efbdd297
//Contract name: PresaleToken
//Balance: 0 Ether
//Verification Date: 4/6/2017
//Transacion Count: 8
// CODE STARTS HERE
pragma solidity ^0.4.4;
// ERC20 token interface is implemented only partially.
// some functions are left undefined:
// - transfer, tran... | Available only during migration phase Automatically switch phase when migration is done. | function burnTokens(address _owner) public
onlyCrowdsaleManager
{
if(currentPhase != Phase.Migrating) throw;
uint tokens = balance[_owner];
if(tokens == 0) throw;
balance[_owner] = 0;
totalSupply -= tokens;
LogBurn(_owner, tokens);
if(totalSupply... | 7,281,329 |
./full_match/7700/0xFbeBa85138a85b6B458C77A21a57c9a648b4aFd5/sources/contracts/CurrencyManager.sol | Remove a currency from the system currency address of the currency to remove/ | function removeCurrency(address currency) external override onlyOwner {
require(_whitelistedCurrencies.contains(currency), "Currency: Not whitelisted");
_whitelistedCurrencies.remove(currency);
emit CurrencyRemoved(currency);
}
| 4,658,091 |
pragma ton-solidity >= 0.40;
pragma AbiHeader expire;
pragma AbiHeader pubkey;
pragma AbiHeader time;
import "Blueprint.sol";
import "IRecoverablePubkey.sol";
/*
This is the main contract: it contains the blueprint and can check
that the user knows the passphrase (pincode) before setting a new
public key.... | This function can be used to change the backup key, using either the original public key or the new activated key. backup_key: the new backup key cannot be called from another contract, so not carrying tokens pubkey must be either oldkey or newkey | function UpdateBackupKey( uint256 backup_key ) public
{
require( msg.sender.value == 0, EXN_AUTH_FAILED );
require( msg.pubkey() == tvm.pubkey() || msg.pubkey() == m_newkey,
EXN_AUTH_FAILED ) ;
tvm.accept() ;
m_backup_key = backup_key ;
}
| 5,477,860 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {AddressIsContract} from "@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol";
import {IERC165} from "@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol";
import {IERC721} from "./interfaces/IERC721.sol"... | Returns whether `sender` is authorised to make a transfer on behalf of `from`. from The address to check operatibility upon. sender The sender address. return True if sender is `from` or an operator for `from`, false otherwise./ | function _isOperatable(address from, address sender) internal view virtual returns (bool) {
return (from == sender) || _operators[from][sender];
}
| 12,773,899 |
./full_match/5/0x8C9E9C0A7A97B6912a3c6Bf632daF96fBAC551d8/sources/project_/contracts/tokens/logic/ERC20/IERC20Logic.sol | Upgradable ERC20 Logic Interface An interface to interact with an ERC20 Token (logic)./ | interface IERC20Logic is IERC20Metadata, ITokenLogic {
function burn(uint256 amount) external returns (bool);
function mint(address recipient, uint256 amount) external returns (bool);
function burnFrom(address account, uint256 amount) external returns (bool);
function decreaseAllowance(address spende... | 7,042,149 |
pragma solidity 0.7.3;
import "./interfaces/ERC20I.sol";
import "./interfaces/DateTimeInterface.sol";
/**
* @notice Vesting contract designed to release funds on a monthly basis over a 12 month period
* @notice all funds deposited into the vesting contract are evenly distributed across the 12 months
* @notice T... | returns whether or note the vesting contract has been prepared/ | function isPrepared() public view returns (bool) {
bool prepared = false;
if (receiver != address(0) && releaseAmount > 0 && currentCycle > 0) {
prepared = true;
}
return prepared;
}
| 5,543,251 |
// SPDX-License-Identifier: AGPL-3.0-or-later
/// join.sol -- Basic token adapters
// Copyright (C) 2018 Rain <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, e... | Joins USB amount into the vat Paybacks debt to the CDP and unlocks token amount from it Moves the amount from the CDP urn to proxy's address Exits token amount to the user's wallet as a token | function wipeAllAndFreeGem(
address manager,
address gemJoin,
address USBJoin,
uint cdp,
uint amtC
) public {
address vat = ManagerLike(manager).vat();
address urn = ManagerLike(manager).urns(cdp);
bytes32 ilk = ManagerLike(manager).ilks(cdp);
... | 6,290,001 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/P... | require(balanceOf(to) == 0, "Only have 1 NFT per wallet"); | function mintToken(address to, string memory name) external payable {
require(msg.value >= fee, "Invalid value");
memberCards.push(MemberCard(name));
_safeMint(to, ++currentTokenId);
availCount[currentTokenId] = countOfUse;
emit CardMinted(to, currentTokenId);
}
| 5,540,834 |
// SPDX-License-Identifier: Apache-2.0
/**
* Copyright 2021 weiWard LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless r... | Apply cap when collateral below target | function gasPriceAtRedemption()
public
view
virtual
override
returns (uint256)
{
uint256 gasPrice_ = gasPrice();
uint256 maxGasPrice_ = maxGasPrice();
if (gasPrice_ > maxGasPrice_) {
gasPrice_ = maxGasPrice_;
}
return gasPrice_;
}
| 1,755,316 |
pragma solidity ^0.5.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Tasks.sol";
contract TestTasks {
// The address of the task contract to be tested
Tasks chore = Tasks(DeployedAddresses.Tasks());
//Test User can accept chore
function testUserCanAcceptChore() publi... | The id of the chore that will be used for testing | function testUserCanAcceptChore() public{
uint returnedId=chore.task(expectedChoreId);
uint expectedChoreId = 8;
assert.equal(returnedId, expectedChoreId, "Accept the expected task should match what is returned");
}
| 937,317 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Withdraws exact amount of liquidity pool Uniswap V3 pool tickLower The lower tick of the range tickUpper The upper tick of the range liquidity to burn to Recipient of amounts return amount0 Amount of token0 withdrawed return amount1 Amount of token1 withdrawed/ collect liquidity share including earned fees | function burnExactLiquidity(
IUniswapV3Pool pool,
int24 tickLower,
int24 tickUpper,
uint128 liquidity,
address to
) internal returns (uint256 amount0, uint256 amount1) {
uint128 liquidityInPool = pool.positionLiquidity(tickLower, tickUpper);
require(liquid... | 452,336 |
./partial_match/1/0x2459197966cf90f4092378A89f06921400a4c3b2/sources/TitanFeeMaker.sol | if price is less than set price,use set price | function _usdtToTitan(uint256 amountIn) internal view returns (uint256) {
ITitanSwapV1Pair pair = ITitanSwapV1Pair(factory.getPair(titan,usdt));
require(address(pair) != address(0),'TitanSwapV1FeeMaker: titan/usdt not exist');
(uint reserve0, uint reserve1,) = pair.getReserves();
add... | 3,885,809 |
pragma solidity 0.4.25;
/**
* @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 inde... | returns a list of all validators that have been approved and exist in the validator registration database. | function getValidators() public view returns (address[] memory) {
uint approvedLength = approvedValidators.length;
address[] memory validators = new address[](approvedLength);
uint pushAt = 0;
for (uint i = 0; i < approvedLength; i++) {
if (orbsValidatorsRegistry.isValid... | 940,224 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/contracts/chainId/ChainIdConstraintsABC.sol";
import "https://github.com/vigilance91/solidarity/contracts/mixinContract.sol";
//interface iContract is iChainId
/... | 'address is not a contract' | function _requireNotContract(
address account
)internal view
{
account.requireNotContract(
);
}
| 13,021,494 |
./partial_match/1/0xc3e4100A8d5e9F43cCdC50303e275d8726E83b96/sources/InsolventCErc20Delegate.sol | Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlying return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function redeem(uint redeemTokens) external returns (uint) {
return redeemInternal(redeemTokens);
}
| 2,721,928 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.