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/56/0xD50aAb6B210fe049B6c5262f5A7676204699AB8E/sources/Vault.sol | Create a new farming position to unlock your yield farming potential. id The ID of the position to unlock the earning. Use ZERO for new position. worker The address of the authorized worker to work for this position. loan The amount of Token to borrow from the pool. maxReturn The max amount of Token to return to th... | function work(uint256 id, address worker, uint256 principalAmount, uint256 loan, uint256 maxReturn, bytes calldata data)
external payable
onlyEOA transferTokenToVault(principalAmount) accrue(principalAmount) nonReentrant
{
require(fairLaunchPoolId != uint256(-1), "work: poolId not set");
if (id == 0... | 11,079,629 |
./full_match/1/0xd9dF2211b576D430FAb3BD93f915a1345974D797/sources/contracts/v1/governance/PRTCLVotes.sol | Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to` should be zero. Total supply of voting units will be adjusted with mints and burns./ | function _transferVotingUnits(
address from,
address to,
uint256 amount,
uint256 collectionId
) internal virtual {
if (from == address(0)) {
_collectionTotalCheckpoints[collectionId].push(_add, amount);
}
if (to == address(0)) {
_co... | 8,408,850 |
pragma solidity ^0.4.18;
// here we are building a simple OTP verification system, that can be integrated into many other systems
// a One Time Password is created as follows:
// user generates many bytes of randomness (can print it out as a QR-code or something)
// user creates a relatively complex password
// use... | verify an OTP, and set up another OTP set the OTP to the new OTP as specified by the user raise an event and return true | function OTPVerify_NEW(bytes verifyOTPRoot, bytes32 newOTPRoot, uint256 newRootLength) public returns(bool success){
if (keccak256(verifyOTPRoot) == userOTPMapping[msg.sender].currentRoot && newRootLength > 1 && newOTPRoot != 0x0 ){
OTPInit(newOTPRoot, newRootLength);
OTPVerificationSuccessful(true);
retur... | 12,857,862 |
/*
-----------------------------------------------------------------
FILE HEADER
-----------------------------------------------------------------
file: Havven.sol
version: 1.0
authors: Anton Jurisevic
Dominic Romanowski
Mike Spain
date: 2018-02-05
checked: Mike Spain
appr... | Override ERC20 transferFrom function in order to perform fee entitlement recomputation whenever balances are updated. / Perform the transfer: if there is a problem, an exception will be thrown in this call. Zero-value transfers still update fee entitlement information, and may roll over the fee period. | function transferFrom(address from, address to, uint value)
external
preCheckFeePeriodRollover
optionalProxy
returns (bool)
{
uint senderPreBalance = state.balanceOf(from);
uint recipientPreBalance = state.balanceOf(to);
_transferFrom_byProxy(messageSende... | 1,230,151 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts-upgradeable/acces... | Returns to normal state. Requirements: - The contract must be paused./ | function unpause() external onlyOwner {
require(paused, "not paused");
paused = false;
emit Unpaused(_msgSender());
}
| 11,808,176 |
./full_match/1/0x04ddDb0C0194b3517Dd09300440748D8B9f6f3F3/sources/rubixSniper.sol | See { IERC20-approve} . Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 9,760,644 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@o... | Sets a new URI for all token types, by relying on the token type ID substitution mechanism By this mechanism, any occurrence of the `\{id\}` substring in either the URI or any of the amounts in the JSON file at said URI will be replaced by clients with the token type ID. interpreted by clients as for token type ID 0x4c... | function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
| 11,467 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract KeyInds {
//START Owner block
address private owner;
event OwnerSet(address indexed oldOwner, address indexed newOwner);
event Beacon();
modifier isOwner() {
require(msg.sender == owner, "Calle... | START international_reserves_of_the_russian_federation | function get_international_reserves_of_the_russian_federation() public view returns(string memory){
return international_reserves_of_the_russian_federation;
}
| 15,830,542 |
./full_match/5/0xA0E69f8Cf9f8F8555e1Bd0983214871e674ac30F/sources/contracts/tenderswap/TenderSwap.sol | @inheritdoc ITenderSwap | function swap(
IERC20 _tokenFrom,
uint256 _dx,
uint256 _minDy,
uint256 _deadline
) external override nonReentrant deadlineCheck(_deadline) returns (uint256) {
if (_tokenFrom == token0.token) {
return SwapUtils.swap(token0, token1, _dx, _minDy, amplificationPar... | 7,038,721 |
./partial_match/1/0x1E8e47B56C4C11A776e8D8EF502529D6305D640e/sources/EthereumDeposit.sol | This will be used for deposit | function () external payable {
require(msg.value <= maxLimit, "Value greater then max limit");
emit Deposit(msg.value);
}
| 4,000,794 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
import {Ownable} from "../lib/Ownable.sol";
import {SafeMath} from "../lib/SafeMath.sol";
import {SafeERC20} from "../lib/SafeERC20.sol";
import {Decimal} from "../lib/Decimal.sol";
import {IERC20} from "../token/IERC20.sol";
... | Setting each variable invididually means we don't overwrite | function stake(
uint256 _amount,
uint256 _positionId
)
external
updateReward(msg.sender, address(0))
{
uint256 totalBalance = balanceOf(msg.sender).add(_amount);
Staker storage staker = stakers[msg.sender];
if (staker.positionId != 0) {
r... | 12,707,269 |
pragma solidity ^0.4.24;
import "./Storage.sol";
contract BytesStorageLogic is Storage {
event BytesUpdated(address indexed factProvider, bytes32 indexed key);
event BytesDeleted(address indexed factProvider, bytes32 indexed key);
/// @param _key The key for the record
/// @param _value The value for... | _factProvider The fact provider _key The key for the record | function getBytes(address _factProvider, bytes32 _key) external view returns (bool success, bytes memory value) {
return _getBytes(_factProvider, _key);
}
| 918,820 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/PLBTStaking/IPLBTStaking.sol";
import "./interfaces/DAO/IDAO.sol";
import "./sushiswap/IUniswapV2Router02.sol";
import "./gysr... | @inheritdoc IPoolFactory/ | function treasury() external view override returns (address) {
return _treasury;
}
| 558,464 |
pragma solidity ^0.5.0;
import "./AssetTransferInterface.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/roles/MinterRole.sol";
/**... | Set the token to TransferOut state The asset changes state Here -> TransferOut. Callable by the asset owner tokenId The token idbytes memory data = abi.encode(tokenId);emit InterledgerEventSending(tokenId, data); | function transferOut(uint256 tokenId) public _existingAsset(tokenId) {
require(ownerOf(tokenId) == msg.sender, "GameToken: Only then owner of this token can perform this operation");
require(assetMap[tokenId].state == State.Here, "GameToken: tokenId must be in Here state");
assetMap[tokenI... | 13,120,871 |
pragma solidity ^0.4.4;
import "zeppelin/contracts/SafeMath.sol";
import "zeppelin/contracts/ownership/Ownable.sol";
import "./PATToken.sol";
// This ICO contract has been inspired by the EOS one
// https://github.com/EOSIO/eos-token-distribution/blob/master/src/eos_sale.sol
contract ICOSale is Ownable {
using Sa... | Allow backers to get their tokens Someone is claiming to early! No need to continue if the total invested of the day is 0 Does the sender already claimed its tokens? Reward backer No need to mint, the contract will own its PAT Log that | function claimByDay(uint day) {
var currentDay = now * 1 days;
if (day > currentDay) throw;
if (dailyTotal[day] == 0) throw;
if (userClaimed[day][msg.sender]) throw;
var totalInvested = dailyTotal[day];
var senderInvested = userInvests[day][msg.sender];
var price = tokensByDay(day).di... | 12,668,756 |
./partial_match/80001/0x7C682dd6E5d569C2e38EA148032098B839B11c9F/sources/contracts/libraries/SafeCast.sol | Cast a uint128 to a int128, revert on overflow y The uint128 to be downcasted return z The downcasted integer, now type int128 | function toInt128(uint128 y) internal pure returns (int128 z) {
require((z = int128(y)) >= 0);
}
| 8,801,440 |
./full_match/1/0xF560151670eB5997a5a0C211Ed13B98103aF095A/sources/localhost/compound/CompoundLoanInfo.sol | Information about cTokens _cTokenAddresses Array of cTokens addresses return tokens Array of cTokens infomartion | function getFullTokensInfo(address[] memory _cTokenAddresses) public view returns(TokenInfoFull[] memory tokens) {
tokens = new TokenInfoFull[](_cTokenAddresses.length);
for (uint i = 0; i < _cTokenAddresses.length; ++i) {
(, uint collFactor) = comp.markets(_cTokenAddresses[i]);
... | 9,715,571 |
./full_match/5/0x654e6dF111F98374d9e5d908D7a5392C308aA18D/sources/contracts/L1/rollup/CanonicalTransactionChain.sol | Adds a transaction to the queue. _target Target L2 contract to send the transaction to. _gasLimit Gas limit for the enqueued L2 transaction. _data Transaction data./ Transactions submitted to the queue lack a method for paying gas fees to the Sequencer. So we need to prevent spam attacks by ensuring that the cost of... | function enqueue(
address _target,
uint256 _gasLimit,
bytes memory _data
) external {
require(
_data.length <= MAX_ROLLUP_TX_SIZE,
"Transaction data size exceeds maximum for rollup transaction."
);
require(
_gasLimit <= maxTran... | 1,961,188 |
./partial_match/4/0xB13907655743481ACe49b4A3369733B0f4fa358E/sources/MIDP2P.sol | the trade this is an internal function _orderId the id of the order to fill _makerAmount maker order amount _takerAmount taker order amount _makerAsset the order maker asset _takerAsset the order taker asset report trade here | function _trade(uint256 _orderId, uint256 _makerAmount, uint256 _takerAmount, ERC20 _makerAsset, ERC20 _takerAsset) internal {
address _taker = tx.origin;
require(_takerAsset.allowance(msg.sender, address(this)) >= _takerAmount,'Not enough allowance');
require(_takerAsset.balanceOf(_taker)>= _takerA... | 16,973,981 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is ch... | This method can be used by the owner to extract mistakenly sent tokens to this contract. _token The address of the token contract that you want to recover set to 0 in case you want to extract ether. | function claimTokens(address _token) external onlyOwner {
if (_token == 0x0) {
owner.transfer(address(this).balance);
return;
}
ERC20 token = ERC20(_token);
uint balance = token.balanceOf(this);
token.transfer(owner, balance);
}
| 10,594,260 |
pragma solidity 0.5.17;
import "./ERC20Interface.sol";
import "./TreasuryBase.sol";
import "./TreasuryFactoryBase.sol";
/**
* @author Quant Network
* @title Allows child payment channel & escrow deposit contracts to be easily created for gateways and mapps.
*/
contract TreasuryFactory is FactoryBase {
/... | Adds a new escrowed deposit gateway - is this stakeholder a gateway (true) or a mapp (false) MAPPorGatewayQNTAddress - the Ethereum address associated to the mapp or gateway's coldWallet MAPPorGatewayOperatorAddress - the Ethereum address associated to the mapp or gateway's operator address, able to call functions o... | function addEscrowDeposit(uint8 gateway, address MAPPorGatewayQNTAddress, address MAPPorGatewayOperatorAddress, address paymentChannel) internal returns (address) {
EscrowedDeposit ued = new EscrowedDeposit(MAPPorGatewayQNTAddress,MAPPorGatewayOperatorAddress,treasuryAddress(),paymentChannel);
addr... | 5,374,078 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
//Hermes Core
contract HermesCore {
address Owner;
string CompanyName;
string SomeInfo;
string SomeUsefullInfo;
bool Trading; //if is working
string[] DeliveryLocations;
//share next problable delivery point only for Hermeses
/... | fullfill the product by your own meanscreate contract for the track of the product | function SendProduct() public pure returns(bool) {
return true;
}
| 5,442,528 |
/**
Copyright (c) 2018, ZSC Dev Team
2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../utillib/LibInt.sol";
import "../common/hashmap.sol";
import "../common/delegate.sol";
contract InsurancePolicy is Delegate {
using LibStri... | [desc] Get policy info by id. [param] _type: info type (0: detail, 1: brief). [param] _id: policy id. [return] error code and policy info for json data. 0: success -1: params error -2: no data -3: no authority -9: inner error/ check param | function getById(uint8 _type, uint _id) external view returns (int, string) {
if ((1 < _type) || (size() <= _id)) {
return (-1, "");
}
int error = 0;
string memory key = "";
uint position = 0;
string memory data0 = "";
address policy = address(0);... | 12,535,688 |
pragma solidity ^0.4.24;
import "./DAO.sol";
import "./interfaces/IERC20.sol";
import "openzeppelin-solidity/contracts/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title STO module for standard capped crowdsal... | Override to extend the way in which ether is converted to tokens. _investedAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _investedAmount/ | function _getTokenAmount(uint256 _investedAmount) internal view returns (uint256) {
return _investedAmount.mul(rate);
}
| 1,046,305 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than ... | Enables the admins to withdraw Ethers present in this contract. _amount Amount of Ether in wei value to withdraw. | function withdrawFunds(uint256 _amount) external whenNotPaused onlyAdmin {
require(_amount <= address(this).balance);
msg.sender.transfer(_amount);
emit FundsWithdrawn(msg.sender, _amount);
}
| 10,556,245 |
pragma solidity ^0.4.24;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidit... | withdraw DAI to nami multisignature wallet, only escrow can call _amount value NAC to withdraw Available at any phase. | function withdrawDai(uint _amount) public
onlyEscrow
{
require(namiMultiSigWallet != address(0x0));
DSToken DAIToken = DSToken(DaiAddress);
if (DAIToken.balanceOf(address(this)) > 0) {
DAIToken.transfer(namiMultiSigWallet, _amount);
}
}
| 2,409,804 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | added nonReentrant modifier as calling token contract / | function getReward() public nonReentrant updateReward(msg.sender) protected checkStart {
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
rewardToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
... | 11,988,156 |
pragma solidity ^0.4.11;
import './ERC223_interface.sol';
import './ERC223_receiving_contract.sol';
import './SafeMath.sol';
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract Lingotts is ERC223Interface {
using SafeMath for uint;
mapping(address => uint) balances; // List of u... | Transfer the specified amount of tokens to the specified address. Invokes the `tokenFallback` function if the recipient is a contract. The token transfer fails if the recipient is a contract but does not implement the `tokenFallback` function or the fallback function to receive funds. _to Receiv... | function transfer(address _to, uint _value, bytes _data) {
if (_value > balances[msg.sender]){
revert();
}
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to... | 923,645 |
./full_match/42/0x92E165cE492EB7C49d3Bd8Ffd3B5D5e3D8F5ac8c/sources/contracts/distribution/ShareTokenRewardPool.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.timestamp <= pool.lastRewardTime) {
return;
}
uint256 tokenSupply = pool.token.balanceOf(address(this));
if (tokenSupply == 0) {
pool.lastRewardTime = block.ti... | 16,294,145 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int... | View the amount of dividend in wei that an address can withdraw. _owner The address of a token holder. return The amount of dividend in wei that `_owner` can withdraw. | function withdrawableDividendOf(address _owner)
public
view
override
returns (uint256)
{
return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);
}
| 414,377 |
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
... | burn tokens/ | function burn(address _wallet, uint256 _amount) public onlyOwner {
_burn(_wallet, _amount);
}
| 12,222,557 |
./partial_match/3/0x473c54cFc05c6189CfDAa6A94d3b9944b26451A6/sources/CallOptionSeller.sol | Make sure you have enough balance to sendDecrement and increment the balance of each address | function transfer(address recipient, uint amount) public {
require(balanceOf[msg.sender] >= amount, "Insufficient balance");
balanceOf[msg.sender] -= amount;
balanceOf[recipient] += amount;
}
| 5,085,621 |
./partial_match/8453/0xc0d3C0D3C0D3c0D3C0D3C0d3C0D3c0D3c0d30015/sources/contracts/universal/StandardBridge.sol | Sends ERC20 tokens to a receiver's address on the other chain. _localToken Address of the ERC20 on this chain. _remoteToken Address of the corresponding token on the remote chain. _to Address of the receiver. _amount Amount of local tokens to deposit. _minGasLimit Minimum amount of gas that the brid... | function _initiateBridgeERC20(
address _localToken,
address _remoteToken,
address _from,
address _to,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
) internal {
if (_isOptimismMintableERC20(_localToken)) {
require(
... | 16,772,571 |
/**
*Submitted for verification at Etherscan.io on 2021-04-16
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.7.6;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
... | Function to withdraw funds from the vault. Can only be called by admin amount: the amount to withdraw (should be <= than the amount in vault)/ | function withdraw(uint256 amount)
external
override
onlyAdmin
returns (bool)
{
require(amount > 0, "Amount can't be 0");
require(
IERC20(token).balanceOf(address(this)) >= amount,
"Amount > Balance"
);
IERC20(token).safeTra... | 15,126,927 |
pragma solidity ^0.5.0;
import "./Ownable.sol";
import "./ChildFactory.sol";
contract Master is Ownable {
/** STORAGE **/
mapping(address => uint) private childrenIndex;
address payable[] private childrenAccounts;
/** EVENTS **/
event childCreated(address child);
event childDeleted(address c... | CREATE/DELETE CHILDREN ACCOUNTS / | function createChildAccount() public onlyOwner() {
require(childrenAccounts.length + 1 > childrenAccounts.length);
ChildFactory child = new ChildFactory();
childrenAccounts.push(address(child));
childrenIndex[address(child)] = childrenAccounts.length - 1;
emit childCreated(ad... | 7,318,301 |
./full_match/3/0xdde52b2e98F7062bb7Fba0472554058d946e3a9D/sources/fegtoken.sol | _getValues splittes tAmount into/ | function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, c... | 14,213,000 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer./ | function mul_ScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (uint) {
Exp memory product = mul_(a, scalar);
return add_(truncate(product), addend);
}
| 17,844 |
./partial_match/3/0x5C90d5EF81617C0928c28DB999Ab5eF8361bF383/sources/Bizzcoin.sol | require(checkPermissions(msg.sender)); | function transfer(address _to, uint256 _value) isRunning public returns (bool) {
super.transfer(_to, _value);
return true;
}
| 5,163,440 |
./full_match/137/0x0D74b7d0e373bA7E61758B0962f8F321Ac2b8387/sources/project_/contracts/WhitelistVerifier.sol | Check if an address can execute a function by verifying it is whitelisted if verification is active. _address The address to be checked against the whitelist./ | function _requireWhitelisted(address _address) internal view {
if (verificationActive) {
require(
checkWhitelist(_address),
string(
abi.encodePacked(
"Whitelist Verifier: account ",
Strings.toHexS... | 3,750,495 |
./partial_match/1/0x456aAd873Eb70566A2AD4c3ef4fd162fc93fF074/sources/Shell.sol | james foley http://github.com/realisation view how much target amount a fixed origin amount will swap for _origin the address of the origin _target the address of the target _originAmount the origin amount return targetAmount_ the target amount that would have been swapped for the origin amount | function viewOriginSwap (
address _origin,
address _target,
uint _originAmount
) external view transactable returns (
uint targetAmount_
) {
targetAmount_ = Swaps.viewOriginSwap(shell, _origin, _target, _originAmount);
}
| 3,661,369 |
// File: @openzeppelin/contracts@3.3.0/utils/Strings.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev String operations.
*/
library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
//... | Returns the license for tokens | function tokenLicense(uint256 _id) public view returns(string memory) {
require(_id < totalSupply(), "CHOOSE A BUG WITHIN RANGE");
return LICENSE_TEXT;
}
| 6,928,712 |
./partial_match/1/0xE3cc697219a23cdc24df5A3b7f35497B8f3f153A/sources/KATMTokenChanger.sol | ERC20 compatible token interface - Implements ERC 20 Token standard - Implements short address attack fix created 29/09/2017 author Frank Bonnet/ | interface IToken {
function totalSupply() public view returns (uint);
function balanceOf(address _owner) public view returns (uint);
function transfer(address _to, uint _value) public returns (bool);
function transferFrom(address _from, address _to, uint _value) public returns (bool);
func... | 9,264,664 |
./partial_match/1/0x5D10E5189d27B864890d9E182710642F2E9F50E7/sources/contracts/MerkleDistributor.sol | onlyOwner functions | function withdrawInCaseTokensGetStuck(address tokenAddress, address toAddress, uint256 amount) external onlyOwner {
if (finalized) {
require(tokenAddress != token, 'Unable to withdraw distributable tokens');
}
IERC20(tokenAddress).transfer(toAddress, amount);
}
| 4,462,186 |
./partial_match/100/0xb16d0b4ae564410DA88064300cdd3B8ae2BCcd6E/sources/Chievs.sol | mintTokenPermissioned(): Mint a new permissioned Gen0 Chievs. These are the tokens that other Chievs will be "cloned from". _to Address to mint to. _permTokenId Address which can clone. _priceFinney Price of the Chievs in Finney. _numClonesAllowed Maximum number of times this Chievs is allowed to be cloned. _toke... | function mintTokenPermissioned(address _to, uint256 _permTokenId, uint256 _permTokenMin, uint256 _priceFinney, uint256 _numClonesAllowed, string memory _tokenURI) public mintable onlyOwnerOrRole returns (uint256 tokenId) {
Chiev memory _chiev = Chiev({priceFinney: _priceFinney, numClonesAllowed: _numClone... | 16,673,048 |
./partial_match/4/0x6fb6cD3822b85de2270ca1A0A1f36021224b39e3/sources/contracts/Mocks/HegicETHOptions.sol | Used for getting the actual options prices period Option period in seconds (1 days <= period <= 4 weeks) amount Option amount strike Strike price of the option return total Total price to be paid return settlementFee Amount to be distributed to the HEGIC token holders return strikeFee Amount that covers the price di... | function fees(
uint256 period,
uint256 amount,
uint256 strike,
OptionType optionType
)
public
view
returns (
uint256 total,
uint256 settlementFee,
uint256 strikeFee,
uint256 periodFee
)
{
... | 8,505,596 |
./partial_match/1/0x8408BaCcc231a6BbA766ed15571403468b32bFA5/sources/NowPass.sol | Sets the total number of tokens that can be currently BOUND | function setMaxBound(uint256 _maxBound) public onlyOwner
{
require(_maxBound > maxBound, "Maximum soulbounds must be greater than previously.");
maxBound = _maxBound;
}
| 9,340,481 |
//SPDX-License-Identifier: Apache
pragma solidity ^0.8.0;
import "./Galaxy.sol";
// =================================================================================================
struct CelestialData {
address owner;
uint lastUpdate;
}
// ==================================================================... | Called when a celestial is added by the galaxy owner via `GalaxyaddCelestial` | function addedExternally(CelestialMapEntry memory mapEntry) external virtual {}
| 5,470,525 |
pragma solidity ^0.5.1;
import "./SnowflakeInterface.sol";
import "./IdentityRegistryInterface.sol";
import "./SafeMath.sol";
import "./IceGlobal.sol";
import "./IceSort.sol";
import "./IceFMSAdv.sol";
import "./IceFMS.sol";
/**
* @title Ice Protocol
* @author Harsh Rajat
* @notice Create Protocol Less File ... | Function to delete an existing group for the user / ein _groupIndex describes the associated index of the group for the user / ein/ Get user EIN Logic Trigger Event | function deleteGroup(uint _groupIndex)
external {
uint ein = identityRegistry.getEIN(msg.sender);
uint currentGroupIndex = groups[ein].deleteGroup(
ein,
_groupIndex,
groupOrder[ein],
groupCount,
shares,
... | 1,089,837 |
./full_match/5/0xBb21e1C34ffeCDEe94E6d6C8d79B1fa2dA440D64/sources/contracts/Strategy/ETHFundDivisionStrategy.sol | Finalizes (or cancels) the strategy update by resetting the data/ | function finalizeStrategyWhitelist() public onlyGovernance {
_setStrategyWhitelistTime(0);
_setFutureStrategy(address(0));
}
| 7,038,543 |
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in su... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public virtual onlyDeployer returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
| 10,970,801 |
./full_match/4/0x16EFC807B4DAB998Ade18b5FC899f193FBD8Cb47/sources/ElevenElevenTest.sol | Mints Smols/ if ETH tiers if SMOL tiers Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense/ | function mintNFT(uint256 numberOfNfts) public payable {
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(numberOfNfts > 0, "numberOfNfts cannot be 0");
require(numberOfNfts <= 5, "You may not buy more than 5 NFTs at once");
require(totalSupply().add(numberOf... | 13,299,598 |
pragma solidity ^0.4.13;
interface ERC721Enumerable /* is ERC721 */ {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() public v... | symbols's name/ | function symbol() external pure returns (string) {
return SYMBOL;
}
| 478,469 |
./full_match/1/0x509faABc284aa9770437423b9f133863Da9cb728/sources/contracts/Votes.sol | Gets the current votes balance for `account` account The address to get votes balance return The number of current votes for `account`/ | function getVotes(address account) external view returns (uint96) {
uint96 nCheckpoints = numCheckpoints[account];
return
nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
| 3,117,963 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IExcaliburRouter.sol';
import './interfaces/IMasterChef.sol';
import './interfaces/IExcaliburV2Pair.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol';
pragma solidity 0.8.11;
/... | Pauses supplied. Withdraws all funds from the LP Depositor, leaving rewards behind./ | function panic() external {
_onlyStrategistOrOwner();
IMasterChef(MASTER_CHEF).emergencyWithdraw(poolId);
pause();
}
| 1,818,173 |
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/src/abstracts/SablierV2Base.sol | @inheritdoc ISablierV2Base Checks: the protocol revenues are not zero. | function claimProtocolRevenues(IERC20 asset) external override onlyAdmin {
uint128 revenues = protocolRevenues[asset];
if (revenues == 0) {
revert Errors.SablierV2Base_NoProtocolRevenues(asset);
}
}
| 9,308,436 |
/**
*Submitted for verification at Etherscan.io on 2021-10-30
*/
pragma solidity 0.5.17;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view... | Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
| 73,612 |
./full_match/421611/0x481148ed881807B574548B759141A0F515060d3f/sources/_aave/core-v3/contracts/protocol/libraries/configuration/ReserveConfiguration.sol | Sets the supply cap of the reserve self The reserve configuration supplyCap The supply cap/ | function setSupplyCap(DataTypes.ReserveConfigurationMap memory self, uint256 supplyCap)
internal
pure
{
require(supplyCap <= MAX_VALID_SUPPLY_CAP, Errors.RC_INVALID_SUPPLY_CAP);
self.data = (self.data & SUPPLY_CAP_MASK) | (supplyCap << SUPPLY_CAP_START_BIT_POSITION);
}
| 13,220,205 |
//Address: 0x897c6cf1996edfb2126703dcecf038df646298fa
//Contract name: TradersWallet
//Balance: 0.03 Ether
//Verification Date: 8/22/2017
//Transacion Count: 6
// CODE STARTS HERE
pragma solidity ^0.4.15;
contract etherDelta {
function deposit() payable;
function withdraw(uint amount);
function depositT... | withdraw a token from etherdelta | function EtherDeltaWithdrawToken(address tokenAddress, uint amount) payable external {
require(msg.sender==owner);
ethDelta.withdrawToken(tokenAddress, amount);
}
| 12,686,162 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgra... | Convert string to lower. str Name to be checked. Uppercase character | function toLower(string memory str) public pure returns (string memory) {
bytes memory bStr = bytes(str);
bytes memory bLower = new bytes(bStr.length);
for (uint256 i = 0; i < bStr.length; i++) {
if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) {
bLower[i] = bytes1(uint8(bStr[i]) + 32);... | 1,576,263 |
pragma solidity 0.5.3;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED628(address indexed pr... | inject NONSTANDARD NAMING | function RECORDSTATEMENT412(string calldata buildingPermitId, uint[] calldata statementDataLayout, bytes calldata statementData) external payable WHENNOTPAUSED828 returns(bytes32) { | 12,859,556 |
./partial_match/1/0xe51bFe53FfA1eE5A02ee075372De5Ad9f92c9bA4/sources/Blender_ETH.sol | Adds two unsigned integers, reverts on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| 4,316,942 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.2
/****************************************************************************
Written by Oliver Straszynski
https://github.com/broliver12/
****************************************************************************/
pragma solidity ^0.8.4;
imp... | Returns the ownership data for the given tokenId | function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) {
return _ownershipOf(tokenId);
}
| 12,843,273 |
./full_match/5/0xFDD10EAb723c003673008361c8C633134c8B7351/sources/src/core/coins/DepositWithdrawToken.sol | Deposits underlying to mint wrapped version to a recipient _recipient is the address of the recipient _amount is the amount of coin to deposit/ | function depositFor(address _recipient, uint256 _amount) external nonReentrant returns (uint256) {
return _depositFor(_recipient, _amount);
}
| 7,044,527 |
//SPDX-License-Identifier: MIT
pragma solidity =0.8.13;
import "@openzeppelin-v4/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin-v4/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "../interfaces/IQuoteToken.sol";
contract ExplicitQuotationMetadata is IQuoteToken, IERC165 {
string i... | @inheritdoc IQuoteToken | function quoteTokenAddress() public view virtual override returns (address) {
return _quoteTokenAddress;
}
| 5,428,320 |
./partial_match/1/0xffbaC21a641Dcfe4552920138D90F3638B3c9fba/sources/Governance.sol | Returns an Ethereum Signed Message, created from a `hash`. This replicates the behavior of the JSON-RPC method. See {recover}./ 32 is the length in bytes of hash, enforced by the type signature above | function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
| 2,613,347 |
./full_match/4/0x97122943AC048cd038188A648D7b8E38ffaE1b1f/sources/contracts/NFTDAOGovernorAlpha.sol | ~7 days in blocks (assuming 15s blocks) | function votingPeriod() public view returns (uint) { return votingtime; } | 12,511,412 |
pragma solidity ^0.4.18;
//import 'dao/Liability.sol';
import 'common/Object.sol';
import 'token/ERC20.sol';
import './MarketHeap.sol';
library CreatorLiability {
function create(address, address, address, uint256) public
returns (Liability);
}
/**
* @title Liability marketplace
*/
contract Liabili... | Market constructor _name Market name/ Put empty oreder with zero index | function LiabilityMarket(string _name) public {
name = _name;
orders[orders.length++].closed = true;
}
| 887,342 |
pragma solidity 0.5.3;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED628(address indexed pr... | inject NONSTANDARD NAMING | function TRANSFERPRIMARY55(address recipient) public ONLYOWNER7 { | 12,859,527 |
./partial_match/5/0x22A750d44726166Ef2E1350B01a482FF5B640555/sources/ERC7212.sol | Refund remaining value | function price(address buyer, uint256 cost, uint256 quantity, uint256 received) internal {
unchecked {
uint256 total = cost * quantity;
if (received < total) {
revert NeedToSendMoreETH();
}
if (received > total) {
if (!succes... | 16,874,973 |
./full_match/82/0x63726970742d656E67696E652D61646472657373/sources/contracts/ScriptEngineV2.sol | this func set candidate for the designated bucket owned by msg.sender will revert if any error happens/ | function bucketUpdateCandidate(
bytes32 bucketID,
address newCandidateAddr
) public returns (bool success) {
string memory errMsg = _meterTracker.native_bucket_update_candidate(
msg.sender,
bucketID,
newCandidateAddr
);
if (
... | 7,095,249 |
pragma solidity ^0.5.9;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./Controlled.sol";
import "./IToken36Controller.sol";
import "./Initializable.sol";
/// ... | Internal function that burns an amount of the token of a given account. account The account whose tokens will be burnt. value The amount that will be burnt./ Burn Event needed for element36 Exchange | function _burn(address account, uint256 value) internal {
require(account != address(0), "address 0 not allowed");
require(IToken36Controller(_controller).onBurn(account) == true, "Token36Controller rejected the burn");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _b... | 6,392,123 |
./full_match/1/0xBCF9F4c6FC589c89d4aAdE063010D0f5B3733680/sources/contracts/staking/Staking.sol | Collect query fees for an allocation from state channels. Funds received are only accepted from a valid sender. _tokens Amount of tokens to collect _allocationID Allocation where the tokens will be assigned/ Allocation identifier validation The contract caller must be an authorized asset holder Allocation must exist ... | function collect(uint256 _tokens, address _allocationID) external override {
require(_allocationID != address(0), "!alloc");
require(assetHolders[msg.sender] == true, "!assetHolder");
AllocationState allocState = _getAllocationState(_allocationID);
require(allocState != AllocationS... | 4,905,293 |
./partial_match/3/0x013b776dBCFB4609Bd03f494823d05879a50f00D/sources/MJCoin.sol | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
event Bought(uint256 amount);
event Sold(uint256 amount);
uint256 sellerBalance = balanceOf(sellerAddress);... | 5,227,907 |
./full_match/1/0x114d647B099D53237be9E03A540DFFaa24351E87/sources/contracts/strategies/balancer/BalancerStrategyBase.sol | Retrieves the output amount for a given input amount using Uniswap v3 Wrapper for a specific reward. reward The reward data containing the queryIn parameter. amountIn The amount of input tokens. return amountOut The amount of output tokens./ | function _getAmountOutUni(
Reward memory reward,
uint256 amountIn
) internal returns (uint256) {
return
IUniswapWrapper(UNI_WRAPPER).getAmountOut(reward.queryIn, amountIn);
}
| 3,107,611 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
pragma experimental ABIEncoderV2;
import "./lib/Lib_RLPReader.sol";
/// @notice MIPS virtual machine interface
interface IMIPS {
/// @notice Given a MIPS state hash (includes code & registers), execute the next instruction and returns
/// the update ... | MIPS virtual machine interface | interface IMIPS {
function Step(bytes32 stateHash) external returns (bytes32);
function m() external pure returns (IMIPSMemory);
pragma solidity ^0.7.3;
}
| 12,895,520 |
./full_match/4/0xB6214030521bC6D27c770a6037fdDC07288A6086/sources/browser/myERC20.sol | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function decreaseApproval(address _spender, uint _subtractedValue) external returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(... | 13,372,467 |
//test contract concept for leveraged positions of a token built-into an erc-20, with long/short capability... pegged to an external asset.
interface OrFeedInterface {
function getExchangeRate ( string fromSymbol, string toSymbol, string venue, uint256 amount ) external view returns ( uint256 );
function getToken... | mad moneylost moneymade moneylost money | function getPNL(address userAddress, uint256 currentPrice, uint256 boughtPrice, uint256 side) constant returns(uint256){
uint256 percentageGain;
uint256 amountExtraToSend;
if(side == 0){
if(currentPrice <= boughtPrice){
... | 12,926,777 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "../TempusPool.sol";
import "../protocols/rari/IRar... | return Updated current Interest Rate with the same precision as the BackingToken | function updateInterestRate() internal override returns (uint256) {
lastCalculatedInterestRate = calculateInterestRate(
rariFundManager,
yieldBearingToken,
backingTokenRariPoolIndex
);
require(lastCalculatedInterestRate > 0, "Calculated rate is too small"... | 6,115,789 |
// SPDX-License-Identifier: MIT
import "../libraries/math/SafeMath.sol";
import "../libraries/utils/ReentrancyGuard.sol";
import "../peripherals/Reader.sol";
import "../core/interfaces/IRouter.sol";
import "../core/interfaces/IVault.sol";
import "./interfaces/IUniswapV2Router.sol";
import "../libraries/token/IERC20.so... | Function that gets one puppets Any address can call it | function getAllFollows() public view returns (Follows[] memory) {
return followsArray;
}
| 13,023,464 |
./full_match/77/0xbB642E83699392B0DfdfCd5cF5D27fb1EC33A6D1/sources/contracts/Stays.sol | Partial withdraw partial withdraw condition | function withdraw(
address payer,
address payable payee,
uint256 payment,
bytes32 _spaceId,
uint256 tokenId
) internal override(IStayEscrow, StayEscrow) {
require(
payment <= spaces[_spaceId].pricePerNightWei,
"Withdraw amount not allowed in this state"
);
super.withdraw(... | 5,048,999 |
./full_match/42161/0xd09556ECE9783f9AABba43e1df6A04a8218e7ca1/sources/project_/contracts/mercenaries/WrappedCharacters.sol | Decreases a stat tokenID ID of the token amount to increase statIndex index of stat | function decreaseStat(uint256 tokenID, uint256 amount, uint256 statIndex)
external
onlyAllowed
onlyExists(tokenID)
{
_decreaseStat(tokenID, amount, statIndex);
}
| 16,306,101 |
pragma solidity ^0.5.0;
contract ClaimManager {
string public name;
uint public claimCount = 0;
mapping(uint => Claim) public claims;
struct Claim {
uint id;
string name;
uint price;
address payable owner;
bool purchased;
}
event ClaimCreated(
u... | Require a valid name Require a valid price Increment claim count Create the claim Trigger an event | function createClaim(string memory _name, uint _price) public {
require(bytes(_name).length > 0);
require(_price > 0);
claimCount ++;
claims[claimCount] = Claim(claimCount, _name, _price, msg.sender, false);
emit ClaimCreated(claimCount, _name, _price, msg.sender, false);
... | 12,717,226 |
./partial_match/3/0xA532384c6DbcFdE283dd410A188cf0c643bEB01E/sources/Governance.sol | get the info of the delisting proposal./ | function getInfoDelistWhitelist(bytes32 proposeId)
external
view
returns (address tokenAddress)
{
tokenAddress = proposeDelist[proposeId].tokenAddress;
}
| 5,169,610 |
./partial_match/3/0x430D77d6c1D3883307bdEA44DCBc8A9c99a66495/sources/CTOMasterFarmer.sol | Perform LP token migration from legacy UniswapV2 to Callisto. Take the current LP token address and return the new LP token address. Migrator should have full access to the caller's LP token. Return the new LP token address. XXX Migrator must have allowance access to UniswapV2 LP tokens. Callisto must mint EXACTLY the ... | interface IMigratorToCallisto {
function migrate(IERC20 token) external returns (IERC20);
pragma solidity 0.6.12;
}
| 5,281,990 |
./full_match/1/0xF560151670eB5997a5a0C211Ed13B98103aF095A/sources/localhost/compound/helpers/CompoundSaverHelper.sol | Returns the underlying address of the cToken asset _cTokenAddress cToken address return Token address of the cToken specified | function getUnderlyingAddr(address _cTokenAddress) internal view returns (address) {
if (_cTokenAddress == CETH_ADDRESS) {
return ETH_ADDRESS;
return CTokenInterface(_cTokenAddress).underlying();
}
}
| 9,715,590 |
//SPDX-License-Identifier: CC-BY-NC-ND-4.0
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.... | update params once we receive a transfer 721 Requirements: - `_sender` cannot be the zero address. - `_tokenId` needs to be part of our allowedIds./ | function onReceiveTransfer721(address _sender, uint256 _tokenId) internal isNewTokenAllowed(_tokenId) {
for (uint120 i; i < senders.length; i++) {
if (senders[i] == _sender) delete senders[i];
}
OpenSeaIERC1155(openseaToken).safeTransferFrom(address(this), _sender, newOldTokenIdPairs[uint16(_tokenI... | 5,800,224 |
./full_match/5/0x064C3F36c2Ebe018F5A7EA7F7B7C9eab09Ae4356/sources/contract-f465086f3e.sol | The following functions are overrides required by Solidity. | function _authorizeUpgrade(address newImplementation)
internal
onlyRole(UPGRADER_ROLE)
override
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155Upgradeable, AccessControlUpgradeable)
returns (bool)
{
return super.su... | 7,066,264 |
./full_match/80001/0x9cFe9F1B7165d48E6820362869566a80DB4f39B0/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 playerPickaxe is not set, then the player has no rewards. If playerLastUpdate or playerPickaxe is not set, then ... | function calculateRewards(address _player)
public
view
returns (uint256 _rewards)
{
if (
!playerLastUpdate[_player].isData || !playerPickaxe[_player].isData
) {
return 0;
}
playerLastUpdate[_player].value;
10_000_0... | 5,581,825 |
./full_match/80001/0x060bBB87eBA7ecF04ce7D17236faa88A5A709dA9/sources/project_/contracts/PresaleCollectionERC1155.sol | Function to get token uri | function uri(uint256 id) public view override returns(string memory) {
return(
string(abi.encodePacked(
BaseURIUpgradeable.baseURI(),
StringsUpgradeable.toString(id),
".json"
))
);
}
| 859,749 |
// Copyright (c) 2017 Sweetbridge Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... | used by certifier authority to set a claim response | function certifyClaim(
string entryId,
ApprovalState state,
uint256 expiryTimestamp,
uint16 certainty) public {
require(certifiers.exists(msg.sender));
require(state == ApprovalState.approved || state == ApprovalState.denied);
bytes32 hashedEnt... | 12,938,914 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract IManager {
function last(address) virtual public returns (uint);
function cdpCan(address, uint, address) virtual public view returns (uint);
function ilks(uint) virtual public view returns (b... | Return data is optional solhint-disable-next-line max-line-length | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(
data,
"SafeERC20: low-level call failed"
);
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC2... | 3,219 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./helpers.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract InstaVaultResolver is Helpers {
struct VaultInfo {
address token;
uint8 decimals;
uint256 tokenMinLimit;
address atoken;
a... | keeping 0.1% margin for final ratio TODO: dont take flashloan if not needed | function rebalanceOneData(address vaultAddr_, address[] memory vaultsToCheck_)
public
view
returns (
uint256 flashAmt_,
uint256 route_,
address[] memory vaults_,
uint256[] memory amts_,
uint256 leverageAmt_,
uint256 swa... | 6,170,046 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY529() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF13(address account) external vi... | inject NONSTANDARD NAMING | function APPROVE986(address spender, uint amount) external returns (bool); | 1,780,064 |
pragma solidity ^0.4.18;
contract TestKittyContract {
Kitty[] public kitties;
struct Kitty {
uint256 genes;
uint64 birthTime;
uint64 cooldownEndBlock;
uint32 matronId;
uint32 sireId;
uint32 siringWithId;
uint16 cooldownInd... | if this variable is 0 then it's not gestating | function getKitty(uint256 _id)
public
view
returns (
bool isGestating,
bool isReady,
uint256 cooldownIndex,
uint256 nextActionAt,
uint256 siringWithId,
uint256 birthTime,
uint256 matronId,
uint256 sireId,
uint256 generat... | 2,550,251 |
//Address: 0x51c340f52ecbda35f56578fb0571fb4eed064fc1
//Contract name: DragonToken
//Balance: 0 Ether
//Verification Date: 2/21/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
*/
contract ERC721 {
event ... | Gets the owner of the specified token ID _tokenId uint256 ID of the token to query the owner of return owner address currently marked as the owner of the given token ID/ | function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
| 15,799,300 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Update the count of non rebasing credits in response to a transfer _from The address you want to send tokens from. _to The address you want to transfer to. _value Amount of OUSD to transfer/ Credits deducted and credited might be different due to the differing creditsPerToken used by each account Transfer to non-reb... | function _executeTransfer(
address _from,
address _to,
uint256 _value
) internal {
uint256 creditsDeducted = _value.mulTruncate(_creditsPerToken(_from));
uint256 creditsCredited = _value.mulTruncate(_creditsPerToken(_to));
_creditBalances[_from] = _creditBalances... | 210,742 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(string memory p0, bool p1, bool p2, bool p3) internal view { | 1,019,066 |
pragma solidity ^0.4.24;
import "contracts/MinersEscrow.sol";
import "contracts/NuCypherToken.sol";
/**
* @notice Upgrade to this contract must lead to fail
**/
contract MinersEscrowBad is MinersEscrow {
constructor(
NuCypherToken _token,
uint32 _hoursPerPeriod,
uint256 _miningCoefficie... | Update node info/ | function updateReward(address _node, uint16 _period) external {
nodes[_node].push(_period);
}
| 946,740 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @dev Implements a single role access control contract.
import "./AccessControl.sol";
//import "@openzeppelin/contracts/access/AccessControl.sol";
/// @title EscrowService Contract
/// @author Alexandre Rapchan B. Barros (from BlockExplorers' Team )
/// @noti... | This should be the second stage of the negociation!" | function SellerClaimPayment () public onlyRole(SELLER_ROLE) {
require (status == 1 , "This should be the second stage of the negociation!");
status = 2 ;
}
| 12,568,126 |
./full_match/42/0x85782998fc924dB5803968F000367c844526e65c/sources/contracts/xtmcswap.sol | Update the burn rate. Can only be called by the current operator./ | function updateLiquidityRate(uint16 _liquidityRate) public onlyOperator {
require(_liquidityRate <= 100, "XTMC::updateLiquidityRate: Burn rate must not exceed the maximum rate.");
emit LiquidityRateUpdated(msg.sender, liquidityRate, _liquidityRate);
liquidityRate = _liquidityRate;
}
| 9,576,150 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.