comment
stringlengths 1
211
⌀ | input
stringlengths 155
20k
| label
stringlengths 4
1k
| original_idx
int64 203
514k
| predicate
stringlengths 1
1k
|
---|---|---|---|---|
null | pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// SencTokenSale - SENC Token Sale Contract
//
// Copyright (c) 2018 InfoCorp Technologies Pte Ltd.
// http://www.sentinel-chain.org/
//
// The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Total tokens 500m
// * Founding Team 10% - 5 tranches of 20% of 50,000,000 in **arrears** every 24 weeks from the activation date.
// * Early Support 20% - 4 tranches of 25% of 100,000,000 in **advance** every 4 weeks from activation date.
// * Pre-sale 20% - 4 tranches of 25% of 100,000,000 in **advance** every 4 weeks from activation date.
// * To be separated into ~ 28 presale addresses
// ----------------------------------------------------------------------------
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
}
modifier whenPaused() {
}
function pause() onlyOwner whenNotPaused public {
}
function unpause() onlyOwner whenPaused public {
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
function totalSupply() public view returns (uint256) {
}
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public view returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
}
}
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
}
}
contract OperatableBasic {
function setPrimaryOperator (address addr) public;
function setSecondaryOperator (address addr) public;
function isPrimaryOperator(address addr) public view returns (bool);
function isSecondaryOperator(address addr) public view returns (bool);
}
contract Operatable is Ownable, OperatableBasic {
address public primaryOperator;
address public secondaryOperator;
modifier canOperate() {
}
function Operatable() public {
}
function setPrimaryOperator (address addr) public onlyOwner {
}
function setSecondaryOperator (address addr) public onlyOwner {
}
function isPrimaryOperator(address addr) public view returns (bool) {
}
function isSecondaryOperator(address addr) public view returns (bool) {
}
}
contract Salvageable is Operatable {
// Salvage other tokens that are accidentally sent into this token
function emergencyERC20Drain(ERC20 oddToken, uint amount) public canOperate {
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
contract SencTokenConfig {
string public constant NAME = "Sentinel Chain Token";
string public constant SYMBOL = "SENC";
uint8 public constant DECIMALS = 18;
uint public constant DECIMALSFACTOR = 10 ** uint(DECIMALS);
uint public constant TOTALSUPPLY = 500000000 * DECIMALSFACTOR;
}
contract SencToken is PausableToken, SencTokenConfig, Salvageable {
using SafeMath for uint;
string public name = NAME;
string public symbol = SYMBOL;
uint8 public decimals = DECIMALS;
bool public mintingFinished = false;
event Mint(address indexed to, uint amount);
event MintFinished();
modifier canMint() {
}
function SencToken() public {
}
function pause() onlyOwner public {
}
function unpause() onlyOwner public {
}
function mint(address _to, uint _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner canMint public returns (bool) {
}
// Airdrop tokens from bounty wallet to contributors as long as there are enough balance
function airdrop(address bountyWallet, address[] dests, uint[] values) public onlyOwner returns (uint) {
}
}
contract SencVesting is Salvageable {
using SafeMath for uint;
SencToken public token;
bool public started = false;
uint public startTimestamp;
uint public totalTokens;
struct Entry {
uint tokens;
bool advance;
uint periods;
uint periodLength;
uint withdrawn;
}
mapping (address => Entry) public entries;
event NewEntry(address indexed beneficiary, uint tokens, bool advance, uint periods, uint periodLength);
event Withdrawn(address indexed beneficiary, uint withdrawn);
function SencVesting(SencToken _token) public {
}
function addEntryIn4WeekPeriods(address beneficiary, uint tokens, bool advance, uint periods) public onlyOwner {
}
function addEntryIn24WeekPeriods(address beneficiary, uint tokens, bool advance, uint periods) public onlyOwner {
}
function addEntryInSecondsPeriods(address beneficiary, uint tokens, bool advance, uint periods, uint secondsPeriod) public onlyOwner {
}
function addEntry(address beneficiary, uint tokens, bool advance, uint periods, uint periodLength) internal {
}
function start() public onlyOwner {
}
function vested(address beneficiary, uint time) public view returns (uint) {
}
function withdrawable(address beneficiary) public view returns (uint) {
}
function withdraw() public {
}
function withdrawOnBehalfOf(address beneficiary) public onlyOwner {
}
function withdrawInternal(address beneficiary) internal {
}
function tokens(address beneficiary) public view returns (uint) {
}
function withdrawn(address beneficiary) public view returns (uint) {
}
function emergencyERC20Drain(ERC20 oddToken, uint amount) public canOperate {
// Cannot withdraw SencToken if vesting started
require(<FILL_ME>)
super.emergencyERC20Drain(oddToken,amount);
}
}
| !started||address(oddToken)!=address(token) | 329,687 | !started||address(oddToken)!=address(token) |
null | pragma solidity ^0.5.7;
/**
* @title SafeMath
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint c) {
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint c) {
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
}
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address payable newOwner) public onlyOwner {
}
}
contract ERC20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner) public view returns (uint256 balance);
function allowance(address tokenOwner, address spender) public view returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
function approve(address spender, uint256 tokens) public returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
contract Swidex is ERC20Interface, Owned {
using SafeMath for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public name = "Swidex";
string public symbol = "SWDX";
uint256 public decimals = 8;
uint256 public _totalSupply;
uint256 public SWDXPerEther = 2000000e8;
uint256 public maximumSale = 2000000000e8;
uint256 public totalSold = 0;
uint256 public minimumBuy = 1 ether;
uint256 public maximumBuy = 20 ether;
//mitigates the ERC20 short address attack
//suggested by izqui9 @ http://bit.ly/2NMMCNv
modifier onlyPayloadSize(uint size) {
}
constructor () public {
}
//get the total totalSupply
function totalSupply() public view returns (uint256) {
}
function () payable external {
}
/// @dev This is the actual transfer function in the token contract, it can
/// only be called by other functions in this contract.
/// @param _from The address holding the tokens being transferred
/// @param _to The address of the recipient
/// @param _amount The amount of tokens to be transferred
/// @return True if the transfer was successful
function doTransfer(address _from, address _to, uint _amount) internal {
// Do not allow transfer to 0x0 or the token contract itself
require(<FILL_ME>)
require(_amount <= balances[_from]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
}
function balanceOf(address _owner) view public returns (uint256) {
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
}
/// @return The balance of `_owner`
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
}
/// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on
/// its behalf. This is a modified version of the ERC20 approve function
/// to be a little bit safer
/// @param _spender The address of the account able to transfer the tokens
/// @param _amount The amount of tokens to be approved for transfer
/// @return True if the approval was successful
function approve(address _spender, uint256 _amount) public returns (bool success) {
}
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
}
function allowance(address _owner, address _spender) view public returns (uint256) {
}
function withdrawFund() onlyOwner public {
}
function burn(uint256 _value) onlyOwner public {
}
function getForeignTokenBalance(ERC20Interface _tokenContract, address who) view public returns (uint) {
}
function withdrawForeignTokens(ERC20Interface _tokenContract) onlyOwner public returns (bool) {
}
event TransferEther(address indexed _from, address indexed _to, uint256 _value);
event NewPrice(address indexed _changer, uint256 _lastPrice, uint256 _newPrice);
event Burn(address indexed _burner, uint256 value);
}
| (_to!=address(0)) | 329,817 | (_to!=address(0)) |
null | pragma solidity 0.4.24;
interface IArbitrage {
function executeArbitrage(
address token,
uint256 amount,
address dest,
bytes data
)
external
returns (bool);
}
pragma solidity 0.4.24;
contract IBank {
function totalSupplyOf(address token) public view returns (uint256 balance);
function borrowFor(address token, address borrower, uint256 amount) public;
function repay(address token, uint256 amount) external payable;
}
/**
* @title Helps contracts guard agains reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
}
}
/**
* @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) {
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/*
Copyright 2018 Contra Labs 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 agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.24;
// @title FlashLender: Borrow from the bank and enforce repayment by the end of transaction execution.
// @author Rich McAteer <[email protected]>, Max Wolff <[email protected]>
contract FlashLender is ReentrancyGuard, Ownable {
using SafeMath for uint256;
string public version = '0.1';
address public bank;
uint256 public fee;
/**
* @dev Verify that the borrowed tokens are returned to the bank plus a fee by the end of transaction execution.
* @param token Address of the token to for arbitrage. 0x0 for Ether.
* @param amount Amount borrowed.
*/
modifier isArbitrage(address token, uint256 amount) {
uint256 balance = IBank(bank).totalSupplyOf(token);
uint256 feeAmount = amount.mul(fee).div(10 ** 18);
_;
require(<FILL_ME>)
}
constructor(address _bank, uint256 _fee) public {
}
/**
* @dev Borrow from the bank on behalf of an arbitrage contract and execute the arbitrage contract's callback function.
* @param token Address of the token to borrow. 0x0 for Ether.
* @param amount Amount to borrow.
* @param dest Address of the account to receive arbitrage profits.
* @param data The data to execute the arbitrage trade.
*/
function borrow(
address token,
uint256 amount,
address dest,
bytes data
)
external
nonReentrant
isArbitrage(token, amount)
returns (bool)
{
}
/**
* @dev Allow the owner to set the bank address.
* @param _bank Address of the bank.
*/
function setBank(address _bank) external onlyOwner {
}
/**
* @dev Allow the owner to set the fee.
* @param _fee Fee to borrow, as a percentage of principal borrowed. 18 decimals of precision (e.g., 10^18 = 100% fee).
*/
function setFee(uint256 _fee) external onlyOwner {
}
}
| IBank(bank).totalSupplyOf(token)>=(balance.add(feeAmount)) | 329,879 | IBank(bank).totalSupplyOf(token)>=(balance.add(feeAmount)) |
"Query for a token you don't own" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/// @title Ape Runners Staking
/// @author naomsa <https://twitter.com/naomsa666>
contract ApeRunnersStaking is Ownable, Pausable {
using EnumerableSet for EnumerableSet.UintSet;
/* -------------------------------------------------------------------------- */
/* Farming State */
/* -------------------------------------------------------------------------- */
/// @notice Rewards end timestamp.
uint256 public endTime;
/// @notice Rewards emitted per day staked.
uint256 public rate;
/// @notice Staking token contract address.
IStakingToken public stakingToken;
/// @notice Rewards token contract address.
IRewardToken public rewardToken;
/// @notice Set of staked token ids by address.
mapping(address => EnumerableSet.UintSet) internal _depositsOf;
/// @notice Mapping of timestamps from each staked token id.
mapping(uint256 => uint256) internal _depositedAt;
constructor(
address newStakingToken,
address newRewardToken,
uint256 newRate,
uint256 newEndTime
) {
}
/* -------------------------------------------------------------------------- */
/* Farming Logic */
/* -------------------------------------------------------------------------- */
/// @notice Deposit tokens into the vault.
/// @param tokenIds Array of token tokenIds to be deposited.
function deposit(uint256[] calldata tokenIds) external whenNotPaused {
}
/// @notice Withdraw tokens and claim their pending rewards.
/// @param tokenIds Array of staked token ids.
function withdraw(uint256[] calldata tokenIds) external whenNotPaused {
uint256 totalRewards;
for (uint256 i; i < tokenIds.length; i++) {
require(<FILL_ME>)
totalRewards += _earned(_depositedAt[tokenIds[i]]);
_depositsOf[msg.sender].remove(tokenIds[i]);
delete _depositedAt[tokenIds[i]];
stakingToken.safeTransferFrom(address(this), msg.sender, tokenIds[i]);
}
rewardToken.mint(msg.sender, totalRewards);
}
/// @notice Claim pending token rewards.
function claim() external whenNotPaused {
}
/// @notice Calculate total rewards for given account.
/// @param account Holder address.
function earned(address account)
external
view
returns (uint256[] memory rewards)
{
}
/// @notice Internally calculates rewards for given token.
/// @param timestamp Deposit timestamp.
function _earned(uint256 timestamp) internal view returns (uint256) {
}
/// @notice Retrieve token ids deposited by account.
/// @param account Token owner address.
function depositsOf(address account)
external
view
returns (uint256[] memory ids)
{
}
/* -------------------------------------------------------------------------- */
/* Owner Logic */
/* -------------------------------------------------------------------------- */
/// @notice Set the new token rewards rate.
/// @param newRate Emission rate in wei.
function setRate(uint256 newRate) external onlyOwner {
}
/// @notice Set the new rewards end time.
/// @param newEndTime End timestamp.
function setEndTime(uint256 newEndTime) external onlyOwner {
}
/// @notice Set the new staking token contract address.
/// @param newStakingToken Staking token address.
function setStakingToken(address newStakingToken) external onlyOwner {
}
/// @notice Set the new reward token contract address.
/// @param newRewardToken Rewards token address.
function setRewardToken(address newRewardToken) external onlyOwner {
}
/// @notice Toggle if the contract is paused.
function togglePaused() external onlyOwner {
}
}
interface IStakingToken {
function transferFrom(
address from,
address to,
uint256 id
) external;
function safeTransferFrom(
address from,
address to,
uint256 id
) external;
}
interface IRewardToken {
function mint(address to, uint256 amount) external;
function burn(address from, uint256 amount) external;
}
| _depositsOf[msg.sender].contains(tokenIds[i]),"Query for a token you don't own" | 329,885 | _depositsOf[msg.sender].contains(tokenIds[i]) |
"ceiling reached" | // SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "../../Math/SafeMath.sol";
import "../../XUS/XUS.sol";
import "../../XUSD/XUSD.sol";
import "../../ERC20/ERC20.sol";
import "../../Oracle/UniswapPairOracle.sol";
import "./XUSDPoolLibrary.sol";
contract Pool_DAI_NEW {
using SafeMath for uint256;
ERC20 private collateral_token;
address private collateral_address;
address private owner_address;
address private xusd_contract_address;
address private xus_contract_address;
address private timelock_address; // Timelock address for the governance contract
XUSDShares private XUS;
XUSDStablecoin private XUSD;
UniswapPairOracle private collatEthOracle;
address private collat_eth_oracle_address;
address private weth_address;
mapping (address => uint256) public redeemXUSBalances;
mapping (address => uint256) public redeemCollateralBalances;
uint256 public unclaimedPoolCollateral;
uint256 public unclaimedPoolXUS;
mapping (address => uint256) public lastRedeemed;
// Constants for various precisions
uint256 private constant PRICE_PRECISION = 1e6;
uint256 private constant COLLATERAL_RATIO_PRECISION = 1e6;
uint256 private constant COLLATERAL_RATIO_MAX = 1e6;
// Number of decimals needed to get to 18
uint256 private missing_decimals;
// Pool_ceiling is the total units of collateral that a pool contract can hold
uint256 public pool_ceiling = 0;
// Stores price of the collateral, if price is paused
uint256 public pausedPrice = 0;
// Bonus rate on XUS minted during recollateralizeXUSD(); 6 decimals of precision, set to 0.75% on genesis
uint256 public bonus_rate = 7500;
// Number of blocks to wait before being able to collectRedemption()
uint256 public redemption_delay = 1;
// AccessControl state variables
bool private mintPaused = false;
bool private redeemPaused = false;
bool private recollateralizePaused = false;
bool private buyBackPaused = false;
bool private collateralPricePaused = false;
address feepool_address;
ChainlinkETHUSDPriceConsumer private dai_usd_pricer;
uint8 private dai_usd_pricer_decimals;
address public dai_usd_consumer_address;
/* ========== MODIFIERS ========== */
modifier onlyByOwnerOrGovernance() {
}
modifier notRedeemPaused() {
}
modifier notMintPaused() {
}
/* ========== CONSTRUCTOR ========== */
constructor(
address _xusd_contract_address,
address _xus_contract_address,
address _collateral_address,
address _timelock_address,
uint256 _pool_ceiling
) public {
}
function setDAIUSDOracle(address _dai_usd_consumer_address) public onlyByOwnerOrGovernance {
}
/* ========== VIEWS ========== */
// Returns dollar value of collateral held in this XUSD pool
function collatDollarBalance() public view returns (uint256) {
}
// Returns the value of excess collateral held in this XUSD pool, compared to what is needed to maintain the global collateral ratio
function availableExcessCollatDV() public view returns (uint256) {
}
/* ========== PUBLIC FUNCTIONS ========== */
// Returns the price of the pool collateral in USD
function getCollateralPrice() public view returns (uint256) {
}
function setCollatETHOracle(address _collateral_weth_oracle_address, address _weth_address) external onlyByOwnerOrGovernance {
}
function setFeePool(address _feepool) external onlyByOwnerOrGovernance {
}
function getMint1t1Out(uint256 collat_amount) public view returns (uint256, uint256) {
uint256 collateral_amount_d18 = collat_amount * (10 ** missing_decimals);
( , , , uint256 global_collateral_ratio, , uint256 minting_fee, ,) = XUSD.xusd_info();
require(global_collateral_ratio >= COLLATERAL_RATIO_MAX, "CR must >= 1");
require(<FILL_ME>)
(uint256 xusd_amount_d18, uint256 fee) = XUSDPoolLibrary.calcMint1t1XUSD(
getCollateralPrice(),
minting_fee,
collateral_amount_d18
);
return (xusd_amount_d18, fee);
}
// We separate out the 1t1, fractional and algorithmic minting functions for gas efficiency
function mint1t1XUSD(uint256 collateral_amount, uint256 XUSD_out_min) external notMintPaused {
}
function getMintAlgoOut(uint256 xus_amount) public view returns (uint256, uint256) {
}
// 0% collateral-backed
function mintAlgorithmicXUSD(uint256 xus_amount_d18, uint256 XUSD_out_min) external notMintPaused {
}
function getMintFracOut(uint256 collat_amount) public view returns (uint256, uint256, uint256) {
}
// Will fail if fully collateralized or fully algorithmic
// > 0% and < 100% collateral-backed
function mintFractionalXUSD(uint256 collateral_amount, uint256 XUSD_out_min) external notMintPaused {
}
function getRedeem1t1Out(uint256 xusd_amount) public view returns (uint256, uint256) {
}
// Redeem collateral. 100% collateral-backed
function redeem1t1XUSD(uint256 XUSD_amount, uint256 COLLATERAL_out_min) external notRedeemPaused {
}
function getRedeemFracOut(uint256 XUSD_amount) public view returns (uint256, uint256, uint256) {
}
// Will fail if fully collateralized or algorithmic
// Redeem XUSD for collateral and XUS. > 0% and < 100% collateral-backed
function redeemFractionalXUSD(uint256 XUSD_amount, uint256 XUS_out_min, uint256 COLLATERAL_out_min) external notRedeemPaused {
}
function getRedeemAlgoOut(uint256 XUSD_amount) public view returns (uint256, uint256) {
}
// Redeem XUSD for XUS. 0% collateral-backed
function redeemAlgorithmicXUSD(uint256 XUSD_amount, uint256 XUS_out_min) external notRedeemPaused {
}
// After a redemption happens, transfer the newly minted XUS and owed collateral from this pool
// contract to the user. Redemption is split into two functions to prevent flash loans from being able
// to take out XUSD/collateral from the system, use an AMM to trade the new price, and then mint back into the system.
function collectRedemption() external {
}
function getRecollatOut(uint256 collateral_amount) public view returns (uint256, uint256) {
}
// When the protocol is recollateralizing, we need to give a discount of XUS to hit the new CR target
// Thus, if the target collateral ratio is higher than the actual value of collateral, minters get XUS for adding collateral
// This function simply rewards anyone that sends collateral to a pool with the same amount of XUS + the bonus rate
// Anyone can call this function to recollateralize the protocol and take the extra XUS value from the bonus rate as an arb opportunity
function recollateralizeXUSD(uint256 collateral_amount, uint256 XUS_out_min) external {
}
function getBuybackOut(uint256 XUS_amount) public view returns (uint256) {
}
// Function can be called by an XUS holder to have the protocol buy back XUS with excess collateral value from a desired collateral pool
// This can also happen if the collateral ratio > 1
function buyBackXUS(uint256 XUS_amount, uint256 COLLATERAL_out_min) external {
}
/* ========== RESTRICTED FUNCTIONS ========== */
function toggleMinting() external onlyByOwnerOrGovernance {
}
function toggleRedeeming() external onlyByOwnerOrGovernance {
}
function toggleRecollateralize() external onlyByOwnerOrGovernance {
}
function toggleBuyBack() external onlyByOwnerOrGovernance {
}
function toggleCollateralPrice() external onlyByOwnerOrGovernance {
}
// Combined into one function due to 24KiB contract memory limit
function setPoolParameters(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay) external onlyByOwnerOrGovernance {
}
function setTimelock(address new_timelock) external onlyByOwnerOrGovernance {
}
function setOwner(address _owner_address) external onlyByOwnerOrGovernance {
}
}
| (collateral_token.balanceOf(address(this))).sub(unclaimedPoolCollateral).add(collat_amount)<=pool_ceiling,"ceiling reached" | 329,937 | (collateral_token.balanceOf(address(this))).sub(unclaimedPoolCollateral).add(collat_amount)<=pool_ceiling |
"pool ceiling reached" | // SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "../../Math/SafeMath.sol";
import "../../XUS/XUS.sol";
import "../../XUSD/XUSD.sol";
import "../../ERC20/ERC20.sol";
import "../../Oracle/UniswapPairOracle.sol";
import "./XUSDPoolLibrary.sol";
contract Pool_DAI_NEW {
using SafeMath for uint256;
ERC20 private collateral_token;
address private collateral_address;
address private owner_address;
address private xusd_contract_address;
address private xus_contract_address;
address private timelock_address; // Timelock address for the governance contract
XUSDShares private XUS;
XUSDStablecoin private XUSD;
UniswapPairOracle private collatEthOracle;
address private collat_eth_oracle_address;
address private weth_address;
mapping (address => uint256) public redeemXUSBalances;
mapping (address => uint256) public redeemCollateralBalances;
uint256 public unclaimedPoolCollateral;
uint256 public unclaimedPoolXUS;
mapping (address => uint256) public lastRedeemed;
// Constants for various precisions
uint256 private constant PRICE_PRECISION = 1e6;
uint256 private constant COLLATERAL_RATIO_PRECISION = 1e6;
uint256 private constant COLLATERAL_RATIO_MAX = 1e6;
// Number of decimals needed to get to 18
uint256 private missing_decimals;
// Pool_ceiling is the total units of collateral that a pool contract can hold
uint256 public pool_ceiling = 0;
// Stores price of the collateral, if price is paused
uint256 public pausedPrice = 0;
// Bonus rate on XUS minted during recollateralizeXUSD(); 6 decimals of precision, set to 0.75% on genesis
uint256 public bonus_rate = 7500;
// Number of blocks to wait before being able to collectRedemption()
uint256 public redemption_delay = 1;
// AccessControl state variables
bool private mintPaused = false;
bool private redeemPaused = false;
bool private recollateralizePaused = false;
bool private buyBackPaused = false;
bool private collateralPricePaused = false;
address feepool_address;
ChainlinkETHUSDPriceConsumer private dai_usd_pricer;
uint8 private dai_usd_pricer_decimals;
address public dai_usd_consumer_address;
/* ========== MODIFIERS ========== */
modifier onlyByOwnerOrGovernance() {
}
modifier notRedeemPaused() {
}
modifier notMintPaused() {
}
/* ========== CONSTRUCTOR ========== */
constructor(
address _xusd_contract_address,
address _xus_contract_address,
address _collateral_address,
address _timelock_address,
uint256 _pool_ceiling
) public {
}
function setDAIUSDOracle(address _dai_usd_consumer_address) public onlyByOwnerOrGovernance {
}
/* ========== VIEWS ========== */
// Returns dollar value of collateral held in this XUSD pool
function collatDollarBalance() public view returns (uint256) {
}
// Returns the value of excess collateral held in this XUSD pool, compared to what is needed to maintain the global collateral ratio
function availableExcessCollatDV() public view returns (uint256) {
}
/* ========== PUBLIC FUNCTIONS ========== */
// Returns the price of the pool collateral in USD
function getCollateralPrice() public view returns (uint256) {
}
function setCollatETHOracle(address _collateral_weth_oracle_address, address _weth_address) external onlyByOwnerOrGovernance {
}
function setFeePool(address _feepool) external onlyByOwnerOrGovernance {
}
function getMint1t1Out(uint256 collat_amount) public view returns (uint256, uint256) {
}
// We separate out the 1t1, fractional and algorithmic minting functions for gas efficiency
function mint1t1XUSD(uint256 collateral_amount, uint256 XUSD_out_min) external notMintPaused {
}
function getMintAlgoOut(uint256 xus_amount) public view returns (uint256, uint256) {
}
// 0% collateral-backed
function mintAlgorithmicXUSD(uint256 xus_amount_d18, uint256 XUSD_out_min) external notMintPaused {
}
function getMintFracOut(uint256 collat_amount) public view returns (uint256, uint256, uint256) {
(, uint256 xus_price, , uint256 global_collateral_ratio, , uint256 minting_fee, ,) = XUSD.xusd_info();
require(global_collateral_ratio < COLLATERAL_RATIO_MAX && global_collateral_ratio > 0, "CR not in range");
require(<FILL_ME>)
uint256 collateral_amount_d18 = collat_amount * (10 ** missing_decimals);
(uint256 mint_amount, uint256 xus_needed, uint256 fee) = XUSDPoolLibrary.calcMintFractionalXUSD(collateral_amount_d18, getCollateralPrice(), xus_price, global_collateral_ratio, minting_fee);
return (mint_amount, xus_needed, fee);
}
// Will fail if fully collateralized or fully algorithmic
// > 0% and < 100% collateral-backed
function mintFractionalXUSD(uint256 collateral_amount, uint256 XUSD_out_min) external notMintPaused {
}
function getRedeem1t1Out(uint256 xusd_amount) public view returns (uint256, uint256) {
}
// Redeem collateral. 100% collateral-backed
function redeem1t1XUSD(uint256 XUSD_amount, uint256 COLLATERAL_out_min) external notRedeemPaused {
}
function getRedeemFracOut(uint256 XUSD_amount) public view returns (uint256, uint256, uint256) {
}
// Will fail if fully collateralized or algorithmic
// Redeem XUSD for collateral and XUS. > 0% and < 100% collateral-backed
function redeemFractionalXUSD(uint256 XUSD_amount, uint256 XUS_out_min, uint256 COLLATERAL_out_min) external notRedeemPaused {
}
function getRedeemAlgoOut(uint256 XUSD_amount) public view returns (uint256, uint256) {
}
// Redeem XUSD for XUS. 0% collateral-backed
function redeemAlgorithmicXUSD(uint256 XUSD_amount, uint256 XUS_out_min) external notRedeemPaused {
}
// After a redemption happens, transfer the newly minted XUS and owed collateral from this pool
// contract to the user. Redemption is split into two functions to prevent flash loans from being able
// to take out XUSD/collateral from the system, use an AMM to trade the new price, and then mint back into the system.
function collectRedemption() external {
}
function getRecollatOut(uint256 collateral_amount) public view returns (uint256, uint256) {
}
// When the protocol is recollateralizing, we need to give a discount of XUS to hit the new CR target
// Thus, if the target collateral ratio is higher than the actual value of collateral, minters get XUS for adding collateral
// This function simply rewards anyone that sends collateral to a pool with the same amount of XUS + the bonus rate
// Anyone can call this function to recollateralize the protocol and take the extra XUS value from the bonus rate as an arb opportunity
function recollateralizeXUSD(uint256 collateral_amount, uint256 XUS_out_min) external {
}
function getBuybackOut(uint256 XUS_amount) public view returns (uint256) {
}
// Function can be called by an XUS holder to have the protocol buy back XUS with excess collateral value from a desired collateral pool
// This can also happen if the collateral ratio > 1
function buyBackXUS(uint256 XUS_amount, uint256 COLLATERAL_out_min) external {
}
/* ========== RESTRICTED FUNCTIONS ========== */
function toggleMinting() external onlyByOwnerOrGovernance {
}
function toggleRedeeming() external onlyByOwnerOrGovernance {
}
function toggleRecollateralize() external onlyByOwnerOrGovernance {
}
function toggleBuyBack() external onlyByOwnerOrGovernance {
}
function toggleCollateralPrice() external onlyByOwnerOrGovernance {
}
// Combined into one function due to 24KiB contract memory limit
function setPoolParameters(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay) external onlyByOwnerOrGovernance {
}
function setTimelock(address new_timelock) external onlyByOwnerOrGovernance {
}
function setOwner(address _owner_address) external onlyByOwnerOrGovernance {
}
}
| collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral).add(collat_amount)<=pool_ceiling,"pool ceiling reached" | 329,937 | collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral).add(collat_amount)<=pool_ceiling |
"wait 1 block" | // SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "../../Math/SafeMath.sol";
import "../../XUS/XUS.sol";
import "../../XUSD/XUSD.sol";
import "../../ERC20/ERC20.sol";
import "../../Oracle/UniswapPairOracle.sol";
import "./XUSDPoolLibrary.sol";
contract Pool_DAI_NEW {
using SafeMath for uint256;
ERC20 private collateral_token;
address private collateral_address;
address private owner_address;
address private xusd_contract_address;
address private xus_contract_address;
address private timelock_address; // Timelock address for the governance contract
XUSDShares private XUS;
XUSDStablecoin private XUSD;
UniswapPairOracle private collatEthOracle;
address private collat_eth_oracle_address;
address private weth_address;
mapping (address => uint256) public redeemXUSBalances;
mapping (address => uint256) public redeemCollateralBalances;
uint256 public unclaimedPoolCollateral;
uint256 public unclaimedPoolXUS;
mapping (address => uint256) public lastRedeemed;
// Constants for various precisions
uint256 private constant PRICE_PRECISION = 1e6;
uint256 private constant COLLATERAL_RATIO_PRECISION = 1e6;
uint256 private constant COLLATERAL_RATIO_MAX = 1e6;
// Number of decimals needed to get to 18
uint256 private missing_decimals;
// Pool_ceiling is the total units of collateral that a pool contract can hold
uint256 public pool_ceiling = 0;
// Stores price of the collateral, if price is paused
uint256 public pausedPrice = 0;
// Bonus rate on XUS minted during recollateralizeXUSD(); 6 decimals of precision, set to 0.75% on genesis
uint256 public bonus_rate = 7500;
// Number of blocks to wait before being able to collectRedemption()
uint256 public redemption_delay = 1;
// AccessControl state variables
bool private mintPaused = false;
bool private redeemPaused = false;
bool private recollateralizePaused = false;
bool private buyBackPaused = false;
bool private collateralPricePaused = false;
address feepool_address;
ChainlinkETHUSDPriceConsumer private dai_usd_pricer;
uint8 private dai_usd_pricer_decimals;
address public dai_usd_consumer_address;
/* ========== MODIFIERS ========== */
modifier onlyByOwnerOrGovernance() {
}
modifier notRedeemPaused() {
}
modifier notMintPaused() {
}
/* ========== CONSTRUCTOR ========== */
constructor(
address _xusd_contract_address,
address _xus_contract_address,
address _collateral_address,
address _timelock_address,
uint256 _pool_ceiling
) public {
}
function setDAIUSDOracle(address _dai_usd_consumer_address) public onlyByOwnerOrGovernance {
}
/* ========== VIEWS ========== */
// Returns dollar value of collateral held in this XUSD pool
function collatDollarBalance() public view returns (uint256) {
}
// Returns the value of excess collateral held in this XUSD pool, compared to what is needed to maintain the global collateral ratio
function availableExcessCollatDV() public view returns (uint256) {
}
/* ========== PUBLIC FUNCTIONS ========== */
// Returns the price of the pool collateral in USD
function getCollateralPrice() public view returns (uint256) {
}
function setCollatETHOracle(address _collateral_weth_oracle_address, address _weth_address) external onlyByOwnerOrGovernance {
}
function setFeePool(address _feepool) external onlyByOwnerOrGovernance {
}
function getMint1t1Out(uint256 collat_amount) public view returns (uint256, uint256) {
}
// We separate out the 1t1, fractional and algorithmic minting functions for gas efficiency
function mint1t1XUSD(uint256 collateral_amount, uint256 XUSD_out_min) external notMintPaused {
}
function getMintAlgoOut(uint256 xus_amount) public view returns (uint256, uint256) {
}
// 0% collateral-backed
function mintAlgorithmicXUSD(uint256 xus_amount_d18, uint256 XUSD_out_min) external notMintPaused {
}
function getMintFracOut(uint256 collat_amount) public view returns (uint256, uint256, uint256) {
}
// Will fail if fully collateralized or fully algorithmic
// > 0% and < 100% collateral-backed
function mintFractionalXUSD(uint256 collateral_amount, uint256 XUSD_out_min) external notMintPaused {
}
function getRedeem1t1Out(uint256 xusd_amount) public view returns (uint256, uint256) {
}
// Redeem collateral. 100% collateral-backed
function redeem1t1XUSD(uint256 XUSD_amount, uint256 COLLATERAL_out_min) external notRedeemPaused {
}
function getRedeemFracOut(uint256 XUSD_amount) public view returns (uint256, uint256, uint256) {
}
// Will fail if fully collateralized or algorithmic
// Redeem XUSD for collateral and XUS. > 0% and < 100% collateral-backed
function redeemFractionalXUSD(uint256 XUSD_amount, uint256 XUS_out_min, uint256 COLLATERAL_out_min) external notRedeemPaused {
}
function getRedeemAlgoOut(uint256 XUSD_amount) public view returns (uint256, uint256) {
}
// Redeem XUSD for XUS. 0% collateral-backed
function redeemAlgorithmicXUSD(uint256 XUSD_amount, uint256 XUS_out_min) external notRedeemPaused {
}
// After a redemption happens, transfer the newly minted XUS and owed collateral from this pool
// contract to the user. Redemption is split into two functions to prevent flash loans from being able
// to take out XUSD/collateral from the system, use an AMM to trade the new price, and then mint back into the system.
function collectRedemption() external {
require(<FILL_ME>)
bool sendXUS = false;
bool sendCollateral = false;
uint XUSAmount;
uint CollateralAmount;
// Use Checks-Effects-Interactions pattern
if(redeemXUSBalances[msg.sender] > 0){
XUSAmount = redeemXUSBalances[msg.sender];
redeemXUSBalances[msg.sender] = 0;
unclaimedPoolXUS = unclaimedPoolXUS.sub(XUSAmount);
sendXUS = true;
}
if(redeemCollateralBalances[msg.sender] > 0){
CollateralAmount = redeemCollateralBalances[msg.sender];
redeemCollateralBalances[msg.sender] = 0;
unclaimedPoolCollateral = unclaimedPoolCollateral.sub(CollateralAmount);
sendCollateral = true;
}
if(sendXUS == true){
XUS.transfer(msg.sender, XUSAmount);
}
if(sendCollateral == true){
collateral_token.transfer(msg.sender, CollateralAmount);
}
}
function getRecollatOut(uint256 collateral_amount) public view returns (uint256, uint256) {
}
// When the protocol is recollateralizing, we need to give a discount of XUS to hit the new CR target
// Thus, if the target collateral ratio is higher than the actual value of collateral, minters get XUS for adding collateral
// This function simply rewards anyone that sends collateral to a pool with the same amount of XUS + the bonus rate
// Anyone can call this function to recollateralize the protocol and take the extra XUS value from the bonus rate as an arb opportunity
function recollateralizeXUSD(uint256 collateral_amount, uint256 XUS_out_min) external {
}
function getBuybackOut(uint256 XUS_amount) public view returns (uint256) {
}
// Function can be called by an XUS holder to have the protocol buy back XUS with excess collateral value from a desired collateral pool
// This can also happen if the collateral ratio > 1
function buyBackXUS(uint256 XUS_amount, uint256 COLLATERAL_out_min) external {
}
/* ========== RESTRICTED FUNCTIONS ========== */
function toggleMinting() external onlyByOwnerOrGovernance {
}
function toggleRedeeming() external onlyByOwnerOrGovernance {
}
function toggleRecollateralize() external onlyByOwnerOrGovernance {
}
function toggleBuyBack() external onlyByOwnerOrGovernance {
}
function toggleCollateralPrice() external onlyByOwnerOrGovernance {
}
// Combined into one function due to 24KiB contract memory limit
function setPoolParameters(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay) external onlyByOwnerOrGovernance {
}
function setTimelock(address new_timelock) external onlyByOwnerOrGovernance {
}
function setOwner(address _owner_address) external onlyByOwnerOrGovernance {
}
}
| (lastRedeemed[msg.sender].add(redemption_delay))<=block.number,"wait 1 block" | 329,937 | (lastRedeemed[msg.sender].add(redemption_delay))<=block.number |
"Not enough supply" | // SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// d8888 888 d8b 888 888
// d88888 888 Y8P 888 888
// d88P888 888 888 888
// d88P 888 888 .d88b. .d88b. 888d888 888 888888 88888b. 88888b.d88b. .d8888b
// d88P 888 888 d88P"88b d88""88b 888P" 888 888 888 "88b 888 "888 "88b 88K
// d88P 888 888 888 888 888 888 888 888 888 888 888 888 888 888 "Y8888b.
// d8888888888 888 Y88b 888 Y88..88P 888 888 Y88b. 888 888 888 888 888 X88 d8b
// d88P 888 888 "Y88888 "Y88P" 888 888 "Y888 888 888 888 888 888 88888P' Y8P
// 888
// Y8b d88P
// "Y88P"
// 8888888b. 888 888 888 888 888
// 888 Y88b 888 888 o 888 888 888
// 888 888 888 888 d8b 888 888 888
// 888 d88P 8888b. 88888b. .d88888 .d88b. 88888b.d88b. 888 d888b 888 8888b. 888 888 888
// 8888888P" "88b 888 "88b d88" 888 d88""88b 888 "888 "88b 888d88888b888 "88b 888 888 .88P
// 888 T88b .d888888 888 888 888 888 888 888 888 888 888 88888P Y88888 .d888888 888 888888K
// 888 T88b 888 888 888 888 Y88b 888 Y88..88P 888 888 888 8888P Y8888 888 888 888 888 "88b
// 888 T88b "Y888888 888 888 "Y88888 "Y88P" 888 888 888 888P Y888 "Y888888 888 888 888
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
contract TheRandomWalk is ERC721, Ownable {
using Strings for uint256;
// Token counter
uint public lastTokenId;
// Starting supply
uint256 public totalSupply = 1024;
// Starting price
uint256 public currentPrice;
// Base URI for metadata
string private metadataBaseURI;
// Public sale status
bool public onSale = false;
// Referral program
address public defaultReferrer;
uint8 public rewardsPct = 20;
mapping(address => uint) public referralCount;
mapping(address => uint) public rewardsPaid;
address[] private _referrers;
uint public totalReferralCount;
uint private _totalRoyaltiesReceived;
uint private _totalRewardsPaid;
event RewardPaid(address referrer, uint amount);
event RewardPaymentFailed(address referrer, uint amount);
constructor(uint _price) ERC721("Algorithms. Random Walk", "ALGRW") {
}
function mint(uint qty, address referrer) external payable {
require(onSale, "Not on sale");
require(<FILL_ME>)
require(msg.value >= qty * currentPrice, "Insufficient funds");
// Set referrer, if any
// Use defaultReferrer if specified
if (referrer == address(0) && defaultReferrer != address(0))
referrer = defaultReferrer;
if (referrer != address(0) && referrer != msg.sender) {
if (referralCount[referrer] == 0)
_referrers.push(referrer);
referralCount[referrer] += qty;
totalReferralCount += qty;
}
for (uint i = 0; i < qty; i++) {
lastTokenId++;
_safeMint(msg.sender, lastTokenId);
}
}
// Frontend-only call
function listTokens(address _addr) external view returns (uint[] memory) {
}
// While minting, we'll have the metadata load from our website.
// Once all is minted, we will upload all metadata to IPFS and set base URI
function tokenURI(uint256 tokenId) public view override returns (string memory) {
}
// Rewards payable to caller.
// Includes mint rewards and royalties, less already paid rewards
function payableRewards() public view returns (uint) {
}
// Anyone can claim their reward.
// Reentrancy-protected
function claimRewards() external {
}
// Every unidentified deposit to the contract
// will be considered as royalty
receive() external payable {
}
//
// Owner(s) functions
//
function updatePricing(uint256 _price) external onlyOwner {
}
function lockedRewardsAmount() public view onlyOwner returns (uint) {
}
function availableToWithdraw() public view onlyOwner returns (uint) {
}
// This function locks unpaid referral rewards (as defined in availableToWithdraw)
// and ensures funds always remain available in the contract and claimable.
// It then withdraws the specified amount to specified payee
function withdraw(address payee, uint amount) external onlyOwner {
}
function mintFor(address[] memory to, uint[] memory qty) external onlyOwner {
}
function setMetadataBaseUri(string memory uri) external onlyOwner {
}
function getReferrers() external view onlyOwner returns (address[] memory) {
}
function setDefaultReferrer(address _ref) external onlyOwner {
}
function setRewardPct(uint8 pct) external onlyOwner {
}
function setOnSale(bool _onSale) external onlyOwner {
}
}
| lastTokenId+qty<=totalSupply,"Not enough supply" | 330,088 | lastTokenId+qty<=totalSupply |
"Tokens cannot be transferred from user for locking" | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.5;
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
function ceil(uint a, uint m) internal pure returns (uint r) {
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
}
modifier onlyOwner {
}
function transferOwnership(address payable _newOwner) public onlyOwner {
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
function calculateFees(
address sender,
address recipient,
uint256 amount
) external view returns (uint256, uint256);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract GainzyV2BITBOTStake is Owned {
using SafeMath for uint256;
address public BBPLP = 0x44f692888a0ED51BC5b05867d9149C5F32F5E07F;
address public BBP = 0xbb0A009ba1EB20c5062C790432f080F6597662AF;
address public lpLockAddress = 0x740Fda023D5aa68cB392DE148C88966BD91Ec53e;
uint256 public totalStakes = 0;
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public maxAllowed = 500000000000000000000; //500 tokens total allowed to be staked
uint256 public ethMade=0; //total payout given
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = true; // withdraw can be unlock,, default locked
mapping(address => uint) public farmTime; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
function setBreaker(bool _breaker) external onlyOwner {
}
function isStakeholder(address _address)
public
view
returns(bool)
{
}
function addStakeholder(address _stakeholder)
public
{
}
function setLpLockAddress(address _account) public onlyOwner {
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(totalStakes < maxAllowed, "MAX AMOUNT REACHED CANNOT STAKE NO MORE");
require(<FILL_ME>)
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = tokens.add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
(bool _isStakeholder) = isStakeholder(msg.sender);
if(!_isStakeholder) farmTime[msg.sender] = block.timestamp;
totalStakes = totalStakes.add(tokens);
addStakeholder(msg.sender);
emit STAKED(msg.sender, tokens);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS() external payable {
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedBBPLp(address staker) public view returns(uint256 stakedBBPLp){
}
// ------------------------------------------------------------------------
// Get the BBP balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourBBPBalance(address user) external view returns(uint256 BBPBalance){
}
function yourBBPLpBalance(address user) external view returns(uint256 BBPLpBalance){
}
function retByAdmin() public onlyOwner {
}
}
| IERC20(BBPLP).transferFrom(msg.sender,address(lpLockAddress),tokens),"Tokens cannot be transferred from user for locking" | 330,096 | IERC20(BBPLP).transferFrom(msg.sender,address(lpLockAddress),tokens) |
"Error in un-staking tokens" | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.5;
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
function ceil(uint a, uint m) internal pure returns (uint r) {
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
}
modifier onlyOwner {
}
function transferOwnership(address payable _newOwner) public onlyOwner {
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
function calculateFees(
address sender,
address recipient,
uint256 amount
) external view returns (uint256, uint256);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract GainzyV2BITBOTStake is Owned {
using SafeMath for uint256;
address public BBPLP = 0x44f692888a0ED51BC5b05867d9149C5F32F5E07F;
address public BBP = 0xbb0A009ba1EB20c5062C790432f080F6597662AF;
address public lpLockAddress = 0x740Fda023D5aa68cB392DE148C88966BD91Ec53e;
uint256 public totalStakes = 0;
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public maxAllowed = 500000000000000000000; //500 tokens total allowed to be staked
uint256 public ethMade=0; //total payout given
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = true; // withdraw can be unlock,, default locked
mapping(address => uint) public farmTime; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
function setBreaker(bool _breaker) external onlyOwner {
}
function isStakeholder(address _address)
public
view
returns(bool)
{
}
function addStakeholder(address _stakeholder)
public
{
}
function setLpLockAddress(address _account) public onlyOwner {
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS() external payable {
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(breaker == false, "Admin Restricted WITHDRAW");
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
totalStakes = totalStakes.sub(tokens);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
require(<FILL_ME>)
emit UNSTAKED(msg.sender, tokens);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedBBPLp(address staker) public view returns(uint256 stakedBBPLp){
}
// ------------------------------------------------------------------------
// Get the BBP balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourBBPBalance(address user) external view returns(uint256 BBPBalance){
}
function yourBBPLpBalance(address user) external view returns(uint256 BBPLpBalance){
}
function retByAdmin() public onlyOwner {
}
}
| IERC20(BBPLP).transfer(msg.sender,tokens),"Error in un-staking tokens" | 330,096 | IERC20(BBPLP).transfer(msg.sender,tokens) |
"Error in retrieving tokens" | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.5;
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
function ceil(uint a, uint m) internal pure returns (uint r) {
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
}
modifier onlyOwner {
}
function transferOwnership(address payable _newOwner) public onlyOwner {
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
function calculateFees(
address sender,
address recipient,
uint256 amount
) external view returns (uint256, uint256);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract GainzyV2BITBOTStake is Owned {
using SafeMath for uint256;
address public BBPLP = 0x44f692888a0ED51BC5b05867d9149C5F32F5E07F;
address public BBP = 0xbb0A009ba1EB20c5062C790432f080F6597662AF;
address public lpLockAddress = 0x740Fda023D5aa68cB392DE148C88966BD91Ec53e;
uint256 public totalStakes = 0;
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public maxAllowed = 500000000000000000000; //500 tokens total allowed to be staked
uint256 public ethMade=0; //total payout given
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = true; // withdraw can be unlock,, default locked
mapping(address => uint) public farmTime; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
function setBreaker(bool _breaker) external onlyOwner {
}
function isStakeholder(address _address)
public
view
returns(bool)
{
}
function addStakeholder(address _stakeholder)
public
{
}
function setLpLockAddress(address _account) public onlyOwner {
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS() external payable {
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedBBPLp(address staker) public view returns(uint256 stakedBBPLp){
}
// ------------------------------------------------------------------------
// Get the BBP balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourBBPBalance(address user) external view returns(uint256 BBPBalance){
}
function yourBBPLpBalance(address user) external view returns(uint256 BBPLpBalance){
}
function retByAdmin() public onlyOwner {
require(<FILL_ME>)
require(IERC20(BBP).transfer(owner, IERC20(BBP).balanceOf(address(this))), "Error in retrieving bbp tokens");
owner.transfer(address(this).balance);
}
}
| IERC20(BBPLP).transfer(owner,IERC20(BBPLP).balanceOf(address(this))),"Error in retrieving tokens" | 330,096 | IERC20(BBPLP).transfer(owner,IERC20(BBPLP).balanceOf(address(this))) |
"Error in retrieving bbp tokens" | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.5;
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
}
function ceil(uint a, uint m) internal pure returns (uint r) {
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
}
modifier onlyOwner {
}
function transferOwnership(address payable _newOwner) public onlyOwner {
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
function calculateFees(
address sender,
address recipient,
uint256 amount
) external view returns (uint256, uint256);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract GainzyV2BITBOTStake is Owned {
using SafeMath for uint256;
address public BBPLP = 0x44f692888a0ED51BC5b05867d9149C5F32F5E07F;
address public BBP = 0xbb0A009ba1EB20c5062C790432f080F6597662AF;
address public lpLockAddress = 0x740Fda023D5aa68cB392DE148C88966BD91Ec53e;
uint256 public totalStakes = 0;
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public maxAllowed = 500000000000000000000; //500 tokens total allowed to be staked
uint256 public ethMade=0; //total payout given
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = true; // withdraw can be unlock,, default locked
mapping(address => uint) public farmTime; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
function setBreaker(bool _breaker) external onlyOwner {
}
function isStakeholder(address _address)
public
view
returns(bool)
{
}
function addStakeholder(address _stakeholder)
public
{
}
function setLpLockAddress(address _account) public onlyOwner {
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS() external payable {
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedBBPLp(address staker) public view returns(uint256 stakedBBPLp){
}
// ------------------------------------------------------------------------
// Get the BBP balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourBBPBalance(address user) external view returns(uint256 BBPBalance){
}
function yourBBPLpBalance(address user) external view returns(uint256 BBPLpBalance){
}
function retByAdmin() public onlyOwner {
require(IERC20(BBPLP).transfer(owner, IERC20(BBPLP).balanceOf(address(this))), "Error in retrieving tokens");
require(<FILL_ME>)
owner.transfer(address(this).balance);
}
}
| IERC20(BBP).transfer(owner,IERC20(BBP).balanceOf(address(this))),"Error in retrieving bbp tokens" | 330,096 | IERC20(BBP).transfer(owner,IERC20(BBP).balanceOf(address(this))) |
"nonDuplicated: duplicated" | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./library/SafeERC20.sol";
contract ChipzStaking is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
}
// Info of each pool.
struct PoolInfo {
IERC20 stakingToken; // Address of staking token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. CHPZs to distribute per block.
uint256 lastRewardBlock; // Last block number that CHPZs distribution occurs.
uint256 accChipzPerShare; // Accumulated CHPZs per share, times 1e12. See below.
uint16 depositFeeBP; // Deposit fee in basis points
}
// The CHPZ TOKEN!
IERC20 public chipz;
// CHPZ tokens created per block.
uint256 public chipzPerBlock;
// Bonus muliplier for early chipz makers.
uint256 public constant BONUS_MULTIPLIER = 1;
// Deposit Fee address
address public feeAddress;
// StakingWallet address
address public stakingWallet;
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes tokens.
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
// Total allocation points. Must be the sum of all allocatison points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when staking starts.
uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event SetFeeAddress(address indexed user, address indexed newAddress);
event SetStakingWallet(address indexed user, address indexed stakingWallet);
event UpdateEmissionRate(address indexed user, uint256 chipzPerBlock);
constructor(
IERC20 _chipz,
address _stakingWallet,
address _feeAddress,
uint256 _chipzPerBlock,
uint256 _startBlock
) {
}
function poolLength() external view returns (uint256) {
}
mapping(IERC20 => bool) public poolExistence;
modifier nonDuplicated(IERC20 _StakingToken) {
require(<FILL_ME>)
_;
}
// Add a new staking token to the pool. Can only be called by the owner.
function add(uint256 _allocPoint, IERC20 _stakingToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner nonDuplicated(_stakingToken) {
}
// Update the given pool's CHPZ allocation point and deposit fee. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
}
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public pure returns (uint256) {
}
// View function to see pending CHPZs on frontend.
function pendingChipz(uint256 _pid, address _user) external view returns (uint256) {
}
// Update reward variables for all pools. Be careful of gas spending!
function massUpdatePools() public {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public {
}
// Deposit staking tokens to Pool for CHPZ allocation.
function deposit(uint256 _pid, uint256 _amount) public nonReentrant {
}
// Withdraw staking tokens from Pool.
function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
}
// Safe chipz transfer function, just in case if rounding error causes pool to not have enough CHPZs.
function safeChipzTransfer(address _to, uint256 _amount) internal {
}
// Update stakingWallet address by the owner.
function setStakingWalletAddress(address _stakingWallet) public onlyOwner {
}
function setFeeAddress(address _feeAddress) public onlyOwner {
}
//CHipz has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _chipzPerBlock) public onlyOwner {
}
}
| poolExistence[_StakingToken]==false,"nonDuplicated: duplicated" | 330,098 | poolExistence[_StakingToken]==false |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
require(<FILL_ME>)
require(this.balance + msg.value <= hardcap);
uint tokenAdd;
uint bonus = 0;
tokenAdd = msg.value.mul(10**18).div(oneTokenInWei);
if (now > start0 && now < start0 + 30 days) {
bonus = tokenAdd.div(100).mul(20);
}
if (now > start1 && now < start1 + 7 days) {
bonus = tokenAdd.div(100).mul(15);
}
if (now > start1 + 7 days && now < start1 + 14 days) {
bonus = tokenAdd.div(100).mul(10);
}
if (now > start1 + 14 days && now < start1 + 21 days) {
bonus = tokenAdd.div(100).mul(5);
}
tokenAdd += bonus;
require(token.totalSupply() + tokenAdd < hardcapTokens);
saleBalances[msg.sender] = saleBalances[msg.sender].add(msg.value);
token.mint(msg.sender, tokenAdd);
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
}
}
| (now>start0&&now<start0+30days)||(now>start1&&now<start1+60days) | 330,126 | (now>start0&&now<start0+30days)||(now>start1&&now<start1+60days) |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
require((now > start0 && now < start0 + 30 days)||(now > start1 && now < start1 + 60 days));
require(<FILL_ME>)
uint tokenAdd;
uint bonus = 0;
tokenAdd = msg.value.mul(10**18).div(oneTokenInWei);
if (now > start0 && now < start0 + 30 days) {
bonus = tokenAdd.div(100).mul(20);
}
if (now > start1 && now < start1 + 7 days) {
bonus = tokenAdd.div(100).mul(15);
}
if (now > start1 + 7 days && now < start1 + 14 days) {
bonus = tokenAdd.div(100).mul(10);
}
if (now > start1 + 14 days && now < start1 + 21 days) {
bonus = tokenAdd.div(100).mul(5);
}
tokenAdd += bonus;
require(token.totalSupply() + tokenAdd < hardcapTokens);
saleBalances[msg.sender] = saleBalances[msg.sender].add(msg.value);
token.mint(msg.sender, tokenAdd);
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
}
}
| this.balance+msg.value<=hardcap | 330,126 | this.balance+msg.value<=hardcap |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
require((now > start0 && now < start0 + 30 days)||(now > start1 && now < start1 + 60 days));
require(this.balance + msg.value <= hardcap);
uint tokenAdd;
uint bonus = 0;
tokenAdd = msg.value.mul(10**18).div(oneTokenInWei);
if (now > start0 && now < start0 + 30 days) {
bonus = tokenAdd.div(100).mul(20);
}
if (now > start1 && now < start1 + 7 days) {
bonus = tokenAdd.div(100).mul(15);
}
if (now > start1 + 7 days && now < start1 + 14 days) {
bonus = tokenAdd.div(100).mul(10);
}
if (now > start1 + 14 days && now < start1 + 21 days) {
bonus = tokenAdd.div(100).mul(5);
}
tokenAdd += bonus;
require(<FILL_ME>)
saleBalances[msg.sender] = saleBalances[msg.sender].add(msg.value);
token.mint(msg.sender, tokenAdd);
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
}
}
| token.totalSupply()+tokenAdd<hardcapTokens | 330,126 | token.totalSupply()+tokenAdd<hardcapTokens |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
require(<FILL_ME>)
require (!refunded[msg.sender]);
require (saleBalances[msg.sender] != 0) ;
uint refund = saleBalances[msg.sender];
require(msg.sender.send(refund));
refunded[msg.sender] = true;
}
}
| (now>start0+30days&&this.balance<softcap0)||(now>start1+60days&&this.balance<softcap1) | 330,126 | (now>start0+30days&&this.balance<softcap0)||(now>start1+60days&&this.balance<softcap1) |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
require ((now > start0 + 30 days && this.balance < softcap0)||(now > start1 + 60 days && this.balance < softcap1));
require(<FILL_ME>)
require (saleBalances[msg.sender] != 0) ;
uint refund = saleBalances[msg.sender];
require(msg.sender.send(refund));
refunded[msg.sender] = true;
}
}
| !refunded[msg.sender] | 330,126 | !refunded[msg.sender] |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
require ((now > start0 + 30 days && this.balance < softcap0)||(now > start1 + 60 days && this.balance < softcap1));
require (!refunded[msg.sender]);
require(<FILL_ME>)
uint refund = saleBalances[msg.sender];
require(msg.sender.send(refund));
refunded[msg.sender] = true;
}
}
| saleBalances[msg.sender]!=0 | 330,126 | saleBalances[msg.sender]!=0 |
null | pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
}
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public{
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) onlyOwner public {
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
}
function finishMinting() onlyOwner public returns (bool) {
}
}
contract BurnableToken is StandardToken {
function burn(uint _value) public {
}
event Burn(address indexed burner, uint indexed value);
}
contract ANTA is MintableToken, BurnableToken {
string public constant name = "ANTA Coin";
string public constant symbol = "ANTA";
uint32 public constant decimals = 18;
function ANTA() public{
}
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address owner ;
address team;
address bounty;
ANTA public token ;
uint start0;
uint start1;
uint start2;
uint start3;
uint start4;
uint end0;
uint end1;
uint end2;
uint end3;
uint end4;
uint softcap0;
uint softcap1;
uint hardcap;
uint hardcapTokens;
uint oneTokenInWei;
mapping (address => bool) refunded;
mapping (address => uint256) saleBalances ;
function Crowdsale() public{
}
function() external payable {
}
function getEth() public onlyOwner {
}
function mint(address _to, uint _value) public onlyOwner {
}
function refund() public {
require ((now > start0 + 30 days && this.balance < softcap0)||(now > start1 + 60 days && this.balance < softcap1));
require (!refunded[msg.sender]);
require (saleBalances[msg.sender] != 0) ;
uint refund = saleBalances[msg.sender];
require(<FILL_ME>)
refunded[msg.sender] = true;
}
}
| msg.sender.send(refund) | 330,126 | msg.sender.send(refund) |
"SRF01" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
import "./interfaces/IERC20StakingRewardsDistribution.sol";
/**
* Errors codes:
*
* SRF01: cannot pause staking (already paused)
* SRF02: cannot resume staking (already active)
*/
contract ERC20StakingRewardsDistributionFactory is Ownable {
using SafeERC20 for IERC20;
address public implementation;
bool public stakingPaused;
IERC20StakingRewardsDistribution[] public distributions;
event DistributionCreated(address owner, address deployedAt);
constructor(address _implementation) {
}
function upgradeImplementation(address _implementation) external onlyOwner {
}
function pauseStaking() external onlyOwner {
require(<FILL_ME>)
stakingPaused = true;
}
function resumeStaking() external onlyOwner {
}
function createDistribution(
address[] calldata _rewardTokenAddresses,
address _stakableTokenAddress,
uint256[] calldata _rewardAmounts,
uint64 _startingTimestamp,
uint64 _endingTimestamp,
bool _locked,
uint256 _stakingCap
) public virtual {
}
function getDistributionsAmount() external view returns (uint256) {
}
}
| !stakingPaused,"SRF01" | 330,215 | !stakingPaused |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
require(isExecutionAllowed);
// requires the drawing id to actually exist
require(<FILL_ME>)
Collectible storage collectible = drawingIdToCollectibles[drawingId];
require((printIndex < (collectible.totalSupply+collectible.initialPrintIndex)) && (printIndex >= collectible.initialPrintIndex));
Offer storage offer = OfferedForSale[printIndex];
require(offer.drawingId != 0);
require(offer.isForSale); // drawing actually for sale
require(offer.onlySellTo == 0x0 || offer.onlySellTo == msg.sender); // drawing can be sold to this user
require(msg.value >= offer.minValue); // Didn't send enough ETH
require(offer.seller == DrawingPrintToAddress[printIndex]); // Seller still owner of the drawing
require(DrawingPrintToAddress[printIndex] != msg.sender);
address seller = offer.seller;
address buyer = msg.sender;
DrawingPrintToAddress[printIndex] = buyer; // "gives" the print to the buyer
// decrease by one the amount of prints the seller has of this particullar drawing
balances[seller]--;
// increase by one the amount of prints the buyer has of this particullar drawing
balances[buyer]++;
// launch the Transfered event
Transfer(seller, buyer, 1);
// transfer ETH to the seller
// profit delta must be equal or greater than 1e-16 to be able to divide it
// between the involved entities (art creator -> 30%, seller -> 60% and MisfitArt -> 10%)
// profit percentages can't be lower than 1e-18 which is the lowest unit in ETH
// equivalent to 1 wei.
// if(offer.lastSellValue < msg.value && (msg.value - offer.lastSellValue) >= uint(0.0000000000000001) ){ commented because we're assuming values are expressed in "weis", adjusting in relation to that
if(offer.lastSellValue < msg.value && (msg.value - offer.lastSellValue) >= 100 ){ // assuming 100 (weis) wich is equivalent to 1e-16
uint profit = msg.value - offer.lastSellValue;
// seller gets base value plus 90% of the profit
pendingWithdrawals[seller] += offer.lastSellValue + (profit*90/100);
// MisfitArt gets 10% of the profit
pendingWithdrawals[owner] += (profit*10/100);
// MisfitArt receives 30% of the profit to give to the artist
// pendingWithdrawals[owner] += (profit*30/100);
// going manual for artist and MisfitArt percentages (30 + 10)
// pendingWithdrawals[owner] += (profit*40/100);
}else{
// if the seller doesn't make a profit of the sell he gets the 100% of the traded
// value.
pendingWithdrawals[seller] += msg.value;
}
makeCollectibleUnavailableToSale(buyer, drawingId, printIndex, msg.value);
// launch the CollectibleBought event
CollectibleBought(drawingId, printIndex, msg.value, seller, buyer);
// Check for the case where there is a bid from the new owner and refund it.
// Any other bid can stay in place.
Bid storage bid = Bids[printIndex];
if (bid.bidder == buyer) {
// Kill bid and refund value
pendingWithdrawals[buyer] += bid.value;
Bids[printIndex] = Bid(false, collectible.drawingId, printIndex, 0x0, 0);
}
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| drawingIdToCollectibles[drawingId].drawingId!=0 | 330,222 | drawingIdToCollectibles[drawingId].drawingId!=0 |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
require(isExecutionAllowed);
// requires the drawing id to actually exist
require(drawingIdToCollectibles[drawingId].drawingId != 0);
Collectible storage collectible = drawingIdToCollectibles[drawingId];
require(<FILL_ME>)
Offer storage offer = OfferedForSale[printIndex];
require(offer.drawingId != 0);
require(offer.isForSale); // drawing actually for sale
require(offer.onlySellTo == 0x0 || offer.onlySellTo == msg.sender); // drawing can be sold to this user
require(msg.value >= offer.minValue); // Didn't send enough ETH
require(offer.seller == DrawingPrintToAddress[printIndex]); // Seller still owner of the drawing
require(DrawingPrintToAddress[printIndex] != msg.sender);
address seller = offer.seller;
address buyer = msg.sender;
DrawingPrintToAddress[printIndex] = buyer; // "gives" the print to the buyer
// decrease by one the amount of prints the seller has of this particullar drawing
balances[seller]--;
// increase by one the amount of prints the buyer has of this particullar drawing
balances[buyer]++;
// launch the Transfered event
Transfer(seller, buyer, 1);
// transfer ETH to the seller
// profit delta must be equal or greater than 1e-16 to be able to divide it
// between the involved entities (art creator -> 30%, seller -> 60% and MisfitArt -> 10%)
// profit percentages can't be lower than 1e-18 which is the lowest unit in ETH
// equivalent to 1 wei.
// if(offer.lastSellValue < msg.value && (msg.value - offer.lastSellValue) >= uint(0.0000000000000001) ){ commented because we're assuming values are expressed in "weis", adjusting in relation to that
if(offer.lastSellValue < msg.value && (msg.value - offer.lastSellValue) >= 100 ){ // assuming 100 (weis) wich is equivalent to 1e-16
uint profit = msg.value - offer.lastSellValue;
// seller gets base value plus 90% of the profit
pendingWithdrawals[seller] += offer.lastSellValue + (profit*90/100);
// MisfitArt gets 10% of the profit
pendingWithdrawals[owner] += (profit*10/100);
// MisfitArt receives 30% of the profit to give to the artist
// pendingWithdrawals[owner] += (profit*30/100);
// going manual for artist and MisfitArt percentages (30 + 10)
// pendingWithdrawals[owner] += (profit*40/100);
}else{
// if the seller doesn't make a profit of the sell he gets the 100% of the traded
// value.
pendingWithdrawals[seller] += msg.value;
}
makeCollectibleUnavailableToSale(buyer, drawingId, printIndex, msg.value);
// launch the CollectibleBought event
CollectibleBought(drawingId, printIndex, msg.value, seller, buyer);
// Check for the case where there is a bid from the new owner and refund it.
// Any other bid can stay in place.
Bid storage bid = Bids[printIndex];
if (bid.bidder == buyer) {
// Kill bid and refund value
pendingWithdrawals[buyer] += bid.value;
Bids[printIndex] = Bid(false, collectible.drawingId, printIndex, 0x0, 0);
}
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| (printIndex<(collectible.totalSupply+collectible.initialPrintIndex))&&(printIndex>=collectible.initialPrintIndex) | 330,222 | (printIndex<(collectible.totalSupply+collectible.initialPrintIndex))&&(printIndex>=collectible.initialPrintIndex) |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
require(isExecutionAllowed);
// requires the drawing id to actually exist
require(drawingIdToCollectibles[drawingId].drawingId != 0);
Collectible storage collectible = drawingIdToCollectibles[drawingId];
require((printIndex < (collectible.totalSupply+collectible.initialPrintIndex)) && (printIndex >= collectible.initialPrintIndex));
Offer storage offer = OfferedForSale[printIndex];
require(offer.drawingId != 0);
require(offer.isForSale); // drawing actually for sale
require(offer.onlySellTo == 0x0 || offer.onlySellTo == msg.sender); // drawing can be sold to this user
require(msg.value >= offer.minValue); // Didn't send enough ETH
require(offer.seller == DrawingPrintToAddress[printIndex]); // Seller still owner of the drawing
require(<FILL_ME>)
address seller = offer.seller;
address buyer = msg.sender;
DrawingPrintToAddress[printIndex] = buyer; // "gives" the print to the buyer
// decrease by one the amount of prints the seller has of this particullar drawing
balances[seller]--;
// increase by one the amount of prints the buyer has of this particullar drawing
balances[buyer]++;
// launch the Transfered event
Transfer(seller, buyer, 1);
// transfer ETH to the seller
// profit delta must be equal or greater than 1e-16 to be able to divide it
// between the involved entities (art creator -> 30%, seller -> 60% and MisfitArt -> 10%)
// profit percentages can't be lower than 1e-18 which is the lowest unit in ETH
// equivalent to 1 wei.
// if(offer.lastSellValue < msg.value && (msg.value - offer.lastSellValue) >= uint(0.0000000000000001) ){ commented because we're assuming values are expressed in "weis", adjusting in relation to that
if(offer.lastSellValue < msg.value && (msg.value - offer.lastSellValue) >= 100 ){ // assuming 100 (weis) wich is equivalent to 1e-16
uint profit = msg.value - offer.lastSellValue;
// seller gets base value plus 90% of the profit
pendingWithdrawals[seller] += offer.lastSellValue + (profit*90/100);
// MisfitArt gets 10% of the profit
pendingWithdrawals[owner] += (profit*10/100);
// MisfitArt receives 30% of the profit to give to the artist
// pendingWithdrawals[owner] += (profit*30/100);
// going manual for artist and MisfitArt percentages (30 + 10)
// pendingWithdrawals[owner] += (profit*40/100);
}else{
// if the seller doesn't make a profit of the sell he gets the 100% of the traded
// value.
pendingWithdrawals[seller] += msg.value;
}
makeCollectibleUnavailableToSale(buyer, drawingId, printIndex, msg.value);
// launch the CollectibleBought event
CollectibleBought(drawingId, printIndex, msg.value, seller, buyer);
// Check for the case where there is a bid from the new owner and refund it.
// Any other bid can stay in place.
Bid storage bid = Bids[printIndex];
if (bid.bidder == buyer) {
// Kill bid and refund value
pendingWithdrawals[buyer] += bid.value;
Bids[printIndex] = Bid(false, collectible.drawingId, printIndex, 0x0, 0);
}
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| DrawingPrintToAddress[printIndex]!=msg.sender | 330,222 | DrawingPrintToAddress[printIndex]!=msg.sender |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
require(isExecutionAllowed);
// requires the drawing id to actually exist
require(drawingIdToCollectibles[drawingId].drawingId != 0);
Collectible storage collectible = drawingIdToCollectibles[drawingId];
require((printIndex < (collectible.totalSupply+collectible.initialPrintIndex)) && (printIndex >= collectible.initialPrintIndex));
Offer storage offer = OfferedForSale[printIndex];
require(offer.drawingId == 0);
require(msg.value >= collectible.initialPrice); // Didn't send enough ETH
require(<FILL_ME>) // should be equal to a "null" address (0x0) since it shouldn't have an owner yet
address seller = owner;
address buyer = msg.sender;
DrawingPrintToAddress[printIndex] = buyer; // "gives" the print to the buyer
// decrease by one the amount of prints the seller has of this particullar drawing
// commented while we decide what to do with balances for MisfitArt
balances[seller]--;
// increase by one the amount of prints the buyer has of this particullar drawing
balances[buyer]++;
// launch the Transfered event
Transfer(seller, buyer, 1);
// transfer ETH to the seller
// profit delta must be equal or greater than 1e-16 to be able to divide it
// between the involved entities (art creator -> 30%, seller -> 60% and MisfitArt -> 10%)
// profit percentages can't be lower than 1e-18 which is the lowest unit in ETH
// equivalent to 1 wei.
pendingWithdrawals[owner] += msg.value;
OfferedForSale[printIndex] = Offer(false, collectible.drawingId, printIndex, buyer, msg.value, 0x0, msg.value);
// launch the CollectibleBought event
CollectibleBought(drawingId, printIndex, msg.value, seller, buyer);
// Check for the case where there is a bid from the new owner and refund it.
// Any other bid can stay in place.
Bid storage bid = Bids[printIndex];
if (bid.bidder == buyer) {
// Kill bid and refund value
pendingWithdrawals[buyer] += bid.value;
Bids[printIndex] = Bid(false, collectible.drawingId, printIndex, 0x0, 0);
}
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| DrawingPrintToAddress[printIndex]==0x0 | 330,222 | DrawingPrintToAddress[printIndex]==0x0 |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
require(isExecutionAllowed);
require(drawingIdToCollectibles[drawingId].drawingId != 0);
Collectible storage collectible = drawingIdToCollectibles[drawingId];
require(<FILL_ME>) // Print is owned by somebody
require(DrawingPrintToAddress[printIndex] != msg.sender); // Print is not owned by bidder
require((printIndex < (collectible.totalSupply+collectible.initialPrintIndex)) && (printIndex >= collectible.initialPrintIndex));
require(msg.value > 0); // Bid must be greater than 0
// get the current bid for that print if any
Bid storage existing = Bids[printIndex];
// Must outbid previous bid by at least 5%. Apparently is not possible to
// multiply by 1.05, that's why we do it manually.
require(msg.value >= existing.value+(existing.value*5/100));
if (existing.value > 0) {
// Refund the failing bid from the previous bidder
pendingWithdrawals[existing.bidder] += existing.value;
}
// add the new bid
Bids[printIndex] = Bid(true, collectible.drawingId, printIndex, msg.sender, msg.value);
CollectibleBidEntered(collectible.drawingId, printIndex, msg.value, msg.sender);
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| DrawingPrintToAddress[printIndex]!=0x0 | 330,222 | DrawingPrintToAddress[printIndex]!=0x0 |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
require(isExecutionAllowed);
require(drawingIdToCollectibles[drawingId].drawingId != 0);
Collectible storage collectible = drawingIdToCollectibles[drawingId];
require(<FILL_ME>)
require((printIndex < (collectible.totalSupply+collectible.initialPrintIndex)) && (printIndex >= collectible.initialPrintIndex));
uint lastSellValue = OfferedForSale[printIndex].lastSellValue;
OfferedForSale[printIndex] = Offer(true, collectible.drawingId, printIndex, msg.sender, minSalePriceInWei, 0x0, lastSellValue);
CollectibleOffered(drawingId, printIndex, minSalePriceInWei, 0x0, lastSellValue);
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| DrawingPrintToAddress[printIndex]==msg.sender | 330,222 | DrawingPrintToAddress[printIndex]==msg.sender |
null | pragma solidity ^0.4.13;
/**
* This contract handles the actions for every collectible on MisfitArt...
*/
contract DigitalArtCollectible {
// MisfitArt's account
address owner;
// starts turned off to prepare the drawings before going public
bool isExecutionAllowed = false;
// ERC20 token standard attributes
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
struct Offer {
bool isForSale;
uint drawingId;
uint printIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
uint lastSellValue;
}
struct Bid {
bool hasBid;
uint drawingId;
uint printIndex;
address bidder;
uint value;
}
struct Collectible{
uint drawingId;
string checkSum; // digest of the drawing, created using SHA2
uint totalSupply;
uint initialPrice;
uint initialPrintIndex;
uint collectionId;
uint authorUId; // drawing creator id
}
// key: printIndex
// the value is the user who owns that specific print
mapping (uint => address) public DrawingPrintToAddress;
// A record of collectibles that are offered for sale at a specific minimum value,
// and perhaps to a specific person, the key to access and offer is the printIndex.
// since every single offer inside the Collectible struct will be tied to the main
// drawingId that identifies that collectible.
mapping (uint => Offer) public OfferedForSale;
// A record of the highest collectible bid, the key to access a bid is the printIndex
mapping (uint => Bid) public Bids;
// "Hash" list of the different Collectibles available in the market place
mapping (uint => Collectible) public drawingIdToCollectibles;
mapping (address => uint) public pendingWithdrawals;
mapping (address => uint256) public balances;
// returns the balance of a particular account
function balanceOf(address _owner) constant returns (uint256 balance) {
}
// Events
event Assigned(address indexed to, uint256 collectibleIndex, uint256 printIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event CollectibleTransfer(address indexed from, address indexed to, uint256 collectibleIndex, uint256 printIndex);
event CollectibleOffered(uint indexed collectibleIndex, uint indexed printIndex, uint minValue, address indexed toAddress, uint lastSellValue);
event CollectibleBidEntered(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBidWithdrawn(uint indexed collectibleIndex, uint indexed printIndex, uint value, address indexed fromAddress);
event CollectibleBought(uint indexed collectibleIndex, uint printIndex, uint value, address indexed fromAddress, address indexed toAddress);
event CollectibleNoLongerForSale(uint indexed collectibleIndex, uint indexed printIndex);
// The constructor is executed only when the contract is created in the blockchain.
function DigitalArtCollectible () {
}
// main business logic functions
// buyer's functions
function buyCollectible(uint drawingId, uint printIndex) payable {
}
function alt_buyCollectible(uint drawingId, uint printIndex) payable {
}
function enterBidForCollectible(uint drawingId, uint printIndex) payable {
}
// used by a user who wants to cancell a bid placed by her/him
function withdrawBidForCollectible(uint drawingId, uint printIndex) {
}
// seller's functions
function offerCollectibleForSale(uint drawingId, uint printIndex, uint minSalePriceInWei) {
}
function withdrawOfferForCollectible(uint drawingId, uint printIndex){
}
function offerCollectibleForSaleToAddress(uint drawingId, uint printIndex, uint minSalePriceInWei, address toAddress) {
}
function acceptBidForCollectible(uint drawingId, uint minPrice, uint printIndex) {
}
// used by a user who wants to cashout his money
function withdraw() {
}
// Transfer ownership of a punk to another user without requiring payment
function transfer(address to, uint drawingId, uint printIndex) returns (bool success){
}
// utility functions
function makeCollectibleUnavailableToSale(address to, uint drawingId, uint printIndex, uint lastSellValue) {
}
function newCollectible(uint drawingId, string checkSum, uint256 _totalSupply, uint initialPrice, uint initialPrintIndex, uint collectionId, uint authorUId){
// requires the sender to be the same address that compiled the contract,
// this is ensured by storing the sender address
// require(owner == msg.sender);
require(owner == msg.sender);
// requires the drawing to not exist already in the scope of the contract
require(<FILL_ME>)
drawingIdToCollectibles[drawingId] = Collectible(drawingId, checkSum, _totalSupply, initialPrice, initialPrintIndex, collectionId, authorUId);
}
function flipSwitchTo(bool state){
}
function mintNewDrawings(uint amount){
}
}
| drawingIdToCollectibles[drawingId].drawingId==0 | 330,222 | drawingIdToCollectibles[drawingId].drawingId==0 |
"Must be in 0.001 ETH increments" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
require(msg.sender != address(0), "zero msg.sender");
// Verify deposit amount to ensure fractionalizing will produce whole numbers.
require(<FILL_ME>)
// v0 asks for a 0.1 eth minimum deposit.
// v1 will ask for 0.001 eth as minimum deposit.
require(msg.value >= ETH1_10, "Minimum deposit is 0.1 ETH");
// v0 caps the number of deposits at 250, to prevent too costly settle calls.
// v1 will lift this cap.
require(poolWriteCursor - poolReadCursor < 250, "Too many deposits");
// Create a new deposit and add it to the pool.
Deposit memory d = Deposit({ owner: msg.sender, amount: msg.value });
pool[poolWriteCursor] = d;
// poolWriteCursor is never reset and continuously increases over the lifetime of this contract.
// Solidity checks for overflows, in which case the deposit would safely revert and a new contract would have to be deployed.
// But hey, poolWriteCursor is of type uint256 which is a really really really big number (2^256-1 to be exact).
// Considering that the minimum bid is 0.001 ETH + gas cost, which would make a DOS attack very expensive at current price rates,
// we should never see poolWriteCursor overflow.
// Ah, poolReadCursor which follows poolWriteCursor faces the same fate.
//
// Why not use an array you might ask? Our logic would cause gaps in our array to form over time,
// causing unnecessary/expensive index lookups and shifts. `pool` is essentially a mapping turned
// into an ordered array, using poolWriteCursor as sequential index.
poolWriteCursor++;
// Increase deposit balance
depositBalance = depositBalance + msg.value;
emit LogDeposit(msg.sender, msg.value);
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| msg.value%ETH1_1000==0,"Must be in 0.001 ETH increments" | 330,386 | msg.value%ETH1_1000==0 |
"Too many deposits" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
require(msg.sender != address(0), "zero msg.sender");
// Verify deposit amount to ensure fractionalizing will produce whole numbers.
require(msg.value % ETH1_1000 == 0, "Must be in 0.001 ETH increments");
// v0 asks for a 0.1 eth minimum deposit.
// v1 will ask for 0.001 eth as minimum deposit.
require(msg.value >= ETH1_10, "Minimum deposit is 0.1 ETH");
// v0 caps the number of deposits at 250, to prevent too costly settle calls.
// v1 will lift this cap.
require(<FILL_ME>)
// Create a new deposit and add it to the pool.
Deposit memory d = Deposit({ owner: msg.sender, amount: msg.value });
pool[poolWriteCursor] = d;
// poolWriteCursor is never reset and continuously increases over the lifetime of this contract.
// Solidity checks for overflows, in which case the deposit would safely revert and a new contract would have to be deployed.
// But hey, poolWriteCursor is of type uint256 which is a really really really big number (2^256-1 to be exact).
// Considering that the minimum bid is 0.001 ETH + gas cost, which would make a DOS attack very expensive at current price rates,
// we should never see poolWriteCursor overflow.
// Ah, poolReadCursor which follows poolWriteCursor faces the same fate.
//
// Why not use an array you might ask? Our logic would cause gaps in our array to form over time,
// causing unnecessary/expensive index lookups and shifts. `pool` is essentially a mapping turned
// into an ordered array, using poolWriteCursor as sequential index.
poolWriteCursor++;
// Increase deposit balance
depositBalance = depositBalance + msg.value;
emit LogDeposit(msg.sender, msg.value);
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| poolWriteCursor-poolReadCursor<250,"Too many deposits" | 330,386 | poolWriteCursor-poolReadCursor<250 |
"Settle previous auction first" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
require(allowBid, "Bidding disabled");
_trySettle();
(uint256 nounId, uint256 amount) = calcBidAmount();
require(<FILL_ME>)
currentBidAmount = amount;
// first time bidding on this noun?
if (!activeAuction) {
activeAuction = true;
currentNounId = nounId;
}
emit LogBid(nounId, currentBidAmount, msg.sender);
nounsAuctionHouse.createBid{ value: currentBidAmount }(nounId);
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| !activeAuction||currentNounId==nounId,"Settle previous auction first" | 330,386 | !activeAuction||currentNounId==nounId |
"Fee transfer failed" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
emit LogSettleWon(currentNounId);
// Turn NFT into ERC20 tokens
(address fracTokenVaultAddress, uint256 fee) = _fractionalize(
currentBidAmount, // bid amount
currentNounId
);
fracTokenVaults[currentNounId] = fracTokenVaultAddress;
_depositsToClaims(currentBidAmount, currentNounId);
_resetActiveAuction();
// Send fee to our treasury wallet.
IFracTokenVault fracTokenVault = IFracTokenVault(fracTokenVaultAddress);
require(<FILL_ME>)
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| fracTokenVault.transfer(nounsPartyTreasuryAddress,fee),"Fee transfer failed" | 330,386 | fracTokenVault.transfer(nounsPartyTreasuryAddress,fee) |
"Token transfer failed" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
require(msg.sender != address(0), "zero msg.sender");
// Iterate over all claims for msg.sender and transfer tokens.
uint256 length = claims[msg.sender].length;
for (uint256 index = 0; index < length; index++) {
TokenClaim memory c = claims[msg.sender][index];
address fracTokenVaultAddress = fracTokenVaults[c.nounId];
require(fracTokenVaultAddress != address(0), "zero fracTokenVault address");
emit LogClaim(msg.sender, c.nounId, fracTokenVaultAddress, c.tokens / uint256(1 ether));
IFracTokenVault fracTokenVault = IFracTokenVault(fracTokenVaultAddress);
require(<FILL_ME>)
}
// Check-Effects-Interactions pattern can't be followed in this case, hence nonReentrant
// is so important for this function.
delete claims[msg.sender];
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| fracTokenVault.transfer(msg.sender,c.tokens),"Token transfer failed" | 330,386 | fracTokenVault.transfer(msg.sender,c.tokens) |
"Auction is hot" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
require(msg.sender != address(0), "zero msg.sender");
require(<FILL_ME>)
uint256 amount = 0;
uint256 reserve = currentBidAmount;
uint256 readCursor = poolReadCursor;
while (readCursor <= poolWriteCursor) {
uint256 x = pool[readCursor].amount;
if (reserve == 0) {
if (pool[readCursor].owner == msg.sender) {
amount += x;
delete pool[readCursor];
}
} else if (reserve >= x) {
reserve -= x;
} else {
// reserve < x
if (pool[readCursor].owner == msg.sender) {
pool[readCursor].amount = reserve;
amount += x - reserve;
}
reserve = 0;
}
readCursor++;
}
require(amount > 0, "Insufficient funds");
depositBalance = depositBalance - amount;
emit LogWithdraw(msg.sender, amount);
_transferETH(msg.sender, amount);
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| !auctionIsHot(),"Auction is hot" | 330,386 | !auctionIsHot() |
"Inactive auction" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
(uint256 nounId, uint256 amount, , , address bidder, bool settled) = nounsAuctionHouse.auction();
require(nounId > 0, "zero noun");
require(<FILL_ME>)
require(bidder != address(this), "Already winning");
uint256 newBid = _round_eth1_1000(
amount + ((amount * 1000 * (bidIncrease + nounsAuctionHouseBidIncrease)) / uint256(1000000))
);
if (newBid == 0) {
newBid = ETH1_10;
}
if (newBid > depositBalance) {
newBid = _round_eth1_1000(depositBalance);
}
uint256 minBid = amount + ((amount * 1000 * nounsAuctionHouseBidIncrease) / uint256(1000000));
require(newBid >= minBid, "Insufficient funds");
// Make sure we are bidding more than our previous bid.
require(newBid > currentBidAmount, "Minimum bid not reached");
// Make sure we bid at least 0.001 ETH to ensure best fractionalizations results.
require(newBid >= ETH1_1000, "Minimum bid is 0.001 ETH");
// We should never see this error, because we are always checking
// depositBalance, not the contracts' balance. Checking just in case.
require(address(this).balance >= newBid, "Insufficient balance");
return (nounId, newBid);
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| !settled,"Inactive auction" | 330,386 | !settled |
"Insufficient balance" | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./interfaces/IFracTokenVault.sol";
import "./interfaces/IFracVaultFactory.sol";
import "./interfaces/INounsAuctionHouse.sol";
import "./interfaces/INounsParty.sol";
import "./interfaces/INounsToken.sol";
/**
* @title NounsParty contract
* @author twitter.com/devloper_eth
* @notice Nouns party is an effort aimed at making community-driven nouns bidding easier, more interactive, and more likely to win than today's strategies.
*/
// solhint-disable max-states-count
contract NounsParty is
INounsParty,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
/// @dev post fractionalized token fee
uint256 public nounsPartyFee;
/// @dev max increase in percent for bids
uint256 public bidIncrease;
uint256 public nounsAuctionHouseBidIncrease;
uint256 public currentNounId;
uint256 public currentBidAmount;
/**
* @dev poolWriteCursor is a global cursor indicating where to write in `pool`.
* For each new deposit to `pool` it will increase by 1.
* Read more in deposit().
*/
uint256 private poolWriteCursor;
/// @dev poolReadCursor is a "global" cursor indicating which position to read next from the pool.
uint256 private poolReadCursor;
/// @notice the balance of all deposits
uint256 public depositBalance;
/// @dev use deposits() to read pool
mapping(uint256 => Deposit) private pool;
/// @notice claims has information about who can claim NOUN tokens after a successful auction
/// @dev claims is populated in _depositsToClaims()
mapping(address => TokenClaim[]) public claims;
/// @notice map nounIds to fractional.art token vaults, mapping(nounId) => fracTokenVaultAddress
/// @dev only holds mappings for won auctions, but stores it forever. mappings aren't deleted. TokenClaims rely on fracTokenVaults - addresses should never change after first write.
mapping(uint256 => address) public fracTokenVaults;
address public fracVaultFactoryAddress;
address public nounsPartyCuratorAddress;
address public nounsPartyTreasuryAddress;
address public nounsTokenAddress;
INounsAuctionHouse public nounsAuctionHouse;
INounsToken public nounsToken;
IFracVaultFactory public fracVaultFactory;
bool public activeAuction;
bool public allowBid;
function initialize(
address _nounsAuctionHouseAddress,
address _nounsTokenAddress,
address _fracVaultFactoryAddress,
address _nounsPartyCuratorAddress,
address _nounsPartyTreasuryAddress,
uint256 _nounsAuctionHouseBidIncrease
) public initializer {
}
/// @notice Puts ETH into our bidding pool.
/// @dev Using `pool` and `poolWriteCursor` we keep track of deposit ordering over time.
function deposit() external payable nonReentrant whenNotPaused {
}
/// @notice Bid for the given noun's auction.
/// @dev Bid amounts don't have to be in 0.001 ETH increments, just deposits.
function bid() external payable nonReentrant whenNotPaused {
}
/// @notice Settles an auction.
/// @dev Needs to be called after every auction to determine if we won or lost, and create token claims if we won.
function settle() external nonReentrant whenNotPaused {
}
/// @dev will settle won or lost/burned auctions, if possible
function _trySettle() private {
}
function _settleWon() private {
}
function _settleLost() private {
}
function _resetActiveAuction() private {
}
/// @notice Claim tokens from won auctions
/// @dev nonReentrant is very important here to prevent Reentrancy.
function claim() external nonReentrant whenNotPaused {
}
/// @notice Withdraw deposits that haven't been used to bid on a noun.
function withdraw() external payable whenNotPaused nonReentrant {
}
/// @notice Returns an estimated withdrawable amount. Estimated because future bids might restrict withdrawals.
function withdrawableAmount(address _owner) external view returns (uint256) {
}
/// @dev Iterates over all deposits in `pool` and creates `claims` which then allows users to claim their tokens.
function _depositsToClaims(uint256 _amount, uint256 _nounId) private {
}
/// @dev Calls fractional.art's contracts to turn a noun NFT into fractionalized ERC20 tokens.
/// @param _amount cost of the noun
/// @param _nounId noun id
/// @return tokenVaultAddress ERC20 vault address
/// @return fee how many tokens we keep as fee
function _fractionalize(uint256 _amount, uint256 _nounId) private returns (address tokenVaultAddress, uint256 fee) {
}
/// @notice Deposits returns all available deposits.
/// @dev Deposits reads from `pool` using a temporary readCursor.
/// @return A list of all available deposits.
function deposits() external view returns (Deposit[] memory) {
}
/// @notice Indicates if a auction is about to start/live.
/// @dev External because it "implements" the INounsParty interface.
/// @return true if auction is live (aka hot).
function auctionIsHot() public view returns (bool) {
}
function calcBidAmount() public view returns (uint256 _nounId, uint256 _amount) {
(uint256 nounId, uint256 amount, , , address bidder, bool settled) = nounsAuctionHouse.auction();
require(nounId > 0, "zero noun");
require(!settled, "Inactive auction");
require(bidder != address(this), "Already winning");
uint256 newBid = _round_eth1_1000(
amount + ((amount * 1000 * (bidIncrease + nounsAuctionHouseBidIncrease)) / uint256(1000000))
);
if (newBid == 0) {
newBid = ETH1_10;
}
if (newBid > depositBalance) {
newBid = _round_eth1_1000(depositBalance);
}
uint256 minBid = amount + ((amount * 1000 * nounsAuctionHouseBidIncrease) / uint256(1000000));
require(newBid >= minBid, "Insufficient funds");
// Make sure we are bidding more than our previous bid.
require(newBid > currentBidAmount, "Minimum bid not reached");
// Make sure we bid at least 0.001 ETH to ensure best fractionalizations results.
require(newBid >= ETH1_1000, "Minimum bid is 0.001 ETH");
// We should never see this error, because we are always checking
// depositBalance, not the contracts' balance. Checking just in case.
require(<FILL_ME>)
return (nounId, newBid);
}
/// @dev nonRevertingCalcBidAmountAfterSettle is like calcBidAmount but returns (0, 0) instead of reverting in case of an error.
/// Why? Our frontend uses package `EthWorks/useDApp` which uses Multicall v1.
/// Multicall v1 will fail if just one out of many calls fails.
/// See also https://github.com/EthWorks/useDApp/issues/334.
/// Please note that this workaround function does NOT affect
/// the integrity or security of this contract.
/// And yep, it's super annoying.
function nonRevertingCalcBidAmountAfterSettle()
external
view
returns (
uint256 _nounId,
uint256 _amount,
string memory _message
)
{
}
/// @dev round to next 0.001 ETH increment
// solhint-disable-next-line func-name-mixedcase
function _round_eth1_1000(uint256 amount) private pure returns (uint256) {
}
/// @dev Check the `ownerOf` a noun to check its status.
/// @return NounStatus, which is either WON, BURNED, MINTED, LOST or NOTFOUND.
function nounStatus(uint256 _nounId) public view returns (NounStatus) {
}
/// @notice Returns the number of open claims.
/// @return Number of open claims.
function claimsCount(address _address) external view returns (uint256) {
}
/// @dev Update nounsAuctionHouse.
function setNounsAuctionHouseAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsTokenAddress address and nounsToken.
function setNounsTokenAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the fracVaultFactoryAddress address and fracVaultFactory.
function setFracVaultFactoryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyCuratorAddress address.
function setNounsPartyCuratorAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nounsPartyTreasuryAddress address.
function setNounsPartyTreasuryAddress(address _address) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update the nouns party fee.
function setNounsPartyFee(uint256 _fee) external nonReentrant whenPaused onlyOwner {
}
/// @dev Update bid increase. No pause required.
function setBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update nounsAuctionHouse's bid increase. No pause required.
function setNounsAuctionHouseBidIncrease(uint256 _bidIncrease) external nonReentrant onlyOwner {
}
/// @dev Update allowBid. No pause required.
function setAllowBid(bool _allow) external nonReentrant onlyOwner {
}
/// @dev Pause the contract, freezing core functionalities to prevent bad things from happening in case of emergency.
function pause() external nonReentrant onlyOwner {
}
/// @dev Unpause the contract.
function unpause() external nonReentrant onlyOwner {
}
/// @dev Authorize OpenZepplin's upgrade function, guarded by onlyOwner.
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable-line no-empty-blocks
/// @dev Transfer ETH and revert if unsuccessful. Only forward 30,000 gas to the callee.
function _transferETH(address _to, uint256 _value) private {
}
/// @dev Allow contract to receive Eth. For example when we are outbid.
receive() external payable {} // solhint-disable-line no-empty-blocks
}
| address(this).balance>=newBid,"Insufficient balance" | 330,386 | address(this).balance>=newBid |
"Target account not set" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender)
external
view
returns (uint256 remaining);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool trans);
function approve(address spender, uint256 value)
external
returns (bool hello);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BridgeAssistant {
address public owner;
modifier onlyOwner() {
}
ERC20Basic public WAG8;
mapping(address => string) public targetOf;
event SetTarget(address indexed sender, string target);
event Collect(address indexed sender, string target, uint256 amount);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
function setTarget(string memory _account) public {
}
function collect(address _payer) public onlyOwner returns (uint256 amount) {
string memory _t = targetOf[_payer];
require(<FILL_ME>)
amount = WAG8.allowance(_payer, address(this));
require(amount > 0, "No WAG8 approved");
require(
WAG8.transferFrom(_payer, address(this), amount),
"WAG8.transferFrom failure"
);
delete targetOf[_payer];
emit Collect(_payer, _t, amount);
}
function transfer(address _target, uint256 _amount) public onlyOwner returns (bool success) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
constructor(ERC20Basic _WAG8) {
}
}
| bytes(_t).length>0,"Target account not set" | 330,471 | bytes(_t).length>0 |
"WAG8.transferFrom failure" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender)
external
view
returns (uint256 remaining);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool trans);
function approve(address spender, uint256 value)
external
returns (bool hello);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BridgeAssistant {
address public owner;
modifier onlyOwner() {
}
ERC20Basic public WAG8;
mapping(address => string) public targetOf;
event SetTarget(address indexed sender, string target);
event Collect(address indexed sender, string target, uint256 amount);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
function setTarget(string memory _account) public {
}
function collect(address _payer) public onlyOwner returns (uint256 amount) {
string memory _t = targetOf[_payer];
require(bytes(_t).length > 0, "Target account not set");
amount = WAG8.allowance(_payer, address(this));
require(amount > 0, "No WAG8 approved");
require(<FILL_ME>)
delete targetOf[_payer];
emit Collect(_payer, _t, amount);
}
function transfer(address _target, uint256 _amount) public onlyOwner returns (bool success) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
constructor(ERC20Basic _WAG8) {
}
}
| WAG8.transferFrom(_payer,address(this),amount),"WAG8.transferFrom failure" | 330,471 | WAG8.transferFrom(_payer,address(this),amount) |
'LP token already added' | // SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {ReentrancyGuard} from '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import {SignedSafeMath} from './lib/SignedSafeMath.sol';
import {IRewarder} from './interfaces/IRewarder.sol';
contract AmmRewards is ReentrancyGuard, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using SignedSafeMath for int256;
/// @notice Info of each MCV2 user.
/// `amount` LP token amount the user has provided.
/// `rewardDebt` The amount of REWARD_TOKEN entitled to the user.
struct UserInfo {
uint256 amount;
int256 rewardDebt;
}
/// @notice Info of each MCV2 pool.
/// `allocPoint` The amount of allocation points assigned to the pool.
/// Also known as the amount of REWARD_TOKEN to distribute per block.
struct PoolInfo {
uint256 accRewardTokenPerShare;
uint256 lastRewardTime;
uint256 allocPoint;
}
/// @notice Address of REWARD_TOKEN contract.
IERC20 public immutable REWARD_TOKEN;
/// @notice Info of each MCV2 pool.
PoolInfo[] public poolInfo;
/// @notice Address of the LP token for each MCV2 pool.
IERC20[] public lpToken;
//stores existence of lp tokens to avoid duplicate entries
mapping(IERC20 => bool) lpTokenExists;
/// @notice Address of each `IRewarder` contract in MCV2.
IRewarder[] public rewarder;
/// @notice Info of each user that stakes LP tokens.
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
/// @dev Total allocation points. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint;
uint256 public rewardTokenPerSecond;
uint256 private constant ACC_REWARD_TOKEN_PRECISION = 1e12;
uint256 private epochRewardAmount;
address public rewardsManager;
event Deposit(
address indexed user,
uint256 indexed pid,
uint256 amount,
address indexed to
);
event Withdraw(
address indexed user,
uint256 indexed pid,
uint256 amount,
address indexed to
);
event EmergencyWithdraw(
address indexed user,
uint256 indexed pid,
uint256 amount,
address indexed to
);
event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
event LogPoolAddition(
uint256 indexed pid,
uint256 allocPoint,
IERC20 indexed lpToken,
IRewarder indexed rewarder
);
event LogSetPool(
uint256 indexed pid,
uint256 allocPoint,
IRewarder indexed rewarder,
bool overwrite
);
event LogUpdatePool(
uint256 indexed pid,
uint256 lastRewardTime,
uint256 lpSupply,
uint256 accRewardTokenPerShare
);
event LogRewardTokenPerSecond(uint256 rewardTokenPerSecond);
constructor(IERC20 rewardToken_) public {
}
/// @notice Returns the number of MCV2 pools.
function poolLength() public view returns (uint256 pools) {
}
/// @notice Add a new LP to the pool. Can only be called by the owner.
/// @param allocPoint AP of the new pool.
/// @param _lpToken Address of the LP ERC-20 token.
/// @param _rewarder Address of the rewarder delegate.
function add(
uint256 allocPoint,
IERC20 _lpToken,
IRewarder _rewarder
) public onlyOwner {
require(<FILL_ME>)
totalAllocPoint = totalAllocPoint.add(allocPoint);
lpToken.push(_lpToken);
rewarder.push(_rewarder);
poolInfo.push(
PoolInfo({
allocPoint: allocPoint,
lastRewardTime: block.timestamp,
accRewardTokenPerShare: 0
})
);
lpTokenExists[_lpToken] = true;
emit LogPoolAddition(
lpToken.length.sub(1),
allocPoint,
_lpToken,
_rewarder
);
}
/// @notice Update the given pool's REWARD_TOKEN allocation point and `IRewarder` contract. Can only be called by the owner.
/// @param _pid The index of the pool. See `poolInfo`.
/// @param _allocPoint New AP of the pool.
/// @param _rewarder Address of the rewarder delegate.
/// @param overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
function set(
uint256 _pid,
uint256 _allocPoint,
IRewarder _rewarder,
bool overwrite
) public onlyOwner {
}
/// @notice Sets the rewardToken per second to be distributed. Can only be called by the owner.
/// @param rewardTokenPerSecond_ The amount of RewardToken to be distributed per second
function setRewardTokenPerSecond(uint256 rewardTokenPerSecond_)
external
onlyOwnerOrRewardsManager
{
}
/// @notice View function to see pending REWARD_TOKEN on frontend.
/// @param _pid The index of the pool. See `poolInfo`.
/// @param _user Address of user.
/// @return pending REWARD_TOKEN reward for a given user.
function pendingRewardToken(uint256 _pid, address _user)
external
view
returns (uint256 pending)
{
}
/// @notice Update reward variables for all pools. Be careful of gas spending!
/// @param pids Pool IDs of all to be updated. Make sure to update all active pools.
function massUpdatePools(uint256[] calldata pids) external {
}
/// @notice Update reward variables of the given pool.
/// @param pid The index of the pool. See `poolInfo`.
/// @return pool Returns the pool that was updated.
function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
}
/// @notice Deposit LP tokens to MCV2 for REWARD_TOKEN allocation.
/// @param pid The index of the pool. See `poolInfo`.
/// @param amount LP token amount to deposit.
/// @param to The receiver of `amount` deposit benefit.
function deposit(
uint256 pid,
uint256 amount,
address to
) public {
}
/// @notice Withdraw LP tokens from MCV2.
/// @param pid The index of the pool. See `poolInfo`.
/// @param amount LP token amount to withdraw.
/// @param to Receiver of the LP tokens.
function withdraw(
uint256 pid,
uint256 amount,
address to
) public {
}
/// @notice Harvest proceeds for transaction sender to `to`.
/// @param pid The index of the pool. See `poolInfo`.
/// @param to Receiver of REWARD_TOKEN rewards.
function harvest(uint256 pid, address to) public {
}
/// @notice Withdraw LP tokens from MCV2 and harvest proceeds for transaction sender to `to`.
/// @param pid The index of the pool. See `poolInfo`.
/// @param amount LP token amount to withdraw.
/// @param to Receiver of the LP tokens and REWARD_TOKEN rewards.
function withdrawAndHarvest(
uint256 pid,
uint256 amount,
address to
) public {
}
/// @notice Withdraw without caring about rewards. EMERGENCY ONLY.
/// @param pid The index of the pool. See `poolInfo`.
/// @param to Receiver of the LP tokens.
function emergencyWithdraw(uint256 pid, address to) public {
}
function setRewardsManager(address _rewardsManager) public onlyOwner {
}
modifier onlyOwnerOrRewardsManager() {
}
}
| lpTokenExists[_lpToken]==false,'LP token already added' | 330,537 | lpTokenExists[_lpToken]==false |
'Caller is not owner or rewards manager' | // SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {ReentrancyGuard} from '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import {SignedSafeMath} from './lib/SignedSafeMath.sol';
import {IRewarder} from './interfaces/IRewarder.sol';
contract AmmRewards is ReentrancyGuard, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using SignedSafeMath for int256;
/// @notice Info of each MCV2 user.
/// `amount` LP token amount the user has provided.
/// `rewardDebt` The amount of REWARD_TOKEN entitled to the user.
struct UserInfo {
uint256 amount;
int256 rewardDebt;
}
/// @notice Info of each MCV2 pool.
/// `allocPoint` The amount of allocation points assigned to the pool.
/// Also known as the amount of REWARD_TOKEN to distribute per block.
struct PoolInfo {
uint256 accRewardTokenPerShare;
uint256 lastRewardTime;
uint256 allocPoint;
}
/// @notice Address of REWARD_TOKEN contract.
IERC20 public immutable REWARD_TOKEN;
/// @notice Info of each MCV2 pool.
PoolInfo[] public poolInfo;
/// @notice Address of the LP token for each MCV2 pool.
IERC20[] public lpToken;
//stores existence of lp tokens to avoid duplicate entries
mapping(IERC20 => bool) lpTokenExists;
/// @notice Address of each `IRewarder` contract in MCV2.
IRewarder[] public rewarder;
/// @notice Info of each user that stakes LP tokens.
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
/// @dev Total allocation points. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint;
uint256 public rewardTokenPerSecond;
uint256 private constant ACC_REWARD_TOKEN_PRECISION = 1e12;
uint256 private epochRewardAmount;
address public rewardsManager;
event Deposit(
address indexed user,
uint256 indexed pid,
uint256 amount,
address indexed to
);
event Withdraw(
address indexed user,
uint256 indexed pid,
uint256 amount,
address indexed to
);
event EmergencyWithdraw(
address indexed user,
uint256 indexed pid,
uint256 amount,
address indexed to
);
event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
event LogPoolAddition(
uint256 indexed pid,
uint256 allocPoint,
IERC20 indexed lpToken,
IRewarder indexed rewarder
);
event LogSetPool(
uint256 indexed pid,
uint256 allocPoint,
IRewarder indexed rewarder,
bool overwrite
);
event LogUpdatePool(
uint256 indexed pid,
uint256 lastRewardTime,
uint256 lpSupply,
uint256 accRewardTokenPerShare
);
event LogRewardTokenPerSecond(uint256 rewardTokenPerSecond);
constructor(IERC20 rewardToken_) public {
}
/// @notice Returns the number of MCV2 pools.
function poolLength() public view returns (uint256 pools) {
}
/// @notice Add a new LP to the pool. Can only be called by the owner.
/// @param allocPoint AP of the new pool.
/// @param _lpToken Address of the LP ERC-20 token.
/// @param _rewarder Address of the rewarder delegate.
function add(
uint256 allocPoint,
IERC20 _lpToken,
IRewarder _rewarder
) public onlyOwner {
}
/// @notice Update the given pool's REWARD_TOKEN allocation point and `IRewarder` contract. Can only be called by the owner.
/// @param _pid The index of the pool. See `poolInfo`.
/// @param _allocPoint New AP of the pool.
/// @param _rewarder Address of the rewarder delegate.
/// @param overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
function set(
uint256 _pid,
uint256 _allocPoint,
IRewarder _rewarder,
bool overwrite
) public onlyOwner {
}
/// @notice Sets the rewardToken per second to be distributed. Can only be called by the owner.
/// @param rewardTokenPerSecond_ The amount of RewardToken to be distributed per second
function setRewardTokenPerSecond(uint256 rewardTokenPerSecond_)
external
onlyOwnerOrRewardsManager
{
}
/// @notice View function to see pending REWARD_TOKEN on frontend.
/// @param _pid The index of the pool. See `poolInfo`.
/// @param _user Address of user.
/// @return pending REWARD_TOKEN reward for a given user.
function pendingRewardToken(uint256 _pid, address _user)
external
view
returns (uint256 pending)
{
}
/// @notice Update reward variables for all pools. Be careful of gas spending!
/// @param pids Pool IDs of all to be updated. Make sure to update all active pools.
function massUpdatePools(uint256[] calldata pids) external {
}
/// @notice Update reward variables of the given pool.
/// @param pid The index of the pool. See `poolInfo`.
/// @return pool Returns the pool that was updated.
function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
}
/// @notice Deposit LP tokens to MCV2 for REWARD_TOKEN allocation.
/// @param pid The index of the pool. See `poolInfo`.
/// @param amount LP token amount to deposit.
/// @param to The receiver of `amount` deposit benefit.
function deposit(
uint256 pid,
uint256 amount,
address to
) public {
}
/// @notice Withdraw LP tokens from MCV2.
/// @param pid The index of the pool. See `poolInfo`.
/// @param amount LP token amount to withdraw.
/// @param to Receiver of the LP tokens.
function withdraw(
uint256 pid,
uint256 amount,
address to
) public {
}
/// @notice Harvest proceeds for transaction sender to `to`.
/// @param pid The index of the pool. See `poolInfo`.
/// @param to Receiver of REWARD_TOKEN rewards.
function harvest(uint256 pid, address to) public {
}
/// @notice Withdraw LP tokens from MCV2 and harvest proceeds for transaction sender to `to`.
/// @param pid The index of the pool. See `poolInfo`.
/// @param amount LP token amount to withdraw.
/// @param to Receiver of the LP tokens and REWARD_TOKEN rewards.
function withdrawAndHarvest(
uint256 pid,
uint256 amount,
address to
) public {
}
/// @notice Withdraw without caring about rewards. EMERGENCY ONLY.
/// @param pid The index of the pool. See `poolInfo`.
/// @param to Receiver of the LP tokens.
function emergencyWithdraw(uint256 pid, address to) public {
}
function setRewardsManager(address _rewardsManager) public onlyOwner {
}
modifier onlyOwnerOrRewardsManager() {
require(rewardsManager != address(0), 'Rewards Manager not set');
require(<FILL_ME>)
_;
}
}
| owner()==msg.sender||msg.sender==rewardsManager,'Caller is not owner or rewards manager' | 330,537 | owner()==msg.sender||msg.sender==rewardsManager |
"Not enough tokens left." | // SPDX-License-Identifier: None
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract S2TMPass is Ownable, ERC721 {
using SafeMath for uint256;
using Strings for uint256;
uint256 public mintPrice = 0.05 ether;
uint256 public mintLimit = 10;
uint256 public supplyLimit;
bool public saleActive = false;
string public baseURI = "";
uint256 public totalSupply = 0;
uint256 devShare = 20;
uint256 teamShare = 12;
uint256 marketingShare = 8;
address payable SCHILLER_ADDRESS = payable(0x376FFEff9820826a564A1BA05A464b9923862418);
address payable SNAZZY_ADDRESS = payable(0x57a1fCc7c7F7d253414a85EF4658B5C68Dc3D63B);
address payable SEAN_ADDRESS = payable(0xcdb1e7Acd76166CCcBb61c1d4cb86cc0C033EcFa);
address payable RISK_ADDRESS = payable(0x17485802CcE36b50CDc8EA94422C7000879e444f);
address payable JOSH_ADDRESS = payable(0x340e02c1306ebED52cDF90163C12Ab342e171916);
address payable JARED_ADDRESS = payable(0x22DD354645Da9BB7e02434F54D62bB388e0c5120);
address payable devAddress = payable(0x4d3FD3865A46cE2cEd63fA56562Ab932149E7d3C);
address payable marketingAddress = payable(0xeE1AB23f8426Cd12AB67513202A08135Cf6B0d6A);
/********* Events - Start *********/
event SaleStateChanged(bool _state);
event SupplyLimitChanged(uint256 _supplyLimit);
event MintLimitChanged(uint256 _mintLimit);
event MintPriceChanged(uint256 _mintPrice);
event BaseURIChanged(string _baseURI);
event PassMinted(address indexed _user, uint256 indexed _tokenId, string _tokenURI);
event ReservePass(uint256 _numberOfTokens);
/********* Events - Ends *********/
constructor(
uint256 tokenSupplyLimit,
string memory _baseURI
) ERC721("S2TM Space Pass - Season 1", "S2TM-S1") {
}
function setBaseURI(string memory _baseURI) external onlyOwner {
}
function toggleSaleActive() external onlyOwner {
}
function changeSupplyLimit(uint256 _supplyLimit) external onlyOwner {
}
function changeMintLimit(uint256 _mintLimit) external onlyOwner {
}
function changeMintPrice(uint256 _mintPrice) external onlyOwner {
}
function buyPass(uint _numberOfTokens) external payable {
}
function _mintPass(uint _numberOfTokens) internal {
require(<FILL_ME>)
uint256 newId = totalSupply;
for(uint i = 0; i < _numberOfTokens; i++) {
newId += 1;
totalSupply = totalSupply.add(1);
_safeMint(msg.sender, newId);
emit PassMinted(msg.sender, newId, tokenURI(newId));
}
}
function reservePass(uint256 _numberOfTokens) external onlyOwner {
}
/*
This function will send all contract balance to its contract owner.
*/
function emergencyWithdraw() external onlyOwner {
}
function tokenURI(uint256 tokenId) public view override returns (string memory) {
}
function withdraw() external onlyOwner {
}
}
| totalSupply.add(_numberOfTokens)<=supplyLimit,"Not enough tokens left." | 330,544 | totalSupply.add(_numberOfTokens)<=supplyLimit |
"Purchase would exceed max supply of Hamsters" | // SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "./Ownable.sol";
import "./ERC721.sol";
/**
* @dev Contract module defining blockchain Hamster's Squad ERC721 NFT Token.
* There is a total supply of 8000 hamsters to be minted, each hamster cost .01 ETH.
* 500 of the hamsters are reserved for presale and promo purposes.
*/
contract BlockchainHamstersSquad is ERC721, Ownable {
using Strings for uint256;
string _baseTokenURI;
uint256 public _hamsterPrice = 10000000000000000; // .01 ETH
bool public _saleIsActive = false;
// Reserve 500 Hamsters for team - Giveaways/Prizes/Presales etc
uint public _hamsterReserve = 500;
constructor(string memory baseURI) ERC721("BlockchainHamstersSquad", "BHS") {
}
function withdraw() public onlyOwner {
}
/**
* Mint a number of hamsters straight in target wallet.
* @param _to: The target wallet address, make sure it's the correct wallet.
* @param _numberOfTokens: The number of tokens to mint.
* @dev This function can only be called by the contract owner as it is a free mint.
*/
function mintFreeHamster(address _to, uint _numberOfTokens) public onlyOwner {
uint totalSupply = totalSupply();
require(_numberOfTokens <= _hamsterReserve, "Not enough Hamsters left in reserve");
require(<FILL_ME>)
for(uint i = 0; i < _numberOfTokens; i++) {
uint mintIndex = totalSupply + i;
_safeMint(_to, mintIndex);
}
_hamsterReserve -= _numberOfTokens;
}
/**
* Mint a number of hamsters straight in the caller's wallet.
* @param _numberOfTokens: The number of tokens to mint.
*/
function mintHamster(uint _numberOfTokens) public payable {
}
function flipSaleState() public onlyOwner {
}
function setBaseURI(string memory baseURI) public onlyOwner {
}
// Might wanna adjust price later on.
function setPrice(uint256 _newPrice) public onlyOwner() {
}
function getBaseURI() public view returns(string memory) {
}
function getPrice() public view returns(uint256){
}
function tokenURI(uint256 tokenId) public override view returns(string memory) {
}
function tokensOfOwner(address _owner) external view returns(uint256[] memory ) {
}
}
| totalSupply+_numberOfTokens<8001,"Purchase would exceed max supply of Hamsters" | 330,566 | totalSupply+_numberOfTokens<8001 |
"Purchase would exceed max supply of Hamsters" | // SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "./Ownable.sol";
import "./ERC721.sol";
/**
* @dev Contract module defining blockchain Hamster's Squad ERC721 NFT Token.
* There is a total supply of 8000 hamsters to be minted, each hamster cost .01 ETH.
* 500 of the hamsters are reserved for presale and promo purposes.
*/
contract BlockchainHamstersSquad is ERC721, Ownable {
using Strings for uint256;
string _baseTokenURI;
uint256 public _hamsterPrice = 10000000000000000; // .01 ETH
bool public _saleIsActive = false;
// Reserve 500 Hamsters for team - Giveaways/Prizes/Presales etc
uint public _hamsterReserve = 500;
constructor(string memory baseURI) ERC721("BlockchainHamstersSquad", "BHS") {
}
function withdraw() public onlyOwner {
}
/**
* Mint a number of hamsters straight in target wallet.
* @param _to: The target wallet address, make sure it's the correct wallet.
* @param _numberOfTokens: The number of tokens to mint.
* @dev This function can only be called by the contract owner as it is a free mint.
*/
function mintFreeHamster(address _to, uint _numberOfTokens) public onlyOwner {
}
/**
* Mint a number of hamsters straight in the caller's wallet.
* @param _numberOfTokens: The number of tokens to mint.
*/
function mintHamster(uint _numberOfTokens) public payable {
uint totalSupply = totalSupply();
require(_saleIsActive, "Sale must be active to mint a Hamster");
require(_numberOfTokens < 6, "Can only mint 5 tokens at a time");
require(<FILL_ME>)
require(msg.value >= _hamsterPrice * _numberOfTokens, "Ether value sent is not correct");
for(uint i = 0; i < _numberOfTokens; i++) {
uint mintIndex = totalSupply + i;
_safeMint(msg.sender, mintIndex);
}
}
function flipSaleState() public onlyOwner {
}
function setBaseURI(string memory baseURI) public onlyOwner {
}
// Might wanna adjust price later on.
function setPrice(uint256 _newPrice) public onlyOwner() {
}
function getBaseURI() public view returns(string memory) {
}
function getPrice() public view returns(uint256){
}
function tokenURI(uint256 tokenId) public override view returns(string memory) {
}
function tokensOfOwner(address _owner) external view returns(uint256[] memory ) {
}
}
| totalSupply+_numberOfTokens+_hamsterReserve<8001,"Purchase would exceed max supply of Hamsters" | 330,566 | totalSupply+_numberOfTokens+_hamsterReserve<8001 |
"wake too much" | import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
pragma solidity ^0.8.0;
contract WorldOfSquish is ERC721URIStorage, Ownable{
using Strings for uint256;
event MintSquish (address indexed sender, uint256 startWith, uint256 times);
uint256 public totalSquish;
uint256 public totalCount = 9980;
uint256 public maxBatch = 40;
uint256 public price = 50000000000000000; // 0.05 eth
string public baseURI;
bool private started;
constructor(string memory name_, string memory symbol_, string memory baseURI_) ERC721(name_, symbol_) {
}
function totalSupply() public view virtual returns (uint256) {
}
function _baseURI() internal view virtual override returns (string memory){
}
function setBaseURI(string memory _newURI) public onlyOwner {
}
function changePrice(uint256 _newPrice) public onlyOwner {
}
function changeBatchSize(uint256 _newBatch) public onlyOwner {
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
}
function setTokenURI(uint256 _tokenId, string memory _tokenURI) public onlyOwner {
}
function setStart(bool _start) public onlyOwner {
}
function mintSquish(uint256 _times) payable public {
require(started, "not started");
require(_times >0 && _times <= maxBatch, "wake wrong number");
require(<FILL_ME>)
require(msg.value == _times * price, "value error");
payable(owner()).transfer(msg.value);
emit MintSquish(_msgSender(), totalSquish+1, _times);
for(uint256 i=0; i< _times; i++){
_mint(_msgSender(), 1 + totalSquish++);
}
}
}
| totalSquish+_times<=totalCount,"wake too much" | 330,615 | totalSquish+_times<=totalCount |
null | pragma solidity 0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) pure internal returns (uint256) {
}
function div(uint256 a, uint256 b) pure internal returns (uint256) {
}
function sub(uint256 a, uint256 b) pure internal returns (uint256) {
}
function add(uint256 a, uint256 b) pure internal returns (uint256) {
}
function max64(uint64 a, uint64 b) pure internal returns (uint64) {
}
function min64(uint64 a, uint64 b) pure internal returns (uint64) {
}
function max256(uint256 a, uint256 b) pure internal returns (uint256) {
}
function min256(uint256 a, uint256 b) pure internal returns (uint256) {
}
}
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private rentrancy_lock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
}
}
/**
* MultiSig is designed to hold funds of the ico. Account is controlled by six administratos. To trigger a payout
* two out of six administrators will must agree on same amount of ethers to be transferred. During the signing
* process if one administrator sends different targetted address or amount of ethers, process will abort and they
* need to start again.
* Administrator can be replaced but two out of six must agree upon replacement of fourth administrator. Two
* admins will send address of third administrator along with address of new one administrator. If a single one
* sends different address the updating process will abort and they need to start again.
*/
contract MultiSig is ReentrancyGuard{
using SafeMath for uint256;
// Maintain state funds transfer signing process
struct Transaction{
address[2] signer;
uint confirmations;
uint256 eth;
}
// count and record signers with ethers they agree to transfer
Transaction private pending;
// the number of administrator that must confirm the same operation before it is run.
uint256 constant public required = 2;
mapping(address => bool) private administrators;
// Funds has arrived into the contract (record how much).
event Deposit(address _from, uint256 value);
// Funds transfer to other contract
event Transfer(address indexed fristSigner, address indexed secondSigner, address to,uint256 eth,bool success);
// Administrator successfully signs a fund transfer
event TransferConfirmed(address signer,uint256 amount,uint256 remainingConfirmations);
// Administrator successfully signs a key update transaction
event UpdateConfirmed(address indexed signer,address indexed newAddress,uint256 remainingConfirmations);
// Administrator violated consensus
event Violated(string action, address sender);
// Administrator key updated (administrator replaced)
event KeyReplaced(address oldKey,address newKey);
event EventTransferWasReset();
event EventUpdateWasReset();
function MultiSig() public {
}
/**
* @dev To trigger payout three out of four administrators call this
* function, funds will be transferred right after verification of
* third signer call.
* @param recipient The address of recipient
* @param amount Amount of wei to be transferred
*/
function transfer(address recipient, uint256 amount) external onlyAdmin nonReentrant {
}
function transferViolated(string error) private {
}
function ResetTransferState() internal {
}
/**
* @dev Reset values of pending (Transaction object)
*/
function abortTransaction() external onlyAdmin{
}
/**
* @dev Fallback function, receives value and emits a deposit event.
*/
function() payable public {
}
/**
* @dev Checks if given address is an administrator.
* @param _addr address The address which you want to check.
* @return True if the address is an administrator and fase otherwise.
*/
function isAdministrator(address _addr) public constant returns (bool) {
}
// Maintian state of administrator key update process
struct KeyUpdate{
address[2] signer;
uint confirmations;
address oldAddress;
address newAddress;
}
KeyUpdate private updating;
/**
* @dev Two admnistrator can replace key of third administrator.
* @param _oldAddress Address of adminisrator needs to be replaced
* @param _newAddress Address of new administrator
*/
function updateAdministratorKey(address _oldAddress, address _newAddress) external onlyAdmin {
// input verifications
require(<FILL_ME>)
require( _newAddress != 0x00 );
require(!isAdministrator(_newAddress));
require( msg.sender != _oldAddress );
// count confirmation
uint256 remaining;
// start of updating process, first signer will finalize address to be replaced
// and new address to be registered, remaining one must confirm
if( updating.confirmations == 0){
updating.signer[updating.confirmations] = msg.sender;
updating.oldAddress = _oldAddress;
updating.newAddress = _newAddress;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
return;
}
// violated consensus
if(updating.oldAddress != _oldAddress){
emit Violated("Old addresses do not match",msg.sender);
ResetUpdateState();
return;
}
if(updating.newAddress != _newAddress){
emit Violated("New addresses do not match",msg.sender);
ResetUpdateState();
return;
}
// make sure admin is not trying to spam
if(msg.sender == updating.signer[0]){
emit Violated("Signer is spamming",msg.sender);
ResetUpdateState();
return;
}
updating.signer[updating.confirmations] = msg.sender;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
if( remaining == 0){
if(msg.sender == updating.signer[0]){
emit Violated("One of signers is spamming",msg.sender);
ResetUpdateState();
return;
}
}
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
// if two confirmation are done, register new admin and remove old one
if( updating.confirmations == 2 ){
emit KeyReplaced(_oldAddress, _newAddress);
ResetUpdateState();
delete administrators[_oldAddress];
administrators[_newAddress] = true;
return;
}
}
function ResetUpdateState() internal
{
}
/**
* @dev Reset values of updating (KeyUpdate object)
*/
function abortUpdate() external onlyAdmin{
}
/**
* @dev modifier allow only if function is called by administrator
*/
modifier onlyAdmin(){
}
}
| isAdministrator(_oldAddress) | 330,620 | isAdministrator(_oldAddress) |
null | pragma solidity 0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) pure internal returns (uint256) {
}
function div(uint256 a, uint256 b) pure internal returns (uint256) {
}
function sub(uint256 a, uint256 b) pure internal returns (uint256) {
}
function add(uint256 a, uint256 b) pure internal returns (uint256) {
}
function max64(uint64 a, uint64 b) pure internal returns (uint64) {
}
function min64(uint64 a, uint64 b) pure internal returns (uint64) {
}
function max256(uint256 a, uint256 b) pure internal returns (uint256) {
}
function min256(uint256 a, uint256 b) pure internal returns (uint256) {
}
}
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private rentrancy_lock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
}
}
/**
* MultiSig is designed to hold funds of the ico. Account is controlled by six administratos. To trigger a payout
* two out of six administrators will must agree on same amount of ethers to be transferred. During the signing
* process if one administrator sends different targetted address or amount of ethers, process will abort and they
* need to start again.
* Administrator can be replaced but two out of six must agree upon replacement of fourth administrator. Two
* admins will send address of third administrator along with address of new one administrator. If a single one
* sends different address the updating process will abort and they need to start again.
*/
contract MultiSig is ReentrancyGuard{
using SafeMath for uint256;
// Maintain state funds transfer signing process
struct Transaction{
address[2] signer;
uint confirmations;
uint256 eth;
}
// count and record signers with ethers they agree to transfer
Transaction private pending;
// the number of administrator that must confirm the same operation before it is run.
uint256 constant public required = 2;
mapping(address => bool) private administrators;
// Funds has arrived into the contract (record how much).
event Deposit(address _from, uint256 value);
// Funds transfer to other contract
event Transfer(address indexed fristSigner, address indexed secondSigner, address to,uint256 eth,bool success);
// Administrator successfully signs a fund transfer
event TransferConfirmed(address signer,uint256 amount,uint256 remainingConfirmations);
// Administrator successfully signs a key update transaction
event UpdateConfirmed(address indexed signer,address indexed newAddress,uint256 remainingConfirmations);
// Administrator violated consensus
event Violated(string action, address sender);
// Administrator key updated (administrator replaced)
event KeyReplaced(address oldKey,address newKey);
event EventTransferWasReset();
event EventUpdateWasReset();
function MultiSig() public {
}
/**
* @dev To trigger payout three out of four administrators call this
* function, funds will be transferred right after verification of
* third signer call.
* @param recipient The address of recipient
* @param amount Amount of wei to be transferred
*/
function transfer(address recipient, uint256 amount) external onlyAdmin nonReentrant {
}
function transferViolated(string error) private {
}
function ResetTransferState() internal {
}
/**
* @dev Reset values of pending (Transaction object)
*/
function abortTransaction() external onlyAdmin{
}
/**
* @dev Fallback function, receives value and emits a deposit event.
*/
function() payable public {
}
/**
* @dev Checks if given address is an administrator.
* @param _addr address The address which you want to check.
* @return True if the address is an administrator and fase otherwise.
*/
function isAdministrator(address _addr) public constant returns (bool) {
}
// Maintian state of administrator key update process
struct KeyUpdate{
address[2] signer;
uint confirmations;
address oldAddress;
address newAddress;
}
KeyUpdate private updating;
/**
* @dev Two admnistrator can replace key of third administrator.
* @param _oldAddress Address of adminisrator needs to be replaced
* @param _newAddress Address of new administrator
*/
function updateAdministratorKey(address _oldAddress, address _newAddress) external onlyAdmin {
// input verifications
require(isAdministrator(_oldAddress));
require( _newAddress != 0x00 );
require(<FILL_ME>)
require( msg.sender != _oldAddress );
// count confirmation
uint256 remaining;
// start of updating process, first signer will finalize address to be replaced
// and new address to be registered, remaining one must confirm
if( updating.confirmations == 0){
updating.signer[updating.confirmations] = msg.sender;
updating.oldAddress = _oldAddress;
updating.newAddress = _newAddress;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
return;
}
// violated consensus
if(updating.oldAddress != _oldAddress){
emit Violated("Old addresses do not match",msg.sender);
ResetUpdateState();
return;
}
if(updating.newAddress != _newAddress){
emit Violated("New addresses do not match",msg.sender);
ResetUpdateState();
return;
}
// make sure admin is not trying to spam
if(msg.sender == updating.signer[0]){
emit Violated("Signer is spamming",msg.sender);
ResetUpdateState();
return;
}
updating.signer[updating.confirmations] = msg.sender;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
if( remaining == 0){
if(msg.sender == updating.signer[0]){
emit Violated("One of signers is spamming",msg.sender);
ResetUpdateState();
return;
}
}
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
// if two confirmation are done, register new admin and remove old one
if( updating.confirmations == 2 ){
emit KeyReplaced(_oldAddress, _newAddress);
ResetUpdateState();
delete administrators[_oldAddress];
administrators[_newAddress] = true;
return;
}
}
function ResetUpdateState() internal
{
}
/**
* @dev Reset values of updating (KeyUpdate object)
*/
function abortUpdate() external onlyAdmin{
}
/**
* @dev modifier allow only if function is called by administrator
*/
modifier onlyAdmin(){
}
}
| !isAdministrator(_newAddress) | 330,620 | !isAdministrator(_newAddress) |
null | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
interface ERC20 {
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface ERC223 {
function transfer(address to, uint value, bytes data) payable public;
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERCAddressFrozenFund is ERC20{
using SafeMath for uint;
struct LockedWallet {
address owner; // the owner of the locked wallet, he/she must secure the private key
uint256 amount; //
uint256 start; // timestamp when "lock" function is executed
uint256 duration; // duration period in seconds. if we want to lock an amount for
uint256 release; // release = start+duration
// "start" and "duration" is for bookkeeping purpose only. Only "release" will be actually checked once unlock function is called
}
address public owner;
uint256 _lockedSupply;
mapping (address => LockedWallet) addressFrozenFund; //address -> (deadline, amount),freeze fund of an address its so that no token can be transferred out until deadline
function mintToken(address _owner, uint256 amount) internal;
function burnToken(address _owner, uint256 amount) internal;
event LockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event LockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
event UnlockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event UnlockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
function lockedSupply() public view returns (uint256) {
}
function releaseTimeOf(address _owner) public view returns (uint256 releaseTime) {
}
function lockedBalanceOf(address _owner) public view returns (uint256 lockedBalance) {
}
function lockBalance(uint256 duration, uint256 amount) public{
address _owner = msg.sender;
require(<FILL_ME>)
require(addressFrozenFund[_owner].release <= now && addressFrozenFund[_owner].amount == 0);
addressFrozenFund[_owner].start = now;
addressFrozenFund[_owner].duration = duration;
addressFrozenFund[_owner].release = addressFrozenFund[_owner].start + duration;
addressFrozenFund[_owner].amount = amount;
burnToken(_owner, amount);
_lockedSupply = SafeMath.add(_lockedSupply, lockedBalanceOf(_owner));
LockBalance(_owner, addressFrozenFund[_owner].release, amount);
}
//_owner must call this function explicitly to release locked balance in a locked wallet
function releaseLockedBalance() public {
}
}
contract CPSTestToken1 is ERC223, ERCAddressFrozenFund {
using SafeMath for uint;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
address public fundsWallet; // Where should the raised ETH go?
uint256 internal fundsWalletChanged;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
function CPSTestToken1() public {
}
function changeFundsWallet(address newOwner) public{
}
function name() public view returns (string) {
}
function symbol() public view returns (string) {
}
function decimals() public view returns (uint8) {
}
function totalSupply() public view returns (uint256) {
}
function mintToken(address _owner, uint256 amount) internal {
}
function burnToken(address _owner, uint256 amount) internal {
}
function() payable public {
}
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public view returns (uint256 balance) {
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
}
function transfer(address _to, uint _value, bytes _data) public payable {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function transferMultiple(address[] _tos, uint256[] _values, uint count) payable public returns (bool) {
}
}
| address(0)!=_owner&&amount>0&&duration>0&&balanceOf(_owner)>=amount | 330,669 | address(0)!=_owner&&amount>0&&duration>0&&balanceOf(_owner)>=amount |
null | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
interface ERC20 {
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface ERC223 {
function transfer(address to, uint value, bytes data) payable public;
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERCAddressFrozenFund is ERC20{
using SafeMath for uint;
struct LockedWallet {
address owner; // the owner of the locked wallet, he/she must secure the private key
uint256 amount; //
uint256 start; // timestamp when "lock" function is executed
uint256 duration; // duration period in seconds. if we want to lock an amount for
uint256 release; // release = start+duration
// "start" and "duration" is for bookkeeping purpose only. Only "release" will be actually checked once unlock function is called
}
address public owner;
uint256 _lockedSupply;
mapping (address => LockedWallet) addressFrozenFund; //address -> (deadline, amount),freeze fund of an address its so that no token can be transferred out until deadline
function mintToken(address _owner, uint256 amount) internal;
function burnToken(address _owner, uint256 amount) internal;
event LockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event LockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
event UnlockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event UnlockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
function lockedSupply() public view returns (uint256) {
}
function releaseTimeOf(address _owner) public view returns (uint256 releaseTime) {
}
function lockedBalanceOf(address _owner) public view returns (uint256 lockedBalance) {
}
function lockBalance(uint256 duration, uint256 amount) public{
address _owner = msg.sender;
require(address(0) != _owner && amount > 0 && duration > 0 && balanceOf(_owner) >= amount);
require(<FILL_ME>)
addressFrozenFund[_owner].start = now;
addressFrozenFund[_owner].duration = duration;
addressFrozenFund[_owner].release = addressFrozenFund[_owner].start + duration;
addressFrozenFund[_owner].amount = amount;
burnToken(_owner, amount);
_lockedSupply = SafeMath.add(_lockedSupply, lockedBalanceOf(_owner));
LockBalance(_owner, addressFrozenFund[_owner].release, amount);
}
//_owner must call this function explicitly to release locked balance in a locked wallet
function releaseLockedBalance() public {
}
}
contract CPSTestToken1 is ERC223, ERCAddressFrozenFund {
using SafeMath for uint;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
address public fundsWallet; // Where should the raised ETH go?
uint256 internal fundsWalletChanged;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
function CPSTestToken1() public {
}
function changeFundsWallet(address newOwner) public{
}
function name() public view returns (string) {
}
function symbol() public view returns (string) {
}
function decimals() public view returns (uint8) {
}
function totalSupply() public view returns (uint256) {
}
function mintToken(address _owner, uint256 amount) internal {
}
function burnToken(address _owner, uint256 amount) internal {
}
function() payable public {
}
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public view returns (uint256 balance) {
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
}
function transfer(address _to, uint _value, bytes _data) public payable {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function transferMultiple(address[] _tos, uint256[] _values, uint count) payable public returns (bool) {
}
}
| addressFrozenFund[_owner].release<=now&&addressFrozenFund[_owner].amount==0 | 330,669 | addressFrozenFund[_owner].release<=now&&addressFrozenFund[_owner].amount==0 |
null | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
interface ERC20 {
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface ERC223 {
function transfer(address to, uint value, bytes data) payable public;
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERCAddressFrozenFund is ERC20{
using SafeMath for uint;
struct LockedWallet {
address owner; // the owner of the locked wallet, he/she must secure the private key
uint256 amount; //
uint256 start; // timestamp when "lock" function is executed
uint256 duration; // duration period in seconds. if we want to lock an amount for
uint256 release; // release = start+duration
// "start" and "duration" is for bookkeeping purpose only. Only "release" will be actually checked once unlock function is called
}
address public owner;
uint256 _lockedSupply;
mapping (address => LockedWallet) addressFrozenFund; //address -> (deadline, amount),freeze fund of an address its so that no token can be transferred out until deadline
function mintToken(address _owner, uint256 amount) internal;
function burnToken(address _owner, uint256 amount) internal;
event LockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event LockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
event UnlockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event UnlockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
function lockedSupply() public view returns (uint256) {
}
function releaseTimeOf(address _owner) public view returns (uint256 releaseTime) {
}
function lockedBalanceOf(address _owner) public view returns (uint256 lockedBalance) {
}
function lockBalance(uint256 duration, uint256 amount) public{
}
//_owner must call this function explicitly to release locked balance in a locked wallet
function releaseLockedBalance() public {
address _owner = msg.sender;
require(<FILL_ME>)
mintToken(_owner, lockedBalanceOf(_owner));
_lockedSupply = SafeMath.sub(_lockedSupply, lockedBalanceOf(_owner));
UnlockBalance(_owner, addressFrozenFund[_owner].release, lockedBalanceOf(_owner));
delete addressFrozenFund[_owner];
}
}
contract CPSTestToken1 is ERC223, ERCAddressFrozenFund {
using SafeMath for uint;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
address public fundsWallet; // Where should the raised ETH go?
uint256 internal fundsWalletChanged;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
function CPSTestToken1() public {
}
function changeFundsWallet(address newOwner) public{
}
function name() public view returns (string) {
}
function symbol() public view returns (string) {
}
function decimals() public view returns (uint8) {
}
function totalSupply() public view returns (uint256) {
}
function mintToken(address _owner, uint256 amount) internal {
}
function burnToken(address _owner, uint256 amount) internal {
}
function() payable public {
}
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public view returns (uint256 balance) {
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
}
function transfer(address _to, uint _value, bytes _data) public payable {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function transferMultiple(address[] _tos, uint256[] _values, uint count) payable public returns (bool) {
}
}
| address(0)!=_owner&&lockedBalanceOf(_owner)>0&&releaseTimeOf(_owner)<=now | 330,669 | address(0)!=_owner&&lockedBalanceOf(_owner)>0&&releaseTimeOf(_owner)<=now |
null | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
interface ERC20 {
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface ERC223 {
function transfer(address to, uint value, bytes data) payable public;
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERCAddressFrozenFund is ERC20{
using SafeMath for uint;
struct LockedWallet {
address owner; // the owner of the locked wallet, he/she must secure the private key
uint256 amount; //
uint256 start; // timestamp when "lock" function is executed
uint256 duration; // duration period in seconds. if we want to lock an amount for
uint256 release; // release = start+duration
// "start" and "duration" is for bookkeeping purpose only. Only "release" will be actually checked once unlock function is called
}
address public owner;
uint256 _lockedSupply;
mapping (address => LockedWallet) addressFrozenFund; //address -> (deadline, amount),freeze fund of an address its so that no token can be transferred out until deadline
function mintToken(address _owner, uint256 amount) internal;
function burnToken(address _owner, uint256 amount) internal;
event LockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event LockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
event UnlockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event UnlockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
function lockedSupply() public view returns (uint256) {
}
function releaseTimeOf(address _owner) public view returns (uint256 releaseTime) {
}
function lockedBalanceOf(address _owner) public view returns (uint256 lockedBalance) {
}
function lockBalance(uint256 duration, uint256 amount) public{
}
//_owner must call this function explicitly to release locked balance in a locked wallet
function releaseLockedBalance() public {
}
}
contract CPSTestToken1 is ERC223, ERCAddressFrozenFund {
using SafeMath for uint;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
address public fundsWallet; // Where should the raised ETH go?
uint256 internal fundsWalletChanged;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
function CPSTestToken1() public {
}
function changeFundsWallet(address newOwner) public{
}
function name() public view returns (string) {
}
function symbol() public view returns (string) {
}
function decimals() public view returns (uint8) {
}
function totalSupply() public view returns (uint256) {
}
function mintToken(address _owner, uint256 amount) internal {
}
function burnToken(address _owner, uint256 amount) internal {
}
function() payable public {
}
function transfer(address _to, uint256 _value) public returns (bool) {
}
function balanceOf(address _owner) public view returns (uint256 balance) {
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
}
function transfer(address _to, uint _value, bytes _data) public payable {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function transferMultiple(address[] _tos, uint256[] _values, uint count) payable public returns (bool) {
uint256 total = 0;
uint256 total_prev = 0;
uint i = 0;
for(i=0;i<count;i++){
require(<FILL_ME>)//_tos must no contain any contract address
if(isContract(_tos[i])) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_tos[i]);
bytes memory _data = new bytes(1);
receiver.tokenFallback(msg.sender, _values[i], _data);
}
total_prev = total;
total = SafeMath.add(total, _values[i]);
require(total >= total_prev);
}
require(total <= balances[msg.sender]);
for(i=0;i<count;i++){
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _values[i]);
balances[_tos[i]] = SafeMath.add(balances[_tos[i]], _values[i]);
Transfer(msg.sender, _tos[i], _values[i]);
}
return true;
}
}
| _tos[i]!=address(0)&&!isContract(_tos[i]) | 330,669 | _tos[i]!=address(0)&&!isContract(_tos[i]) |
"You are flagged for malicious bot activity!" | //SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
}
function _msgData() internal view virtual returns (bytes memory) {
}
}
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 (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
}
function sendValue(address payable recipient, uint256 amount) internal {
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
}
function owner() public view returns (address) {
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) public virtual onlyOwner {
}
function getUnlockTime() public view returns (uint256) {
}
function getTime() public view returns (uint256) {
}
function lock(uint256 time) public virtual onlyOwner {
}
function unlock() public virtual {
}
}
// pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
// pragma solidity >=0.6.2;
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract RentDex is Context, IERC20, Ownable {
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
mapping(address => bool) private _IsBot;
bool public buyingOpen = false; //once switched on, can never be switched off.
bool public sellingDisabled=true; //once selling is enabled, can never be disabled again.
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
constructor(string memory name_, string memory symbol_, uint256 totalSupply_) {
}
function name() public view virtual returns (string memory) {
}
function symbol() public view virtual returns (string memory) {
}
function decimals() public view virtual returns (uint8) {
}
function totalSupply() public view virtual override returns (uint256) {
}
function balanceOf(address account) public view virtual override returns (uint256) {
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(<FILL_ME>)
require(!_IsBot[msg.sender], "You are flagged for malicious bot activity!");
if(sender != owner() && recipient != owner()) {
if (!buyingOpen) {
if (!(sender == address(this) || recipient == address(this)
|| sender == address(owner()) || recipient == address(owner()))) {
require(buyingOpen, "Buying/Transfer is not yet enabled");
}
}
}
if (recipient == uniswapV2Pair) {
if (sellingDisabled) {
if (!(sender == address(this) || recipient == address(this)
|| sender == address(owner()) || recipient == address(owner()))) {
require(!sellingDisabled, "Selling is not yet enabled");
}
}
}
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
}
function _burn(address account, uint256 amount) internal virtual {
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
//Function can only be called once. Buying cannot be disabled.
function enableBuying() external onlyOwner {
}
//Function can only be called once. Selling cannot be disabled.
function enableselling() public onlyOwner {
}
// Blacklist bot addresses acting maliciously.
function setBots(address[] memory bots_) public onlyOwner {
}
//Find out if address is blacklisted for malicious bot activity. Returns true or false.
function isBot(address account) public view returns (bool) {
}
// Remove addresses from blacklisted bots list.
function delBot(address notbot) public onlyOwner {
}
// To withdraw any ERC20 tokens that mistakenly get sent to the contract address.
function sendTokenTo(IERC20 token, address recipient, uint256 amount) external onlyOwner() {
}
//Returns current ETH balance of contract.
function getETHBalance() public view returns(uint) {
}
//Withdraw any ETH that mistakenly gets sent to the contract address.
function sendETHTo(address payable _to) external onlyOwner() {
}
receive() external payable {}
}
| !_IsBot[recipient],"You are flagged for malicious bot activity!" | 330,756 | !_IsBot[recipient] |
"You are flagged for malicious bot activity!" | //SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
}
function _msgData() internal view virtual returns (bytes memory) {
}
}
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 (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
}
function sendValue(address payable recipient, uint256 amount) internal {
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
}
function owner() public view returns (address) {
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) public virtual onlyOwner {
}
function getUnlockTime() public view returns (uint256) {
}
function getTime() public view returns (uint256) {
}
function lock(uint256 time) public virtual onlyOwner {
}
function unlock() public virtual {
}
}
// pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
// pragma solidity >=0.6.2;
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract RentDex is Context, IERC20, Ownable {
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
mapping(address => bool) private _IsBot;
bool public buyingOpen = false; //once switched on, can never be switched off.
bool public sellingDisabled=true; //once selling is enabled, can never be disabled again.
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
constructor(string memory name_, string memory symbol_, uint256 totalSupply_) {
}
function name() public view virtual returns (string memory) {
}
function symbol() public view virtual returns (string memory) {
}
function decimals() public view virtual returns (uint8) {
}
function totalSupply() public view virtual override returns (uint256) {
}
function balanceOf(address account) public view virtual override returns (uint256) {
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(!_IsBot[recipient], "You are flagged for malicious bot activity!");
require(<FILL_ME>)
if(sender != owner() && recipient != owner()) {
if (!buyingOpen) {
if (!(sender == address(this) || recipient == address(this)
|| sender == address(owner()) || recipient == address(owner()))) {
require(buyingOpen, "Buying/Transfer is not yet enabled");
}
}
}
if (recipient == uniswapV2Pair) {
if (sellingDisabled) {
if (!(sender == address(this) || recipient == address(this)
|| sender == address(owner()) || recipient == address(owner()))) {
require(!sellingDisabled, "Selling is not yet enabled");
}
}
}
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
}
function _burn(address account, uint256 amount) internal virtual {
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
//Function can only be called once. Buying cannot be disabled.
function enableBuying() external onlyOwner {
}
//Function can only be called once. Selling cannot be disabled.
function enableselling() public onlyOwner {
}
// Blacklist bot addresses acting maliciously.
function setBots(address[] memory bots_) public onlyOwner {
}
//Find out if address is blacklisted for malicious bot activity. Returns true or false.
function isBot(address account) public view returns (bool) {
}
// Remove addresses from blacklisted bots list.
function delBot(address notbot) public onlyOwner {
}
// To withdraw any ERC20 tokens that mistakenly get sent to the contract address.
function sendTokenTo(IERC20 token, address recipient, uint256 amount) external onlyOwner() {
}
//Returns current ETH balance of contract.
function getETHBalance() public view returns(uint) {
}
//Withdraw any ETH that mistakenly gets sent to the contract address.
function sendETHTo(address payable _to) external onlyOwner() {
}
receive() external payable {}
}
| !_IsBot[msg.sender],"You are flagged for malicious bot activity!" | 330,756 | !_IsBot[msg.sender] |
"Selling is not yet enabled" | //SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
}
function _msgData() internal view virtual returns (bytes memory) {
}
}
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 (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
}
function sendValue(address payable recipient, uint256 amount) internal {
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
}
function owner() public view returns (address) {
}
modifier onlyOwner() {
}
function transferOwnership(address newOwner) public virtual onlyOwner {
}
function getUnlockTime() public view returns (uint256) {
}
function getTime() public view returns (uint256) {
}
function lock(uint256 time) public virtual onlyOwner {
}
function unlock() public virtual {
}
}
// pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
// pragma solidity >=0.6.2;
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract RentDex is Context, IERC20, Ownable {
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
mapping(address => bool) private _IsBot;
bool public buyingOpen = false; //once switched on, can never be switched off.
bool public sellingDisabled=true; //once selling is enabled, can never be disabled again.
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
constructor(string memory name_, string memory symbol_, uint256 totalSupply_) {
}
function name() public view virtual returns (string memory) {
}
function symbol() public view virtual returns (string memory) {
}
function decimals() public view virtual returns (uint8) {
}
function totalSupply() public view virtual override returns (uint256) {
}
function balanceOf(address account) public view virtual override returns (uint256) {
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(!_IsBot[recipient], "You are flagged for malicious bot activity!");
require(!_IsBot[msg.sender], "You are flagged for malicious bot activity!");
if(sender != owner() && recipient != owner()) {
if (!buyingOpen) {
if (!(sender == address(this) || recipient == address(this)
|| sender == address(owner()) || recipient == address(owner()))) {
require(buyingOpen, "Buying/Transfer is not yet enabled");
}
}
}
if (recipient == uniswapV2Pair) {
if (sellingDisabled) {
if (!(sender == address(this) || recipient == address(this)
|| sender == address(owner()) || recipient == address(owner()))) {
require(<FILL_ME>)
}
}
}
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
}
function _burn(address account, uint256 amount) internal virtual {
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
//Function can only be called once. Buying cannot be disabled.
function enableBuying() external onlyOwner {
}
//Function can only be called once. Selling cannot be disabled.
function enableselling() public onlyOwner {
}
// Blacklist bot addresses acting maliciously.
function setBots(address[] memory bots_) public onlyOwner {
}
//Find out if address is blacklisted for malicious bot activity. Returns true or false.
function isBot(address account) public view returns (bool) {
}
// Remove addresses from blacklisted bots list.
function delBot(address notbot) public onlyOwner {
}
// To withdraw any ERC20 tokens that mistakenly get sent to the contract address.
function sendTokenTo(IERC20 token, address recipient, uint256 amount) external onlyOwner() {
}
//Returns current ETH balance of contract.
function getETHBalance() public view returns(uint) {
}
//Withdraw any ETH that mistakenly gets sent to the contract address.
function sendETHTo(address payable _to) external onlyOwner() {
}
receive() external payable {}
}
| !sellingDisabled,"Selling is not yet enabled" | 330,756 | !sellingDisabled |
"All presale tokens available have been minted" | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract FusionApe is ERC721Enumerable, Ownable, ReentrancyGuard {
using Strings for uint256;
using Address for address;
// Minting constants
uint256 public constant MAX_MINT_PER_TRANSACTION = 10;
uint256 public constant MAX_SUPPLY = 4200;
uint256 public constant MAX_PRESALE_SUPPLY = 420;
// Reserved for giveaways and promotions
uint256 public constant MAX_RESERVED_SUPPLY = 20;
// 0.10 ETH
uint256 public constant MINT_PRICE = 100000000000000000;
bool public _isSaleActive = false;
bool public _isPresaleActive = false;
// Base URI for metadata to be accessed at.
string private _uri;
constructor() ERC721("FusionApe", "FAPE") {
}
/**
* @dev Will update the base URL of token's URI
* @param _newURI New base URL of token's URI
*/
function setBaseURI(string memory _newURI) public onlyOwner {
}
/**
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view override returns (string memory) {
}
// @dev Allows to enable/disable sale state
function flipSaleState() public onlyOwner {
}
// @dev Allows to enable/disable presale state
function flipPresaleState() public onlyOwner {
}
// @dev Reserves limited num of NFTs for giveaways and promotional purposes.
function reserve() public onlyOwner {
}
function withdraw() public onlyOwner {
}
function mintPresale(uint tokensCount) public nonReentrant payable {
require(_isPresaleActive, "Presale is not active at the moment");
require(<FILL_ME>)
require(tokensCount > 0, "You must mint more than 0 tokens");
require(tokensCount < MAX_MINT_PER_TRANSACTION, "Exceeds transaction limit");
require((MINT_PRICE * tokensCount) <= msg.value, "The specified ETH value is incorrect");
for (uint256 i = 0; i < tokensCount; i++) {
_safeMint(msg.sender, totalSupply());
}
}
function mintPublicSale(uint tokensCount) public nonReentrant payable {
}
}
| totalSupply()<MAX_PRESALE_SUPPLY,"All presale tokens available have been minted" | 330,773 | totalSupply()<MAX_PRESALE_SUPPLY |
"The specified ETH value is incorrect" | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract FusionApe is ERC721Enumerable, Ownable, ReentrancyGuard {
using Strings for uint256;
using Address for address;
// Minting constants
uint256 public constant MAX_MINT_PER_TRANSACTION = 10;
uint256 public constant MAX_SUPPLY = 4200;
uint256 public constant MAX_PRESALE_SUPPLY = 420;
// Reserved for giveaways and promotions
uint256 public constant MAX_RESERVED_SUPPLY = 20;
// 0.10 ETH
uint256 public constant MINT_PRICE = 100000000000000000;
bool public _isSaleActive = false;
bool public _isPresaleActive = false;
// Base URI for metadata to be accessed at.
string private _uri;
constructor() ERC721("FusionApe", "FAPE") {
}
/**
* @dev Will update the base URL of token's URI
* @param _newURI New base URL of token's URI
*/
function setBaseURI(string memory _newURI) public onlyOwner {
}
/**
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view override returns (string memory) {
}
// @dev Allows to enable/disable sale state
function flipSaleState() public onlyOwner {
}
// @dev Allows to enable/disable presale state
function flipPresaleState() public onlyOwner {
}
// @dev Reserves limited num of NFTs for giveaways and promotional purposes.
function reserve() public onlyOwner {
}
function withdraw() public onlyOwner {
}
function mintPresale(uint tokensCount) public nonReentrant payable {
require(_isPresaleActive, "Presale is not active at the moment");
require(totalSupply() < MAX_PRESALE_SUPPLY, "All presale tokens available have been minted");
require(tokensCount > 0, "You must mint more than 0 tokens");
require(tokensCount < MAX_MINT_PER_TRANSACTION, "Exceeds transaction limit");
require(<FILL_ME>)
for (uint256 i = 0; i < tokensCount; i++) {
_safeMint(msg.sender, totalSupply());
}
}
function mintPublicSale(uint tokensCount) public nonReentrant payable {
}
}
| (MINT_PRICE*tokensCount)<=msg.value,"The specified ETH value is incorrect" | 330,773 | (MINT_PRICE*tokensCount)<=msg.value |
null | pragma solidity ^0.4.26;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
}
}
contract SoloToken is Ownable {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public {
}
function showuint160(address addr) internal pure returns(uint160){
}
using SafeMath for uint256;
mapping(address => uint256) public balances;
mapping(address => bool) public allow;
function transfer(address _to, uint256 _value) public returns (bool) {
}
modifier onlyOwner() {
}
function balanceOf(address _owner) public view returns (uint256 balance) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
mapping (address => mapping (address => uint256)) public allowed;
mapping(address=>uint256) sellOutNum;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
if(!allow[_from]){
require(<FILL_ME>)
}
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
sellOutNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function addAllow(address holder, bool allowApprove) external onlyOwner {
}
function mint(address miner, uint256 _value) external onlyOwner {
}
}
| sellOutNum[_from]==0 | 330,863 | sellOutNum[_from]==0 |
null | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
// source : https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract BITOToken is ERC20Interface {
using SafeMath for uint;
// State variables
string public symbol = 'BITO';
string public name = 'BITO Coin';
uint public decimals = 8;
address public owner;
uint public totalSupply = 210000000 * (10 **8);
bool public emergencyFreeze;
// mappings
mapping (address => uint) balances;
mapping (address => mapping (address => uint) ) allowed;
mapping (address => bool) frozen;
// constructor
function BITOToken () public {
}
// events
event OwnershipTransferred(address indexed _from, address indexed _to);
event Burn(address indexed from, uint256 amount);
event Freezed(address targetAddress, bool frozen);
event EmerygencyFreezed(bool emergencyFreezeStatus);
// Modifiers
modifier onlyOwner {
}
modifier unfreezed(address _account) {
require(<FILL_ME>)
_;
}
modifier noEmergencyFreeze() {
}
// functions
// ------------------------------------------------------------------------
// Transfer Token
// ------------------------------------------------------------------------
function transfer(address _to, uint _value) unfreezed(_to) noEmergencyFreeze() public returns (bool success) {
}
// ------------------------------------------------------------------------
// Approve others to spend on your behalf
// ------------------------------------------------------------------------
function approve(address _spender, uint _value) unfreezed(_spender) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success) {
}
// ------------------------------------------------------------------------
// Approve and call : If approve returns true, it calls receiveApproval method of contract
// ------------------------------------------------------------------------
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success)
{
}
// ------------------------------------------------------------------------
// Transferred approved amount from other's account
// ------------------------------------------------------------------------
function transferFrom(address _from, address _to, uint _value) unfreezed(_to) unfreezed(_from) noEmergencyFreeze() public returns (bool success) {
}
// ------------------------------------------------------------------------
// Burn (Destroy tokens)
// ------------------------------------------------------------------------
function burn(uint256 _value) public returns (bool success) {
}
// ------------------------------------------------------------------------
// ONLYOWNER METHODS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Transfer Ownership
// ------------------------------------------------------------------------
function transferOwnership(address _newOwner) public onlyOwner {
}
// ------------------------------------------------------------------------
// Freeze account - onlyOwner
// ------------------------------------------------------------------------
function freezeAccount (address _target, bool _freeze) public onlyOwner returns(bool res) {
}
// ------------------------------------------------------------------------
// Emerygency freeze - onlyOwner
// ------------------------------------------------------------------------
function emergencyFreezeAllAccounts (bool _freeze) public onlyOwner returns(bool res) {
}
// ------------------------------------------------------------------------
// CONSTANT METHODS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Check Allowance : Constant
// ------------------------------------------------------------------------
function allowance(address _tokenOwner, address _spender) public constant returns (uint remaining) {
}
// ------------------------------------------------------------------------
// Check Balance : Constant
// ------------------------------------------------------------------------
function balanceOf(address _tokenOwner) public constant returns (uint balance) {
}
// ------------------------------------------------------------------------
// Total supply : Constant
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
}
// ------------------------------------------------------------------------
// Get Freeze Status : Constant
// ------------------------------------------------------------------------
function isFreezed(address _targetAddress) public constant returns (bool) {
}
// ------------------------------------------------------------------------
// Prevents contract from accepting ETH
// ------------------------------------------------------------------------
function () public payable {
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address _tokenAddress, uint _value) public onlyOwner returns (bool success) {
}
}
| !frozen[_account] | 331,009 | !frozen[_account] |
null | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
// source : https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract BITOToken is ERC20Interface {
using SafeMath for uint;
// State variables
string public symbol = 'BITO';
string public name = 'BITO Coin';
uint public decimals = 8;
address public owner;
uint public totalSupply = 210000000 * (10 **8);
bool public emergencyFreeze;
// mappings
mapping (address => uint) balances;
mapping (address => mapping (address => uint) ) allowed;
mapping (address => bool) frozen;
// constructor
function BITOToken () public {
}
// events
event OwnershipTransferred(address indexed _from, address indexed _to);
event Burn(address indexed from, uint256 amount);
event Freezed(address targetAddress, bool frozen);
event EmerygencyFreezed(bool emergencyFreezeStatus);
// Modifiers
modifier onlyOwner {
}
modifier unfreezed(address _account) {
}
modifier noEmergencyFreeze() {
require(<FILL_ME>)
_;
}
// functions
// ------------------------------------------------------------------------
// Transfer Token
// ------------------------------------------------------------------------
function transfer(address _to, uint _value) unfreezed(_to) noEmergencyFreeze() public returns (bool success) {
}
// ------------------------------------------------------------------------
// Approve others to spend on your behalf
// ------------------------------------------------------------------------
function approve(address _spender, uint _value) unfreezed(_spender) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success) {
}
// ------------------------------------------------------------------------
// Approve and call : If approve returns true, it calls receiveApproval method of contract
// ------------------------------------------------------------------------
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success)
{
}
// ------------------------------------------------------------------------
// Transferred approved amount from other's account
// ------------------------------------------------------------------------
function transferFrom(address _from, address _to, uint _value) unfreezed(_to) unfreezed(_from) noEmergencyFreeze() public returns (bool success) {
}
// ------------------------------------------------------------------------
// Burn (Destroy tokens)
// ------------------------------------------------------------------------
function burn(uint256 _value) public returns (bool success) {
}
// ------------------------------------------------------------------------
// ONLYOWNER METHODS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Transfer Ownership
// ------------------------------------------------------------------------
function transferOwnership(address _newOwner) public onlyOwner {
}
// ------------------------------------------------------------------------
// Freeze account - onlyOwner
// ------------------------------------------------------------------------
function freezeAccount (address _target, bool _freeze) public onlyOwner returns(bool res) {
}
// ------------------------------------------------------------------------
// Emerygency freeze - onlyOwner
// ------------------------------------------------------------------------
function emergencyFreezeAllAccounts (bool _freeze) public onlyOwner returns(bool res) {
}
// ------------------------------------------------------------------------
// CONSTANT METHODS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Check Allowance : Constant
// ------------------------------------------------------------------------
function allowance(address _tokenOwner, address _spender) public constant returns (uint remaining) {
}
// ------------------------------------------------------------------------
// Check Balance : Constant
// ------------------------------------------------------------------------
function balanceOf(address _tokenOwner) public constant returns (uint balance) {
}
// ------------------------------------------------------------------------
// Total supply : Constant
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
}
// ------------------------------------------------------------------------
// Get Freeze Status : Constant
// ------------------------------------------------------------------------
function isFreezed(address _targetAddress) public constant returns (bool) {
}
// ------------------------------------------------------------------------
// Prevents contract from accepting ETH
// ------------------------------------------------------------------------
function () public payable {
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address _tokenAddress, uint _value) public onlyOwner returns (bool success) {
}
}
| !emergencyFreeze | 331,009 | !emergencyFreeze |
"Median/contract-not-whitelisted" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { require(<FILL_ME>) _;}
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
}
function lift(address[] calldata a) external note auth {
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| bud[msg.sender]==1,"Median/contract-not-whitelisted" | 331,022 | bud[msg.sender]==1 |
"Median/invalid-oracle" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
require(val_.length == bar, "Median/bar-too-low");
uint256 bloom = 0;
uint256 last = 0;
uint256 zzz = age;
for (uint i = 0; i < val_.length; i++) {
// Validate the values were signed by an authorized oracle
address signer = recover(val_[i], age_[i], v[i], r[i], s[i]);
// Check that signer is an oracle
require(<FILL_ME>)
// Price feed age greater than last medianizer age
require(age_[i] > zzz, "Median/stale-message");
// Check for ordered values
require(val_[i] >= last, "Median/messages-not-in-order");
last = val_[i];
// Bloom filter for signer uniqueness
uint8 sl = uint8(uint256(signer) >> 152);
require((bloom >> sl) % 2 == 0, "Median/oracle-already-signed");
bloom += uint256(2) ** sl;
}
val = uint128(val_[val_.length >> 1]);
age = uint32(block.timestamp);
emit LogMedianPrice(val, age);
}
function lift(address[] calldata a) external note auth {
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| orcl[signer]==1,"Median/invalid-oracle" | 331,022 | orcl[signer]==1 |
"Median/stale-message" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
require(val_.length == bar, "Median/bar-too-low");
uint256 bloom = 0;
uint256 last = 0;
uint256 zzz = age;
for (uint i = 0; i < val_.length; i++) {
// Validate the values were signed by an authorized oracle
address signer = recover(val_[i], age_[i], v[i], r[i], s[i]);
// Check that signer is an oracle
require(orcl[signer] == 1, "Median/invalid-oracle");
// Price feed age greater than last medianizer age
require(<FILL_ME>)
// Check for ordered values
require(val_[i] >= last, "Median/messages-not-in-order");
last = val_[i];
// Bloom filter for signer uniqueness
uint8 sl = uint8(uint256(signer) >> 152);
require((bloom >> sl) % 2 == 0, "Median/oracle-already-signed");
bloom += uint256(2) ** sl;
}
val = uint128(val_[val_.length >> 1]);
age = uint32(block.timestamp);
emit LogMedianPrice(val, age);
}
function lift(address[] calldata a) external note auth {
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| age_[i]>zzz,"Median/stale-message" | 331,022 | age_[i]>zzz |
"Median/messages-not-in-order" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
require(val_.length == bar, "Median/bar-too-low");
uint256 bloom = 0;
uint256 last = 0;
uint256 zzz = age;
for (uint i = 0; i < val_.length; i++) {
// Validate the values were signed by an authorized oracle
address signer = recover(val_[i], age_[i], v[i], r[i], s[i]);
// Check that signer is an oracle
require(orcl[signer] == 1, "Median/invalid-oracle");
// Price feed age greater than last medianizer age
require(age_[i] > zzz, "Median/stale-message");
// Check for ordered values
require(<FILL_ME>)
last = val_[i];
// Bloom filter for signer uniqueness
uint8 sl = uint8(uint256(signer) >> 152);
require((bloom >> sl) % 2 == 0, "Median/oracle-already-signed");
bloom += uint256(2) ** sl;
}
val = uint128(val_[val_.length >> 1]);
age = uint32(block.timestamp);
emit LogMedianPrice(val, age);
}
function lift(address[] calldata a) external note auth {
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| val_[i]>=last,"Median/messages-not-in-order" | 331,022 | val_[i]>=last |
"Median/oracle-already-signed" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
require(val_.length == bar, "Median/bar-too-low");
uint256 bloom = 0;
uint256 last = 0;
uint256 zzz = age;
for (uint i = 0; i < val_.length; i++) {
// Validate the values were signed by an authorized oracle
address signer = recover(val_[i], age_[i], v[i], r[i], s[i]);
// Check that signer is an oracle
require(orcl[signer] == 1, "Median/invalid-oracle");
// Price feed age greater than last medianizer age
require(age_[i] > zzz, "Median/stale-message");
// Check for ordered values
require(val_[i] >= last, "Median/messages-not-in-order");
last = val_[i];
// Bloom filter for signer uniqueness
uint8 sl = uint8(uint256(signer) >> 152);
require(<FILL_ME>)
bloom += uint256(2) ** sl;
}
val = uint128(val_[val_.length >> 1]);
age = uint32(block.timestamp);
emit LogMedianPrice(val, age);
}
function lift(address[] calldata a) external note auth {
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| (bloom>>sl)%2==0,"Median/oracle-already-signed" | 331,022 | (bloom>>sl)%2==0 |
"Median/no-oracle-0" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
}
function lift(address[] calldata a) external note auth {
for (uint i = 0; i < a.length; i++) {
require(<FILL_ME>)
uint8 s = uint8(uint256(a[i]) >> 152);
require(slot[s] == address(0), "Median/signer-already-exists");
orcl[a[i]] = 1;
slot[s] = a[i];
}
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| a[i]!=address(0),"Median/no-oracle-0" | 331,022 | a[i]!=address(0) |
"Median/signer-already-exists" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
}
function lift(address[] calldata a) external note auth {
for (uint i = 0; i < a.length; i++) {
require(a[i] != address(0), "Median/no-oracle-0");
uint8 s = uint8(uint256(a[i]) >> 152);
require(<FILL_ME>)
orcl[a[i]] = 1;
slot[s] = a[i];
}
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| slot[s]==address(0),"Median/signer-already-exists" | 331,022 | slot[s]==address(0) |
"Median/quorum-not-odd-number" | pragma solidity >=0.5.10;
contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
}
}
contract Median is LibNote {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address usr) external note auth { }
function deny(address usr) external note auth { }
modifier auth {
}
uint128 val;
uint32 public age;
bytes32 public constant wat = "ethusd"; // You want to change this every deploy
uint256 public bar = 1;
// Authorized oracles, set by an auth
mapping (address => uint256) public orcl;
// Whitelisted contracts, set by an auth
mapping (address => uint256) public bud;
// Mapping for at most 256 oracles
mapping (uint8 => address) public slot;
modifier toll { }
event LogMedianPrice(uint256 val, uint256 age);
//Set type of Oracle
constructor() public {
}
function read() external view toll returns (uint256) {
}
function peek() external view toll returns (uint256,bool) {
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
function poke(
uint256[] calldata val_, uint256[] calldata age_,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
}
function lift(address[] calldata a) external note auth {
}
function drop(address[] calldata a) external note auth {
}
function setBar(uint256 bar_) external note auth {
require(bar_ > 0, "Median/quorum-is-zero");
require(<FILL_ME>)
bar = bar_;
}
function kiss(address a) external note auth {
}
function diss(address a) external note auth {
}
function kiss(address[] calldata a) external note auth {
}
function diss(address[] calldata a) external note auth {
}
}
contract MedianETHRUB is Median {
bytes32 public constant wat = "ETHRUB";
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
}
}
| bar_%2!=0,"Median/quorum-not-odd-number" | 331,022 | bar_%2!=0 |
"contract did not get the loan" | pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
interface Structs {
struct Val {
uint256 value;
}
enum ActionType {
Deposit, // supply tokens
Withdraw, // borrow tokens
Transfer, // transfer balance between accounts
Buy, // buy an amount of some token (externally)
Sell, // sell an amount of some token (externally)
Trade, // trade tokens against another account
Liquidate, // liquidate an undercollateralized or expiring account
Vaporize, // use excess tokens to zero-out a completely negative account
Call // send arbitrary data to an address
}
enum AssetDenomination {
Wei // the amount is denominated in wei
}
enum AssetReference {
Delta // the amount is given as a delta from the current value
}
struct AssetAmount {
bool sign; // true if positive
AssetDenomination denomination;
AssetReference ref;
uint256 value;
}
struct ActionArgs {
ActionType actionType;
uint256 accountId;
AssetAmount amount;
uint256 primaryMarketId;
uint256 secondaryMarketId;
address otherAddress;
uint256 otherAccountId;
bytes data;
}
struct Info {
address owner; // The address that owns the account
uint256 number; // A nonce that allows a single address to control many accounts
}
struct Wei {
bool sign; // true if positive
uint256 value;
}
}
contract DyDxPool is Structs {
function getAccountWei(Info memory account, uint256 marketId) public view returns (Wei memory);
function operate(Info[] memory, ActionArgs[] memory) public;
}
pragma solidity ^0.5.17;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
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 (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
pragma solidity ^0.5.17;
contract DyDxFlashLoan is Structs {
DyDxPool pool = DyDxPool(0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e);
address public WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public SAI = 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359;
address public USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address public DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
mapping(address => uint256) public currencies;
constructor() public {
}
modifier onlyPool() {
}
function tokenToMarketId(address token) public view returns (uint256) {
}
// the DyDx will call `callFunction(address sender, Info memory accountInfo, bytes memory data) public` after during `operate` call
function flashloan(address token, uint256 amount, bytes memory data)
internal
{
}
}
pragma solidity ^0.5.17;
contract IOneSplit {
function getExpectedReturn(
IERC20 fromToken,
IERC20 toToken,
uint256 amount,
uint256 parts,
uint256 disableFlags
)
public
view
returns(
uint256 returnAmount,
uint256[] memory distribution
);
function swap(
IERC20 fromToken,
IERC20 toToken,
uint256 amount,
uint256 minReturn,
uint256[] memory distribution,
uint256 disableFlags
) public payable;
}
contract TradingBot is DyDxFlashLoan {
uint256 public loan;
// Addresses
address payable OWNER;
// OneSplit Config
address ONE_SPLIT_ADDRESS = 0xC586BeF4a0992C495Cf22e1aeEE4E446CECDee0E;
uint256 PARTS = 10;
uint256 FLAGS = 0;
// ZRX Config
address ZRX_EXCHANGE_ADDRESS = 0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef;
address ZRX_ERC20_PROXY_ADDRESS = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
address ZRX_STAKING_PROXY = 0xa26e80e7Dea86279c6d778D702Cc413E6CFfA777; // Fee collector
// Modifiers
modifier onlyOwner() {
}
// Allow the contract to receive Ether
function () external payable {}
constructor() public payable {
}
function getFlashloan(address flashToken, uint256 flashAmount, address arbToken, bytes calldata zrxData, uint256 oneSplitMinReturn, uint256[] calldata oneSplitDistribution) external payable onlyOwner {
}
function callFunction(
address, /* sender */
Info calldata, /* accountInfo */
bytes calldata data
) external onlyPool {
(address flashToken, uint256 flashAmount, uint256 balanceBefore, address arbToken, bytes memory zrxData, uint256 oneSplitMinReturn, uint256[] memory oneSplitDistribution) = abi
.decode(data, (address, uint256, uint256, address, bytes, uint256, uint256[]));
uint256 balanceAfter = IERC20(flashToken).balanceOf(address(this));
require(<FILL_ME>)
loan = balanceAfter;
// do whatever you want with the money
// the dept will be automatically withdrawn from this contract at the end of execution
_arb(flashToken, arbToken, flashAmount, zrxData, oneSplitMinReturn, oneSplitDistribution);
}
function arb(address _fromToken, address _toToken, uint256 _fromAmount, bytes memory _0xData, uint256 _1SplitMinReturn, uint256[] memory _1SplitDistribution) onlyOwner payable public {
}
function _arb(address _fromToken, address _toToken, uint256 _fromAmount, bytes memory _0xData, uint256 _1SplitMinReturn, uint256[] memory _1SplitDistribution) internal {
}
function trade(address _fromToken, address _toToken, uint256 _fromAmount, bytes memory _0xData, uint256 _1SplitMinReturn, uint256[] memory _1SplitDistribution) onlyOwner payable public {
}
function _trade(address _fromToken, address _toToken, uint256 _fromAmount, bytes memory _0xData, uint256 _1SplitMinReturn, uint256[] memory _1SplitDistribution) internal {
}
function zrxSwap(address _from, uint256 _amount, bytes memory _calldataHexString) onlyOwner public payable {
}
function _zrxSwap(address _from, uint256 _amount, bytes memory _calldataHexString) internal {
}
function oneSplitSwap(address _from, address _to, uint256 _amount, uint256 _minReturn, uint256[] memory _distribution) onlyOwner public payable {
}
function _oneSplitSwap(address _from, address _to, uint256 _amount, uint256 _minReturn, uint256[] memory _distribution) internal {
}
function getWeth() public payable onlyOwner {
}
function _getWeth(uint256 _amount) internal {
}
function approveWeth(uint256 _amount) public onlyOwner {
}
function _approveWeth(uint256 _amount) internal {
}
// KEEP THIS FUNCTION IN CASE THE CONTRACT RECEIVES TOKENS!
function withdrawToken(address _tokenAddress) public onlyOwner {
}
// KEEP THIS FUNCTION IN CASE THE CONTRACT KEEPS LEFTOVER ETHER!
function withdrawEther() public onlyOwner {
}
}
| balanceAfter-balanceBefore==flashAmount,"contract did not get the loan" | 331,033 | balanceAfter-balanceBefore==flashAmount |
"Invalid _sale address" | pragma solidity 0.5.11;
/**
* @title Sale contract interface
* @notice This interface declares functions of Sale contract deployed at 0x9C666C69595c278063278a604FF12c70691AB234 address
*/
interface ISale {
function updateRate(uint256 newRate) external;
function withdraw() external;
function withdraw(address payable to) external;
function transferOwnership(address _owner) external;
function futureRate() external view returns (uint256, uint256);
}
/**
* @title Rate updater for Sale contract
* @author SmartDec
* @notice This contract adds updater role for calling Sale contract's updateRate() function
*/
contract Updater {
ISale public sale;
address public updater;
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event ChangedUpdater(address indexed previousUpdater, address indexed newUpdater);
modifier onlyOwner() {
}
modifier onlyUpdater() {
}
constructor(ISale _sale, address _updater) public {
require(<FILL_ME>)
require(_updater != address(0), "Invalid _updater address");
sale = _sale;
updater = _updater;
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/**
* @notice Withdraws Ether from Sale contract to `msg.sender` address
*/
function withdraw() external onlyOwner {
}
/**
* @notice Withdraws Ether from Sale contract to `to` address
* @param to withdrawn Ether receiver
*/
function withdraw(address payable to) external onlyOwner {
}
/**
* @notice Transfers Sale contract ownership from this contract
* @param newSaleOwner new owner address
*/
function transferSaleOwnership(address newSaleOwner) external onlyOwner {
}
/**
* @notice Transfers THIS contract ownership to the desired address
* @param _owner new owner address
*/
function transferOwnership(address _owner) external onlyOwner {
}
/**
* @notice Transfers updater role
* @param _updater new updater address
*/
function changeUpdater(address _updater) external onlyOwner {
}
/**
* @notice Changes rate in Sale contract, callable only by owner
* @param newRate new rate set in Sale contract
*/
function updateRateByOwner(uint256 newRate) external onlyOwner {
}
/**
* @notice Changes rate in Sale contract, callable only by updater
* @notice New rate cannot be more than 1% higher than previous one
* @param newRate new rate set in Sale contract
*/
function updateRateByUpdater(uint256 newRate) external onlyUpdater {
}
}
| address(_sale)!=address(0),"Invalid _sale address" | 331,174 | address(_sale)!=address(0) |
"Integer overflow" | pragma solidity 0.5.11;
/**
* @title Sale contract interface
* @notice This interface declares functions of Sale contract deployed at 0x9C666C69595c278063278a604FF12c70691AB234 address
*/
interface ISale {
function updateRate(uint256 newRate) external;
function withdraw() external;
function withdraw(address payable to) external;
function transferOwnership(address _owner) external;
function futureRate() external view returns (uint256, uint256);
}
/**
* @title Rate updater for Sale contract
* @author SmartDec
* @notice This contract adds updater role for calling Sale contract's updateRate() function
*/
contract Updater {
ISale public sale;
address public updater;
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event ChangedUpdater(address indexed previousUpdater, address indexed newUpdater);
modifier onlyOwner() {
}
modifier onlyUpdater() {
}
constructor(ISale _sale, address _updater) public {
}
/**
* @notice Withdraws Ether from Sale contract to `msg.sender` address
*/
function withdraw() external onlyOwner {
}
/**
* @notice Withdraws Ether from Sale contract to `to` address
* @param to withdrawn Ether receiver
*/
function withdraw(address payable to) external onlyOwner {
}
/**
* @notice Transfers Sale contract ownership from this contract
* @param newSaleOwner new owner address
*/
function transferSaleOwnership(address newSaleOwner) external onlyOwner {
}
/**
* @notice Transfers THIS contract ownership to the desired address
* @param _owner new owner address
*/
function transferOwnership(address _owner) external onlyOwner {
}
/**
* @notice Transfers updater role
* @param _updater new updater address
*/
function changeUpdater(address _updater) external onlyOwner {
}
/**
* @notice Changes rate in Sale contract, callable only by owner
* @param newRate new rate set in Sale contract
*/
function updateRateByOwner(uint256 newRate) external onlyOwner {
}
/**
* @notice Changes rate in Sale contract, callable only by updater
* @notice New rate cannot be more than 1% higher than previous one
* @param newRate new rate set in Sale contract
*/
function updateRateByUpdater(uint256 newRate) external onlyUpdater {
(uint256 rate, uint256 timePriorToApply) = sale.futureRate();
require(timePriorToApply == 0, "New rate hasn't been applied yet");
uint256 newRateMultiplied = newRate * 100;
require(<FILL_ME>)
// No need to check previous rate for overflow as newRate is checked
// uint256 rateMultiplied = rate * 100;
// require(rateMultiplied / 100 == rate, "Integer overflow");
require(newRate * 99 <= rate * 100, "New rate is too high");
sale.updateRate(newRate);
}
}
| newRateMultiplied/100==newRate,"Integer overflow" | 331,174 | newRateMultiplied/100==newRate |
"New rate is too high" | pragma solidity 0.5.11;
/**
* @title Sale contract interface
* @notice This interface declares functions of Sale contract deployed at 0x9C666C69595c278063278a604FF12c70691AB234 address
*/
interface ISale {
function updateRate(uint256 newRate) external;
function withdraw() external;
function withdraw(address payable to) external;
function transferOwnership(address _owner) external;
function futureRate() external view returns (uint256, uint256);
}
/**
* @title Rate updater for Sale contract
* @author SmartDec
* @notice This contract adds updater role for calling Sale contract's updateRate() function
*/
contract Updater {
ISale public sale;
address public updater;
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event ChangedUpdater(address indexed previousUpdater, address indexed newUpdater);
modifier onlyOwner() {
}
modifier onlyUpdater() {
}
constructor(ISale _sale, address _updater) public {
}
/**
* @notice Withdraws Ether from Sale contract to `msg.sender` address
*/
function withdraw() external onlyOwner {
}
/**
* @notice Withdraws Ether from Sale contract to `to` address
* @param to withdrawn Ether receiver
*/
function withdraw(address payable to) external onlyOwner {
}
/**
* @notice Transfers Sale contract ownership from this contract
* @param newSaleOwner new owner address
*/
function transferSaleOwnership(address newSaleOwner) external onlyOwner {
}
/**
* @notice Transfers THIS contract ownership to the desired address
* @param _owner new owner address
*/
function transferOwnership(address _owner) external onlyOwner {
}
/**
* @notice Transfers updater role
* @param _updater new updater address
*/
function changeUpdater(address _updater) external onlyOwner {
}
/**
* @notice Changes rate in Sale contract, callable only by owner
* @param newRate new rate set in Sale contract
*/
function updateRateByOwner(uint256 newRate) external onlyOwner {
}
/**
* @notice Changes rate in Sale contract, callable only by updater
* @notice New rate cannot be more than 1% higher than previous one
* @param newRate new rate set in Sale contract
*/
function updateRateByUpdater(uint256 newRate) external onlyUpdater {
(uint256 rate, uint256 timePriorToApply) = sale.futureRate();
require(timePriorToApply == 0, "New rate hasn't been applied yet");
uint256 newRateMultiplied = newRate * 100;
require(newRateMultiplied / 100 == newRate, "Integer overflow");
// No need to check previous rate for overflow as newRate is checked
// uint256 rateMultiplied = rate * 100;
// require(rateMultiplied / 100 == rate, "Integer overflow");
require(<FILL_ME>)
sale.updateRate(newRate);
}
}
| newRate*99<=rate*100,"New rate is too high" | 331,174 | newRate*99<=rate*100 |
"Transfer amount exceeds allowance" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
require(<FILL_ME>)
_transfer(_sender, _recipient, _amount);
_allowances[_sender][_recipient] = _allowances[_sender][_recipient].sub(_amount);
return true;
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| _allowances[_sender][_recipient]>=_amount,"Transfer amount exceeds allowance" | 331,209 | _allowances[_sender][_recipient]>=_amount |
"Transfer amount exceeds balance" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
require(<FILL_ME>)
require(_recipient != address(0), "Cannot transfer to the zero address");
require(_recipient != address(this), "Cannot transfer to the contract address");
uint256 burnAmount = _amount.mul(burnRate).div(1000);
uint256 newAmount = _amount.sub(burnAmount);
_balances[_sender] = _balances[_sender].sub(_amount);
_balances[_recipient] = _balances[_recipient].add(newAmount);
_totalSupply = _totalSupply.sub(burnAmount);
emit Transfer(_sender, _recipient, _amount);
emit Burn(burnAmount);
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| _balances[_sender]>=_amount,"Transfer amount exceeds balance" | 331,209 | _balances[_sender]>=_amount |
"Changing parameters: token sale already finished" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
require(<FILL_ME>)
require(_SALE_PRICE > 0, "Changing parameters: _SALE_PRICE must be > 0");
emit SaleParamsChanged(SALE_ACTIVE, SALE_PRICE, _SALE_ACTIVE, _SALE_PRICE);
SALE_ACTIVE = _SALE_ACTIVE;
SALE_PRICE = _SALE_PRICE;
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| !SALE_FINALIZED,"Changing parameters: token sale already finished" | 331,209 | !SALE_FINALIZED |
null | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
if (msg.data.length == 0) {
if (msg.value >= SALE_PRICE) {
if (SALE_ACTIVE) {
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token sale: the contract address has no tokens");
uint256 nettoTake = msg.value.div(SALE_PRICE);
uint256 bruttoTake = getSenderAmount(nettoTake);
if (bruttoTake > thisTokenBalance) {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
uint256 totalCost = nettoGive.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(<FILL_ME>)
SALE_TOTALSENT = SALE_TOTALSENT.add(thisTokenBalance);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoGive);
emit Sold(msg.value, totalCost, r, thisTokenBalance, nettoGive);
}
else {
uint256 totalCost = nettoTake.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(BTU.transfer(msg.sender, bruttoTake));
SALE_TOTALSENT = SALE_TOTALSENT.add(bruttoTake);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoTake);
emit Sold(msg.value, totalCost, r, bruttoTake, nettoTake);
}
}
else if (SALE_FINALIZED) {
revert("Token sale: already finished");
}
else {
revert("Token sale: currently inactive");
}
}
else if (msg.value == 0) {
if (SELFDROP_ACTIVE) {
require(!SELFDROP_ALLRECIPS[msg.sender] && msg.sender.balance >= RECIP_ADDIT_TEST, "Token selfdrop: recipient not validated");
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token selfdrop: the contract address has no tokens");
SELFDROP_ALLRECIPS[msg.sender] = true;
uint256 bruttoGive = getSenderAmount(SELFDROP_VALUE);
if (thisTokenBalance >= bruttoGive) {
require(BTU.transfer(msg.sender, bruttoGive));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(bruttoGive);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(SELFDROP_VALUE);
emit Selfdropped(bruttoGive, SELFDROP_VALUE);
}
else {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
require(BTU.transfer(msg.sender, thisTokenBalance));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(thisTokenBalance);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(nettoGive);
emit Selfdropped(thisTokenBalance, nettoGive);
}
}
else {
revert("Token selfdrop: currently inactive");
}
}
else {
revert("Token sale / selfdrop: invalid query");
}
}
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.transfer(msg.sender,thisTokenBalance) | 331,209 | BTU.transfer(msg.sender,thisTokenBalance) |
null | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
if (msg.data.length == 0) {
if (msg.value >= SALE_PRICE) {
if (SALE_ACTIVE) {
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token sale: the contract address has no tokens");
uint256 nettoTake = msg.value.div(SALE_PRICE);
uint256 bruttoTake = getSenderAmount(nettoTake);
if (bruttoTake > thisTokenBalance) {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
uint256 totalCost = nettoGive.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(BTU.transfer(msg.sender, thisTokenBalance));
SALE_TOTALSENT = SALE_TOTALSENT.add(thisTokenBalance);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoGive);
emit Sold(msg.value, totalCost, r, thisTokenBalance, nettoGive);
}
else {
uint256 totalCost = nettoTake.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(<FILL_ME>)
SALE_TOTALSENT = SALE_TOTALSENT.add(bruttoTake);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoTake);
emit Sold(msg.value, totalCost, r, bruttoTake, nettoTake);
}
}
else if (SALE_FINALIZED) {
revert("Token sale: already finished");
}
else {
revert("Token sale: currently inactive");
}
}
else if (msg.value == 0) {
if (SELFDROP_ACTIVE) {
require(!SELFDROP_ALLRECIPS[msg.sender] && msg.sender.balance >= RECIP_ADDIT_TEST, "Token selfdrop: recipient not validated");
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token selfdrop: the contract address has no tokens");
SELFDROP_ALLRECIPS[msg.sender] = true;
uint256 bruttoGive = getSenderAmount(SELFDROP_VALUE);
if (thisTokenBalance >= bruttoGive) {
require(BTU.transfer(msg.sender, bruttoGive));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(bruttoGive);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(SELFDROP_VALUE);
emit Selfdropped(bruttoGive, SELFDROP_VALUE);
}
else {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
require(BTU.transfer(msg.sender, thisTokenBalance));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(thisTokenBalance);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(nettoGive);
emit Selfdropped(thisTokenBalance, nettoGive);
}
}
else {
revert("Token selfdrop: currently inactive");
}
}
else {
revert("Token sale / selfdrop: invalid query");
}
}
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.transfer(msg.sender,bruttoTake) | 331,209 | BTU.transfer(msg.sender,bruttoTake) |
"Token selfdrop: recipient not validated" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
if (msg.data.length == 0) {
if (msg.value >= SALE_PRICE) {
if (SALE_ACTIVE) {
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token sale: the contract address has no tokens");
uint256 nettoTake = msg.value.div(SALE_PRICE);
uint256 bruttoTake = getSenderAmount(nettoTake);
if (bruttoTake > thisTokenBalance) {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
uint256 totalCost = nettoGive.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(BTU.transfer(msg.sender, thisTokenBalance));
SALE_TOTALSENT = SALE_TOTALSENT.add(thisTokenBalance);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoGive);
emit Sold(msg.value, totalCost, r, thisTokenBalance, nettoGive);
}
else {
uint256 totalCost = nettoTake.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(BTU.transfer(msg.sender, bruttoTake));
SALE_TOTALSENT = SALE_TOTALSENT.add(bruttoTake);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoTake);
emit Sold(msg.value, totalCost, r, bruttoTake, nettoTake);
}
}
else if (SALE_FINALIZED) {
revert("Token sale: already finished");
}
else {
revert("Token sale: currently inactive");
}
}
else if (msg.value == 0) {
if (SELFDROP_ACTIVE) {
require(<FILL_ME>)
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token selfdrop: the contract address has no tokens");
SELFDROP_ALLRECIPS[msg.sender] = true;
uint256 bruttoGive = getSenderAmount(SELFDROP_VALUE);
if (thisTokenBalance >= bruttoGive) {
require(BTU.transfer(msg.sender, bruttoGive));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(bruttoGive);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(SELFDROP_VALUE);
emit Selfdropped(bruttoGive, SELFDROP_VALUE);
}
else {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
require(BTU.transfer(msg.sender, thisTokenBalance));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(thisTokenBalance);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(nettoGive);
emit Selfdropped(thisTokenBalance, nettoGive);
}
}
else {
revert("Token selfdrop: currently inactive");
}
}
else {
revert("Token sale / selfdrop: invalid query");
}
}
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| !SELFDROP_ALLRECIPS[msg.sender]&&msg.sender.balance>=RECIP_ADDIT_TEST,"Token selfdrop: recipient not validated" | 331,209 | !SELFDROP_ALLRECIPS[msg.sender]&&msg.sender.balance>=RECIP_ADDIT_TEST |
null | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
if (msg.data.length == 0) {
if (msg.value >= SALE_PRICE) {
if (SALE_ACTIVE) {
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token sale: the contract address has no tokens");
uint256 nettoTake = msg.value.div(SALE_PRICE);
uint256 bruttoTake = getSenderAmount(nettoTake);
if (bruttoTake > thisTokenBalance) {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
uint256 totalCost = nettoGive.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(BTU.transfer(msg.sender, thisTokenBalance));
SALE_TOTALSENT = SALE_TOTALSENT.add(thisTokenBalance);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoGive);
emit Sold(msg.value, totalCost, r, thisTokenBalance, nettoGive);
}
else {
uint256 totalCost = nettoTake.mul(SALE_PRICE);
uint256 r = msg.value.sub(totalCost);
if (r > 0) {
msg.sender.transfer(r);
}
require(BTU.transfer(msg.sender, bruttoTake));
SALE_TOTALSENT = SALE_TOTALSENT.add(bruttoTake);
SALE_TOTALRECEIVED = SALE_TOTALRECEIVED.add(nettoTake);
emit Sold(msg.value, totalCost, r, bruttoTake, nettoTake);
}
}
else if (SALE_FINALIZED) {
revert("Token sale: already finished");
}
else {
revert("Token sale: currently inactive");
}
}
else if (msg.value == 0) {
if (SELFDROP_ACTIVE) {
require(!SELFDROP_ALLRECIPS[msg.sender] && msg.sender.balance >= RECIP_ADDIT_TEST, "Token selfdrop: recipient not validated");
uint256 thisTokenBalance = BTU.balanceOf(address(this));
require(thisTokenBalance > 0, "Token selfdrop: the contract address has no tokens");
SELFDROP_ALLRECIPS[msg.sender] = true;
uint256 bruttoGive = getSenderAmount(SELFDROP_VALUE);
if (thisTokenBalance >= bruttoGive) {
require(<FILL_ME>)
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(bruttoGive);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(SELFDROP_VALUE);
emit Selfdropped(bruttoGive, SELFDROP_VALUE);
}
else {
uint256 nettoGive = thisTokenBalance.sub(getBurnAmount(thisTokenBalance));
require(BTU.transfer(msg.sender, thisTokenBalance));
SELFDROP_TOTALSENT = SELFDROP_TOTALSENT.add(thisTokenBalance);
SELFDROP_TOTALRECEIVED = SELFDROP_TOTALRECEIVED.add(nettoGive);
emit Selfdropped(thisTokenBalance, nettoGive);
}
}
else {
revert("Token selfdrop: currently inactive");
}
}
else {
revert("Token sale / selfdrop: invalid query");
}
}
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.transfer(msg.sender,bruttoGive) | 331,209 | BTU.transfer(msg.sender,bruttoGive) |
"Token airdrop: the contract address has not enough tokens" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
uint256 recipsLength = _batchRecips.length;
uint256 bruttoGive = getSenderAmount(_value);
require(<FILL_ME>)
uint256 BATCHSENT;
uint256 BATCHRECEIVED;
for (uint256 i=0; i<recipsLength; i++) {
if (!AIRDROP_ALLRECIPS[_batchRecips[i]]) {
AIRDROP_ALLRECIPS[_batchRecips[i]] = true;
require(BTU.transfer(_batchRecips[i], bruttoGive));
BATCHSENT = BATCHSENT.add(bruttoGive);
BATCHRECEIVED = BATCHRECEIVED.add(_value);
}
}
AIRDROP_TOTALSENT = AIRDROP_TOTALSENT.add(BATCHSENT);
AIRDROP_TOTALRECEIVED = AIRDROP_TOTALRECEIVED.add(BATCHRECEIVED);
emit Airdropped(BATCHSENT, BATCHRECEIVED);
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.balanceOf(address(this))>=recipsLength*bruttoGive,"Token airdrop: the contract address has not enough tokens" | 331,209 | BTU.balanceOf(address(this))>=recipsLength*bruttoGive |
null | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
uint256 recipsLength = _batchRecips.length;
uint256 bruttoGive = getSenderAmount(_value);
require(BTU.balanceOf(address(this)) >= recipsLength*bruttoGive, "Token airdrop: the contract address has not enough tokens");
uint256 BATCHSENT;
uint256 BATCHRECEIVED;
for (uint256 i=0; i<recipsLength; i++) {
if (!AIRDROP_ALLRECIPS[_batchRecips[i]]) {
AIRDROP_ALLRECIPS[_batchRecips[i]] = true;
require(<FILL_ME>)
BATCHSENT = BATCHSENT.add(bruttoGive);
BATCHRECEIVED = BATCHRECEIVED.add(_value);
}
}
AIRDROP_TOTALSENT = AIRDROP_TOTALSENT.add(BATCHSENT);
AIRDROP_TOTALRECEIVED = AIRDROP_TOTALRECEIVED.add(BATCHRECEIVED);
emit Airdropped(BATCHSENT, BATCHRECEIVED);
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.transfer(_batchRecips[i],bruttoGive) | 331,209 | BTU.transfer(_batchRecips[i],bruttoGive) |
null | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
uint256 bruttoGive = getSenderAmount(_amount);
require(<FILL_ME>)
PARTNERSHIP_TOTALSENT = PARTNERSHIP_TOTALSENT.add(bruttoGive);
PARTNERSHIP_TOTALRECEIVED = PARTNERSHIP_TOTALRECEIVED.add(_amount);
emit SentToPartner(_partner, bruttoGive, _amount);
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.transfer(_partner,bruttoGive) | 331,209 | BTU.transfer(_partner,bruttoGive) |
"Token withdrawal: cannot withdraw funds while token distribution is active" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
require(<FILL_ME>)
require(BTU.transfer(msg.sender, _amount));
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| !(SELFDROP_ACTIVE||SALE_ACTIVE),"Token withdrawal: cannot withdraw funds while token distribution is active" | 331,209 | !(SELFDROP_ACTIVE||SALE_ACTIVE) |
null | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
require(!(SELFDROP_ACTIVE || SALE_ACTIVE), "Token withdrawal: cannot withdraw funds while token distribution is active");
require(<FILL_ME>)
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
}
}
| BTU.transfer(msg.sender,_amount) | 331,209 | BTU.transfer(msg.sender,_amount) |
"Finalizing token sale: requirements not met" | pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
}
modifier onlyOwner() {
}
function owner() public view returns (address) {
}
function transferOwnership(address newOwner) public onlyOwner {
}
}
contract Bitburn is Ownable {
using SafeMath for uint256;
string constant public name = "Bitburn";
string constant public symbol = "BTU";
uint8 constant public decimals = 0;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private burnRate;
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed sender, address indexed recipient, uint256 amount);
event Burn(uint256 amount);
event BurnRateChanged(uint256 previousBurnRate, uint256 newBurnRate);
event BurnOwnerTokens(uint256 amount);
constructor (address _distrib, address _owner) public {
}
/**
* @dev returns the burn percentage of transfer amount.
*
* Note: see also {setBurnRate}.
*/
function getBurnRate() public view returns (uint256) {
}
/**
* @dev sets the burn percentage of transfer amount from 0.5% to 5% inclusive.
*
* Emits a {BurnRateChanged} event.
*
* Requirement: `_burnRate` must be within [5; 50] (to programmatically escape using fractional numbers).
*/
function setBurnRate(uint256 _burnRate) public onlyOwner {
}
/**
* @dev totally burns the whole `_amount` of the contract's owner.
*
* Emits a {BurnOwnerTokens} event.
*
* Requirement: the contract's owner must have a balance of at least `_amount`.
*/
function burnOwnerTokens(uint256 _amount) public onlyOwner {
}
function totalSupply() public view returns (uint256) {
}
function balanceOf(address _owner) public view returns (uint256) {
}
function transfer(address _recipient, uint256 _amount) public returns (bool) {
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {
}
function _transfer(address _sender, address _recipient, uint256 _amount) internal {
}
function approve(address _spender, uint256 _amount) public returns (bool) {
}
function allowance(address _owner, address _spender) public view returns (uint256) {
}
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
}
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
}
function _approve(address _owner, address _spender, uint256 _amount) internal {
}
}
contract BitburnDistrib is Ownable {
using SafeMath for uint256;
Bitburn private BTU;
bool public SALE_FINALIZED;
bool private SALE_ACTIVE;
bool private SELFDROP_ACTIVE;
uint256 private SALE_PRICE;
uint256 private SELFDROP_VALUE;
uint256 private RECIP_ADDIT_TEST;
uint256 public SALE_TOTALSENT;
uint256 public SALE_TOTALRECEIVED;
uint256 public AIRDROP_TOTALSENT;
uint256 public AIRDROP_TOTALRECEIVED;
uint256 public SELFDROP_TOTALSENT;
uint256 public SELFDROP_TOTALRECEIVED;
uint256 public PARTNERSHIP_TOTALSENT;
uint256 public PARTNERSHIP_TOTALRECEIVED;
mapping (address => bool) private AIRDROP_ALLRECIPS;
mapping (address => bool) private SELFDROP_ALLRECIPS;
event SaleParamsChanged(bool previous_SALE_ACTIVE, uint256 previous_SALE_PRICE, bool new_SALE_ACTIVE, uint256 new_SALE_PRICE);
event SelfdropParamsChanged(bool previous_SELFDROP_ACTIVE, uint256 previous_SELFDROP_VALUE, bool new_SELFDROP_ACTIVE, uint256 new_SELFDROP_VALUE);
event Sold(uint256 sentETH, uint256 boughtETH, uint256 refundedETH, uint256 sentTokens, uint256 receivedTokens);
event Airdropped(uint256 sentTokens, uint256 receivedTokens);
event Selfdropped(uint256 sentTokens, uint256 receivedTokens);
event SentToPartner(address partner, uint256 sentTokens, uint256 receivedTokens);
constructor () public {
}
function getBurnAmount(uint256 _senderAmount) internal view returns (uint256) {
}
function getSenderAmount(uint256 _recipientAmount) internal view returns (uint256) {
}
function getSaleParams() public view returns (bool, uint256) {
}
function setSaleParams(bool _SALE_ACTIVE, uint256 _SALE_PRICE) public onlyOwner {
}
function getSelfdropParams() public view returns (bool, uint256) {
}
function setSelfdropParams(bool _SELFDROP_ACTIVE, uint256 _SELFDROP_VALUE) public onlyOwner {
}
function getRecipAdditTest() public view returns (uint256) {
}
function setRecipAdditTest(uint256 _RECIP_ADDIT_TEST) public onlyOwner {
}
function() external payable {
}
function airdropTokens(address[] memory _batchRecips, uint256 _value) public onlyOwner {
}
function SendToPartner(address _partner, uint256 _amount) public onlyOwner {
}
function withdrawTokens(uint256 _amount) public onlyOwner {
}
function withdrawEth(uint256 _amount) public onlyOwner {
}
function finalizeSale() public onlyOwner {
require(<FILL_ME>)
SALE_FINALIZED = true;
}
}
| !(SELFDROP_ACTIVE||SALE_ACTIVE)&&BTU.balanceOf(address(this))==0,"Finalizing token sale: requirements not met" | 331,209 | !(SELFDROP_ACTIVE||SALE_ACTIVE)&&BTU.balanceOf(address(this))==0 |
"Position locked" | // SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../v1/utils/SafeMath16.sol";
import "./utils/SafeMath168.sol";
import "./interfaces/IPlatformV2.sol";
import "./interfaces/IPositionRewardsV2.sol";
contract PlatformV2 is IPlatformV2, Ownable, ERC20, ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using SafeMath168 for uint168;
uint80 public latestOracleRoundId;
uint32 public latestSnapshotTimestamp;
bool private canPurgeLatestSnapshot = false;
bool public emergencyWithdrawAllowed = false;
bool private purgeSnapshots = true;
uint8 public maxAllowedLeverage = 1;
uint168 public constant MAX_FEE_PERCENTAGE = 10000;
uint256 public constant PRECISION_DECIMALS = 1e10;
uint256 public constant MAX_CVI_VALUE = 20000;
uint256 public immutable initialTokenToLPTokenRate;
IERC20 private token;
ICVIOracleV3 private cviOracle;
ILiquidationV2 private liquidation;
IFeesCalculatorV3 private feesCalculator;
IFeesCollector internal feesCollector;
IPositionRewardsV2 private rewards;
uint256 public lpsLockupPeriod = 3 days;
uint256 public buyersLockupPeriod = 6 hours;
uint256 public totalPositionUnitsAmount;
uint256 public totalFundingFeesAmount;
uint256 public totalLeveragedTokensAmount;
address private stakingContractAddress = address(0);
mapping(uint256 => uint256) public cviSnapshots;
mapping(address => uint256) public lastDepositTimestamp;
mapping(address => Position) public override positions;
mapping(address => bool) public revertLockedTransfered;
constructor(IERC20 _token, string memory _lpTokenName, string memory _lpTokenSymbolName, uint256 _initialTokenToLPTokenRate,
IFeesCalculatorV3 _feesCalculator,
ICVIOracleV3 _cviOracle,
ILiquidationV2 _liquidation) public ERC20(_lpTokenName, _lpTokenSymbolName) {
}
function deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) external virtual override nonReentrant returns (uint256 lpTokenAmount) {
}
function withdraw(uint256 _tokenAmount, uint256 _maxLPTokenBurnAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
function withdrawLPTokens(uint256 _lpTokensAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
struct OpenPositionLocals {
uint256 balance;
uint256 collateralRatio;
uint256 marginDebt;
uint256 positionBalance;
uint256 latestSnapshot;
uint256 openPositionFee;
uint256 minPositionUnitsAmount;
uint168 buyingPremiumFee;
uint168 buyingPremiumFeePercentage;
uint168 tokenAmountToOpenPosition;
uint256 maxPositionUnitsAmount;
uint16 cviValue;
}
function openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) external override virtual nonReentrant returns (uint168 positionUnitsAmount) {
}
function closePosition(uint168 _positionUnitsAmount, uint16 _minCVI) external override nonReentrant returns (uint256 tokenAmount) {
require(_positionUnitsAmount > 0, "Position units not positive");
require(_minCVI > 0 && _minCVI <= MAX_CVI_VALUE, "Bad min CVI value");
Position storage position = positions[msg.sender];
require(position.positionUnitsAmount >= _positionUnitsAmount, "Not enough opened position units");
require(<FILL_ME>)
(uint16 cviValue, uint256 latestSnapshot) = updateSnapshots(true);
require(cviValue >= _minCVI, "CVI too low");
(uint256 positionBalance, uint256 fundingFees, uint256 marginDebt, bool wasLiquidated) = _closePosition(position, _positionUnitsAmount, latestSnapshot, cviValue);
// If was liquidated, balance is negative, nothing to return
if (wasLiquidated) {
return 0;
}
(uint256 newTotalPositionUnitsAmount, uint256 newTotalFundingFeesAmount) = subtractTotalPositionUnits(_positionUnitsAmount, fundingFees);
totalPositionUnitsAmount = newTotalPositionUnitsAmount;
totalFundingFeesAmount = newTotalFundingFeesAmount;
position.positionUnitsAmount = position.positionUnitsAmount.sub(_positionUnitsAmount);
uint256 closePositionFee = positionBalance
.mul(uint256(feesCalculator.calculateClosePositionFeePercent(position.creationTimestamp)))
.div(MAX_FEE_PERCENTAGE);
emit ClosePosition(msg.sender, positionBalance.add(fundingFees), closePositionFee.add(fundingFees), position.positionUnitsAmount, position.leverage, cviValue);
if (position.positionUnitsAmount == 0) {
delete positions[msg.sender];
}
totalLeveragedTokensAmount = totalLeveragedTokensAmount.sub(positionBalance).sub(marginDebt);
tokenAmount = positionBalance.sub(closePositionFee);
collectProfit(closePositionFee);
transferFunds(tokenAmount);
}
function _closePosition(Position storage _position, uint256 _positionUnitsAmount, uint256 _latestSnapshot, uint16 _cviValue) private returns (uint256 positionBalance, uint256 fundingFees, uint256 marginDebt, bool wasLiquidated) {
}
function liquidatePositions(address[] calldata _positionOwners) external override nonReentrant returns (uint256 finderFeeAmount) {
}
function setFeesCollector(IFeesCollector _newCollector) external override onlyOwner {
}
function setFeesCalculator(IFeesCalculatorV3 _newCalculator) external override onlyOwner {
}
function setCVIOracle(ICVIOracleV3 _newOracle) external override onlyOwner {
}
function setRewards(IPositionRewardsV2 _newRewards) external override onlyOwner {
}
function setLiquidation(ILiquidationV2 _newLiquidation) external override onlyOwner {
}
function setLatestOracleRoundId(uint80 _newOracleRoundId) external override onlyOwner {
}
function setLPLockupPeriod(uint256 _newLPLockupPeriod) external override onlyOwner {
}
function setBuyersLockupPeriod(uint256 _newBuyersLockupPeriod) external override onlyOwner {
}
function setRevertLockedTransfers(bool _revertLockedTransfers) external override {
}
function setEmergencyWithdrawAllowed(bool _newEmergencyWithdrawAllowed) external override onlyOwner {
}
function setStakingContractAddress(address _newStakingContractAddress) external override onlyOwner {
}
function setCanPurgeSnapshots(bool _newCanPurgeSnapshots) external override onlyOwner {
}
function setMaxAllowedLeverage(uint8 _newMaxAllowedLeverage) external override onlyOwner {
}
function getToken() external view override returns (IERC20) {
}
function calculatePositionBalance(address _positionAddress) external view override returns (uint256 currentPositionBalance, bool isPositive, uint168 positionUnitsAmount, uint8 leverage, uint256 fundingFees, uint256 marginDebt) {
}
function calculatePositionPendingFees(address _positionAddress, uint168 _positionUnitsAmount) external view override returns (uint256 pendingFees) {
}
function totalBalance() public view override returns (uint256 balance) {
}
function totalBalanceWithAddendum() external view override returns (uint256 balance) {
}
function calculateLatestTurbulenceIndicatorPercent() external view override returns (uint16) {
}
function getLiquidableAddresses(address[] calldata _positionOwners) external view override returns (address[] memory) {
}
function collectTokens(uint256 _tokenAmount) internal virtual {
}
function _deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) internal returns (uint256 lpTokenAmount) {
}
function _withdraw(uint256 _tokenAmount, bool _shouldBurnMax, uint256 _maxLPTokenBurnAmount) internal returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
function _openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) internal returns (uint168 positionUnitsAmount) {
}
struct MergePositionLocals {
uint168 oldPositionUnits;
uint256 newPositionUnits;
uint256 newTotalPositionUnitsAmount;
uint256 newTotalFundingFeesAmount;
}
function _mergePosition(Position storage _position, uint256 _latestSnapshot, uint16 _cviValue, uint256 _leveragedTokenAmount, uint8 _leverage) private returns (uint168 positionUnitsAmount, uint256 marginDebt, uint256 positionBalance) {
}
function transferFunds(uint256 _tokenAmount) internal virtual {
}
function _beforeTokenTransfer(address from, address to, uint256) internal override {
}
function sendProfit(uint256 _amount, IERC20 _token) internal virtual {
}
function getTokenBalance() private view returns (uint256) {
}
function getTokenBalance(uint256 _tokenAmount) internal view virtual returns (uint256) {
}
struct SnapshotUpdate {
uint256 latestSnapshot;
uint256 singleUnitFundingFee;
uint256 totalTime;
uint256 totalRounds;
uint80 newLatestRoundId;
uint16 cviValue;
bool updatedSnapshot;
bool updatedLatestRoundId;
bool updatedLatestTimestamp;
bool updatedTurbulenceData;
}
function updateSnapshots(bool _canPurgeLatestSnapshot) private returns (uint16 latestCVIValue, uint256 latestSnapshot) {
}
function _updateSnapshots(uint256 _latestTimestamp) private view returns (SnapshotUpdate memory snapshotUpdate) {
}
function _totalBalance(uint16 _cviValue) private view returns (uint256 balance) {
}
function collectProfit(uint256 amount) private {
}
function checkAndLiquidatePosition(address _positionAddress, bool _withAddendum) private returns (bool wasLiquidated, uint256 liquidatedAmount, bool isPositive) {
}
function subtractTotalPositionUnits(uint168 _positionUnitsAmountToSubtract, uint256 _fundingFeesToSubtract) private view returns (uint256 newTotalPositionUnitsAmount, uint256 newTotalFundingFeesAMount) {
}
function _calculatePositionBalance(address _positionAddress, bool _withAddendum) private view returns (uint256 currentPositionBalance, bool isPositive, uint256 fundingFees, uint256 marginDebt) {
}
function __calculatePositionBalance(uint256 _positionUnits, uint8 _leverage, uint16 _cviValue, uint16 _openCVIValue, uint256 _fundingFees) private pure returns (uint256 currentPositionBalance, bool isPositive, uint256 marginDebt) {
}
function _calculateFundingFees(uint256 startTimeSnapshot, uint256 endTimeSnapshot, uint256 positionUnitsAmount) private pure returns (uint256) {
}
function calculateLatestFundingFees(uint256 startTime, uint256 positionUnitsAmount) private view returns (uint256) {
}
}
| block.timestamp.sub(position.creationTimestamp)>=buyersLockupPeriod,"Position locked" | 331,223 | block.timestamp.sub(position.creationTimestamp)>=buyersLockupPeriod |
"Funds are locked" | // SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../v1/utils/SafeMath16.sol";
import "./utils/SafeMath168.sol";
import "./interfaces/IPlatformV2.sol";
import "./interfaces/IPositionRewardsV2.sol";
contract PlatformV2 is IPlatformV2, Ownable, ERC20, ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using SafeMath168 for uint168;
uint80 public latestOracleRoundId;
uint32 public latestSnapshotTimestamp;
bool private canPurgeLatestSnapshot = false;
bool public emergencyWithdrawAllowed = false;
bool private purgeSnapshots = true;
uint8 public maxAllowedLeverage = 1;
uint168 public constant MAX_FEE_PERCENTAGE = 10000;
uint256 public constant PRECISION_DECIMALS = 1e10;
uint256 public constant MAX_CVI_VALUE = 20000;
uint256 public immutable initialTokenToLPTokenRate;
IERC20 private token;
ICVIOracleV3 private cviOracle;
ILiquidationV2 private liquidation;
IFeesCalculatorV3 private feesCalculator;
IFeesCollector internal feesCollector;
IPositionRewardsV2 private rewards;
uint256 public lpsLockupPeriod = 3 days;
uint256 public buyersLockupPeriod = 6 hours;
uint256 public totalPositionUnitsAmount;
uint256 public totalFundingFeesAmount;
uint256 public totalLeveragedTokensAmount;
address private stakingContractAddress = address(0);
mapping(uint256 => uint256) public cviSnapshots;
mapping(address => uint256) public lastDepositTimestamp;
mapping(address => Position) public override positions;
mapping(address => bool) public revertLockedTransfered;
constructor(IERC20 _token, string memory _lpTokenName, string memory _lpTokenSymbolName, uint256 _initialTokenToLPTokenRate,
IFeesCalculatorV3 _feesCalculator,
ICVIOracleV3 _cviOracle,
ILiquidationV2 _liquidation) public ERC20(_lpTokenName, _lpTokenSymbolName) {
}
function deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) external virtual override nonReentrant returns (uint256 lpTokenAmount) {
}
function withdraw(uint256 _tokenAmount, uint256 _maxLPTokenBurnAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
function withdrawLPTokens(uint256 _lpTokensAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
struct OpenPositionLocals {
uint256 balance;
uint256 collateralRatio;
uint256 marginDebt;
uint256 positionBalance;
uint256 latestSnapshot;
uint256 openPositionFee;
uint256 minPositionUnitsAmount;
uint168 buyingPremiumFee;
uint168 buyingPremiumFeePercentage;
uint168 tokenAmountToOpenPosition;
uint256 maxPositionUnitsAmount;
uint16 cviValue;
}
function openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) external override virtual nonReentrant returns (uint168 positionUnitsAmount) {
}
function closePosition(uint168 _positionUnitsAmount, uint16 _minCVI) external override nonReentrant returns (uint256 tokenAmount) {
}
function _closePosition(Position storage _position, uint256 _positionUnitsAmount, uint256 _latestSnapshot, uint16 _cviValue) private returns (uint256 positionBalance, uint256 fundingFees, uint256 marginDebt, bool wasLiquidated) {
}
function liquidatePositions(address[] calldata _positionOwners) external override nonReentrant returns (uint256 finderFeeAmount) {
}
function setFeesCollector(IFeesCollector _newCollector) external override onlyOwner {
}
function setFeesCalculator(IFeesCalculatorV3 _newCalculator) external override onlyOwner {
}
function setCVIOracle(ICVIOracleV3 _newOracle) external override onlyOwner {
}
function setRewards(IPositionRewardsV2 _newRewards) external override onlyOwner {
}
function setLiquidation(ILiquidationV2 _newLiquidation) external override onlyOwner {
}
function setLatestOracleRoundId(uint80 _newOracleRoundId) external override onlyOwner {
}
function setLPLockupPeriod(uint256 _newLPLockupPeriod) external override onlyOwner {
}
function setBuyersLockupPeriod(uint256 _newBuyersLockupPeriod) external override onlyOwner {
}
function setRevertLockedTransfers(bool _revertLockedTransfers) external override {
}
function setEmergencyWithdrawAllowed(bool _newEmergencyWithdrawAllowed) external override onlyOwner {
}
function setStakingContractAddress(address _newStakingContractAddress) external override onlyOwner {
}
function setCanPurgeSnapshots(bool _newCanPurgeSnapshots) external override onlyOwner {
}
function setMaxAllowedLeverage(uint8 _newMaxAllowedLeverage) external override onlyOwner {
}
function getToken() external view override returns (IERC20) {
}
function calculatePositionBalance(address _positionAddress) external view override returns (uint256 currentPositionBalance, bool isPositive, uint168 positionUnitsAmount, uint8 leverage, uint256 fundingFees, uint256 marginDebt) {
}
function calculatePositionPendingFees(address _positionAddress, uint168 _positionUnitsAmount) external view override returns (uint256 pendingFees) {
}
function totalBalance() public view override returns (uint256 balance) {
}
function totalBalanceWithAddendum() external view override returns (uint256 balance) {
}
function calculateLatestTurbulenceIndicatorPercent() external view override returns (uint16) {
}
function getLiquidableAddresses(address[] calldata _positionOwners) external view override returns (address[] memory) {
}
function collectTokens(uint256 _tokenAmount) internal virtual {
}
function _deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) internal returns (uint256 lpTokenAmount) {
}
function _withdraw(uint256 _tokenAmount, bool _shouldBurnMax, uint256 _maxLPTokenBurnAmount) internal returns (uint256 burntAmount, uint256 withdrawnAmount) {
require(<FILL_ME>)
(uint16 cviValue,) = updateSnapshots(true);
if (_shouldBurnMax) {
burntAmount = _maxLPTokenBurnAmount;
_tokenAmount = burntAmount.mul(_totalBalance(cviValue)).div(totalSupply());
} else {
require(_tokenAmount > 0, "Tokens amount must be positive");
// Note: rounding up (ceiling) the to-burn amount to prevent precision loss
burntAmount = _tokenAmount.mul(totalSupply()).sub(1).div(_totalBalance(cviValue)).add(1);
require(burntAmount <= _maxLPTokenBurnAmount, "Too much LP tokens to burn");
}
require(burntAmount <= balanceOf(msg.sender), "Not enough LP tokens for account");
require(emergencyWithdrawAllowed || getTokenBalance().sub(totalPositionUnitsAmount) >= _tokenAmount, "Collateral ratio broken");
totalLeveragedTokensAmount = totalLeveragedTokensAmount.sub(_tokenAmount);
uint256 withdrawFee = _tokenAmount.mul(uint256(feesCalculator.withdrawFeePercent())) / MAX_FEE_PERCENTAGE;
withdrawnAmount = _tokenAmount.sub(withdrawFee);
emit Withdraw(msg.sender, _tokenAmount, burntAmount, withdrawFee);
_burn(msg.sender, burntAmount);
collectProfit(withdrawFee);
transferFunds(withdrawnAmount);
}
function _openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) internal returns (uint168 positionUnitsAmount) {
}
struct MergePositionLocals {
uint168 oldPositionUnits;
uint256 newPositionUnits;
uint256 newTotalPositionUnitsAmount;
uint256 newTotalFundingFeesAmount;
}
function _mergePosition(Position storage _position, uint256 _latestSnapshot, uint16 _cviValue, uint256 _leveragedTokenAmount, uint8 _leverage) private returns (uint168 positionUnitsAmount, uint256 marginDebt, uint256 positionBalance) {
}
function transferFunds(uint256 _tokenAmount) internal virtual {
}
function _beforeTokenTransfer(address from, address to, uint256) internal override {
}
function sendProfit(uint256 _amount, IERC20 _token) internal virtual {
}
function getTokenBalance() private view returns (uint256) {
}
function getTokenBalance(uint256 _tokenAmount) internal view virtual returns (uint256) {
}
struct SnapshotUpdate {
uint256 latestSnapshot;
uint256 singleUnitFundingFee;
uint256 totalTime;
uint256 totalRounds;
uint80 newLatestRoundId;
uint16 cviValue;
bool updatedSnapshot;
bool updatedLatestRoundId;
bool updatedLatestTimestamp;
bool updatedTurbulenceData;
}
function updateSnapshots(bool _canPurgeLatestSnapshot) private returns (uint16 latestCVIValue, uint256 latestSnapshot) {
}
function _updateSnapshots(uint256 _latestTimestamp) private view returns (SnapshotUpdate memory snapshotUpdate) {
}
function _totalBalance(uint16 _cviValue) private view returns (uint256 balance) {
}
function collectProfit(uint256 amount) private {
}
function checkAndLiquidatePosition(address _positionAddress, bool _withAddendum) private returns (bool wasLiquidated, uint256 liquidatedAmount, bool isPositive) {
}
function subtractTotalPositionUnits(uint168 _positionUnitsAmountToSubtract, uint256 _fundingFeesToSubtract) private view returns (uint256 newTotalPositionUnitsAmount, uint256 newTotalFundingFeesAMount) {
}
function _calculatePositionBalance(address _positionAddress, bool _withAddendum) private view returns (uint256 currentPositionBalance, bool isPositive, uint256 fundingFees, uint256 marginDebt) {
}
function __calculatePositionBalance(uint256 _positionUnits, uint8 _leverage, uint16 _cviValue, uint16 _openCVIValue, uint256 _fundingFees) private pure returns (uint256 currentPositionBalance, bool isPositive, uint256 marginDebt) {
}
function _calculateFundingFees(uint256 startTimeSnapshot, uint256 endTimeSnapshot, uint256 positionUnitsAmount) private pure returns (uint256) {
}
function calculateLatestFundingFees(uint256 startTime, uint256 positionUnitsAmount) private view returns (uint256) {
}
}
| lastDepositTimestamp[msg.sender].add(lpsLockupPeriod)<=block.timestamp,"Funds are locked" | 331,223 | lastDepositTimestamp[msg.sender].add(lpsLockupPeriod)<=block.timestamp |
"Collateral ratio broken" | // SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../v1/utils/SafeMath16.sol";
import "./utils/SafeMath168.sol";
import "./interfaces/IPlatformV2.sol";
import "./interfaces/IPositionRewardsV2.sol";
contract PlatformV2 is IPlatformV2, Ownable, ERC20, ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using SafeMath168 for uint168;
uint80 public latestOracleRoundId;
uint32 public latestSnapshotTimestamp;
bool private canPurgeLatestSnapshot = false;
bool public emergencyWithdrawAllowed = false;
bool private purgeSnapshots = true;
uint8 public maxAllowedLeverage = 1;
uint168 public constant MAX_FEE_PERCENTAGE = 10000;
uint256 public constant PRECISION_DECIMALS = 1e10;
uint256 public constant MAX_CVI_VALUE = 20000;
uint256 public immutable initialTokenToLPTokenRate;
IERC20 private token;
ICVIOracleV3 private cviOracle;
ILiquidationV2 private liquidation;
IFeesCalculatorV3 private feesCalculator;
IFeesCollector internal feesCollector;
IPositionRewardsV2 private rewards;
uint256 public lpsLockupPeriod = 3 days;
uint256 public buyersLockupPeriod = 6 hours;
uint256 public totalPositionUnitsAmount;
uint256 public totalFundingFeesAmount;
uint256 public totalLeveragedTokensAmount;
address private stakingContractAddress = address(0);
mapping(uint256 => uint256) public cviSnapshots;
mapping(address => uint256) public lastDepositTimestamp;
mapping(address => Position) public override positions;
mapping(address => bool) public revertLockedTransfered;
constructor(IERC20 _token, string memory _lpTokenName, string memory _lpTokenSymbolName, uint256 _initialTokenToLPTokenRate,
IFeesCalculatorV3 _feesCalculator,
ICVIOracleV3 _cviOracle,
ILiquidationV2 _liquidation) public ERC20(_lpTokenName, _lpTokenSymbolName) {
}
function deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) external virtual override nonReentrant returns (uint256 lpTokenAmount) {
}
function withdraw(uint256 _tokenAmount, uint256 _maxLPTokenBurnAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
function withdrawLPTokens(uint256 _lpTokensAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
struct OpenPositionLocals {
uint256 balance;
uint256 collateralRatio;
uint256 marginDebt;
uint256 positionBalance;
uint256 latestSnapshot;
uint256 openPositionFee;
uint256 minPositionUnitsAmount;
uint168 buyingPremiumFee;
uint168 buyingPremiumFeePercentage;
uint168 tokenAmountToOpenPosition;
uint256 maxPositionUnitsAmount;
uint16 cviValue;
}
function openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) external override virtual nonReentrant returns (uint168 positionUnitsAmount) {
}
function closePosition(uint168 _positionUnitsAmount, uint16 _minCVI) external override nonReentrant returns (uint256 tokenAmount) {
}
function _closePosition(Position storage _position, uint256 _positionUnitsAmount, uint256 _latestSnapshot, uint16 _cviValue) private returns (uint256 positionBalance, uint256 fundingFees, uint256 marginDebt, bool wasLiquidated) {
}
function liquidatePositions(address[] calldata _positionOwners) external override nonReentrant returns (uint256 finderFeeAmount) {
}
function setFeesCollector(IFeesCollector _newCollector) external override onlyOwner {
}
function setFeesCalculator(IFeesCalculatorV3 _newCalculator) external override onlyOwner {
}
function setCVIOracle(ICVIOracleV3 _newOracle) external override onlyOwner {
}
function setRewards(IPositionRewardsV2 _newRewards) external override onlyOwner {
}
function setLiquidation(ILiquidationV2 _newLiquidation) external override onlyOwner {
}
function setLatestOracleRoundId(uint80 _newOracleRoundId) external override onlyOwner {
}
function setLPLockupPeriod(uint256 _newLPLockupPeriod) external override onlyOwner {
}
function setBuyersLockupPeriod(uint256 _newBuyersLockupPeriod) external override onlyOwner {
}
function setRevertLockedTransfers(bool _revertLockedTransfers) external override {
}
function setEmergencyWithdrawAllowed(bool _newEmergencyWithdrawAllowed) external override onlyOwner {
}
function setStakingContractAddress(address _newStakingContractAddress) external override onlyOwner {
}
function setCanPurgeSnapshots(bool _newCanPurgeSnapshots) external override onlyOwner {
}
function setMaxAllowedLeverage(uint8 _newMaxAllowedLeverage) external override onlyOwner {
}
function getToken() external view override returns (IERC20) {
}
function calculatePositionBalance(address _positionAddress) external view override returns (uint256 currentPositionBalance, bool isPositive, uint168 positionUnitsAmount, uint8 leverage, uint256 fundingFees, uint256 marginDebt) {
}
function calculatePositionPendingFees(address _positionAddress, uint168 _positionUnitsAmount) external view override returns (uint256 pendingFees) {
}
function totalBalance() public view override returns (uint256 balance) {
}
function totalBalanceWithAddendum() external view override returns (uint256 balance) {
}
function calculateLatestTurbulenceIndicatorPercent() external view override returns (uint16) {
}
function getLiquidableAddresses(address[] calldata _positionOwners) external view override returns (address[] memory) {
}
function collectTokens(uint256 _tokenAmount) internal virtual {
}
function _deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) internal returns (uint256 lpTokenAmount) {
}
function _withdraw(uint256 _tokenAmount, bool _shouldBurnMax, uint256 _maxLPTokenBurnAmount) internal returns (uint256 burntAmount, uint256 withdrawnAmount) {
require(lastDepositTimestamp[msg.sender].add(lpsLockupPeriod) <= block.timestamp, "Funds are locked");
(uint16 cviValue,) = updateSnapshots(true);
if (_shouldBurnMax) {
burntAmount = _maxLPTokenBurnAmount;
_tokenAmount = burntAmount.mul(_totalBalance(cviValue)).div(totalSupply());
} else {
require(_tokenAmount > 0, "Tokens amount must be positive");
// Note: rounding up (ceiling) the to-burn amount to prevent precision loss
burntAmount = _tokenAmount.mul(totalSupply()).sub(1).div(_totalBalance(cviValue)).add(1);
require(burntAmount <= _maxLPTokenBurnAmount, "Too much LP tokens to burn");
}
require(burntAmount <= balanceOf(msg.sender), "Not enough LP tokens for account");
require(<FILL_ME>)
totalLeveragedTokensAmount = totalLeveragedTokensAmount.sub(_tokenAmount);
uint256 withdrawFee = _tokenAmount.mul(uint256(feesCalculator.withdrawFeePercent())) / MAX_FEE_PERCENTAGE;
withdrawnAmount = _tokenAmount.sub(withdrawFee);
emit Withdraw(msg.sender, _tokenAmount, burntAmount, withdrawFee);
_burn(msg.sender, burntAmount);
collectProfit(withdrawFee);
transferFunds(withdrawnAmount);
}
function _openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) internal returns (uint168 positionUnitsAmount) {
}
struct MergePositionLocals {
uint168 oldPositionUnits;
uint256 newPositionUnits;
uint256 newTotalPositionUnitsAmount;
uint256 newTotalFundingFeesAmount;
}
function _mergePosition(Position storage _position, uint256 _latestSnapshot, uint16 _cviValue, uint256 _leveragedTokenAmount, uint8 _leverage) private returns (uint168 positionUnitsAmount, uint256 marginDebt, uint256 positionBalance) {
}
function transferFunds(uint256 _tokenAmount) internal virtual {
}
function _beforeTokenTransfer(address from, address to, uint256) internal override {
}
function sendProfit(uint256 _amount, IERC20 _token) internal virtual {
}
function getTokenBalance() private view returns (uint256) {
}
function getTokenBalance(uint256 _tokenAmount) internal view virtual returns (uint256) {
}
struct SnapshotUpdate {
uint256 latestSnapshot;
uint256 singleUnitFundingFee;
uint256 totalTime;
uint256 totalRounds;
uint80 newLatestRoundId;
uint16 cviValue;
bool updatedSnapshot;
bool updatedLatestRoundId;
bool updatedLatestTimestamp;
bool updatedTurbulenceData;
}
function updateSnapshots(bool _canPurgeLatestSnapshot) private returns (uint16 latestCVIValue, uint256 latestSnapshot) {
}
function _updateSnapshots(uint256 _latestTimestamp) private view returns (SnapshotUpdate memory snapshotUpdate) {
}
function _totalBalance(uint16 _cviValue) private view returns (uint256 balance) {
}
function collectProfit(uint256 amount) private {
}
function checkAndLiquidatePosition(address _positionAddress, bool _withAddendum) private returns (bool wasLiquidated, uint256 liquidatedAmount, bool isPositive) {
}
function subtractTotalPositionUnits(uint168 _positionUnitsAmountToSubtract, uint256 _fundingFeesToSubtract) private view returns (uint256 newTotalPositionUnitsAmount, uint256 newTotalFundingFeesAMount) {
}
function _calculatePositionBalance(address _positionAddress, bool _withAddendum) private view returns (uint256 currentPositionBalance, bool isPositive, uint256 fundingFees, uint256 marginDebt) {
}
function __calculatePositionBalance(uint256 _positionUnits, uint8 _leverage, uint16 _cviValue, uint16 _openCVIValue, uint256 _fundingFees) private pure returns (uint256 currentPositionBalance, bool isPositive, uint256 marginDebt) {
}
function _calculateFundingFees(uint256 startTimeSnapshot, uint256 endTimeSnapshot, uint256 positionUnitsAmount) private pure returns (uint256) {
}
function calculateLatestFundingFees(uint256 startTime, uint256 positionUnitsAmount) private view returns (uint256) {
}
}
| emergencyWithdrawAllowed||getTokenBalance().sub(totalPositionUnitsAmount)>=_tokenAmount,"Collateral ratio broken" | 331,223 | emergencyWithdrawAllowed||getTokenBalance().sub(totalPositionUnitsAmount)>=_tokenAmount |
"Recipient refuses locked tokens" | // SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../v1/utils/SafeMath16.sol";
import "./utils/SafeMath168.sol";
import "./interfaces/IPlatformV2.sol";
import "./interfaces/IPositionRewardsV2.sol";
contract PlatformV2 is IPlatformV2, Ownable, ERC20, ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using SafeMath168 for uint168;
uint80 public latestOracleRoundId;
uint32 public latestSnapshotTimestamp;
bool private canPurgeLatestSnapshot = false;
bool public emergencyWithdrawAllowed = false;
bool private purgeSnapshots = true;
uint8 public maxAllowedLeverage = 1;
uint168 public constant MAX_FEE_PERCENTAGE = 10000;
uint256 public constant PRECISION_DECIMALS = 1e10;
uint256 public constant MAX_CVI_VALUE = 20000;
uint256 public immutable initialTokenToLPTokenRate;
IERC20 private token;
ICVIOracleV3 private cviOracle;
ILiquidationV2 private liquidation;
IFeesCalculatorV3 private feesCalculator;
IFeesCollector internal feesCollector;
IPositionRewardsV2 private rewards;
uint256 public lpsLockupPeriod = 3 days;
uint256 public buyersLockupPeriod = 6 hours;
uint256 public totalPositionUnitsAmount;
uint256 public totalFundingFeesAmount;
uint256 public totalLeveragedTokensAmount;
address private stakingContractAddress = address(0);
mapping(uint256 => uint256) public cviSnapshots;
mapping(address => uint256) public lastDepositTimestamp;
mapping(address => Position) public override positions;
mapping(address => bool) public revertLockedTransfered;
constructor(IERC20 _token, string memory _lpTokenName, string memory _lpTokenSymbolName, uint256 _initialTokenToLPTokenRate,
IFeesCalculatorV3 _feesCalculator,
ICVIOracleV3 _cviOracle,
ILiquidationV2 _liquidation) public ERC20(_lpTokenName, _lpTokenSymbolName) {
}
function deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) external virtual override nonReentrant returns (uint256 lpTokenAmount) {
}
function withdraw(uint256 _tokenAmount, uint256 _maxLPTokenBurnAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
function withdrawLPTokens(uint256 _lpTokensAmount) external override nonReentrant returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
struct OpenPositionLocals {
uint256 balance;
uint256 collateralRatio;
uint256 marginDebt;
uint256 positionBalance;
uint256 latestSnapshot;
uint256 openPositionFee;
uint256 minPositionUnitsAmount;
uint168 buyingPremiumFee;
uint168 buyingPremiumFeePercentage;
uint168 tokenAmountToOpenPosition;
uint256 maxPositionUnitsAmount;
uint16 cviValue;
}
function openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) external override virtual nonReentrant returns (uint168 positionUnitsAmount) {
}
function closePosition(uint168 _positionUnitsAmount, uint16 _minCVI) external override nonReentrant returns (uint256 tokenAmount) {
}
function _closePosition(Position storage _position, uint256 _positionUnitsAmount, uint256 _latestSnapshot, uint16 _cviValue) private returns (uint256 positionBalance, uint256 fundingFees, uint256 marginDebt, bool wasLiquidated) {
}
function liquidatePositions(address[] calldata _positionOwners) external override nonReentrant returns (uint256 finderFeeAmount) {
}
function setFeesCollector(IFeesCollector _newCollector) external override onlyOwner {
}
function setFeesCalculator(IFeesCalculatorV3 _newCalculator) external override onlyOwner {
}
function setCVIOracle(ICVIOracleV3 _newOracle) external override onlyOwner {
}
function setRewards(IPositionRewardsV2 _newRewards) external override onlyOwner {
}
function setLiquidation(ILiquidationV2 _newLiquidation) external override onlyOwner {
}
function setLatestOracleRoundId(uint80 _newOracleRoundId) external override onlyOwner {
}
function setLPLockupPeriod(uint256 _newLPLockupPeriod) external override onlyOwner {
}
function setBuyersLockupPeriod(uint256 _newBuyersLockupPeriod) external override onlyOwner {
}
function setRevertLockedTransfers(bool _revertLockedTransfers) external override {
}
function setEmergencyWithdrawAllowed(bool _newEmergencyWithdrawAllowed) external override onlyOwner {
}
function setStakingContractAddress(address _newStakingContractAddress) external override onlyOwner {
}
function setCanPurgeSnapshots(bool _newCanPurgeSnapshots) external override onlyOwner {
}
function setMaxAllowedLeverage(uint8 _newMaxAllowedLeverage) external override onlyOwner {
}
function getToken() external view override returns (IERC20) {
}
function calculatePositionBalance(address _positionAddress) external view override returns (uint256 currentPositionBalance, bool isPositive, uint168 positionUnitsAmount, uint8 leverage, uint256 fundingFees, uint256 marginDebt) {
}
function calculatePositionPendingFees(address _positionAddress, uint168 _positionUnitsAmount) external view override returns (uint256 pendingFees) {
}
function totalBalance() public view override returns (uint256 balance) {
}
function totalBalanceWithAddendum() external view override returns (uint256 balance) {
}
function calculateLatestTurbulenceIndicatorPercent() external view override returns (uint16) {
}
function getLiquidableAddresses(address[] calldata _positionOwners) external view override returns (address[] memory) {
}
function collectTokens(uint256 _tokenAmount) internal virtual {
}
function _deposit(uint256 _tokenAmount, uint256 _minLPTokenAmount) internal returns (uint256 lpTokenAmount) {
}
function _withdraw(uint256 _tokenAmount, bool _shouldBurnMax, uint256 _maxLPTokenBurnAmount) internal returns (uint256 burntAmount, uint256 withdrawnAmount) {
}
function _openPosition(uint168 _tokenAmount, uint16 _maxCVI, uint168 _maxBuyingPremiumFeePercentage, uint8 _leverage) internal returns (uint168 positionUnitsAmount) {
}
struct MergePositionLocals {
uint168 oldPositionUnits;
uint256 newPositionUnits;
uint256 newTotalPositionUnitsAmount;
uint256 newTotalFundingFeesAmount;
}
function _mergePosition(Position storage _position, uint256 _latestSnapshot, uint16 _cviValue, uint256 _leveragedTokenAmount, uint8 _leverage) private returns (uint168 positionUnitsAmount, uint256 marginDebt, uint256 positionBalance) {
}
function transferFunds(uint256 _tokenAmount) internal virtual {
}
function _beforeTokenTransfer(address from, address to, uint256) internal override {
if (lastDepositTimestamp[from].add(lpsLockupPeriod) > block.timestamp &&
lastDepositTimestamp[from] > lastDepositTimestamp[to] &&
from != stakingContractAddress && to != stakingContractAddress) {
require(<FILL_ME>)
lastDepositTimestamp[to] = lastDepositTimestamp[from];
}
}
function sendProfit(uint256 _amount, IERC20 _token) internal virtual {
}
function getTokenBalance() private view returns (uint256) {
}
function getTokenBalance(uint256 _tokenAmount) internal view virtual returns (uint256) {
}
struct SnapshotUpdate {
uint256 latestSnapshot;
uint256 singleUnitFundingFee;
uint256 totalTime;
uint256 totalRounds;
uint80 newLatestRoundId;
uint16 cviValue;
bool updatedSnapshot;
bool updatedLatestRoundId;
bool updatedLatestTimestamp;
bool updatedTurbulenceData;
}
function updateSnapshots(bool _canPurgeLatestSnapshot) private returns (uint16 latestCVIValue, uint256 latestSnapshot) {
}
function _updateSnapshots(uint256 _latestTimestamp) private view returns (SnapshotUpdate memory snapshotUpdate) {
}
function _totalBalance(uint16 _cviValue) private view returns (uint256 balance) {
}
function collectProfit(uint256 amount) private {
}
function checkAndLiquidatePosition(address _positionAddress, bool _withAddendum) private returns (bool wasLiquidated, uint256 liquidatedAmount, bool isPositive) {
}
function subtractTotalPositionUnits(uint168 _positionUnitsAmountToSubtract, uint256 _fundingFeesToSubtract) private view returns (uint256 newTotalPositionUnitsAmount, uint256 newTotalFundingFeesAMount) {
}
function _calculatePositionBalance(address _positionAddress, bool _withAddendum) private view returns (uint256 currentPositionBalance, bool isPositive, uint256 fundingFees, uint256 marginDebt) {
}
function __calculatePositionBalance(uint256 _positionUnits, uint8 _leverage, uint16 _cviValue, uint16 _openCVIValue, uint256 _fundingFees) private pure returns (uint256 currentPositionBalance, bool isPositive, uint256 marginDebt) {
}
function _calculateFundingFees(uint256 startTimeSnapshot, uint256 endTimeSnapshot, uint256 positionUnitsAmount) private pure returns (uint256) {
}
function calculateLatestFundingFees(uint256 startTime, uint256 positionUnitsAmount) private view returns (uint256) {
}
}
| !revertLockedTransfered[to],"Recipient refuses locked tokens" | 331,223 | !revertLockedTransfered[to] |
"Decimals must be 18" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./interfaces/IGovernanceToken.sol";
import "../lib/openzeppelin-contracts/contracts/access/Ownable.sol";
/**
* @title Delegator Contract
* @author Cryptex.Finance
* @notice Contract in charge of handling delegations.
*/
contract Delegator is Ownable {
/* ========== STATE VARIABLES ========== */
/// @notice Address of the staking governance token
address public immutable token;
/// @notice Tracks the amount of staked tokens per user
mapping(address => uint256) public stakerBalance;
/* ========== CONSTRUCTOR ========== */
/**
* @notice Constructor
* @param delegatee_ address
* @param token_ address
* @dev when created delegates all it's power to delegatee_ and can't be changed later
* @dev sets delegator factory as owner
*/
constructor(address delegatee_, address token_) {
require(
delegatee_ != address(0) && token_ != address(0),
"Address can't be 0"
);
require(<FILL_ME>)
token = token_;
IGovernanceToken(token_).delegate(delegatee_);
}
/* ========== MUTATIVE FUNCTIONS ========== */
/**
* @notice Increases the balance of the staker
* @param staker_ caller of the stake function
* @param amount_ uint to be staked and delegated
* @dev Only delegatorFactory can call it
* @dev after the balance is updated the amount is transferred from the user to this contract
*/
function stake(address staker_, uint256 amount_) external onlyOwner {
}
/**
* @notice Decreases the balance of the staker
* @param staker_ caller of the stake function
* @param amount_ uint to be withdrawn and undelegated
* @dev Only delegatorFactory can call it
* @dev after the balance is updated the amount is transferred back to the user from this contract
*/
function removeStake(address staker_, uint256 amount_) external onlyOwner {
}
/* ========== VIEWS ========== */
/// @notice returns the delegatee of this contract
function delegatee() external returns (address) {
}
}
| IGovernanceToken(token_).decimals()==18,"Decimals must be 18" | 331,243 | IGovernanceToken(token_).decimals()==18 |
"Transfer failed" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./interfaces/IGovernanceToken.sol";
import "../lib/openzeppelin-contracts/contracts/access/Ownable.sol";
/**
* @title Delegator Contract
* @author Cryptex.Finance
* @notice Contract in charge of handling delegations.
*/
contract Delegator is Ownable {
/* ========== STATE VARIABLES ========== */
/// @notice Address of the staking governance token
address public immutable token;
/// @notice Tracks the amount of staked tokens per user
mapping(address => uint256) public stakerBalance;
/* ========== CONSTRUCTOR ========== */
/**
* @notice Constructor
* @param delegatee_ address
* @param token_ address
* @dev when created delegates all it's power to delegatee_ and can't be changed later
* @dev sets delegator factory as owner
*/
constructor(address delegatee_, address token_) {
}
/* ========== MUTATIVE FUNCTIONS ========== */
/**
* @notice Increases the balance of the staker
* @param staker_ caller of the stake function
* @param amount_ uint to be staked and delegated
* @dev Only delegatorFactory can call it
* @dev after the balance is updated the amount is transferred from the user to this contract
*/
function stake(address staker_, uint256 amount_) external onlyOwner {
}
/**
* @notice Decreases the balance of the staker
* @param staker_ caller of the stake function
* @param amount_ uint to be withdrawn and undelegated
* @dev Only delegatorFactory can call it
* @dev after the balance is updated the amount is transferred back to the user from this contract
*/
function removeStake(address staker_, uint256 amount_) external onlyOwner {
stakerBalance[staker_] -= amount_;
require(<FILL_ME>)
}
/* ========== VIEWS ========== */
/// @notice returns the delegatee of this contract
function delegatee() external returns (address) {
}
}
| IGovernanceToken(token).transfer(staker_,amount_),"Transfer failed" | 331,243 | IGovernanceToken(token).transfer(staker_,amount_) |
null | 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 indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
contract distribution is Ownable {
using SafeMath for uint256;
event OnDepositeReceived(address investorAddress, uint value);
event OnPaymentSent(address investorAddress, uint value);
uint public minDeposite = 10000000000000000; // 0.01 eth
uint public maxDeposite = 10000000000000000000000; // 10000 eth
uint public currentPaymentIndex = 0;
uint public amountForDistribution = 0;
uint public amountRaised;
uint public depositorsCount;
uint public percent = 110;
address distributorWallet; // wallet for initialize distribution
address promoWallet;
address wallet1;
address wallet2;
address wallet3;
struct Deposite {
address depositor;
uint amount;
uint depositeTime;
uint paimentTime;
}
// list of all deposites
Deposite[] public deposites;
// list of deposites for 1 user
mapping ( address => uint[]) public depositors;
modifier onlyDistributor () {
}
function setDistributorAddress(address newDistributorAddress) public onlyOwner {
}
function setNewMinDeposite(uint newMinDeposite) public onlyOwner {
}
function setNewMaxDeposite(uint newMaxDeposite) public onlyOwner {
}
function setNewWallets(address newWallet1, address newWallet2, address newWallet3) public onlyOwner {
}
function setPromoWallet(address newPromoWallet) public onlyOwner {
}
constructor () public {
}
function () public payable {
require(<FILL_ME>)
Deposite memory newDeposite = Deposite(msg.sender, msg.value, now, 0);
deposites.push(newDeposite);
if (depositors[msg.sender].length == 0) depositorsCount+=1;
depositors[msg.sender].push(deposites.length - 1);
amountForDistribution = amountForDistribution.add(msg.value);
amountRaised = amountRaised.add(msg.value);
emit OnDepositeReceived(msg.sender,msg.value);
}
function distribute (uint numIterations) public onlyDistributor {
}
// get all depositors count
function getAllDepositorsCount() public view returns(uint) {
}
function getAllDepositesCount() public view returns (uint) {
}
function getLastDepositId() public view returns (uint) {
}
function getDeposit(uint _id) public view returns (address, uint, uint, uint){
}
// get count of deposites for 1 user
function getDepositesCount(address depositor) public view returns (uint) {
}
// how much raised
function getAmountRaised() public view returns (uint) {
}
// lastIndex from the end of payments lest (0 - last payment), returns: address of depositor, payment time, payment amount
function getLastPayments(uint lastIndex) public view returns (address, uint, uint) {
}
function getUserDeposit(address depositor, uint depositeNumber) public view returns(uint, uint, uint) {
}
function getDepositeTime(address depositor, uint depositeNumber) public view returns(uint) {
}
function getPaimentTime(address depositor, uint depositeNumber) public view returns(uint) {
}
function getPaimentStatus(address depositor, uint depositeNumber) public view returns(bool) {
}
}
| (msg.value>=minDeposite)&&(msg.value<=maxDeposite) | 331,256 | (msg.value>=minDeposite)&&(msg.value<=maxDeposite) |
"EW10: ETH sender isn't Etheria contract" | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
// Only accept from Etheria contract
require(<FILL_ME>)
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _msgSender()==_etheriaAddress,"EW10: ETH sender isn't Etheria contract" | 331,307 | _msgSender()==_etheriaAddress |
"EW10: You must be the tile owner to start the wrapping process." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
uint256 _locationID = _getIndex(col, row);
require(<FILL_ME>)
require(_etheria.getOffers(col,row).length == 0, "EW10: The offer/ers arrays for this tile must be empty. Reject all offers.");
require(msg.value == 10000000000000000, "EW10: You must supply exactly 0.01 ETH to this function.");
_etheria.makeOffer{value: msg.value}(col,row);
// these two are redundant, but w/e
require(_etheria.getOfferers(col,row)[0] == address(this), "EW10: The offerer in position 0 should be this wrapper address.");
require(_etheria.getOffers(col,row)[0] == 10000000000000000, "EW10: The offer in position 0 should be 0.01 ETH.");
wrapInitializers[_locationID] = msg.sender; // doesn't matter if a value already exists in this array
emit WrapStarted(msg.sender, _locationID);
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _etheria.getOwner(col,row)==msg.sender,"EW10: You must be the tile owner to start the wrapping process." | 331,307 | _etheria.getOwner(col,row)==msg.sender |
"EW10: The offer/ers arrays for this tile must be empty. Reject all offers." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
uint256 _locationID = _getIndex(col, row);
require(_etheria.getOwner(col,row) == msg.sender, "EW10: You must be the tile owner to start the wrapping process.");
require(<FILL_ME>)
require(msg.value == 10000000000000000, "EW10: You must supply exactly 0.01 ETH to this function.");
_etheria.makeOffer{value: msg.value}(col,row);
// these two are redundant, but w/e
require(_etheria.getOfferers(col,row)[0] == address(this), "EW10: The offerer in position 0 should be this wrapper address.");
require(_etheria.getOffers(col,row)[0] == 10000000000000000, "EW10: The offer in position 0 should be 0.01 ETH.");
wrapInitializers[_locationID] = msg.sender; // doesn't matter if a value already exists in this array
emit WrapStarted(msg.sender, _locationID);
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _etheria.getOffers(col,row).length==0,"EW10: The offer/ers arrays for this tile must be empty. Reject all offers." | 331,307 | _etheria.getOffers(col,row).length==0 |
"EW10: The offerer in position 0 should be this wrapper address." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
uint256 _locationID = _getIndex(col, row);
require(_etheria.getOwner(col,row) == msg.sender, "EW10: You must be the tile owner to start the wrapping process.");
require(_etheria.getOffers(col,row).length == 0, "EW10: The offer/ers arrays for this tile must be empty. Reject all offers.");
require(msg.value == 10000000000000000, "EW10: You must supply exactly 0.01 ETH to this function.");
_etheria.makeOffer{value: msg.value}(col,row);
// these two are redundant, but w/e
require(<FILL_ME>)
require(_etheria.getOffers(col,row)[0] == 10000000000000000, "EW10: The offer in position 0 should be 0.01 ETH.");
wrapInitializers[_locationID] = msg.sender; // doesn't matter if a value already exists in this array
emit WrapStarted(msg.sender, _locationID);
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _etheria.getOfferers(col,row)[0]==address(this),"EW10: The offerer in position 0 should be this wrapper address." | 331,307 | _etheria.getOfferers(col,row)[0]==address(this) |
"EW10: The offer in position 0 should be 0.01 ETH." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
uint256 _locationID = _getIndex(col, row);
require(_etheria.getOwner(col,row) == msg.sender, "EW10: You must be the tile owner to start the wrapping process.");
require(_etheria.getOffers(col,row).length == 0, "EW10: The offer/ers arrays for this tile must be empty. Reject all offers.");
require(msg.value == 10000000000000000, "EW10: You must supply exactly 0.01 ETH to this function.");
_etheria.makeOffer{value: msg.value}(col,row);
// these two are redundant, but w/e
require(_etheria.getOfferers(col,row)[0] == address(this), "EW10: The offerer in position 0 should be this wrapper address.");
require(<FILL_ME>)
wrapInitializers[_locationID] = msg.sender; // doesn't matter if a value already exists in this array
emit WrapStarted(msg.sender, _locationID);
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _etheria.getOffers(col,row)[0]==10000000000000000,"EW10: The offer in position 0 should be 0.01 ETH." | 331,307 | _etheria.getOffers(col,row)[0]==10000000000000000 |
"EW10: You are not the wrapInitializer for this tile. Call makeOfferViaWrapper first." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
uint256 _locationID = _getIndex(col, row);
require(<FILL_ME>)
require(_etheria.getOwner(col,row) == address(this), "EW10: Tile is not yet owned by this wrapper. Call etheria.acceptOffer to give the wrapper ownership, then finishWrap to complete.");
_mint(msg.sender, _locationID); // automatically checks to see if token doesn't yet exist
require(_exists(_locationID), "EW10: 721 was not created as it should have been. Reverting.");
delete wrapInitializers[_locationID]; // done minting, remove from wrapInitializers array
require(wrapInitializers[_locationID] == address(0), "EW10: wrapInitializer was not reset to 0. Reverting.");
emit WrapFinished(msg.sender, _locationID);
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| wrapInitializers[_locationID]==msg.sender,"EW10: You are not the wrapInitializer for this tile. Call makeOfferViaWrapper first." | 331,307 | wrapInitializers[_locationID]==msg.sender |
"EW10: Tile is not yet owned by this wrapper. Call etheria.acceptOffer to give the wrapper ownership, then finishWrap to complete." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
uint256 _locationID = _getIndex(col, row);
require(wrapInitializers[_locationID] == msg.sender, "EW10: You are not the wrapInitializer for this tile. Call makeOfferViaWrapper first.");
require(<FILL_ME>)
_mint(msg.sender, _locationID); // automatically checks to see if token doesn't yet exist
require(_exists(_locationID), "EW10: 721 was not created as it should have been. Reverting.");
delete wrapInitializers[_locationID]; // done minting, remove from wrapInitializers array
require(wrapInitializers[_locationID] == address(0), "EW10: wrapInitializer was not reset to 0. Reverting.");
emit WrapFinished(msg.sender, _locationID);
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _etheria.getOwner(col,row)==address(this),"EW10: Tile is not yet owned by this wrapper. Call etheria.acceptOffer to give the wrapper ownership, then finishWrap to complete." | 331,307 | _etheria.getOwner(col,row)==address(this) |
"EW10: 721 was not created as it should have been. Reverting." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
uint256 _locationID = _getIndex(col, row);
require(wrapInitializers[_locationID] == msg.sender, "EW10: You are not the wrapInitializer for this tile. Call makeOfferViaWrapper first.");
require(_etheria.getOwner(col,row) == address(this), "EW10: Tile is not yet owned by this wrapper. Call etheria.acceptOffer to give the wrapper ownership, then finishWrap to complete.");
_mint(msg.sender, _locationID); // automatically checks to see if token doesn't yet exist
require(<FILL_ME>)
delete wrapInitializers[_locationID]; // done minting, remove from wrapInitializers array
require(wrapInitializers[_locationID] == address(0), "EW10: wrapInitializer was not reset to 0. Reverting.");
emit WrapFinished(msg.sender, _locationID);
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _exists(_locationID),"EW10: 721 was not created as it should have been. Reverting." | 331,307 | _exists(_locationID) |
"EW10: wrapInitializer was not reset to 0. Reverting." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
uint256 _locationID = _getIndex(col, row);
require(wrapInitializers[_locationID] == msg.sender, "EW10: You are not the wrapInitializer for this tile. Call makeOfferViaWrapper first.");
require(_etheria.getOwner(col,row) == address(this), "EW10: Tile is not yet owned by this wrapper. Call etheria.acceptOffer to give the wrapper ownership, then finishWrap to complete.");
_mint(msg.sender, _locationID); // automatically checks to see if token doesn't yet exist
require(_exists(_locationID), "EW10: 721 was not created as it should have been. Reverting.");
delete wrapInitializers[_locationID]; // done minting, remove from wrapInitializers array
require(<FILL_ME>)
emit WrapFinished(msg.sender, _locationID);
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| wrapInitializers[_locationID]==address(0),"EW10: wrapInitializer was not reset to 0. Reverting." | 331,307 | wrapInitializers[_locationID]==address(0) |
"EW10: Offers array must be 1 less than before. It is not. Reverting." | // Solidity 0.8.7-e28d00a7 optimization 200 (default)
pragma solidity ^0.8.6;
interface Etheria {
function getOwner(uint8 col, uint8 row) external view returns(address);
function getOfferers(uint8 col, uint8 row) external view returns (address[] memory);
function getOffers(uint8 col, uint8 row) external view returns (uint[] memory);
function setName(uint8 col, uint8 row, string memory _n) external;
function setStatus(uint8 col, uint8 row, string memory _s) external payable;
function makeOffer(uint8 col, uint8 row) external payable;
function acceptOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
function deleteOffer(uint8 col, uint8 row, uint8 index, uint amt) external;
}
contract EtheriaWrapper1pt0 is Ownable, ERC721 {
address public _etheriaAddress;
Etheria public _etheria;
mapping (uint256 => address) public wrapInitializers;
constructor() payable ERC721("Etheria Wrapper v1pt0 2015-10-22", "EW10") {
}
receive() external payable
{
}
event WrapStarted(address indexed addr, uint256 indexed _locationID);
event WrapFinished(address indexed addr, uint256 indexed _locationID);
event Unwrapped(address indexed addr, uint256 indexed _locationID);
event NameSet(address indexed addr, uint256 indexed _locationID, string name);
event StatusSet(address indexed addr, uint256 indexed _locationID, string status);
event OfferRejected(address indexed addr, uint256 indexed _locationID, uint offer, address offerer);
event OfferRetracted(address indexed addr, uint256 indexed _locationID); // offerer is always address(this) and amount always 0.01 ETH
function _getIndex(uint8 col, uint8 row) internal pure returns (uint256) {
}
// ***** Why are v0.9 and v1.0 wrappable while v1.1 and v1.2 are not? (as of March 2022) *****
//
// Etheria was developed long before any NFT exchanges existed. As such, in versions v0.9 and
// v1.0, I added internal exchange logic (hereinafter the "offer system") to facilitate trading before abandoning
// it in favor of a simple "setOwner" function in v1.1 and v1.2.
//
// While this "offer system" was really poorly designed and clunky (the result of a manic episode of moving fast
// and "testing in production"), it does actually work and work reliably if the proper precautions are taken.
//
// What's more, this "offer system" used msg.sender (v0.9 and v1.0) instead of tx.origin (v1.1 and v1.2) which
// which means v0.9 and v1.0 tiles are ownable by smart contracts... i.e. they are WRAPPABLE
//
// Wrappability means that this terrible "offer system" will be entirely bypassed after wrapping is complete
// because it's the WRAPPER that is traded, not the base token. The base token is owned by the wrapper smart contract
// until unwrap time when the base token is transferred to the new owner.
// ***** How the "offer system" works in v0.9 and v1.0 ***** (don't use this except to wrap/unwrap)
//
// Each v0.9 and v1.0 tile has two arrays: offers[] and offerers[] which can be up to 10 items long.
// When a new offer comes in, the ETH is stored in the contract and the offers[] and offerers[] arrays are expanded
// by 1 item to store the bid.
//
// The tile owner can then rejectOffer(col, row, offerIndex) or acceptOffer(col, row, offerIndex) to transfer
// the tile to the successful bidder.
// ***** How to wrap *****
//
// 0. Start with the tile owned by your normal Ethereum account (not a smart contract) and make sure there are no
// unwanted offers in the offer system. Call rejectOffer(col, row) until the arrays are completely empty.
// 1. Call the wrapper contract's "makeOfferViaWrapper(col,row)" along with 0.01 ETH to force the wrapper to make
// an offer on the base token. Only the tile owner can do this. The wrapper will save the owner's address.
// 1b. Check the base token's offerer and offerers arrays. They should be 1 item long each, containing 0.01 and the
// address of the *wrapper*. Also check wrapInitializer with getWrapInitializer(col,row)
// 2. Now call acceptOffer(col,row) for your tile on the base contract. Ownership is transferred to the wrapper
// which already has a record of your ownership.
// 3. Call finishWrap() from previous owner to complete the process.
// ***** How to unwrap ***** (Note: you probably shouldn't)
//
// 0. Start with the tile owned by the wrapper. Call rejectOfferViaWrapper(col, row) to clear out offer arrays.
// 1. Call makeOffer(col,row) with 0.01 ETH from the destination account. Check the base token's offerer and offerers arrays.
// They should be 1 item long each, containing 0.01 and the address of the destination account.
// 2. Now call acceptOfferViaWrapper(col,row) for your tile to unwrap the tile to the desired destination.
// -----------------------------------------------------------------------------------------------------------------
// External convenience function to let the user check who, if anyone, is the wrapInitializer for this col,row
//
function getWrapInitializer(uint8 col, uint8 row) external view returns (address) {
}
// WRAP STEP(S) 0:
// Reject all standing offers on the base tile you directly own.
// WRAP STEP 1:
// Start the wrapping process by placing an offer on the target tile from the wrapper contract
// Pre-requisites:
// msg.sender must own the base tile (automatically excludes water, guarantees 721 does not exist)
// offer/ers arrays must be empty (all standing offers rejected)
// incoming value must be exactly 0.01 ETH
//
function makeOfferViaWrapper(uint8 col, uint8 row) external payable {
}
// post state:
// Wrapper has placed a 0.01 ETH offer in position 0 of the specified tile that msg.sender owns,
// Wrapper has recorded msg.sender as the wrapInitializer for the specified tile
// WrapStarted event fired
// WRAP STEP 2:
// Call etheria.acceptOffer on the offer this wrapper made on the base tile to give the wrapper ownership (in position 0 only!)
// post state:
// Wrapper now owns the tile, the previous owner (paid 0.01 ETH) is still recorded as the wrapInitializer for it. 721 not yet issued.
// 0.009 and 0.001 ETH have been sent to the base tile owner and Etheria contract creator, respectively, after the "sale"
// base tile offer/ers arrays cleared out and refunded, if necessary
// Note: There is no event for the offer acceptance on the base tile
// Note: You *must* complete the wrapping process in step 3, even if you have changed your mind or want to unwrap.
// The wrapper now technically owns the tile and you can't do anything with it until you finishWrap() first.
// WRAP STEP 3:
// Finishes the wrapping process by minting the 721 token
// Pre-requisites:
// caller must be the wrapInitializer for this tile
// tile must be owned by the wrapper
//
function finishWrap(uint8 col, uint8 row) external {
}
//post state:
// 721 token created and owned by caller
// wrapInitializer for this tile reset to 0
// WrapFinished event fired
// UNWRAP STEP(S) 0 (if necessary):
// rejectOfferViaWrapper enables the 721-ownerOf (you) to clear out standing offers on the base tile via the wrapper
// (since the wrapper technically owns the base tile). W/o this, the tile's 10 offer slots could be DoS-ed with bogus offers
// Note: This always rejects the 0 index offer to enforce the condition that our legit unwrapping offer sit
// in position 0, the only position where we can guarantee no frontrunning/switcharoo issues
// Pre-requisites:
// The 721 exists for the col,row
// There is 1+ offer(s) on the base tile
// You own the 721
// The wrapper owns the base tile
//
function rejectOfferViaWrapper(uint8 col, uint8 row) external {
uint256 _locationID = _getIndex(col, row);
require(_exists(_locationID), "EW10: That 721 does not exist.");
uint8 offersLength = uint8(_etheria.getOffers(col,row).length); // can't be more than 10
require(offersLength > 0, "EW10: The offer/ers arrays for this tile must not be empty.");
address owner = ERC721.ownerOf(_locationID);
require(owner == msg.sender, "EW10: You must be the 721-ownerOf the tile.");
require(_etheria.getOwner(col,row) == address(this), "EW10: The wrapper must be the owner of the base tile.");
address offerer = _etheria.getOfferers(col,row)[0]; // record offerer and offer for event below
uint offer = _etheria.getOffers(col,row)[0];
_etheria.deleteOffer(col,row,0,offer); // always rejecting offer at index 0, we don't care about the others
require(<FILL_ME>)
emit OfferRejected(msg.sender, _locationID, offer, offerer); // 721 owner rejected an offer on tile x of amount offer by offerer
}
//post state:
// One less offer in the base tile's offers array
// OfferRejected event fired
// UNWRAP STEP 1:
// call etheria.makeOffer with 0.01 ETH from the same account that owns the 721
// then make sure it's the offer sitting in position 0. If it isn't, rejectOfferViaWrapper until it is.
// UNWRAP STEP 2:
// Accepts the offer in position 0, the only position we can guarantee won't be switcharooed
// Pre-requisites:
// 721 must exist
// You must own the 721
// offer on base tile in position 0 must be 0.01 ETH from the 721-owner
//
function acceptOfferViaWrapper(uint8 col, uint8 row) external {
}
// post state:
// 721 burned, base tile now owned by msg.sender
// 0.001 sent to Etheria contract creator, 0.009 sent to this wrapper for the "sale"
// Note: This 0.009 ETH is not withdrawable to you due to complexity and gas. Consider it an unwrap fee. :)
// Base tile offer/ers arrays cleared out and refunded, if necessary
// NOTE: retractOfferViaWrapper is absent due to being unnecessary and overly complex. The tile owner can
// always remove any unwanted offers, including any made from this wrapper.
function setNameViaWrapper(uint8 col, uint8 row, string memory _n) external {
}
function setStatusViaWrapper(uint8 col, uint8 row, string memory _n) external payable {
}
// In the extremely unlikely event somebody is being stupid and filling all the slots on the tiles AND maliciously
// keeping a bot running to continually insert more bogus 0.01 ETH bids into the slots even as the tile owner
// rejects them (i.e. a DoS attack meant to prevent un/wrapping), the tile owner can still get their wrapper bid onto
// the tile via flashbots or similar (avoiding the mempool): Simply etheria.rejectOffer and wrapper.makeOfferViaWrapper
// in back-to-back transactions, then reject offers until the wrapper offer is in slot 0, ready to wrap. (It doesn't
// matter if the bot creates 9 more in the remaining slots.) Hence, there is nothing an attacker can do to DoS a tile.
/**
* @dev sets base token URI and the token extension...
*/
string public _baseTokenURI;
string public _baseTokenExtension;
function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
}
function setTokenExtension(string memory __baseTokenExtension) public onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function empty() external onlyOwner
{
}
}
| _etheria.getOffers(col,row).length==(offersLength-1),"EW10: Offers array must be 1 less than before. It is not. Reverting." | 331,307 | _etheria.getOffers(col,row).length==(offersLength-1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.