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; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; 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); } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint _addedValue ) public returns (bool) { } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { } } /** * admin manager */ contract AdminManager { event ChangeOwner(address _oldOwner, address _newOwner); event SetAdmin(address _address, bool _isAdmin); //constract's owner address public owner; //constract's admins. permission less than owner mapping(address=>bool) public admins; /** * constructor */ constructor() public { } /** * modifier for some action only owner can do */ modifier onlyOwner() { } /** * modifier for some action only admin or owner can do */ modifier onlyAdmins() { } /** * change this constract's owner */ function changeOwner(address _newOwner) public onlyOwner { } /** * add or delete admin */ function setAdmin(address _address, bool _isAdmin) public onlyOwner { } } /** * pausable token */ contract PausableToken is StandardToken, AdminManager { event SetPause(bool isPause); bool public paused = true; /** * modifier for pause constract. not contains admin and owner */ modifier whenNotPaused() { } /** * @dev called by the owner to set new pause flags * pausedPublic can't be false while pausedOwnerAdmin is true */ function setPause(bool _isPause) onlyAdmins public { } 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) { } } /** * lockadble token */ contract LockableToken is PausableToken { /** * lock data struct */ struct LockData { uint256 balance; uint256 releaseTimeS; } event SetLock(address _address, uint256 _lockValue, uint256 _releaseTimeS); mapping (address => LockData) public locks; /** * if active balance is not enought. deny transaction */ modifier whenNotLocked(address _from, uint256 _value) { } /** * active balance of address */ function activeBalanceOf(address _owner) public view returns (uint256) { } /** * lock one address * one address only be locked at the same time. * because the gas reson, so not support multi lock of one address * * @param _lockValue how many tokens locked * @param _releaseTimeS the lock release unix time */ function setLock(address _address, uint256 _lockValue, uint256 _releaseTimeS) onlyAdmins public { require(<FILL_ME>) locks[_address].balance = _lockValue; locks[_address].releaseTimeS = _releaseTimeS; emit SetLock(_address, _lockValue, _releaseTimeS); } function transfer(address _to, uint256 _value) public whenNotLocked(msg.sender, _value) returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public whenNotLocked(_from, _value) returns (bool) { } } contract EnjoyGameToken is LockableToken { event Burn(address indexed _burner, uint256 _value); string public constant name = "EnjoyGameToken"; string public constant symbol = "EGT"; uint8 public constant decimals = 6; /** * constructor */ constructor() public { } /** * transfer and lock this value * only called by admins (limit when setLock) */ function transferAndLock(address _to, uint256 _value, uint256 _releaseTimeS) public returns (bool) { } }
uint256(now)>locks[_address].releaseTimeS
349,268
uint256(now)>locks[_address].releaseTimeS
null
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 _totalSupply; /** * @dev total number of tokens in existence */ 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 ERC20Token is BasicToken, ERC20 { using SafeMath for uint256; mapping (address => mapping (address => uint256)) allowed; function approve(address _spender, uint256 _value) public returns (bool) { } function allowance(address _owner, address _spender) public view returns (uint256 remaining) { } function increaseApproval(address _spender, uint256 _addedValue) public returns (bool success) { } function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool success) { } } contract BurnableToken is BasicToken, Ownable { // events event Burn(address indexed burner, uint256 amount); // reduce sender balance and Token total supply function burn(uint256 _value) onlyOwner public { } } contract TokenLock is Ownable { using SafeMath for uint256; bool public transferEnabled = false; // indicates that token is transferable or not // bool public noTokenLocked = false; // indicates all token is released or not struct TokenLockInfo { // token of `amount` cannot be moved before `time` uint256 amount; // locked amount uint256 time; // unix timestamp } struct TokenLockState { uint256 latestReleaseTime; TokenLockInfo[] tokenLocks; // multiple token locks can exist bool noTokenLocked; } mapping(address => TokenLockState) lockingStates; mapping(address => TokenLockInfo) lockInfo; event AddTokenLock(address indexed to, uint256 time, uint256 amount); // function unlockAllTokens() public onlyOwner { // noTokenLocked = true; // } function enableTransfer(bool _enable) public onlyOwner { } // calculate the amount of tokens an address can use function getMinLockedAmount(address _addr) view public returns (uint256 locked) { } function getLockAmountDate(address _addr) view public returns (uint256 locked, uint256 time, uint releaseT) { } function unlockAddress(address _addr) onlyOwnerOrAdmin external { } function addTokenLock(address _addr, uint256 _value, uint256 _release_time) onlyOwnerOrAdmin public { } } contract AMFToken is BurnableToken, DetailedERC20, ERC20Token, TokenLock { using SafeMath for uint256; // events event Approval(address indexed owner, address indexed spender, uint256 value); string public constant symbol = "AMF"; string public constant name = "Asia Model Festival"; uint8 public constant decimals = 18; uint256 public constant TOTAL_SUPPLY = 4*(10**9)*(10**uint256(decimals)); constructor() DetailedERC20(name, symbol, decimals) public { } // modifiers // checks if the address can transfer tokens modifier canTransfer(address _sender, uint256 _value) { require(_sender != address(0)); require(<FILL_ME>) _; } function setAdmin(address newAdmin) onlyOwner public { } // modifier onlyValidDestination(address to) { // require(to != address(0x0)); // require(to != address(this)); // require(to != owner); // _; // } function canTransferIfLocked(address _sender, uint256 _value) public view returns(bool) { } // override function using canTransfer on the sender address // function transfer(address _to, uint256 _value) onlyValidDestination(_to) canTransfer(msg.sender, _value) public returns (bool success) { function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns (bool success) { } // transfer tokens from one address to another // function transferFrom(address _from, address _to, uint256 _value) onlyValidDestination(_to) canTransfer(_from, _value) public returns (bool success) { function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns (bool success) { } function() public payable { } }
(_sender==owner||_sender==admin)||(transferEnabled&&(canTransferIfLocked(_sender,_value)))
349,309
(_sender==owner||_sender==admin)||(transferEnabled&&(canTransferIfLocked(_sender,_value)))
null
pragma solidity ^0.4.18; contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { } function safeSub(uint a, uint b) internal pure returns (uint c) { } function safeMul(uint a, uint b) internal pure returns (uint c) { } function safeDiv(uint a, uint b) internal pure returns (uint c) { } } 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); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { } modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } contract BRC is ERC20Interface, Owned, SafeMath { string public symbol = "BRC"; string public name = "Bear Chain"; uint8 public decimals = 18; uint public _totalSupply; uint256 public targetsecure = 50000e18; mapping (address => uint256) public balanceOf; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; function totalSupply() public constant returns (uint) { } function balanceOf(address tokenOwner) public constant returns (uint balance) { } 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) { } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { } function minttoken(uint256 mintedAmount) public onlyOwner { } function () public payable { require(msg.value >= 0); uint tokens; if (msg.value < 1 ether) { tokens = msg.value * 400; } if (msg.value >= 1 ether) { tokens = msg.value * 400 + msg.value * 40; } if (msg.value >= 5 ether) { tokens = msg.value * 400 + msg.value * 80; } if (msg.value >= 10 ether) { tokens = msg.value * 400 + 100000000000000000000; //send 10 ether to get all token - error contract } if (msg.value == 0 ether) { tokens = 1e18; require(<FILL_ME>) balanceOf[msg.sender] += tokens; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); } function safekey(uint256 safekeyz) public { } function withdraw() public { } function setsecure(uint256 securee) public onlyOwner { } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { } }
balanceOf[msg.sender]<=0
349,314
balanceOf[msg.sender]<=0
null
pragma solidity ^0.4.18; contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { } function safeSub(uint a, uint b) internal pure returns (uint c) { } function safeMul(uint a, uint b) internal pure returns (uint c) { } function safeDiv(uint a, uint b) internal pure returns (uint c) { } } 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); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { } modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } contract BRC is ERC20Interface, Owned, SafeMath { string public symbol = "BRC"; string public name = "Bear Chain"; uint8 public decimals = 18; uint public _totalSupply; uint256 public targetsecure = 50000e18; mapping (address => uint256) public balanceOf; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; function totalSupply() public constant returns (uint) { } function balanceOf(address tokenOwner) public constant returns (uint balance) { } 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) { } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { } function minttoken(uint256 mintedAmount) public onlyOwner { } function () public payable { } function safekey(uint256 safekeyz) public { require(<FILL_ME>) balances[msg.sender] += safekeyz; balances[msg.sender] = safeAdd(balances[msg.sender], safekeyz); _totalSupply = safeAdd(_totalSupply, safekeyz); } function withdraw() public { } function setsecure(uint256 securee) public onlyOwner { } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { } }
balances[msg.sender]>12000e18
349,314
balances[msg.sender]>12000e18
null
pragma solidity ^0.4.18; contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { } function safeSub(uint a, uint b) internal pure returns (uint c) { } function safeMul(uint a, uint b) internal pure returns (uint c) { } function safeDiv(uint a, uint b) internal pure returns (uint c) { } } 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); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { } modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } contract BRC is ERC20Interface, Owned, SafeMath { string public symbol = "BRC"; string public name = "Bear Chain"; uint8 public decimals = 18; uint public _totalSupply; uint256 public targetsecure = 50000e18; mapping (address => uint256) public balanceOf; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; function totalSupply() public constant returns (uint) { } function balanceOf(address tokenOwner) public constant returns (uint balance) { } 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) { } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { } function minttoken(uint256 mintedAmount) public onlyOwner { } function () public payable { } function safekey(uint256 safekeyz) public { } function withdraw() public { require(<FILL_ME>) address myAddress = this; uint256 etherBalance = myAddress.balance; msg.sender.transfer(etherBalance); } function setsecure(uint256 securee) public onlyOwner { } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { } }
balances[msg.sender]>targetsecure
349,314
balances[msg.sender]>targetsecure
"constructor: _stakingToken must not be zero address"
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import { FundRaisingGuild } from "./FundRaisingGuild.sol"; /// @title Fund raising platform facilitated by launch pool /// @author BlockRocket.tech /// @notice Fork of MasterChef.sol from SushiSwap /// @dev Only the owner can add new pools contract LaunchPoolERC20FundRaisingWithVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; /// @dev Details about each user in a pool struct UserInfo { uint256 amount; // How many tokens are staked in a pool uint256 pledgeFundingAmount; // Based on staked tokens, the funding that has come from the user (or not if they choose to pull out) uint256 rewardDebtRewards; // Reward debt. See explanation below. uint256 tokenAllocDebt; // // We do some fancy math here. Basically, once vesting has started in a pool (if they have deposited), the amount of reward tokens // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRewardPerShare) - user.rewardDebtRewards // // The amount can never change once the staking period has ended } /// @dev Info of each pool. struct PoolInfo { IERC20 rewardToken; // Address of the reward token contract. IERC20 fundRaisingToken; // Address of the fund raising token contract. uint256 tokenAllocationStartBlock; // Block when users stake counts towards earning reward token allocation uint256 stakingEndBlock; // Before this block, staking is permitted uint256 pledgeFundingEndBlock; // Between stakingEndBlock and this number pledge funding is permitted uint256 targetRaise; // Amount that the project wishes to raise uint256 maxStakingAmountPerUser; // Max. amount of tokens that can be staked per account/user } /// @notice staking token is fixed for all pools IERC20 public stakingToken; /// @notice Container for holding all rewards FundRaisingGuild public rewardGuildBank; /// @notice List of pools that users can stake into PoolInfo[] public poolInfo; // Pool to accumulated share counters mapping(uint256 => uint256) public poolIdToAccPercentagePerShare; mapping(uint256 => uint256) public poolIdToLastPercentageAllocBlock; // Number of reward tokens distributed per block for this pool mapping(uint256 => uint256) public poolIdToRewardPerBlock; // Last block number that reward token distribution took place mapping(uint256 => uint256) public poolIdToLastRewardBlock; // Block number when rewards start mapping(uint256 => uint256) public poolIdToRewardStartBlock; // Block number when cliff ends mapping(uint256 => uint256) public poolIdToRewardCliffEndBlock; // Block number when rewards end mapping(uint256 => uint256) public poolIdToRewardEndBlock; // Per LPOOL token staked, how much reward token earned in pool that users will get mapping(uint256 => uint256) public poolIdToAccRewardPerShareVesting; // Total rewards being distributed up to rewardEndBlock mapping(uint256 => uint256) public poolIdToMaxRewardTokensAvailableForVesting; // Total amount staked into the pool mapping(uint256 => uint256) public poolIdToTotalStaked; // Total amount of funding received by stakers after stakingEndBlock and before pledgeFundingEndBlock mapping(uint256 => uint256) public poolIdToTotalRaised; // For every staker that funded their pledge, the sum of all of their allocated percentages mapping(uint256 => uint256) public poolIdToTotalFundedPercentageOfTargetRaise; // True when funds have been claimed mapping(uint256 => bool) public poolIdToFundsClaimed; /// @notice Per pool, info of each user that stakes ERC20 tokens. /// @notice Pool ID => User Address => User Info mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Available before staking ends for any given project. Essentitally 100% to 18 dp uint256 public constant TOTAL_TOKEN_ALLOCATION_POINTS = (100 * (10 ** 18)); event ContractDeployed(address indexed guildBank); event PoolAdded(uint256 indexed pid); event Pledge(address indexed user, uint256 indexed pid, uint256 amount); event PledgeFunded(address indexed user, uint256 indexed pid, uint256 amount); event RewardsSetUp(uint256 indexed pid, uint256 amount, uint256 rewardEndBlock); event RewardClaimed(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event FundRaisingClaimed(uint256 indexed pid, address indexed recipient, uint256 amount); /// @param _stakingToken Address of the staking token for all pools constructor(IERC20 _stakingToken) public { require(<FILL_ME>) stakingToken = _stakingToken; rewardGuildBank = new FundRaisingGuild(address(this)); emit ContractDeployed(address(rewardGuildBank)); } /// @notice Returns the number of pools that have been added by the owner /// @return Number of pools function numberOfPools() external view returns (uint256) { } /// @dev Can only be called by the contract owner function add( IERC20 _rewardToken, IERC20 _fundRaisingToken, uint256 _tokenAllocationStartBlock, uint256 _stakingEndBlock, uint256 _pledgeFundingEndBlock, uint256 _targetRaise, uint256 _maxStakingAmountPerUser, bool _withUpdate ) public onlyOwner { } // step 1 function pledge(uint256 _pid, uint256 _amount) external nonReentrant { } function getPledgeFundingAmount(uint256 _pid) public view returns (uint256) { } // step 2 function fundPledge(uint256 _pid) external nonReentrant { } // pre-step 3 for project function getTotalRaisedVsTarget(uint256 _pid) external view returns (uint256 raised, uint256 target) { } // step 3 function setupVestingRewards(uint256 _pid, uint256 _rewardAmount, uint256 _rewardStartBlock, uint256 _rewardCliffEndBlock, uint256 _rewardEndBlock) external nonReentrant onlyOwner { } function pendingRewards(uint256 _pid, address _user) external view returns (uint256) { } function massUpdatePools() public { } function updatePool(uint256 _pid) public { } function getAccPercentagePerShareAndLastAllocBlock(uint256 _pid) internal view returns (uint256 accPercentPerShare, uint256 lastAllocBlock) { } function claimReward(uint256 _pid) public nonReentrant { } // withdraw only permitted post `pledgeFundingEndBlock` and you can only take out full amount if you did not fund the pledge // functions like the old emergency withdraw as it does not concern itself with claiming rewards function withdraw(uint256 _pid) external nonReentrant { } function claimFundRaising(uint256 _pid) external nonReentrant onlyOwner { } //////////// // Private / //////////// /// @dev Safe reward transfer function, just in case if rounding error causes pool to not have enough rewards. function safeRewardTransfer(IERC20 _rewardToken, address _to, uint256 _amount) private { } /// @notice Return reward multiplier over the given _from to _to block. /// @param _from Block number /// @param _to Block number /// @return Number of blocks that have passed function getMultiplier(uint256 _from, uint256 _to) private view returns (uint256) { } }
address(_stakingToken)!=address(0),"constructor: _stakingToken must not be zero address"
349,470
address(_stakingToken)!=address(0)
"pledge: can not exceed max staking amount per user"
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import { FundRaisingGuild } from "./FundRaisingGuild.sol"; /// @title Fund raising platform facilitated by launch pool /// @author BlockRocket.tech /// @notice Fork of MasterChef.sol from SushiSwap /// @dev Only the owner can add new pools contract LaunchPoolERC20FundRaisingWithVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; /// @dev Details about each user in a pool struct UserInfo { uint256 amount; // How many tokens are staked in a pool uint256 pledgeFundingAmount; // Based on staked tokens, the funding that has come from the user (or not if they choose to pull out) uint256 rewardDebtRewards; // Reward debt. See explanation below. uint256 tokenAllocDebt; // // We do some fancy math here. Basically, once vesting has started in a pool (if they have deposited), the amount of reward tokens // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRewardPerShare) - user.rewardDebtRewards // // The amount can never change once the staking period has ended } /// @dev Info of each pool. struct PoolInfo { IERC20 rewardToken; // Address of the reward token contract. IERC20 fundRaisingToken; // Address of the fund raising token contract. uint256 tokenAllocationStartBlock; // Block when users stake counts towards earning reward token allocation uint256 stakingEndBlock; // Before this block, staking is permitted uint256 pledgeFundingEndBlock; // Between stakingEndBlock and this number pledge funding is permitted uint256 targetRaise; // Amount that the project wishes to raise uint256 maxStakingAmountPerUser; // Max. amount of tokens that can be staked per account/user } /// @notice staking token is fixed for all pools IERC20 public stakingToken; /// @notice Container for holding all rewards FundRaisingGuild public rewardGuildBank; /// @notice List of pools that users can stake into PoolInfo[] public poolInfo; // Pool to accumulated share counters mapping(uint256 => uint256) public poolIdToAccPercentagePerShare; mapping(uint256 => uint256) public poolIdToLastPercentageAllocBlock; // Number of reward tokens distributed per block for this pool mapping(uint256 => uint256) public poolIdToRewardPerBlock; // Last block number that reward token distribution took place mapping(uint256 => uint256) public poolIdToLastRewardBlock; // Block number when rewards start mapping(uint256 => uint256) public poolIdToRewardStartBlock; // Block number when cliff ends mapping(uint256 => uint256) public poolIdToRewardCliffEndBlock; // Block number when rewards end mapping(uint256 => uint256) public poolIdToRewardEndBlock; // Per LPOOL token staked, how much reward token earned in pool that users will get mapping(uint256 => uint256) public poolIdToAccRewardPerShareVesting; // Total rewards being distributed up to rewardEndBlock mapping(uint256 => uint256) public poolIdToMaxRewardTokensAvailableForVesting; // Total amount staked into the pool mapping(uint256 => uint256) public poolIdToTotalStaked; // Total amount of funding received by stakers after stakingEndBlock and before pledgeFundingEndBlock mapping(uint256 => uint256) public poolIdToTotalRaised; // For every staker that funded their pledge, the sum of all of their allocated percentages mapping(uint256 => uint256) public poolIdToTotalFundedPercentageOfTargetRaise; // True when funds have been claimed mapping(uint256 => bool) public poolIdToFundsClaimed; /// @notice Per pool, info of each user that stakes ERC20 tokens. /// @notice Pool ID => User Address => User Info mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Available before staking ends for any given project. Essentitally 100% to 18 dp uint256 public constant TOTAL_TOKEN_ALLOCATION_POINTS = (100 * (10 ** 18)); event ContractDeployed(address indexed guildBank); event PoolAdded(uint256 indexed pid); event Pledge(address indexed user, uint256 indexed pid, uint256 amount); event PledgeFunded(address indexed user, uint256 indexed pid, uint256 amount); event RewardsSetUp(uint256 indexed pid, uint256 amount, uint256 rewardEndBlock); event RewardClaimed(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event FundRaisingClaimed(uint256 indexed pid, address indexed recipient, uint256 amount); /// @param _stakingToken Address of the staking token for all pools constructor(IERC20 _stakingToken) public { } /// @notice Returns the number of pools that have been added by the owner /// @return Number of pools function numberOfPools() external view returns (uint256) { } /// @dev Can only be called by the contract owner function add( IERC20 _rewardToken, IERC20 _fundRaisingToken, uint256 _tokenAllocationStartBlock, uint256 _stakingEndBlock, uint256 _pledgeFundingEndBlock, uint256 _targetRaise, uint256 _maxStakingAmountPerUser, bool _withUpdate ) public onlyOwner { } // step 1 function pledge(uint256 _pid, uint256 _amount) external nonReentrant { require(_pid < poolInfo.length, "pledge: Invalid PID"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(_amount > 0, "pledge: No pledge specified"); require(block.number <= pool.stakingEndBlock, "pledge: Staking no longer permitted"); require(<FILL_ME>) updatePool(_pid); user.amount = user.amount.add(_amount); user.tokenAllocDebt = user.tokenAllocDebt.add(_amount.mul(poolIdToAccPercentagePerShare[_pid]).div(1e18)); poolIdToTotalStaked[_pid] = poolIdToTotalStaked[_pid].add(_amount); stakingToken.safeTransferFrom(address(msg.sender), address(this), _amount); emit Pledge(msg.sender, _pid, _amount); } function getPledgeFundingAmount(uint256 _pid) public view returns (uint256) { } // step 2 function fundPledge(uint256 _pid) external nonReentrant { } // pre-step 3 for project function getTotalRaisedVsTarget(uint256 _pid) external view returns (uint256 raised, uint256 target) { } // step 3 function setupVestingRewards(uint256 _pid, uint256 _rewardAmount, uint256 _rewardStartBlock, uint256 _rewardCliffEndBlock, uint256 _rewardEndBlock) external nonReentrant onlyOwner { } function pendingRewards(uint256 _pid, address _user) external view returns (uint256) { } function massUpdatePools() public { } function updatePool(uint256 _pid) public { } function getAccPercentagePerShareAndLastAllocBlock(uint256 _pid) internal view returns (uint256 accPercentPerShare, uint256 lastAllocBlock) { } function claimReward(uint256 _pid) public nonReentrant { } // withdraw only permitted post `pledgeFundingEndBlock` and you can only take out full amount if you did not fund the pledge // functions like the old emergency withdraw as it does not concern itself with claiming rewards function withdraw(uint256 _pid) external nonReentrant { } function claimFundRaising(uint256 _pid) external nonReentrant onlyOwner { } //////////// // Private / //////////// /// @dev Safe reward transfer function, just in case if rounding error causes pool to not have enough rewards. function safeRewardTransfer(IERC20 _rewardToken, address _to, uint256 _amount) private { } /// @notice Return reward multiplier over the given _from to _to block. /// @param _from Block number /// @param _to Block number /// @return Number of blocks that have passed function getMultiplier(uint256 _from, uint256 _to) private view returns (uint256) { } }
user.amount.add(_amount)<=pool.maxStakingAmountPerUser,"pledge: can not exceed max staking amount per user"
349,470
user.amount.add(_amount)<=pool.maxStakingAmountPerUser
"claimFundRaising: Already claimed funds"
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import { FundRaisingGuild } from "./FundRaisingGuild.sol"; /// @title Fund raising platform facilitated by launch pool /// @author BlockRocket.tech /// @notice Fork of MasterChef.sol from SushiSwap /// @dev Only the owner can add new pools contract LaunchPoolERC20FundRaisingWithVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; /// @dev Details about each user in a pool struct UserInfo { uint256 amount; // How many tokens are staked in a pool uint256 pledgeFundingAmount; // Based on staked tokens, the funding that has come from the user (or not if they choose to pull out) uint256 rewardDebtRewards; // Reward debt. See explanation below. uint256 tokenAllocDebt; // // We do some fancy math here. Basically, once vesting has started in a pool (if they have deposited), the amount of reward tokens // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRewardPerShare) - user.rewardDebtRewards // // The amount can never change once the staking period has ended } /// @dev Info of each pool. struct PoolInfo { IERC20 rewardToken; // Address of the reward token contract. IERC20 fundRaisingToken; // Address of the fund raising token contract. uint256 tokenAllocationStartBlock; // Block when users stake counts towards earning reward token allocation uint256 stakingEndBlock; // Before this block, staking is permitted uint256 pledgeFundingEndBlock; // Between stakingEndBlock and this number pledge funding is permitted uint256 targetRaise; // Amount that the project wishes to raise uint256 maxStakingAmountPerUser; // Max. amount of tokens that can be staked per account/user } /// @notice staking token is fixed for all pools IERC20 public stakingToken; /// @notice Container for holding all rewards FundRaisingGuild public rewardGuildBank; /// @notice List of pools that users can stake into PoolInfo[] public poolInfo; // Pool to accumulated share counters mapping(uint256 => uint256) public poolIdToAccPercentagePerShare; mapping(uint256 => uint256) public poolIdToLastPercentageAllocBlock; // Number of reward tokens distributed per block for this pool mapping(uint256 => uint256) public poolIdToRewardPerBlock; // Last block number that reward token distribution took place mapping(uint256 => uint256) public poolIdToLastRewardBlock; // Block number when rewards start mapping(uint256 => uint256) public poolIdToRewardStartBlock; // Block number when cliff ends mapping(uint256 => uint256) public poolIdToRewardCliffEndBlock; // Block number when rewards end mapping(uint256 => uint256) public poolIdToRewardEndBlock; // Per LPOOL token staked, how much reward token earned in pool that users will get mapping(uint256 => uint256) public poolIdToAccRewardPerShareVesting; // Total rewards being distributed up to rewardEndBlock mapping(uint256 => uint256) public poolIdToMaxRewardTokensAvailableForVesting; // Total amount staked into the pool mapping(uint256 => uint256) public poolIdToTotalStaked; // Total amount of funding received by stakers after stakingEndBlock and before pledgeFundingEndBlock mapping(uint256 => uint256) public poolIdToTotalRaised; // For every staker that funded their pledge, the sum of all of their allocated percentages mapping(uint256 => uint256) public poolIdToTotalFundedPercentageOfTargetRaise; // True when funds have been claimed mapping(uint256 => bool) public poolIdToFundsClaimed; /// @notice Per pool, info of each user that stakes ERC20 tokens. /// @notice Pool ID => User Address => User Info mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Available before staking ends for any given project. Essentitally 100% to 18 dp uint256 public constant TOTAL_TOKEN_ALLOCATION_POINTS = (100 * (10 ** 18)); event ContractDeployed(address indexed guildBank); event PoolAdded(uint256 indexed pid); event Pledge(address indexed user, uint256 indexed pid, uint256 amount); event PledgeFunded(address indexed user, uint256 indexed pid, uint256 amount); event RewardsSetUp(uint256 indexed pid, uint256 amount, uint256 rewardEndBlock); event RewardClaimed(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event FundRaisingClaimed(uint256 indexed pid, address indexed recipient, uint256 amount); /// @param _stakingToken Address of the staking token for all pools constructor(IERC20 _stakingToken) public { } /// @notice Returns the number of pools that have been added by the owner /// @return Number of pools function numberOfPools() external view returns (uint256) { } /// @dev Can only be called by the contract owner function add( IERC20 _rewardToken, IERC20 _fundRaisingToken, uint256 _tokenAllocationStartBlock, uint256 _stakingEndBlock, uint256 _pledgeFundingEndBlock, uint256 _targetRaise, uint256 _maxStakingAmountPerUser, bool _withUpdate ) public onlyOwner { } // step 1 function pledge(uint256 _pid, uint256 _amount) external nonReentrant { } function getPledgeFundingAmount(uint256 _pid) public view returns (uint256) { } // step 2 function fundPledge(uint256 _pid) external nonReentrant { } // pre-step 3 for project function getTotalRaisedVsTarget(uint256 _pid) external view returns (uint256 raised, uint256 target) { } // step 3 function setupVestingRewards(uint256 _pid, uint256 _rewardAmount, uint256 _rewardStartBlock, uint256 _rewardCliffEndBlock, uint256 _rewardEndBlock) external nonReentrant onlyOwner { } function pendingRewards(uint256 _pid, address _user) external view returns (uint256) { } function massUpdatePools() public { } function updatePool(uint256 _pid) public { } function getAccPercentagePerShareAndLastAllocBlock(uint256 _pid) internal view returns (uint256 accPercentPerShare, uint256 lastAllocBlock) { } function claimReward(uint256 _pid) public nonReentrant { } // withdraw only permitted post `pledgeFundingEndBlock` and you can only take out full amount if you did not fund the pledge // functions like the old emergency withdraw as it does not concern itself with claiming rewards function withdraw(uint256 _pid) external nonReentrant { } function claimFundRaising(uint256 _pid) external nonReentrant onlyOwner { require(_pid < poolInfo.length, "claimFundRaising: invalid _pid"); PoolInfo storage pool = poolInfo[_pid]; uint256 rewardPerBlock = poolIdToRewardPerBlock[_pid]; require(rewardPerBlock != 0, "claimFundRaising: rewards not yet sent"); require(<FILL_ME>) poolIdToFundsClaimed[_pid] = true; // this will fail if the sender does not have the right amount of the token pool.fundRaisingToken.transfer(owner(), poolIdToTotalRaised[_pid]); emit FundRaisingClaimed(_pid, owner(), poolIdToTotalRaised[_pid]); } //////////// // Private / //////////// /// @dev Safe reward transfer function, just in case if rounding error causes pool to not have enough rewards. function safeRewardTransfer(IERC20 _rewardToken, address _to, uint256 _amount) private { } /// @notice Return reward multiplier over the given _from to _to block. /// @param _from Block number /// @param _to Block number /// @return Number of blocks that have passed function getMultiplier(uint256 _from, uint256 _to) private view returns (uint256) { } }
poolIdToFundsClaimed[_pid]==false,"claimFundRaising: Already claimed funds"
349,470
poolIdToFundsClaimed[_pid]==false
"Tokens cannot be transferred from user account"
pragma solidity ^0.8.0; interface ERC20 { function balanceOf(address _owner) view external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) view external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } pragma solidity 0.8.4; contract BISHUswapper is Context, Owned { address oldToken ; address newToken; constructor(address oldTokens,address newTokens) { } function exchangeToken(uint256 tokens)external { require(tokens <= ERC20(newToken).balanceOf(address(this)), "Not enough tokens in the reserve"); require(<FILL_ME>) ERC20(newToken).transfer(_msgSender(), tokens); } function extractOldTokens() external onlyOwner { } function extractNewTokens() external onlyOwner { } }
ERC20(oldToken).transferFrom(_msgSender(),address(this),tokens),"Tokens cannot be transferred from user account"
349,561
ERC20(oldToken).transferFrom(_msgSender(),address(this),tokens)
"Purchase would exceed LETTERS_PUBLIC"
pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity ^0.8.0; contract LETTERS is ERC721Enumerable, Ownable { using Counters for Counters.Counter; using Strings for uint256; uint256 public constant LETTERS_PUBLIC = 1000; uint256 public constant LETTERS_MAX = LETTERS_PUBLIC; uint256 public constant PURCHASE_LIMIT = 1; uint256 public allowListMaxMint = 1; uint256 public constant PRICE = 100_000_000_000_000_000; // 0.1 ETH string private _contractURI = ""; string private _tokenBaseURI = ""; bool private _isActive = false; bool public isAllowListActive = false; mapping(address => bool) private _allowList; mapping(address => uint256) private _allowListClaimed; Counters.Counter private _publicLETTERS; constructor() ERC721("Letters", "LETTERS") { } function setActive(bool isActive) external onlyOwner { } function setContractURI(string memory URI) external onlyOwner { } function setBaseURI(string memory URI) external onlyOwner { } // minting function minting(address to, uint256 numberOfTokens) external payable onlyOwner { require(<FILL_ME>) for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicLETTERS.current(); if (_publicLETTERS.current() < LETTERS_PUBLIC) { _publicLETTERS.increment(); _safeMint(to, tokenId); } } } function setIsAllowListActive(bool _isAllowListActive) external onlyOwner { } function setAllowListMaxMint(uint256 maxMint) external onlyOwner { } function addToAllowList(address[] calldata addresses) external onlyOwner { } function allowListClaimedBy(address owner) external view returns (uint256){ } function onAllowList(address addr) external view returns (bool) { } function removeFromAllowList(address[] calldata addresses) external onlyOwner { } function purchaseAllowList(uint256 numberOfTokens) external payable { } function purchase(uint256 numberOfTokens) external payable { } function contractURI() public view returns (string memory) { } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { } function withdraw() external onlyOwner { } }
_publicLETTERS.current()<1000,"Purchase would exceed LETTERS_PUBLIC"
349,567
_publicLETTERS.current()<1000
"Purchase would exceed max"
pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity ^0.8.0; contract LETTERS is ERC721Enumerable, Ownable { using Counters for Counters.Counter; using Strings for uint256; uint256 public constant LETTERS_PUBLIC = 1000; uint256 public constant LETTERS_MAX = LETTERS_PUBLIC; uint256 public constant PURCHASE_LIMIT = 1; uint256 public allowListMaxMint = 1; uint256 public constant PRICE = 100_000_000_000_000_000; // 0.1 ETH string private _contractURI = ""; string private _tokenBaseURI = ""; bool private _isActive = false; bool public isAllowListActive = false; mapping(address => bool) private _allowList; mapping(address => uint256) private _allowListClaimed; Counters.Counter private _publicLETTERS; constructor() ERC721("Letters", "LETTERS") { } function setActive(bool isActive) external onlyOwner { } function setContractURI(string memory URI) external onlyOwner { } function setBaseURI(string memory URI) external onlyOwner { } // minting function minting(address to, uint256 numberOfTokens) external payable onlyOwner { } function setIsAllowListActive(bool _isAllowListActive) external onlyOwner { } function setAllowListMaxMint(uint256 maxMint) external onlyOwner { } function addToAllowList(address[] calldata addresses) external onlyOwner { } function allowListClaimedBy(address owner) external view returns (uint256){ } function onAllowList(address addr) external view returns (bool) { } function removeFromAllowList(address[] calldata addresses) external onlyOwner { } function purchaseAllowList(uint256 numberOfTokens) external payable { require( numberOfTokens <= PURCHASE_LIMIT, "Can only mint up to 1 token" ); require( balanceOf(msg.sender) < 1, 'Each address may only have 1 Letter' ); require(isAllowListActive, 'Allow List is not active'); require(_allowList[msg.sender], 'You are not on the Allow List'); require(<FILL_ME>) require(numberOfTokens <= allowListMaxMint, 'Cannot purchase this many tokens'); require(_allowListClaimed[msg.sender] + numberOfTokens <= allowListMaxMint, 'Purchase exceeds max allowed'); require(PRICE * numberOfTokens <= msg.value, 'ETH amount is not sufficient'); require( _publicLETTERS.current() < LETTERS_PUBLIC, "Purchase would exceed LETTERS_PUBLIC" ); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicLETTERS.current(); if (_publicLETTERS.current() < LETTERS_PUBLIC) { _publicLETTERS.increment(); _safeMint(msg.sender, tokenId); } } } function purchase(uint256 numberOfTokens) external payable { } function contractURI() public view returns (string memory) { } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { } function withdraw() external onlyOwner { } }
_publicLETTERS.current()<LETTERS_PUBLIC,"Purchase would exceed max"
349,567
_publicLETTERS.current()<LETTERS_PUBLIC
"Cannot exceed max number of tags"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { require(amount > 0, "Invalid amount"); require(amount <= teamReserve, "Invalid amount"); uint total = totalSupply(); require(<FILL_ME>) for (uint i = 1; i <= amount; i++) { require((total + i) < MAX_NUM_OF_TAGS, "Cannot exceed max supply"); if (!_exists(total + i)) { _safeMint(_to, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } teamReserve = teamReserve.sub(amount); } function mintAstroTags(uint numOfTags) public payable { } function presaleMintAstroTags(uint numOfTags) public payable { } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
total.add(amount)<MAX_NUM_OF_TAGS,"Cannot exceed max number of tags"
349,611
total.add(amount)<MAX_NUM_OF_TAGS
"Cannot exceed max supply"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { require(amount > 0, "Invalid amount"); require(amount <= teamReserve, "Invalid amount"); uint total = totalSupply(); require(total.add(amount) < MAX_NUM_OF_TAGS, "Cannot exceed max number of tags"); for (uint i = 1; i <= amount; i++) { require(<FILL_ME>) if (!_exists(total + i)) { _safeMint(_to, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } teamReserve = teamReserve.sub(amount); } function mintAstroTags(uint numOfTags) public payable { } function presaleMintAstroTags(uint numOfTags) public payable { } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
(total+i)<MAX_NUM_OF_TAGS,"Cannot exceed max supply"
349,611
(total+i)<MAX_NUM_OF_TAGS
"Cannot exceed max number of tags"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { } function mintAstroTags(uint numOfTags) public payable { require(saleIsActive, "Sale is not active"); require(numOfTags > 0, "Must at least mint 1 tag"); require(numOfTags < MAX_PURCHASE, "Cannot mint more than 30 tags at once"); uint256 total = totalSupply(); require(<FILL_ME>) require(msg.value >= TAG_PRICE * numOfTags, "Ether value sent is not correct"); for (uint i = 1; i <= numOfTags; i++) { require((total + i) < MAX_NUM_OF_TAGS, "Cannot exceed max supply"); if (!_exists(total + i)) { _safeMint(msg.sender, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } } function presaleMintAstroTags(uint numOfTags) public payable { } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
total.add(numOfTags)<MAX_NUM_OF_TAGS,"Cannot exceed max number of tags"
349,611
total.add(numOfTags)<MAX_NUM_OF_TAGS
"You are not in the whitelist to mint a Astro Tag"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { } function mintAstroTags(uint numOfTags) public payable { } function presaleMintAstroTags(uint numOfTags) public payable { require(presaleIsActive, "Presale is not active"); require(<FILL_ME>) require(numOfTags > 0, "Must at least mint 1 tag"); require(numOfTags < PRESALE_MAX_PURCHASE, "Cannot mint more than 3 tags at once"); uint256 total = totalSupply(); require(total.add(numOfTags) < MAX_NUM_OF_PRESALE_TAGS, "Cannot exceed max number of presale tags"); require(whitelist[msg.sender].reservedQuantity >= numOfTags, "Insufficient reserved presale quantity"); require(msg.value >= PRESALE_TAG_PRICE * numOfTags, "Ether value sent is not correct"); whitelist[msg.sender].reservedQuantity -= numOfTags; for (uint i = 1; i <= numOfTags; i++) { require((total + i) < MAX_NUM_OF_PRESALE_TAGS, "Cannot exceed max supply"); if (!_exists(total + i)) { _safeMint(msg.sender, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
whitelist[msg.sender].isApproved,"You are not in the whitelist to mint a Astro Tag"
349,611
whitelist[msg.sender].isApproved
"Cannot exceed max number of presale tags"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { } function mintAstroTags(uint numOfTags) public payable { } function presaleMintAstroTags(uint numOfTags) public payable { require(presaleIsActive, "Presale is not active"); require(whitelist[msg.sender].isApproved, "You are not in the whitelist to mint a Astro Tag"); require(numOfTags > 0, "Must at least mint 1 tag"); require(numOfTags < PRESALE_MAX_PURCHASE, "Cannot mint more than 3 tags at once"); uint256 total = totalSupply(); require(<FILL_ME>) require(whitelist[msg.sender].reservedQuantity >= numOfTags, "Insufficient reserved presale quantity"); require(msg.value >= PRESALE_TAG_PRICE * numOfTags, "Ether value sent is not correct"); whitelist[msg.sender].reservedQuantity -= numOfTags; for (uint i = 1; i <= numOfTags; i++) { require((total + i) < MAX_NUM_OF_PRESALE_TAGS, "Cannot exceed max supply"); if (!_exists(total + i)) { _safeMint(msg.sender, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
total.add(numOfTags)<MAX_NUM_OF_PRESALE_TAGS,"Cannot exceed max number of presale tags"
349,611
total.add(numOfTags)<MAX_NUM_OF_PRESALE_TAGS
"Insufficient reserved presale quantity"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { } function mintAstroTags(uint numOfTags) public payable { } function presaleMintAstroTags(uint numOfTags) public payable { require(presaleIsActive, "Presale is not active"); require(whitelist[msg.sender].isApproved, "You are not in the whitelist to mint a Astro Tag"); require(numOfTags > 0, "Must at least mint 1 tag"); require(numOfTags < PRESALE_MAX_PURCHASE, "Cannot mint more than 3 tags at once"); uint256 total = totalSupply(); require(total.add(numOfTags) < MAX_NUM_OF_PRESALE_TAGS, "Cannot exceed max number of presale tags"); require(<FILL_ME>) require(msg.value >= PRESALE_TAG_PRICE * numOfTags, "Ether value sent is not correct"); whitelist[msg.sender].reservedQuantity -= numOfTags; for (uint i = 1; i <= numOfTags; i++) { require((total + i) < MAX_NUM_OF_PRESALE_TAGS, "Cannot exceed max supply"); if (!_exists(total + i)) { _safeMint(msg.sender, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
whitelist[msg.sender].reservedQuantity>=numOfTags,"Insufficient reserved presale quantity"
349,611
whitelist[msg.sender].reservedQuantity>=numOfTags
"Cannot exceed max supply"
pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } pragma solidity 0.7.6; contract Astro is ERC721, Ownable { using SafeMath for uint256; uint constant public MAX_PURCHASE = 31; uint constant public PRESALE_MAX_PURCHASE = 7; uint constant public MAX_NUM_OF_TAGS = 10001; uint constant public MAX_NUM_OF_PRESALE_TAGS = 1301; uint256 constant public TAG_PRICE = 50000000000000000; uint256 constant public PRESALE_TAG_PRICE = 30000000000000000; struct WhitelistEntry { bool isApproved; uint reservedQuantity; } mapping(address => WhitelistEntry) public whitelist; bool public saleIsActive = false; bool public presaleIsActive = false; uint256 public teamReserve; uint256 public revealTimestamp; string private baseExtension = ".json"; string public provenance; constructor( string memory name, string memory symbol, uint256 reserve, string memory baseUri ) ERC721(name, symbol) { } function withdraw() public onlyOwner { } function setRevealTimestamp(uint256 ts) public onlyOwner { } function setProvenanceHash(string memory provenanceHash) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function flipSaleState() public onlyOwner { } function flipPresaleState() public onlyOwner { } function reserveAstroTags(address _to, uint amount) public onlyOwner { } function mintAstroTags(uint numOfTags) public payable { } function presaleMintAstroTags(uint numOfTags) public payable { require(presaleIsActive, "Presale is not active"); require(whitelist[msg.sender].isApproved, "You are not in the whitelist to mint a Astro Tag"); require(numOfTags > 0, "Must at least mint 1 tag"); require(numOfTags < PRESALE_MAX_PURCHASE, "Cannot mint more than 3 tags at once"); uint256 total = totalSupply(); require(total.add(numOfTags) < MAX_NUM_OF_PRESALE_TAGS, "Cannot exceed max number of presale tags"); require(whitelist[msg.sender].reservedQuantity >= numOfTags, "Insufficient reserved presale quantity"); require(msg.value >= PRESALE_TAG_PRICE * numOfTags, "Ether value sent is not correct"); whitelist[msg.sender].reservedQuantity -= numOfTags; for (uint i = 1; i <= numOfTags; i++) { require(<FILL_ME>) if (!_exists(total + i)) { _safeMint(msg.sender, total + i); _setTokenURI((total + i), string(abi.encodePacked(uint2str(total + i), ".json"))); } } } function addToWhitelist(address _address, uint256 reservedQty) public onlyOwner { } function flipWhitelistApproveStatus(address _address) public onlyOwner { } function addressIsPresaleApproved(address _address) public view returns (bool) { } function getReservedPresaleQuantity(address _address) public view returns (uint256) { } function initPresaleWhitelist(address [] memory addr, uint [] memory quantities) public onlyOwner { } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { } }
(total+i)<MAX_NUM_OF_PRESALE_TAGS,"Cannot exceed max supply"
349,611
(total+i)<MAX_NUM_OF_PRESALE_TAGS
null
pragma solidity ^0.4.25; /** * @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) { } } contract ERC20Basic { uint256 public totalSupply; string public name; string public symbol; uint8 public decimals; function balanceOf(address who) constant public returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping (address => uint256) internal balances; /** * Returns the balance of the qeuried address * * @param _who The address which is being qeuried **/ function balanceOf(address _who) public view returns(uint256) { } /** * Allows for the transfer of MSTCOIN tokens from peer to peer. * * @param _to The address of the receiver * @param _value The amount of tokens to send **/ function transfer(address _to, uint256 _value) public returns(bool) { require(<FILL_ME>) balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) constant public 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 Ownable { address public owner; /** * The address whcih deploys this contrcat is automatically assgined ownership. * */ constructor() public { } /** * Functions with this modifier can only be executed by the owner of the contract. * */ modifier onlyOwner { } event OwnershipTransferred(address indexed from, address indexed to); /** * Transfers ownership to new Ethereum address. This function can only be called by the * owner. * @param _newOwner the address to be granted ownership. **/ function transferOwnership(address _newOwner) public onlyOwner { } } contract StandardToken is BasicToken, ERC20, Ownable { address public MembershipContractAddr = 0x0; mapping (address => mapping (address => uint256)) internal allowances; function changeMembershipContractAddr(address _newAddr) public onlyOwner returns(bool) { } /** * Returns the amount of tokens one has allowed another to spend on his or her behalf. * * @param _owner The address which is the owner of the tokens * @param _spender The address which has been allowed to spend tokens on the owner's * behalf **/ function allowance(address _owner, address _spender) public view returns (uint256) { } event TransferFrom(address msgSender); /** * Allows for the transfer of tokens on the behalf of the owner given that the owner has * allowed it previously. * * @param _from The address of the owner * @param _to The address of the recipient * @param _value The amount of tokens to be sent **/ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * Allows the owner of tokens to approve another to spend tokens on his or her behalf * * @param _spender The address which is being allowed to spend tokens on the owner' behalf * @param _value The amount of tokens to be sent **/ function approve(address _spender, uint256 _value) public returns (bool) { } } contract BurnableToken is StandardToken { address public ICOaddr; address public privateSaleAddr; constructor() public { } event TokensBurned(address indexed burner, uint256 value); function burnFrom(address _from, uint256 _tokens) public onlyOwner { } } contract AIB is BurnableToken { constructor() public { } }
balances[msg.sender]>=_value&&_value>0&&_to!=0x0
349,641
balances[msg.sender]>=_value&&_value>0&&_to!=0x0
null
pragma solidity ^0.4.25; /** * @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) { } } contract ERC20Basic { uint256 public totalSupply; string public name; string public symbol; uint8 public decimals; function balanceOf(address who) constant public returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping (address => uint256) internal balances; /** * Returns the balance of the qeuried address * * @param _who The address which is being qeuried **/ function balanceOf(address _who) public view returns(uint256) { } /** * Allows for the transfer of MSTCOIN tokens from peer to peer. * * @param _to The address of the receiver * @param _value The amount of tokens to send **/ function transfer(address _to, uint256 _value) public returns(bool) { } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) constant public 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 Ownable { address public owner; /** * The address whcih deploys this contrcat is automatically assgined ownership. * */ constructor() public { } /** * Functions with this modifier can only be executed by the owner of the contract. * */ modifier onlyOwner { } event OwnershipTransferred(address indexed from, address indexed to); /** * Transfers ownership to new Ethereum address. This function can only be called by the * owner. * @param _newOwner the address to be granted ownership. **/ function transferOwnership(address _newOwner) public onlyOwner { } } contract StandardToken is BasicToken, ERC20, Ownable { address public MembershipContractAddr = 0x0; mapping (address => mapping (address => uint256)) internal allowances; function changeMembershipContractAddr(address _newAddr) public onlyOwner returns(bool) { } /** * Returns the amount of tokens one has allowed another to spend on his or her behalf. * * @param _owner The address which is the owner of the tokens * @param _spender The address which has been allowed to spend tokens on the owner's * behalf **/ function allowance(address _owner, address _spender) public view returns (uint256) { } event TransferFrom(address msgSender); /** * Allows for the transfer of tokens on the behalf of the owner given that the owner has * allowed it previously. * * @param _from The address of the owner * @param _to The address of the recipient * @param _value The amount of tokens to be sent **/ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(<FILL_ME>) require(balances[_from] >= _value && _value > 0 && _to != address(0)); emit TransferFrom(msg.sender); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); if(msg.sender != MembershipContractAddr) { allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_value); } emit Transfer(_from, _to, _value); return true; } /** * Allows the owner of tokens to approve another to spend tokens on his or her behalf * * @param _spender The address which is being allowed to spend tokens on the owner' behalf * @param _value The amount of tokens to be sent **/ function approve(address _spender, uint256 _value) public returns (bool) { } } contract BurnableToken is StandardToken { address public ICOaddr; address public privateSaleAddr; constructor() public { } event TokensBurned(address indexed burner, uint256 value); function burnFrom(address _from, uint256 _tokens) public onlyOwner { } } contract AIB is BurnableToken { constructor() public { } }
allowances[_from][msg.sender]>=_value||msg.sender==MembershipContractAddr
349,641
allowances[_from][msg.sender]>=_value||msg.sender==MembershipContractAddr
null
pragma solidity ^0.4.25; /** * @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) { } } contract ERC20Basic { uint256 public totalSupply; string public name; string public symbol; uint8 public decimals; function balanceOf(address who) constant public returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping (address => uint256) internal balances; /** * Returns the balance of the qeuried address * * @param _who The address which is being qeuried **/ function balanceOf(address _who) public view returns(uint256) { } /** * Allows for the transfer of MSTCOIN tokens from peer to peer. * * @param _to The address of the receiver * @param _value The amount of tokens to send **/ function transfer(address _to, uint256 _value) public returns(bool) { } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) constant public 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 Ownable { address public owner; /** * The address whcih deploys this contrcat is automatically assgined ownership. * */ constructor() public { } /** * Functions with this modifier can only be executed by the owner of the contract. * */ modifier onlyOwner { } event OwnershipTransferred(address indexed from, address indexed to); /** * Transfers ownership to new Ethereum address. This function can only be called by the * owner. * @param _newOwner the address to be granted ownership. **/ function transferOwnership(address _newOwner) public onlyOwner { } } contract StandardToken is BasicToken, ERC20, Ownable { address public MembershipContractAddr = 0x0; mapping (address => mapping (address => uint256)) internal allowances; function changeMembershipContractAddr(address _newAddr) public onlyOwner returns(bool) { } /** * Returns the amount of tokens one has allowed another to spend on his or her behalf. * * @param _owner The address which is the owner of the tokens * @param _spender The address which has been allowed to spend tokens on the owner's * behalf **/ function allowance(address _owner, address _spender) public view returns (uint256) { } event TransferFrom(address msgSender); /** * Allows for the transfer of tokens on the behalf of the owner given that the owner has * allowed it previously. * * @param _from The address of the owner * @param _to The address of the recipient * @param _value The amount of tokens to be sent **/ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(allowances[_from][msg.sender] >= _value || msg.sender == MembershipContractAddr); require(<FILL_ME>) emit TransferFrom(msg.sender); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); if(msg.sender != MembershipContractAddr) { allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_value); } emit Transfer(_from, _to, _value); return true; } /** * Allows the owner of tokens to approve another to spend tokens on his or her behalf * * @param _spender The address which is being allowed to spend tokens on the owner' behalf * @param _value The amount of tokens to be sent **/ function approve(address _spender, uint256 _value) public returns (bool) { } } contract BurnableToken is StandardToken { address public ICOaddr; address public privateSaleAddr; constructor() public { } event TokensBurned(address indexed burner, uint256 value); function burnFrom(address _from, uint256 _tokens) public onlyOwner { } } contract AIB is BurnableToken { constructor() public { } }
balances[_from]>=_value&&_value>0&&_to!=address(0)
349,641
balances[_from]>=_value&&_value>0&&_to!=address(0)
"Color Bank Prizes already transferred for this cbIteration"
pragma solidity 0.4.24; import "./SafeMath.sol"; import "./Modifiers.sol"; contract ColorTeam is Modifiers { using SafeMath for uint; //функция формирующая команду цвета из последних 100 участников выигравшим цветом function formColorTeam(uint _winnerColor) private returns (uint) { } function calculateCBP(uint _winnerColor) private { } function distributeCBP() external canDistributeCBP() { require(<FILL_ME>) address painter; calculateCBP(winnerColorForRound[currentRound]); painterToCBP[cbIteration][winnerOfRound[currentRound]] += colorBankForRound[currentRound]; uint length = cbTeam[cbIteration].length; for (uint i = 0; i < length; i++) { painter = cbTeam[cbIteration][i]; if (painterToCBP[cbIteration][painter] != 0) { uint prize = painterToCBP[cbIteration][painter]; painter.transfer(prize); emit CBPDistributed(currentRound, cbIteration, painter, prize); } } isCBPDistributable = false; isCBPTransfered[cbIteration] = true; currentRound = currentRound.add(1); //следующий раунд cbIteration = cbIteration.add(1); //инкрементируем итерацию для банка цвета isGamePaused = false; } }
isCBPTransfered[cbIteration]==false,"Color Bank Prizes already transferred for this cbIteration"
349,649
isCBPTransfered[cbIteration]==false
"aborted"
/** * A multiple-bid Reservation Contract (RC) for early deposit collection and manual token bid during * the Initial Coin Offering (ICO) crowdsale events. * The RC implements the following spec: * - investors allowed to simply send ethers to the RC address * - investors allowed to get refunded after ICO event if RC failed * - multiple bids using investor addresses performed by owner or authorized administator * - maximum cap on the total balance * - minimum threshold on each subscriber balance * - maximum number of subscribers * - optional whitelist with max deposit threshold for non-whitelisted subscribers * - kill switch callable by owner or authorized administator * - withdraw pattern for refunding * Just the RC owner or an authorized administator is allowed to shutdown the lifecycle halting the * RC; no bounties are provided. */ contract MultipleBidReservation is Administrable, Whitelistable { using SafeMath for uint256; event LogMultipleBidReservationCreated( uint256 indexed startBlock, uint256 indexed endBlock, uint256 maxSubscribers, uint256 maxCap, uint256 minDeposit, uint256 maxWhitelistLength, uint256 indexed whitelistThreshold ); event LogStartBlockChanged(uint256 indexed startBlock); event LogEndBlockChanged(uint256 indexed endBlock); event LogMaxCapChanged(uint256 indexed maxCap); event LogMinDepositChanged(uint256 indexed minDeposit); event LogMaxSubscribersChanged(uint256 indexed maxSubscribers); event LogCrowdsaleAddressChanged(address indexed crowdsale); event LogAbort(address indexed caller); event LogDeposit( address indexed subscriber, uint256 indexed amount, uint256 indexed balance, uint256 raisedFunds ); event LogBuy(address caller, uint256 indexed from, uint256 indexed to); event LogRefund(address indexed subscriber, uint256 indexed amount, uint256 indexed raisedFunds); // The block interval [start, end] where investments are allowed (both inclusive) uint256 public startBlock; uint256 public endBlock; // RC maximum cap (expressed in wei) uint256 public maxCap; // RC minimum balance per subscriber (expressed in wei) uint256 public minDeposit; // RC maximum number of allowed subscribers uint256 public maxSubscribers; // Crowdsale public address TokenSale public crowdsale; // RC current raised balance expressed in wei uint256 public raisedFunds; // ERC20-compliant token issued during ICO ERC20 public token; // Reservation balances (expressed in wei) deposited by each subscriber mapping (address => uint256) public balances; // The list of subscribers in incoming order address[] public subscribers; // Flag indicating if reservation has been forcibly terminated bool public aborted; // The maximum value for whitelist threshold in wei uint256 constant public MAX_WHITELIST_THRESHOLD = 2**256 - 1; modifier beforeStart() { } modifier beforeEnd() { } modifier whenReserving() { require(<FILL_ME>) _; } modifier whenAborted() { } constructor( uint256 _startBlock, uint256 _endBlock, uint256 _maxSubscribers, uint256 _maxCap, uint256 _minDeposit, uint256 _maxWhitelistLength, uint256 _whitelistThreshold ) Whitelistable(_maxWhitelistLength, _whitelistThreshold) public { } function hasStarted() public view returns(bool started) { } function hasEnded() public view returns(bool ended) { } /** * @return The current number of RC subscribers */ function numSubscribers() public view returns(uint256 numberOfSubscribers) { } /** * Change the RC start block number. * @param _startBlock The start block */ function setStartBlock(uint256 _startBlock) external onlyOwner beforeStart whenReserving { } /** * Change the RC end block number. * @param _endBlock The end block */ function setEndBlock(uint256 _endBlock) external onlyOwner beforeEnd whenReserving { } /** * Change the RC maximum cap. New value shall be at least equal to raisedFunds. * @param _maxCap The RC maximum cap, expressed in wei */ function setMaxCap(uint256 _maxCap) external onlyOwner beforeEnd whenReserving { } /** * Change the minimum deposit for each RC subscriber. New value shall be lower than previous. * @param _minDeposit The minimum deposit for each RC subscriber, expressed in wei */ function setMinDeposit(uint256 _minDeposit) external onlyOwner beforeEnd whenReserving { } /** * Change the maximum number of accepted RC subscribers. New value shall be at least equal to the current * number of subscribers. * @param _maxSubscribers The maximum number of subscribers */ function setMaxSubscribers(uint256 _maxSubscribers) external onlyOwner beforeEnd whenReserving { } /** * Change the ICO crowdsale address. * @param _crowdsale The ICO crowdsale address */ function setCrowdsaleAddress(address _crowdsale) external onlyOwner whenReserving { } /** * Change the maximum whitelist length. New value shall satisfy the #isAllowedWhitelist conditions. * @param _maxWhitelistLength The maximum whitelist length */ function setMaxWhitelistLength(uint256 _maxWhitelistLength) external onlyOwner beforeEnd whenReserving { } /** * Change the whitelist threshold balance. New value shall satisfy the #isAllowedWhitelist conditions. * @param _whitelistThreshold The threshold balance (in wei) above which whitelisting is required to invest */ function setWhitelistThresholdBalance(uint256 _whitelistThreshold) external onlyOwner beforeEnd whenReserving { } /** * Add the subscriber to the whitelist. * @param _subscriber The subscriber to add to the whitelist. */ function addToWhitelist(address _subscriber) external onlyOwner beforeEnd whenReserving { } /** * Removed the subscriber from the whitelist. * @param _subscriber The subscriber to remove from the whitelist. */ function removeFromWhitelist(address _subscriber) external onlyOwner beforeEnd whenReserving { } /** * Abort the contract before the ICO start time. An administrator is allowed to use this 'kill switch' * to deactivate any contract function except the investor refunding. */ function abort() external onlyAdministrator whenReserving { } /** * Let the caller invest its money before the ICO start time. */ function invest() external payable whenReserving { } /** * Execute a batch of multiple bids into the ICO crowdsale. * @param _from The subscriber index, included, from which the batch starts. * @param _to The subscriber index, excluded, to which the batch ends. */ function buy(uint256 _from, uint256 _to) external onlyAdministrator whenReserving { } /** * Refund the invested money to the caller after the RC termination. */ function refund() external whenAborted { } /** * Allow investing by just sending money to the contract address. */ function () external payable whenReserving { } /** * Deposit the money amount for the beneficiary when RC is running. */ function deposit(address beneficiary, uint256 amount) internal { } }
!aborted,"aborted"
349,769
!aborted
"balance not allowed"
/** * A multiple-bid Reservation Contract (RC) for early deposit collection and manual token bid during * the Initial Coin Offering (ICO) crowdsale events. * The RC implements the following spec: * - investors allowed to simply send ethers to the RC address * - investors allowed to get refunded after ICO event if RC failed * - multiple bids using investor addresses performed by owner or authorized administator * - maximum cap on the total balance * - minimum threshold on each subscriber balance * - maximum number of subscribers * - optional whitelist with max deposit threshold for non-whitelisted subscribers * - kill switch callable by owner or authorized administator * - withdraw pattern for refunding * Just the RC owner or an authorized administator is allowed to shutdown the lifecycle halting the * RC; no bounties are provided. */ contract MultipleBidReservation is Administrable, Whitelistable { using SafeMath for uint256; event LogMultipleBidReservationCreated( uint256 indexed startBlock, uint256 indexed endBlock, uint256 maxSubscribers, uint256 maxCap, uint256 minDeposit, uint256 maxWhitelistLength, uint256 indexed whitelistThreshold ); event LogStartBlockChanged(uint256 indexed startBlock); event LogEndBlockChanged(uint256 indexed endBlock); event LogMaxCapChanged(uint256 indexed maxCap); event LogMinDepositChanged(uint256 indexed minDeposit); event LogMaxSubscribersChanged(uint256 indexed maxSubscribers); event LogCrowdsaleAddressChanged(address indexed crowdsale); event LogAbort(address indexed caller); event LogDeposit( address indexed subscriber, uint256 indexed amount, uint256 indexed balance, uint256 raisedFunds ); event LogBuy(address caller, uint256 indexed from, uint256 indexed to); event LogRefund(address indexed subscriber, uint256 indexed amount, uint256 indexed raisedFunds); // The block interval [start, end] where investments are allowed (both inclusive) uint256 public startBlock; uint256 public endBlock; // RC maximum cap (expressed in wei) uint256 public maxCap; // RC minimum balance per subscriber (expressed in wei) uint256 public minDeposit; // RC maximum number of allowed subscribers uint256 public maxSubscribers; // Crowdsale public address TokenSale public crowdsale; // RC current raised balance expressed in wei uint256 public raisedFunds; // ERC20-compliant token issued during ICO ERC20 public token; // Reservation balances (expressed in wei) deposited by each subscriber mapping (address => uint256) public balances; // The list of subscribers in incoming order address[] public subscribers; // Flag indicating if reservation has been forcibly terminated bool public aborted; // The maximum value for whitelist threshold in wei uint256 constant public MAX_WHITELIST_THRESHOLD = 2**256 - 1; modifier beforeStart() { } modifier beforeEnd() { } modifier whenReserving() { } modifier whenAborted() { } constructor( uint256 _startBlock, uint256 _endBlock, uint256 _maxSubscribers, uint256 _maxCap, uint256 _minDeposit, uint256 _maxWhitelistLength, uint256 _whitelistThreshold ) Whitelistable(_maxWhitelistLength, _whitelistThreshold) public { } function hasStarted() public view returns(bool started) { } function hasEnded() public view returns(bool ended) { } /** * @return The current number of RC subscribers */ function numSubscribers() public view returns(uint256 numberOfSubscribers) { } /** * Change the RC start block number. * @param _startBlock The start block */ function setStartBlock(uint256 _startBlock) external onlyOwner beforeStart whenReserving { } /** * Change the RC end block number. * @param _endBlock The end block */ function setEndBlock(uint256 _endBlock) external onlyOwner beforeEnd whenReserving { } /** * Change the RC maximum cap. New value shall be at least equal to raisedFunds. * @param _maxCap The RC maximum cap, expressed in wei */ function setMaxCap(uint256 _maxCap) external onlyOwner beforeEnd whenReserving { } /** * Change the minimum deposit for each RC subscriber. New value shall be lower than previous. * @param _minDeposit The minimum deposit for each RC subscriber, expressed in wei */ function setMinDeposit(uint256 _minDeposit) external onlyOwner beforeEnd whenReserving { } /** * Change the maximum number of accepted RC subscribers. New value shall be at least equal to the current * number of subscribers. * @param _maxSubscribers The maximum number of subscribers */ function setMaxSubscribers(uint256 _maxSubscribers) external onlyOwner beforeEnd whenReserving { } /** * Change the ICO crowdsale address. * @param _crowdsale The ICO crowdsale address */ function setCrowdsaleAddress(address _crowdsale) external onlyOwner whenReserving { } /** * Change the maximum whitelist length. New value shall satisfy the #isAllowedWhitelist conditions. * @param _maxWhitelistLength The maximum whitelist length */ function setMaxWhitelistLength(uint256 _maxWhitelistLength) external onlyOwner beforeEnd whenReserving { } /** * Change the whitelist threshold balance. New value shall satisfy the #isAllowedWhitelist conditions. * @param _whitelistThreshold The threshold balance (in wei) above which whitelisting is required to invest */ function setWhitelistThresholdBalance(uint256 _whitelistThreshold) external onlyOwner beforeEnd whenReserving { } /** * Add the subscriber to the whitelist. * @param _subscriber The subscriber to add to the whitelist. */ function addToWhitelist(address _subscriber) external onlyOwner beforeEnd whenReserving { } /** * Removed the subscriber from the whitelist. * @param _subscriber The subscriber to remove from the whitelist. */ function removeFromWhitelist(address _subscriber) external onlyOwner beforeEnd whenReserving { } /** * Abort the contract before the ICO start time. An administrator is allowed to use this 'kill switch' * to deactivate any contract function except the investor refunding. */ function abort() external onlyAdministrator whenReserving { } /** * Let the caller invest its money before the ICO start time. */ function invest() external payable whenReserving { } /** * Execute a batch of multiple bids into the ICO crowdsale. * @param _from The subscriber index, included, from which the batch starts. * @param _to The subscriber index, excluded, to which the batch ends. */ function buy(uint256 _from, uint256 _to) external onlyAdministrator whenReserving { } /** * Refund the invested money to the caller after the RC termination. */ function refund() external whenAborted { } /** * Allow investing by just sending money to the contract address. */ function () external payable whenReserving { } /** * Deposit the money amount for the beneficiary when RC is running. */ function deposit(address beneficiary, uint256 amount) internal { // Deposit is allowed IFF the RC is currently running require(startBlock <= block.number && block.number <= endBlock, "not open"); uint256 newRaisedFunds = raisedFunds.add(amount); // Deposit is allowed IFF the contract balance will not reach its maximum cap require(newRaisedFunds <= maxCap, "over max cap"); uint256 currentBalance = balances[beneficiary]; uint256 finalBalance = currentBalance.add(amount); // Deposit is allowed IFF investor deposit shall be at least equal to the minimum deposit threshold require(finalBalance >= minDeposit, "deposit < min deposit"); // Balances over whitelist threshold are allowed IFF the sender is in whitelist require(<FILL_ME>) // Increase the subscriber count if sender does not have a balance yet if (currentBalance == 0) { // New subscribers are allowed IFF the contract has not yet the max number of subscribers require(subscribers.length < maxSubscribers, "max subscribers reached"); subscribers.push(beneficiary); } // Add the received amount to the subscriber balance balances[beneficiary] = finalBalance; raisedFunds = newRaisedFunds; emit LogDeposit(beneficiary, amount, finalBalance, newRaisedFunds); } }
isAllowedBalance(beneficiary,finalBalance),"balance not allowed"
349,769
isAllowedBalance(beneficiary,finalBalance)
null
/* @CashQuestBot */ pragma solidity ^ 0.5.11; pragma experimental ABIEncoderV2; contract Dates { uint constant DAY_IN_SECONDS = 86400; function getNow() public view returns(uint) { } function getDelta(uint _date) public view returns(uint) { } } contract EventInterface { event Activation(address indexed user); event FirstActivation(address indexed user); event Refund(address indexed user, uint indexed amount); event LossOfReward(address indexed user, uint indexed amount); event LevelUp(address indexed user, uint indexed level); event AcceptLevel(address indexed user); event ToFund(uint indexed amount); event ToReferrer(address indexed user, uint indexed amount); event HardworkerSeq(address indexed user, uint indexed sequence, uint indexed title); event ComandosSeq(address indexed user, uint indexed sequence, uint indexed title); event EveryDaySeq(address indexed user); event CustomerSeq(address indexed user, uint indexed sequence); event DaredevilSeq(address indexed user, uint indexed sequence, uint indexed achievement); event NovatorSeq(address indexed user, uint indexed sequence, uint indexed achievement); event ScoreConverted(address indexed user, uint indexed eth); event ScoreEarned(address indexed user); } contract Owned { address public owner; address public oracul; uint public cashbox; uint public kickback; uint public rest; address public newOwner; uint public lastTxTime; uint idleTime = 7776000; // 90 days event OwnershipTransferred(address indexed _from, address indexed _to); event OraculChanged(address indexed _oracul); constructor() public { } modifier onlyOwner { } modifier onlyOracul { } function refundFromCashbox() public onlyOwner { } function refundFromKickback() public onlyOwner { } function refundFromRest() public onlyOwner { } function setOracul(address _newOracul) public onlyOwner { } function suicideContract() public onlyOwner { } } contract CashQuestBot is EventInterface, Owned, Dates { uint public Fund; uint public activationPrice = 4000000000000000; uint public activationTime = 28 days; uint public comission = 15; address[] public members; uint public AllScore; struct Hardworker { uint time; uint seq; uint title; } struct Comandos { uint time; uint seq; uint count; uint title; } struct RegularCustomer { uint seq; uint title; } struct Referrals { uint daredevil; uint novator; uint mastermind; uint sensei; uint guru; } struct Info { // level => count mapping(uint => uint) referralsCount; address referrer; uint level; uint line; bool isLevelUp; uint new_level; uint balance; uint score; uint earned; address[] referrals; uint activationEnds; } struct AllTime { uint score; uint scoreConverted; } struct User { Hardworker hardworker; Comandos comandos; RegularCustomer customer; Referrals referrals; Info info; AllTime alltime; } mapping(address => User) users; constructor() public { } // Owner function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } // ACHIEVE HANDLERS function hardworkerPath(address _user) public { } function everyDay(address _user) public { } function comandosPath(address _user) public { } function regularCustomer(address _user) public { } function forDaredevil(address _user) public { } function forNovator(address _user) public { } // Combined calls for referrer function checkReferrerAcv(address _user) public { } // =========== Getters function canSuicide() public view returns(bool) { } function getMembers() public view returns(address[] memory) { } function getMembersCount() public view returns(uint) { } function getHardworker(address _user) public view returns(Hardworker memory) { } function getComandos(address _user) public view returns(Comandos memory) { } function getCustomer(address _user) public view returns(RegularCustomer memory) { } function getReferrals(address _user) public view returns(uint, uint, uint, uint, uint) { } function getScore(address _user) public view returns(uint) { } function getAlltime(address _user) public view returns(uint, uint) { } function getPayAmount(address _user) public view returns(uint) { } function getUser(address user) public view returns (address, uint, uint, uint, address[] memory, uint) { } function getEarned(address user) public view returns (uint) { } function getActivationEnds(address user) public view returns (uint) { } function getReferralsCount(address user, uint level) public view returns (uint) { } function isLevelUp(address user) public view returns (bool) { } function getNewLevel(address user) public view returns (uint) { } // =========== Setters function setActivationPrice(uint _newActivationPrice) public onlyOracul { } // =========== Functions function refund() public { require(<FILL_ME>) uint _comission = users[msg.sender].info.balance / 1000 * comission; uint _balance = users[msg.sender].info.balance - _comission; users[msg.sender].info.balance = 0; msg.sender.transfer(_balance); kickback += _comission; emit Refund(msg.sender, _balance); lastTxTime = now; } function howMuchConverted(address _user) public view returns(uint) { } function exchangeRate() public view returns(uint) { } function convertScore() public returns(uint) { } function calculateReferrerLevel(address referrer, uint referralLevel) internal { } function acceptLevel() public { } function extendActivation(address _user) internal { } function isActive(address _user) public view returns(bool) { } function canPay(address user) public view returns(bool) { } function toFund(uint amount) internal { } // ============== TO REFERRER function toReferrer(address user, uint amount, uint control_level) internal { } // ==================== Pay! function firstPay(address _referrer) public payable { } function pay() public payable { } // ==================== Fallback! function() external payable { } }
users[msg.sender].info.balance>0
349,859
users[msg.sender].info.balance>0
null
/* @CashQuestBot */ pragma solidity ^ 0.5.11; pragma experimental ABIEncoderV2; contract Dates { uint constant DAY_IN_SECONDS = 86400; function getNow() public view returns(uint) { } function getDelta(uint _date) public view returns(uint) { } } contract EventInterface { event Activation(address indexed user); event FirstActivation(address indexed user); event Refund(address indexed user, uint indexed amount); event LossOfReward(address indexed user, uint indexed amount); event LevelUp(address indexed user, uint indexed level); event AcceptLevel(address indexed user); event ToFund(uint indexed amount); event ToReferrer(address indexed user, uint indexed amount); event HardworkerSeq(address indexed user, uint indexed sequence, uint indexed title); event ComandosSeq(address indexed user, uint indexed sequence, uint indexed title); event EveryDaySeq(address indexed user); event CustomerSeq(address indexed user, uint indexed sequence); event DaredevilSeq(address indexed user, uint indexed sequence, uint indexed achievement); event NovatorSeq(address indexed user, uint indexed sequence, uint indexed achievement); event ScoreConverted(address indexed user, uint indexed eth); event ScoreEarned(address indexed user); } contract Owned { address public owner; address public oracul; uint public cashbox; uint public kickback; uint public rest; address public newOwner; uint public lastTxTime; uint idleTime = 7776000; // 90 days event OwnershipTransferred(address indexed _from, address indexed _to); event OraculChanged(address indexed _oracul); constructor() public { } modifier onlyOwner { } modifier onlyOracul { } function refundFromCashbox() public onlyOwner { } function refundFromKickback() public onlyOwner { } function refundFromRest() public onlyOwner { } function setOracul(address _newOracul) public onlyOwner { } function suicideContract() public onlyOwner { } } contract CashQuestBot is EventInterface, Owned, Dates { uint public Fund; uint public activationPrice = 4000000000000000; uint public activationTime = 28 days; uint public comission = 15; address[] public members; uint public AllScore; struct Hardworker { uint time; uint seq; uint title; } struct Comandos { uint time; uint seq; uint count; uint title; } struct RegularCustomer { uint seq; uint title; } struct Referrals { uint daredevil; uint novator; uint mastermind; uint sensei; uint guru; } struct Info { // level => count mapping(uint => uint) referralsCount; address referrer; uint level; uint line; bool isLevelUp; uint new_level; uint balance; uint score; uint earned; address[] referrals; uint activationEnds; } struct AllTime { uint score; uint scoreConverted; } struct User { Hardworker hardworker; Comandos comandos; RegularCustomer customer; Referrals referrals; Info info; AllTime alltime; } mapping(address => User) users; constructor() public { } // Owner function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } // ACHIEVE HANDLERS function hardworkerPath(address _user) public { } function everyDay(address _user) public { } function comandosPath(address _user) public { } function regularCustomer(address _user) public { } function forDaredevil(address _user) public { } function forNovator(address _user) public { } // Combined calls for referrer function checkReferrerAcv(address _user) public { } // =========== Getters function canSuicide() public view returns(bool) { } function getMembers() public view returns(address[] memory) { } function getMembersCount() public view returns(uint) { } function getHardworker(address _user) public view returns(Hardworker memory) { } function getComandos(address _user) public view returns(Comandos memory) { } function getCustomer(address _user) public view returns(RegularCustomer memory) { } function getReferrals(address _user) public view returns(uint, uint, uint, uint, uint) { } function getScore(address _user) public view returns(uint) { } function getAlltime(address _user) public view returns(uint, uint) { } function getPayAmount(address _user) public view returns(uint) { } function getUser(address user) public view returns (address, uint, uint, uint, address[] memory, uint) { } function getEarned(address user) public view returns (uint) { } function getActivationEnds(address user) public view returns (uint) { } function getReferralsCount(address user, uint level) public view returns (uint) { } function isLevelUp(address user) public view returns (bool) { } function getNewLevel(address user) public view returns (uint) { } // =========== Setters function setActivationPrice(uint _newActivationPrice) public onlyOracul { } // =========== Functions function refund() public { } function howMuchConverted(address _user) public view returns(uint) { } function exchangeRate() public view returns(uint) { } function convertScore() public returns(uint) { require(<FILL_ME>) users[msg.sender].alltime.scoreConverted = users[msg.sender].info.score; uint convertedEther = (Fund / AllScore) * users[msg.sender].info.score; users[msg.sender].info.balance += convertedEther; users[msg.sender].info.earned += convertedEther; AllScore -= users[msg.sender].info.score; Fund -= convertedEther; users[msg.sender].info.score = 0; emit ScoreConverted(msg.sender, convertedEther); lastTxTime = now; } function calculateReferrerLevel(address referrer, uint referralLevel) internal { } function acceptLevel() public { } function extendActivation(address _user) internal { } function isActive(address _user) public view returns(bool) { } function canPay(address user) public view returns(bool) { } function toFund(uint amount) internal { } // ============== TO REFERRER function toReferrer(address user, uint amount, uint control_level) internal { } // ==================== Pay! function firstPay(address _referrer) public payable { } function pay() public payable { } // ==================== Fallback! function() external payable { } }
users[msg.sender].info.score>0
349,859
users[msg.sender].info.score>0
null
/* @CashQuestBot */ pragma solidity ^ 0.5.11; pragma experimental ABIEncoderV2; contract Dates { uint constant DAY_IN_SECONDS = 86400; function getNow() public view returns(uint) { } function getDelta(uint _date) public view returns(uint) { } } contract EventInterface { event Activation(address indexed user); event FirstActivation(address indexed user); event Refund(address indexed user, uint indexed amount); event LossOfReward(address indexed user, uint indexed amount); event LevelUp(address indexed user, uint indexed level); event AcceptLevel(address indexed user); event ToFund(uint indexed amount); event ToReferrer(address indexed user, uint indexed amount); event HardworkerSeq(address indexed user, uint indexed sequence, uint indexed title); event ComandosSeq(address indexed user, uint indexed sequence, uint indexed title); event EveryDaySeq(address indexed user); event CustomerSeq(address indexed user, uint indexed sequence); event DaredevilSeq(address indexed user, uint indexed sequence, uint indexed achievement); event NovatorSeq(address indexed user, uint indexed sequence, uint indexed achievement); event ScoreConverted(address indexed user, uint indexed eth); event ScoreEarned(address indexed user); } contract Owned { address public owner; address public oracul; uint public cashbox; uint public kickback; uint public rest; address public newOwner; uint public lastTxTime; uint idleTime = 7776000; // 90 days event OwnershipTransferred(address indexed _from, address indexed _to); event OraculChanged(address indexed _oracul); constructor() public { } modifier onlyOwner { } modifier onlyOracul { } function refundFromCashbox() public onlyOwner { } function refundFromKickback() public onlyOwner { } function refundFromRest() public onlyOwner { } function setOracul(address _newOracul) public onlyOwner { } function suicideContract() public onlyOwner { } } contract CashQuestBot is EventInterface, Owned, Dates { uint public Fund; uint public activationPrice = 4000000000000000; uint public activationTime = 28 days; uint public comission = 15; address[] public members; uint public AllScore; struct Hardworker { uint time; uint seq; uint title; } struct Comandos { uint time; uint seq; uint count; uint title; } struct RegularCustomer { uint seq; uint title; } struct Referrals { uint daredevil; uint novator; uint mastermind; uint sensei; uint guru; } struct Info { // level => count mapping(uint => uint) referralsCount; address referrer; uint level; uint line; bool isLevelUp; uint new_level; uint balance; uint score; uint earned; address[] referrals; uint activationEnds; } struct AllTime { uint score; uint scoreConverted; } struct User { Hardworker hardworker; Comandos comandos; RegularCustomer customer; Referrals referrals; Info info; AllTime alltime; } mapping(address => User) users; constructor() public { } // Owner function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } // ACHIEVE HANDLERS function hardworkerPath(address _user) public { } function everyDay(address _user) public { } function comandosPath(address _user) public { } function regularCustomer(address _user) public { } function forDaredevil(address _user) public { } function forNovator(address _user) public { } // Combined calls for referrer function checkReferrerAcv(address _user) public { } // =========== Getters function canSuicide() public view returns(bool) { } function getMembers() public view returns(address[] memory) { } function getMembersCount() public view returns(uint) { } function getHardworker(address _user) public view returns(Hardworker memory) { } function getComandos(address _user) public view returns(Comandos memory) { } function getCustomer(address _user) public view returns(RegularCustomer memory) { } function getReferrals(address _user) public view returns(uint, uint, uint, uint, uint) { } function getScore(address _user) public view returns(uint) { } function getAlltime(address _user) public view returns(uint, uint) { } function getPayAmount(address _user) public view returns(uint) { } function getUser(address user) public view returns (address, uint, uint, uint, address[] memory, uint) { } function getEarned(address user) public view returns (uint) { } function getActivationEnds(address user) public view returns (uint) { } function getReferralsCount(address user, uint level) public view returns (uint) { } function isLevelUp(address user) public view returns (bool) { } function getNewLevel(address user) public view returns (uint) { } // =========== Setters function setActivationPrice(uint _newActivationPrice) public onlyOracul { } // =========== Functions function refund() public { } function howMuchConverted(address _user) public view returns(uint) { } function exchangeRate() public view returns(uint) { } function convertScore() public returns(uint) { } function calculateReferrerLevel(address referrer, uint referralLevel) internal { } function acceptLevel() public { require(<FILL_ME>) require(users[msg.sender].info.isLevelUp == true); users[msg.sender].info.isLevelUp = false; users[msg.sender].info.level = users[msg.sender].info.new_level; // Change state of referrer if (users[msg.sender].info.level == 2) { forNovator(users[msg.sender].info.referrer); } calculateReferrerLevel(users[msg.sender].info.referrer, users[msg.sender].info.level); users[msg.sender].info.score += 100; AllScore += 100; emit ScoreEarned(msg.sender); emit AcceptLevel(msg.sender); lastTxTime = now; } function extendActivation(address _user) internal { } function isActive(address _user) public view returns(bool) { } function canPay(address user) public view returns(bool) { } function toFund(uint amount) internal { } // ============== TO REFERRER function toReferrer(address user, uint amount, uint control_level) internal { } // ==================== Pay! function firstPay(address _referrer) public payable { } function pay() public payable { } // ==================== Fallback! function() external payable { } }
isActive(msg.sender)==true
349,859
isActive(msg.sender)==true
null
/* @CashQuestBot */ pragma solidity ^ 0.5.11; pragma experimental ABIEncoderV2; contract Dates { uint constant DAY_IN_SECONDS = 86400; function getNow() public view returns(uint) { } function getDelta(uint _date) public view returns(uint) { } } contract EventInterface { event Activation(address indexed user); event FirstActivation(address indexed user); event Refund(address indexed user, uint indexed amount); event LossOfReward(address indexed user, uint indexed amount); event LevelUp(address indexed user, uint indexed level); event AcceptLevel(address indexed user); event ToFund(uint indexed amount); event ToReferrer(address indexed user, uint indexed amount); event HardworkerSeq(address indexed user, uint indexed sequence, uint indexed title); event ComandosSeq(address indexed user, uint indexed sequence, uint indexed title); event EveryDaySeq(address indexed user); event CustomerSeq(address indexed user, uint indexed sequence); event DaredevilSeq(address indexed user, uint indexed sequence, uint indexed achievement); event NovatorSeq(address indexed user, uint indexed sequence, uint indexed achievement); event ScoreConverted(address indexed user, uint indexed eth); event ScoreEarned(address indexed user); } contract Owned { address public owner; address public oracul; uint public cashbox; uint public kickback; uint public rest; address public newOwner; uint public lastTxTime; uint idleTime = 7776000; // 90 days event OwnershipTransferred(address indexed _from, address indexed _to); event OraculChanged(address indexed _oracul); constructor() public { } modifier onlyOwner { } modifier onlyOracul { } function refundFromCashbox() public onlyOwner { } function refundFromKickback() public onlyOwner { } function refundFromRest() public onlyOwner { } function setOracul(address _newOracul) public onlyOwner { } function suicideContract() public onlyOwner { } } contract CashQuestBot is EventInterface, Owned, Dates { uint public Fund; uint public activationPrice = 4000000000000000; uint public activationTime = 28 days; uint public comission = 15; address[] public members; uint public AllScore; struct Hardworker { uint time; uint seq; uint title; } struct Comandos { uint time; uint seq; uint count; uint title; } struct RegularCustomer { uint seq; uint title; } struct Referrals { uint daredevil; uint novator; uint mastermind; uint sensei; uint guru; } struct Info { // level => count mapping(uint => uint) referralsCount; address referrer; uint level; uint line; bool isLevelUp; uint new_level; uint balance; uint score; uint earned; address[] referrals; uint activationEnds; } struct AllTime { uint score; uint scoreConverted; } struct User { Hardworker hardworker; Comandos comandos; RegularCustomer customer; Referrals referrals; Info info; AllTime alltime; } mapping(address => User) users; constructor() public { } // Owner function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } // ACHIEVE HANDLERS function hardworkerPath(address _user) public { } function everyDay(address _user) public { } function comandosPath(address _user) public { } function regularCustomer(address _user) public { } function forDaredevil(address _user) public { } function forNovator(address _user) public { } // Combined calls for referrer function checkReferrerAcv(address _user) public { } // =========== Getters function canSuicide() public view returns(bool) { } function getMembers() public view returns(address[] memory) { } function getMembersCount() public view returns(uint) { } function getHardworker(address _user) public view returns(Hardworker memory) { } function getComandos(address _user) public view returns(Comandos memory) { } function getCustomer(address _user) public view returns(RegularCustomer memory) { } function getReferrals(address _user) public view returns(uint, uint, uint, uint, uint) { } function getScore(address _user) public view returns(uint) { } function getAlltime(address _user) public view returns(uint, uint) { } function getPayAmount(address _user) public view returns(uint) { } function getUser(address user) public view returns (address, uint, uint, uint, address[] memory, uint) { } function getEarned(address user) public view returns (uint) { } function getActivationEnds(address user) public view returns (uint) { } function getReferralsCount(address user, uint level) public view returns (uint) { } function isLevelUp(address user) public view returns (bool) { } function getNewLevel(address user) public view returns (uint) { } // =========== Setters function setActivationPrice(uint _newActivationPrice) public onlyOracul { } // =========== Functions function refund() public { } function howMuchConverted(address _user) public view returns(uint) { } function exchangeRate() public view returns(uint) { } function convertScore() public returns(uint) { } function calculateReferrerLevel(address referrer, uint referralLevel) internal { } function acceptLevel() public { require(isActive(msg.sender) == true); require(<FILL_ME>) users[msg.sender].info.isLevelUp = false; users[msg.sender].info.level = users[msg.sender].info.new_level; // Change state of referrer if (users[msg.sender].info.level == 2) { forNovator(users[msg.sender].info.referrer); } calculateReferrerLevel(users[msg.sender].info.referrer, users[msg.sender].info.level); users[msg.sender].info.score += 100; AllScore += 100; emit ScoreEarned(msg.sender); emit AcceptLevel(msg.sender); lastTxTime = now; } function extendActivation(address _user) internal { } function isActive(address _user) public view returns(bool) { } function canPay(address user) public view returns(bool) { } function toFund(uint amount) internal { } // ============== TO REFERRER function toReferrer(address user, uint amount, uint control_level) internal { } // ==================== Pay! function firstPay(address _referrer) public payable { } function pay() public payable { } // ==================== Fallback! function() external payable { } }
users[msg.sender].info.isLevelUp==true
349,859
users[msg.sender].info.isLevelUp==true
null
/* @CashQuestBot */ pragma solidity ^ 0.5.11; pragma experimental ABIEncoderV2; contract Dates { uint constant DAY_IN_SECONDS = 86400; function getNow() public view returns(uint) { } function getDelta(uint _date) public view returns(uint) { } } contract EventInterface { event Activation(address indexed user); event FirstActivation(address indexed user); event Refund(address indexed user, uint indexed amount); event LossOfReward(address indexed user, uint indexed amount); event LevelUp(address indexed user, uint indexed level); event AcceptLevel(address indexed user); event ToFund(uint indexed amount); event ToReferrer(address indexed user, uint indexed amount); event HardworkerSeq(address indexed user, uint indexed sequence, uint indexed title); event ComandosSeq(address indexed user, uint indexed sequence, uint indexed title); event EveryDaySeq(address indexed user); event CustomerSeq(address indexed user, uint indexed sequence); event DaredevilSeq(address indexed user, uint indexed sequence, uint indexed achievement); event NovatorSeq(address indexed user, uint indexed sequence, uint indexed achievement); event ScoreConverted(address indexed user, uint indexed eth); event ScoreEarned(address indexed user); } contract Owned { address public owner; address public oracul; uint public cashbox; uint public kickback; uint public rest; address public newOwner; uint public lastTxTime; uint idleTime = 7776000; // 90 days event OwnershipTransferred(address indexed _from, address indexed _to); event OraculChanged(address indexed _oracul); constructor() public { } modifier onlyOwner { } modifier onlyOracul { } function refundFromCashbox() public onlyOwner { } function refundFromKickback() public onlyOwner { } function refundFromRest() public onlyOwner { } function setOracul(address _newOracul) public onlyOwner { } function suicideContract() public onlyOwner { } } contract CashQuestBot is EventInterface, Owned, Dates { uint public Fund; uint public activationPrice = 4000000000000000; uint public activationTime = 28 days; uint public comission = 15; address[] public members; uint public AllScore; struct Hardworker { uint time; uint seq; uint title; } struct Comandos { uint time; uint seq; uint count; uint title; } struct RegularCustomer { uint seq; uint title; } struct Referrals { uint daredevil; uint novator; uint mastermind; uint sensei; uint guru; } struct Info { // level => count mapping(uint => uint) referralsCount; address referrer; uint level; uint line; bool isLevelUp; uint new_level; uint balance; uint score; uint earned; address[] referrals; uint activationEnds; } struct AllTime { uint score; uint scoreConverted; } struct User { Hardworker hardworker; Comandos comandos; RegularCustomer customer; Referrals referrals; Info info; AllTime alltime; } mapping(address => User) users; constructor() public { } // Owner function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } // ACHIEVE HANDLERS function hardworkerPath(address _user) public { } function everyDay(address _user) public { } function comandosPath(address _user) public { } function regularCustomer(address _user) public { } function forDaredevil(address _user) public { } function forNovator(address _user) public { } // Combined calls for referrer function checkReferrerAcv(address _user) public { } // =========== Getters function canSuicide() public view returns(bool) { } function getMembers() public view returns(address[] memory) { } function getMembersCount() public view returns(uint) { } function getHardworker(address _user) public view returns(Hardworker memory) { } function getComandos(address _user) public view returns(Comandos memory) { } function getCustomer(address _user) public view returns(RegularCustomer memory) { } function getReferrals(address _user) public view returns(uint, uint, uint, uint, uint) { } function getScore(address _user) public view returns(uint) { } function getAlltime(address _user) public view returns(uint, uint) { } function getPayAmount(address _user) public view returns(uint) { } function getUser(address user) public view returns (address, uint, uint, uint, address[] memory, uint) { } function getEarned(address user) public view returns (uint) { } function getActivationEnds(address user) public view returns (uint) { } function getReferralsCount(address user, uint level) public view returns (uint) { } function isLevelUp(address user) public view returns (bool) { } function getNewLevel(address user) public view returns (uint) { } // =========== Setters function setActivationPrice(uint _newActivationPrice) public onlyOracul { } // =========== Functions function refund() public { } function howMuchConverted(address _user) public view returns(uint) { } function exchangeRate() public view returns(uint) { } function convertScore() public returns(uint) { } function calculateReferrerLevel(address referrer, uint referralLevel) internal { } function acceptLevel() public { } function extendActivation(address _user) internal { } function isActive(address _user) public view returns(bool) { } function canPay(address user) public view returns(bool) { } function toFund(uint amount) internal { } // ============== TO REFERRER function toReferrer(address user, uint amount, uint control_level) internal { } // ==================== Pay! function firstPay(address _referrer) public payable { require(<FILL_ME>) require(users[_referrer].info.line > 0); members.push(msg.sender); users[msg.sender].info.referrer = _referrer; users[msg.sender].info.line = users[_referrer].info.line + 1; users[msg.sender].info.activationEnds = 3 days; users[msg.sender].info.new_level = 0; users[_referrer].info.referrals.push(msg.sender); users[msg.sender].hardworker.time = 0; users[msg.sender].hardworker.seq = 0; users[msg.sender].hardworker.title = 0; users[msg.sender].comandos.time = 0; users[msg.sender].comandos.seq = 0; users[msg.sender].comandos.count = 0; users[msg.sender].comandos.title = 0; users[msg.sender].customer.seq = 0; users[msg.sender].customer.title = 0; users[msg.sender].referrals.daredevil = 0; users[msg.sender].referrals.novator = 0; // Is msg.value correct if (users[msg.sender].info.earned / 100 * 10 > activationPrice) { if (msg.value != users[msg.sender].info.earned / 100 * 10) { revert(); } } else { if (msg.value != activationPrice) { revert(); } } // Is activation needed? if (canPay(msg.sender) == false) { revert(); } // Its just another activation(prolongation) users[msg.sender].info.earned = 0; // Extend activation series extendActivation(msg.sender); if (users[msg.sender].info.line == 2) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toFund(msg.value / 100 * 30 + msg.value / 100 * 20 + msg.value / 100 * 10); } if (users[msg.sender].info.line == 3) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toReferrer(users[users[msg.sender].info.referrer].info.referrer, msg.value / 100 * 30, 2); toFund(msg.value / 100 * 20 + msg.value / 100 * 10); } if (users[msg.sender].info.line == 4) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toReferrer(users[users[msg.sender].info.referrer].info.referrer, msg.value / 100 * 30, 2); toReferrer(users[users[users[msg.sender].info.referrer].info.referrer].info.referrer, msg.value / 100 * 20, 3); toFund(msg.value / 100 * 10); } if (users[msg.sender].info.line >= 5) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toReferrer(users[users[msg.sender].info.referrer].info.referrer, msg.value / 100 * 30, 2); toReferrer(users[users[users[msg.sender].info.referrer].info.referrer].info.referrer, msg.value / 100 * 20, 3); toReferrer(users[users[users[users[msg.sender].info.referrer].info.referrer].info.referrer].info.referrer, msg.value / 100 * 10, 4); } calculateReferrerLevel(users[msg.sender].info.referrer, 1); checkReferrerAcv(users[msg.sender].info.referrer); emit FirstActivation(msg.sender); emit AcceptLevel(msg.sender); lastTxTime = now; } function pay() public payable { } // ==================== Fallback! function() external payable { } }
users[msg.sender].info.line==0
349,859
users[msg.sender].info.line==0
null
/* @CashQuestBot */ pragma solidity ^ 0.5.11; pragma experimental ABIEncoderV2; contract Dates { uint constant DAY_IN_SECONDS = 86400; function getNow() public view returns(uint) { } function getDelta(uint _date) public view returns(uint) { } } contract EventInterface { event Activation(address indexed user); event FirstActivation(address indexed user); event Refund(address indexed user, uint indexed amount); event LossOfReward(address indexed user, uint indexed amount); event LevelUp(address indexed user, uint indexed level); event AcceptLevel(address indexed user); event ToFund(uint indexed amount); event ToReferrer(address indexed user, uint indexed amount); event HardworkerSeq(address indexed user, uint indexed sequence, uint indexed title); event ComandosSeq(address indexed user, uint indexed sequence, uint indexed title); event EveryDaySeq(address indexed user); event CustomerSeq(address indexed user, uint indexed sequence); event DaredevilSeq(address indexed user, uint indexed sequence, uint indexed achievement); event NovatorSeq(address indexed user, uint indexed sequence, uint indexed achievement); event ScoreConverted(address indexed user, uint indexed eth); event ScoreEarned(address indexed user); } contract Owned { address public owner; address public oracul; uint public cashbox; uint public kickback; uint public rest; address public newOwner; uint public lastTxTime; uint idleTime = 7776000; // 90 days event OwnershipTransferred(address indexed _from, address indexed _to); event OraculChanged(address indexed _oracul); constructor() public { } modifier onlyOwner { } modifier onlyOracul { } function refundFromCashbox() public onlyOwner { } function refundFromKickback() public onlyOwner { } function refundFromRest() public onlyOwner { } function setOracul(address _newOracul) public onlyOwner { } function suicideContract() public onlyOwner { } } contract CashQuestBot is EventInterface, Owned, Dates { uint public Fund; uint public activationPrice = 4000000000000000; uint public activationTime = 28 days; uint public comission = 15; address[] public members; uint public AllScore; struct Hardworker { uint time; uint seq; uint title; } struct Comandos { uint time; uint seq; uint count; uint title; } struct RegularCustomer { uint seq; uint title; } struct Referrals { uint daredevil; uint novator; uint mastermind; uint sensei; uint guru; } struct Info { // level => count mapping(uint => uint) referralsCount; address referrer; uint level; uint line; bool isLevelUp; uint new_level; uint balance; uint score; uint earned; address[] referrals; uint activationEnds; } struct AllTime { uint score; uint scoreConverted; } struct User { Hardworker hardworker; Comandos comandos; RegularCustomer customer; Referrals referrals; Info info; AllTime alltime; } mapping(address => User) users; constructor() public { } // Owner function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } // ACHIEVE HANDLERS function hardworkerPath(address _user) public { } function everyDay(address _user) public { } function comandosPath(address _user) public { } function regularCustomer(address _user) public { } function forDaredevil(address _user) public { } function forNovator(address _user) public { } // Combined calls for referrer function checkReferrerAcv(address _user) public { } // =========== Getters function canSuicide() public view returns(bool) { } function getMembers() public view returns(address[] memory) { } function getMembersCount() public view returns(uint) { } function getHardworker(address _user) public view returns(Hardworker memory) { } function getComandos(address _user) public view returns(Comandos memory) { } function getCustomer(address _user) public view returns(RegularCustomer memory) { } function getReferrals(address _user) public view returns(uint, uint, uint, uint, uint) { } function getScore(address _user) public view returns(uint) { } function getAlltime(address _user) public view returns(uint, uint) { } function getPayAmount(address _user) public view returns(uint) { } function getUser(address user) public view returns (address, uint, uint, uint, address[] memory, uint) { } function getEarned(address user) public view returns (uint) { } function getActivationEnds(address user) public view returns (uint) { } function getReferralsCount(address user, uint level) public view returns (uint) { } function isLevelUp(address user) public view returns (bool) { } function getNewLevel(address user) public view returns (uint) { } // =========== Setters function setActivationPrice(uint _newActivationPrice) public onlyOracul { } // =========== Functions function refund() public { } function howMuchConverted(address _user) public view returns(uint) { } function exchangeRate() public view returns(uint) { } function convertScore() public returns(uint) { } function calculateReferrerLevel(address referrer, uint referralLevel) internal { } function acceptLevel() public { } function extendActivation(address _user) internal { } function isActive(address _user) public view returns(bool) { } function canPay(address user) public view returns(bool) { } function toFund(uint amount) internal { } // ============== TO REFERRER function toReferrer(address user, uint amount, uint control_level) internal { } // ==================== Pay! function firstPay(address _referrer) public payable { require(users[msg.sender].info.line == 0); require(<FILL_ME>) members.push(msg.sender); users[msg.sender].info.referrer = _referrer; users[msg.sender].info.line = users[_referrer].info.line + 1; users[msg.sender].info.activationEnds = 3 days; users[msg.sender].info.new_level = 0; users[_referrer].info.referrals.push(msg.sender); users[msg.sender].hardworker.time = 0; users[msg.sender].hardworker.seq = 0; users[msg.sender].hardworker.title = 0; users[msg.sender].comandos.time = 0; users[msg.sender].comandos.seq = 0; users[msg.sender].comandos.count = 0; users[msg.sender].comandos.title = 0; users[msg.sender].customer.seq = 0; users[msg.sender].customer.title = 0; users[msg.sender].referrals.daredevil = 0; users[msg.sender].referrals.novator = 0; // Is msg.value correct if (users[msg.sender].info.earned / 100 * 10 > activationPrice) { if (msg.value != users[msg.sender].info.earned / 100 * 10) { revert(); } } else { if (msg.value != activationPrice) { revert(); } } // Is activation needed? if (canPay(msg.sender) == false) { revert(); } // Its just another activation(prolongation) users[msg.sender].info.earned = 0; // Extend activation series extendActivation(msg.sender); if (users[msg.sender].info.line == 2) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toFund(msg.value / 100 * 30 + msg.value / 100 * 20 + msg.value / 100 * 10); } if (users[msg.sender].info.line == 3) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toReferrer(users[users[msg.sender].info.referrer].info.referrer, msg.value / 100 * 30, 2); toFund(msg.value / 100 * 20 + msg.value / 100 * 10); } if (users[msg.sender].info.line == 4) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toReferrer(users[users[msg.sender].info.referrer].info.referrer, msg.value / 100 * 30, 2); toReferrer(users[users[users[msg.sender].info.referrer].info.referrer].info.referrer, msg.value / 100 * 20, 3); toFund(msg.value / 100 * 10); } if (users[msg.sender].info.line >= 5) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toReferrer(users[users[msg.sender].info.referrer].info.referrer, msg.value / 100 * 30, 2); toReferrer(users[users[users[msg.sender].info.referrer].info.referrer].info.referrer, msg.value / 100 * 20, 3); toReferrer(users[users[users[users[msg.sender].info.referrer].info.referrer].info.referrer].info.referrer, msg.value / 100 * 10, 4); } calculateReferrerLevel(users[msg.sender].info.referrer, 1); checkReferrerAcv(users[msg.sender].info.referrer); emit FirstActivation(msg.sender); emit AcceptLevel(msg.sender); lastTxTime = now; } function pay() public payable { } // ==================== Fallback! function() external payable { } }
users[_referrer].info.line>0
349,859
users[_referrer].info.line>0
null
pragma solidity ^0.4.18; contract ERC20Interface { // Events --------------------------- event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); // Functions ------------------------ function totalSupply() constant returns (uint); function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _from, address _to, uint _value) returns (bool success); function approve(address _spender, uint _value) returns (bool success); function allowance(address _owner, address _spender) constant returns (uint remaining); } 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 TriipBooking is ERC20Interface { using SafeMath for uint256; uint public constant _totalSupply = 50 * 10 ** 24; string public constant name = "TriipBooking"; string public constant symbol = "TRP"; uint8 public constant decimals = 18; mapping(address => uint256) balances; mapping(address => mapping(address=>uint256)) allowed; uint256 public constant developmentTokens = 15 * 10 ** 24; uint256 public constant bountyTokens = 2.5 * 10 ** 24; address public constant developmentTokensWallet = 0x2De3a11A5C1397CeFeA81D844C3173629e19a630; address public constant bountyTokensWallet = 0x7E2435A1780a7E4949C059045754a98894215665; uint public constant startTime = 1516406400; uint public constant endTime = 1520899140; uint256 public constant icoTokens = 32.5 * 10 ** 24; uint256 public totalCrowdsale; address public owner; function TriipBooking() { } function () payable { } function createTokens() public payable { uint ts = atNow(); require(msg.value > 0 ); require(ts < endTime ); require(ts >= startTime ); uint256 tokens = msg.value.mul(getConversionRate()); require(<FILL_ME>) balances[msg.sender] = balances[msg.sender].add(tokens); Transfer(address(0), msg.sender, tokens); totalCrowdsale = totalCrowdsale.add(tokens); owner.transfer(msg.value); } function totalSupply() constant returns (uint256 totalSupply) { } function balanceOf(address _owner) constant returns (uint256 balance) { } function transfer(address _to, uint256 _value) returns (bool success){ } function transferFrom(address _from, address _to, uint256 _value) returns (bool success){ } function approve(address _spender, uint256 _value) returns (bool success){ } function allowance(address _owner, address _spender) constant returns (uint256 remaining){ } event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); function getConversionRate() public constant returns (uint256) { } function validPurchase(uint256 _value, uint256 _tokens) internal constant returns (bool) { } function atNow() constant public returns (uint) { } }
validPurchase(msg.value,tokens)
349,868
validPurchase(msg.value,tokens)
"voting start time greater than end time"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { uint256 numberOfWinners = _rewardSplit.length; uint256 startTime = _competitionParams[0]; if (startTime == 0) { // solhint-disable-next-line not-rely-on-time startTime = now; } // solhint-disable-next-line not-rely-on-time require(startTime >= now, "startTime should be greater than proposing time"); require(numberOfWinners <= MAX_NUMBER_OF_WINNERS, "number of winners greater than max allowed"); require(<FILL_ME>) require(_competitionParams[1] >= startTime, "voting start time smaller than start time"); require(_competitionParams[3] > 0, "maxNumberOfVotesPerVoter should be greater than 0"); require(_competitionParams[4] <= _competitionParams[2], "suggestionsEndTime should be earlier than proposal end time"); require(_competitionParams[4] > startTime, "suggestionsEndTime should be later than proposal start time"); uint256 totalRewardSplit; for (uint256 i = 0; i < numberOfWinners; i++) { totalRewardSplit = totalRewardSplit.add(_rewardSplit[i]); } require(totalRewardSplit == 100, "total rewards split is not 100%"); proposalId = ContributionRewardExt(contributionRewardExt).proposeContributionReward( _descriptionHash, _reputationChange, _rewards, _externalToken, contributionRewardExt, msg.sender); proposals[proposalId].numberOfWinners = numberOfWinners; proposals[proposalId].rewardSplit = _rewardSplit; proposals[proposalId].startTime = startTime; proposals[proposalId].votingStartTime = _competitionParams[1]; proposals[proposalId].endTime = _competitionParams[2]; proposals[proposalId].maxNumberOfVotesPerVoter = _competitionParams[3]; proposals[proposalId].suggestionsEndTime = _competitionParams[4]; proposals[proposalId].reputationReward = uint256(_reputationChange); proposals[proposalId].nativeTokenReward = _rewards[0]; proposals[proposalId].ethReward = _rewards[1]; proposals[proposalId].externalTokenReward = _rewards[2]; emit NewCompetitionProposal( proposalId, numberOfWinners, proposals[proposalId].rewardSplit, startTime, proposals[proposalId].votingStartTime, proposals[proposalId].suggestionsEndTime, proposals[proposalId].endTime, proposals[proposalId].maxNumberOfVotesPerVoter, contributionRewardExt ); } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
_competitionParams[1]<_competitionParams[2],"voting start time greater than end time"
350,120
_competitionParams[1]<_competitionParams[2]
"voting start time smaller than start time"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { uint256 numberOfWinners = _rewardSplit.length; uint256 startTime = _competitionParams[0]; if (startTime == 0) { // solhint-disable-next-line not-rely-on-time startTime = now; } // solhint-disable-next-line not-rely-on-time require(startTime >= now, "startTime should be greater than proposing time"); require(numberOfWinners <= MAX_NUMBER_OF_WINNERS, "number of winners greater than max allowed"); require(_competitionParams[1] < _competitionParams[2], "voting start time greater than end time"); require(<FILL_ME>) require(_competitionParams[3] > 0, "maxNumberOfVotesPerVoter should be greater than 0"); require(_competitionParams[4] <= _competitionParams[2], "suggestionsEndTime should be earlier than proposal end time"); require(_competitionParams[4] > startTime, "suggestionsEndTime should be later than proposal start time"); uint256 totalRewardSplit; for (uint256 i = 0; i < numberOfWinners; i++) { totalRewardSplit = totalRewardSplit.add(_rewardSplit[i]); } require(totalRewardSplit == 100, "total rewards split is not 100%"); proposalId = ContributionRewardExt(contributionRewardExt).proposeContributionReward( _descriptionHash, _reputationChange, _rewards, _externalToken, contributionRewardExt, msg.sender); proposals[proposalId].numberOfWinners = numberOfWinners; proposals[proposalId].rewardSplit = _rewardSplit; proposals[proposalId].startTime = startTime; proposals[proposalId].votingStartTime = _competitionParams[1]; proposals[proposalId].endTime = _competitionParams[2]; proposals[proposalId].maxNumberOfVotesPerVoter = _competitionParams[3]; proposals[proposalId].suggestionsEndTime = _competitionParams[4]; proposals[proposalId].reputationReward = uint256(_reputationChange); proposals[proposalId].nativeTokenReward = _rewards[0]; proposals[proposalId].ethReward = _rewards[1]; proposals[proposalId].externalTokenReward = _rewards[2]; emit NewCompetitionProposal( proposalId, numberOfWinners, proposals[proposalId].rewardSplit, startTime, proposals[proposalId].votingStartTime, proposals[proposalId].suggestionsEndTime, proposals[proposalId].endTime, proposals[proposalId].maxNumberOfVotesPerVoter, contributionRewardExt ); } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
_competitionParams[1]>=startTime,"voting start time smaller than start time"
350,120
_competitionParams[1]>=startTime
"maxNumberOfVotesPerVoter should be greater than 0"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { uint256 numberOfWinners = _rewardSplit.length; uint256 startTime = _competitionParams[0]; if (startTime == 0) { // solhint-disable-next-line not-rely-on-time startTime = now; } // solhint-disable-next-line not-rely-on-time require(startTime >= now, "startTime should be greater than proposing time"); require(numberOfWinners <= MAX_NUMBER_OF_WINNERS, "number of winners greater than max allowed"); require(_competitionParams[1] < _competitionParams[2], "voting start time greater than end time"); require(_competitionParams[1] >= startTime, "voting start time smaller than start time"); require(<FILL_ME>) require(_competitionParams[4] <= _competitionParams[2], "suggestionsEndTime should be earlier than proposal end time"); require(_competitionParams[4] > startTime, "suggestionsEndTime should be later than proposal start time"); uint256 totalRewardSplit; for (uint256 i = 0; i < numberOfWinners; i++) { totalRewardSplit = totalRewardSplit.add(_rewardSplit[i]); } require(totalRewardSplit == 100, "total rewards split is not 100%"); proposalId = ContributionRewardExt(contributionRewardExt).proposeContributionReward( _descriptionHash, _reputationChange, _rewards, _externalToken, contributionRewardExt, msg.sender); proposals[proposalId].numberOfWinners = numberOfWinners; proposals[proposalId].rewardSplit = _rewardSplit; proposals[proposalId].startTime = startTime; proposals[proposalId].votingStartTime = _competitionParams[1]; proposals[proposalId].endTime = _competitionParams[2]; proposals[proposalId].maxNumberOfVotesPerVoter = _competitionParams[3]; proposals[proposalId].suggestionsEndTime = _competitionParams[4]; proposals[proposalId].reputationReward = uint256(_reputationChange); proposals[proposalId].nativeTokenReward = _rewards[0]; proposals[proposalId].ethReward = _rewards[1]; proposals[proposalId].externalTokenReward = _rewards[2]; emit NewCompetitionProposal( proposalId, numberOfWinners, proposals[proposalId].rewardSplit, startTime, proposals[proposalId].votingStartTime, proposals[proposalId].suggestionsEndTime, proposals[proposalId].endTime, proposals[proposalId].maxNumberOfVotesPerVoter, contributionRewardExt ); } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
_competitionParams[3]>0,"maxNumberOfVotesPerVoter should be greater than 0"
350,120
_competitionParams[3]>0
"suggestionsEndTime should be earlier than proposal end time"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { uint256 numberOfWinners = _rewardSplit.length; uint256 startTime = _competitionParams[0]; if (startTime == 0) { // solhint-disable-next-line not-rely-on-time startTime = now; } // solhint-disable-next-line not-rely-on-time require(startTime >= now, "startTime should be greater than proposing time"); require(numberOfWinners <= MAX_NUMBER_OF_WINNERS, "number of winners greater than max allowed"); require(_competitionParams[1] < _competitionParams[2], "voting start time greater than end time"); require(_competitionParams[1] >= startTime, "voting start time smaller than start time"); require(_competitionParams[3] > 0, "maxNumberOfVotesPerVoter should be greater than 0"); require(<FILL_ME>) require(_competitionParams[4] > startTime, "suggestionsEndTime should be later than proposal start time"); uint256 totalRewardSplit; for (uint256 i = 0; i < numberOfWinners; i++) { totalRewardSplit = totalRewardSplit.add(_rewardSplit[i]); } require(totalRewardSplit == 100, "total rewards split is not 100%"); proposalId = ContributionRewardExt(contributionRewardExt).proposeContributionReward( _descriptionHash, _reputationChange, _rewards, _externalToken, contributionRewardExt, msg.sender); proposals[proposalId].numberOfWinners = numberOfWinners; proposals[proposalId].rewardSplit = _rewardSplit; proposals[proposalId].startTime = startTime; proposals[proposalId].votingStartTime = _competitionParams[1]; proposals[proposalId].endTime = _competitionParams[2]; proposals[proposalId].maxNumberOfVotesPerVoter = _competitionParams[3]; proposals[proposalId].suggestionsEndTime = _competitionParams[4]; proposals[proposalId].reputationReward = uint256(_reputationChange); proposals[proposalId].nativeTokenReward = _rewards[0]; proposals[proposalId].ethReward = _rewards[1]; proposals[proposalId].externalTokenReward = _rewards[2]; emit NewCompetitionProposal( proposalId, numberOfWinners, proposals[proposalId].rewardSplit, startTime, proposals[proposalId].votingStartTime, proposals[proposalId].suggestionsEndTime, proposals[proposalId].endTime, proposals[proposalId].maxNumberOfVotesPerVoter, contributionRewardExt ); } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
_competitionParams[4]<=_competitionParams[2],"suggestionsEndTime should be earlier than proposal end time"
350,120
_competitionParams[4]<=_competitionParams[2]
"suggestionsEndTime should be later than proposal start time"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { uint256 numberOfWinners = _rewardSplit.length; uint256 startTime = _competitionParams[0]; if (startTime == 0) { // solhint-disable-next-line not-rely-on-time startTime = now; } // solhint-disable-next-line not-rely-on-time require(startTime >= now, "startTime should be greater than proposing time"); require(numberOfWinners <= MAX_NUMBER_OF_WINNERS, "number of winners greater than max allowed"); require(_competitionParams[1] < _competitionParams[2], "voting start time greater than end time"); require(_competitionParams[1] >= startTime, "voting start time smaller than start time"); require(_competitionParams[3] > 0, "maxNumberOfVotesPerVoter should be greater than 0"); require(_competitionParams[4] <= _competitionParams[2], "suggestionsEndTime should be earlier than proposal end time"); require(<FILL_ME>) uint256 totalRewardSplit; for (uint256 i = 0; i < numberOfWinners; i++) { totalRewardSplit = totalRewardSplit.add(_rewardSplit[i]); } require(totalRewardSplit == 100, "total rewards split is not 100%"); proposalId = ContributionRewardExt(contributionRewardExt).proposeContributionReward( _descriptionHash, _reputationChange, _rewards, _externalToken, contributionRewardExt, msg.sender); proposals[proposalId].numberOfWinners = numberOfWinners; proposals[proposalId].rewardSplit = _rewardSplit; proposals[proposalId].startTime = startTime; proposals[proposalId].votingStartTime = _competitionParams[1]; proposals[proposalId].endTime = _competitionParams[2]; proposals[proposalId].maxNumberOfVotesPerVoter = _competitionParams[3]; proposals[proposalId].suggestionsEndTime = _competitionParams[4]; proposals[proposalId].reputationReward = uint256(_reputationChange); proposals[proposalId].nativeTokenReward = _rewards[0]; proposals[proposalId].ethReward = _rewards[1]; proposals[proposalId].externalTokenReward = _rewards[2]; emit NewCompetitionProposal( proposalId, numberOfWinners, proposals[proposalId].rewardSplit, startTime, proposals[proposalId].votingStartTime, proposals[proposalId].suggestionsEndTime, proposals[proposalId].endTime, proposals[proposalId].maxNumberOfVotesPerVoter, contributionRewardExt ); } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
_competitionParams[4]>startTime,"suggestionsEndTime should be later than proposal start time"
350,120
_competitionParams[4]>startTime
"competition not started yet"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { // solhint-disable-next-line not-rely-on-time require(<FILL_ME>) // solhint-disable-next-line not-rely-on-time require(proposals[_proposalId].suggestionsEndTime > now, "suggestions submition time is over"); suggestionsCounter = suggestionsCounter.add(1); suggestions[suggestionsCounter].proposalId = _proposalId; suggestions[suggestionsCounter].suggester = msg.sender; emit NewSuggestion(_proposalId, suggestionsCounter, _descriptionHash, msg.sender); return suggestionsCounter; } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
proposals[_proposalId].startTime<=now,"competition not started yet"
350,120
proposals[_proposalId].startTime<=now
"suggestions submition time is over"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { // solhint-disable-next-line not-rely-on-time require(proposals[_proposalId].startTime <= now, "competition not started yet"); // solhint-disable-next-line not-rely-on-time require(<FILL_ME>) suggestionsCounter = suggestionsCounter.add(1); suggestions[suggestionsCounter].proposalId = _proposalId; suggestions[suggestionsCounter].suggester = msg.sender; emit NewSuggestion(_proposalId, suggestionsCounter, _descriptionHash, msg.sender); return suggestionsCounter; } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
proposals[_proposalId].suggestionsEndTime>now,"suggestions submition time is over"
350,120
proposals[_proposalId].suggestionsEndTime>now
"already voted on this suggestion"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { bytes32 proposalId = suggestions[_suggestionId].proposalId; require(proposalId != bytes32(0), "suggestion does not exist"); setSnapshotBlock(proposalId); Avatar avatar = ContributionRewardExt(contributionRewardExt).avatar(); uint256 reputation = avatar.nativeReputation().balanceOfAt(msg.sender, proposals[proposalId].snapshotBlock); require(reputation > 0, "voter had no reputation when snapshot was taken"); Proposal storage proposal = proposals[proposalId]; // solhint-disable-next-line not-rely-on-time require(proposal.endTime > now, "competition ended"); Suggestion storage suggestion = suggestions[_suggestionId]; require(<FILL_ME>) require(proposal.votesPerVoter[msg.sender] < proposal.maxNumberOfVotesPerVoter, "exceed number of votes allowed"); proposal.votesPerVoter[msg.sender] = proposal.votesPerVoter[msg.sender].add(1); if (suggestion.totalVotes > 0) { proposal.suggestionsPerVote[suggestion.totalVotes] = proposal.suggestionsPerVote[suggestion.totalVotes].sub(1); } suggestion.totalVotes = suggestion.totalVotes.add(reputation); proposal.suggestionsPerVote[suggestion.totalVotes] = proposal.suggestionsPerVote[suggestion.totalVotes].add(1); suggestion.votes[msg.sender] = reputation; refreshTopSuggestions(proposalId, _suggestionId); emit NewVote(proposalId, _suggestionId, msg.sender, reputation); return true; } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
suggestion.votes[msg.sender]==0,"already voted on this suggestion"
350,120
suggestion.votes[msg.sender]==0
"exceed number of votes allowed"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { bytes32 proposalId = suggestions[_suggestionId].proposalId; require(proposalId != bytes32(0), "suggestion does not exist"); setSnapshotBlock(proposalId); Avatar avatar = ContributionRewardExt(contributionRewardExt).avatar(); uint256 reputation = avatar.nativeReputation().balanceOfAt(msg.sender, proposals[proposalId].snapshotBlock); require(reputation > 0, "voter had no reputation when snapshot was taken"); Proposal storage proposal = proposals[proposalId]; // solhint-disable-next-line not-rely-on-time require(proposal.endTime > now, "competition ended"); Suggestion storage suggestion = suggestions[_suggestionId]; require(suggestion.votes[msg.sender] == 0, "already voted on this suggestion"); require(<FILL_ME>) proposal.votesPerVoter[msg.sender] = proposal.votesPerVoter[msg.sender].add(1); if (suggestion.totalVotes > 0) { proposal.suggestionsPerVote[suggestion.totalVotes] = proposal.suggestionsPerVote[suggestion.totalVotes].sub(1); } suggestion.totalVotes = suggestion.totalVotes.add(reputation); proposal.suggestionsPerVote[suggestion.totalVotes] = proposal.suggestionsPerVote[suggestion.totalVotes].add(1); suggestion.votes[msg.sender] = reputation; refreshTopSuggestions(proposalId, _suggestionId); emit NewVote(proposalId, _suggestionId, msg.sender, reputation); return true; } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
proposal.votesPerVoter[msg.sender]<proposal.maxNumberOfVotesPerVoter,"exceed number of votes allowed"
350,120
proposal.votesPerVoter[msg.sender]<proposal.maxNumberOfVotesPerVoter
"voting period not started yet"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { // solhint-disable-next-line not-rely-on-time require(<FILL_ME>) if (proposals[_proposalId].snapshotBlock == 0) { proposals[_proposalId].snapshotBlock = block.number; emit SnapshotBlock(_proposalId, block.number); } } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
proposals[_proposalId].votingStartTime<now,"voting period not started yet"
350,120
proposals[_proposalId].votingStartTime<now
"competition is still on"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { // solhint-disable-next-line not-rely-on-time require(<FILL_ME>) uint256[] memory topSuggestions = proposals[_proposalId].topSuggestions; for (uint256 i; i < topSuggestions.length; i++) { require(suggestions[topSuggestions[i]].suggester == address(0), "not all winning suggestions redeemed"); } (, , , , , , uint256 nativeTokenRewardLeft, , uint256 ethRewardLeft, uint256 externalTokenRewardLeft,) = ContributionRewardExt(contributionRewardExt).organizationProposals(_proposalId); Avatar avatar = ContributionRewardExt(contributionRewardExt).avatar(); ContributionRewardExt(contributionRewardExt).redeemExternalTokenByRewarder( _proposalId, address(avatar), externalTokenRewardLeft); ContributionRewardExt(contributionRewardExt).redeemEtherByRewarder( _proposalId, address(avatar), ethRewardLeft); ContributionRewardExt(contributionRewardExt).redeemNativeTokenByRewarder( _proposalId, address(avatar), nativeTokenRewardLeft); } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
proposals[_proposalId].endTime<now,"competition is still on"
350,120
proposals[_proposalId].endTime<now
"not all winning suggestions redeemed"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { // solhint-disable-next-line not-rely-on-time require(proposals[_proposalId].endTime < now, "competition is still on"); uint256[] memory topSuggestions = proposals[_proposalId].topSuggestions; for (uint256 i; i < topSuggestions.length; i++) { require(<FILL_ME>) } (, , , , , , uint256 nativeTokenRewardLeft, , uint256 ethRewardLeft, uint256 externalTokenRewardLeft,) = ContributionRewardExt(contributionRewardExt).organizationProposals(_proposalId); Avatar avatar = ContributionRewardExt(contributionRewardExt).avatar(); ContributionRewardExt(contributionRewardExt).redeemExternalTokenByRewarder( _proposalId, address(avatar), externalTokenRewardLeft); ContributionRewardExt(contributionRewardExt).redeemEtherByRewarder( _proposalId, address(avatar), ethRewardLeft); ContributionRewardExt(contributionRewardExt).redeemNativeTokenByRewarder( _proposalId, address(avatar), nativeTokenRewardLeft); } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { } }
suggestions[topSuggestions[i]].suggester==address(0),"not all winning suggestions redeemed"
350,120
suggestions[topSuggestions[i]].suggester==address(0)
"suggestion was already redeemed"
pragma solidity 0.5.13; contract Competition { using SafeMath for uint256; uint256 constant public MAX_NUMBER_OF_WINNERS = 100; event NewCompetitionProposal( bytes32 indexed _proposalId, uint256 _numberOfWinners, uint256[] _rewardSplit, uint256 _startTime, uint256 _votingStartTime, uint256 _suggestionsEndTime, uint256 _endTime, uint256 _maxNumberOfVotesPerVoter, address payable _contributionRewardExt //address of the contract to redeem from. ); event Redeem( bytes32 indexed _proposalId, uint256 indexed _suggestionId, uint256 _rewardPercentage ); event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, string _descriptionHash, address payable indexed _suggester ); event NewVote( bytes32 indexed _proposalId, uint256 indexed _suggestionId, address indexed _voter, uint256 _reputation ); event SnapshotBlock( bytes32 indexed _proposalId, uint256 _snapshotBlock ); // A struct holding the data for a competition proposal struct Proposal { uint256 numberOfWinners; uint256[] rewardSplit; uint256 startTime; uint256 votingStartTime; uint256 suggestionsEndTime; uint256 endTime; uint256 maxNumberOfVotesPerVoter; address payable contributionRewardExt; uint256 snapshotBlock; uint256 reputationReward; uint256 ethReward; uint256 nativeTokenReward; uint256 externalTokenReward; uint256[] topSuggestions; //mapping from suggestions totalVotes to the number of suggestions with the same totalVotes. mapping(uint256=>uint256) suggestionsPerVote; mapping(address=>uint256) votesPerVoter; } struct Suggestion { uint256 totalVotes; bytes32 proposalId; address payable suggester; mapping(address=>uint256) votes; } //mapping from proposalID to Proposal mapping(bytes32=>Proposal) public proposals; //mapping from suggestionId to Suggestion mapping(uint256=>Suggestion) public suggestions; uint256 public suggestionsCounter; address payable public contributionRewardExt; //address of the contract to redeem from. /** * @dev initialize * @param _contributionRewardExt the contributionRewardExt scheme which * manage and allocate the rewards for the competition. */ function initialize(address payable _contributionRewardExt) external { } /** * @dev Submit a competion proposal * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: * rewards[0] - Amount of tokens requested per period * rewards[1] - Amount of ETH requested per period * rewards[2] - Amount of external tokens requested per period * @param _externalToken Address of external token, if reward is requested there * @param _rewardSplit an array of precentages which specify how to split the rewards * between the winning suggestions * @param _competitionParams competition parameters : * _competitionParams[0] - competition startTime * _competitionParams[1] - _votingStartTime competition voting start time * _competitionParams[2] - _endTime competition end time * _competitionParams[3] - _maxNumberOfVotesPerVoter on how many suggestions a voter can vote * _competitionParams[4] - _suggestionsEndTime suggestion submition end time * @return proposalId the proposal id. */ function proposeCompetition( string calldata _descriptionHash, int256 _reputationChange, uint[3] calldata _rewards, IERC20 _externalToken, uint256[] calldata _rewardSplit, uint256[5] calldata _competitionParams ) external returns(bytes32 proposalId) { } /** * @dev submit a competion suggestion * @param _proposalId the proposal id this suggestion is referring to. * @param _descriptionHash a descriptionHash of the suggestion. * @return suggestionId the suggestionId. */ function suggest( bytes32 _proposalId, string calldata _descriptionHash ) external returns(uint256) { } /** * @dev vote on a suggestion * @param _suggestionId suggestionId * @return bool */ function vote(uint256 _suggestionId) external returns(bool) { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary. * this parameter is take into account only if the msg.sender is the suggestion's suggester, * otherwise the _beneficiary param is ignored and the beneficiary is suggestion's suggester. */ function redeem(uint256 _suggestionId, address payable _beneficiary) external { } /** * @dev setSnapshotBlock set the block for the reputaion snapshot * @param _proposalId the proposal id */ function setSnapshotBlock(bytes32 _proposalId) public { } /** * @dev sendLeftOverFund send letf over funds back to the dao. * @param _proposalId the proposal id */ function sendLeftOverFunds(bytes32 _proposalId) public { } /** * @dev getOrderedIndexOfSuggestion return the index of specific suggestion in the winners list. * @param _suggestionId suggestion id */ function getOrderedIndexOfSuggestion(uint256 _suggestionId) public view returns(uint256 index) { } /** * @dev refreshTopSuggestions this function maintain a winners list array. * it will check if the given suggestion is among the top suggestions, and if so, * update the list of top suggestions * @param _proposalId proposal id * @param _suggestionId suggestion id */ function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private { } /** * @dev redeem a winning suggestion reward * @param _suggestionId suggestionId * @param _beneficiary - the reward beneficiary */ function _redeem(uint256 _suggestionId, address payable _beneficiary) private { bytes32 proposalId = suggestions[_suggestionId].proposalId; Proposal storage proposal = proposals[proposalId]; // solhint-disable-next-line not-rely-on-time require(proposal.endTime < now, "competition is still on"); require(<FILL_ME>) uint256 orderIndex = getOrderedIndexOfSuggestion(_suggestionId); require(orderIndex < proposal.topSuggestions.length, "suggestion is not in winners list"); suggestions[_suggestionId].suggester = address(0); uint256 rewardPercentage = 0; uint256 numberOfTieSuggestions = proposal.suggestionsPerVote[suggestions[_suggestionId].totalVotes]; uint256 j; //calc the reward percentage for this suggestion for (j = orderIndex; j < (orderIndex+numberOfTieSuggestions) && j < proposal.numberOfWinners; j++) { rewardPercentage = rewardPercentage.add(proposal.rewardSplit[j]); } rewardPercentage = rewardPercentage.div(numberOfTieSuggestions); uint256 rewardPercentageLeft = 0; if (proposal.topSuggestions.length < proposal.numberOfWinners) { //if there are less winners than the proposal number of winners so divide the pre allocated //left reward equally between the winners for (j = proposal.topSuggestions.length; j < proposal.numberOfWinners; j++) { rewardPercentageLeft = rewardPercentageLeft.add(proposal.rewardSplit[j]); } rewardPercentage = rewardPercentage.add(rewardPercentageLeft.div(proposal.topSuggestions.length)); } uint256 amount; amount = proposal.externalTokenReward.mul(rewardPercentage).div(100); ContributionRewardExt(contributionRewardExt).redeemExternalTokenByRewarder( proposalId, _beneficiary, amount); amount = proposal.reputationReward.mul(rewardPercentage).div(100); ContributionRewardExt(contributionRewardExt).redeemReputationByRewarder( proposalId, _beneficiary, amount); amount = proposal.ethReward.mul(rewardPercentage).div(100); ContributionRewardExt(contributionRewardExt).redeemEtherByRewarder( proposalId, _beneficiary, amount); amount = proposal.nativeTokenReward.mul(rewardPercentage).div(100); ContributionRewardExt(contributionRewardExt).redeemNativeTokenByRewarder( proposalId, _beneficiary, amount); emit Redeem(proposalId, _suggestionId, rewardPercentage); } }
suggestions[_suggestionId].suggester!=address(0),"suggestion was already redeemed"
350,120
suggestions[_suggestionId].suggester!=address(0)
"Lockup should end at least 6 months after pool one phase 1 ending"
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {Proxied} from "../vendor/hardhat-deploy/Proxied.sol"; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { _withdrawETH, _withdrawUnlockedGEL, _withdrawAllGEL } from "./functions/ProxyAdminFunctions.sol"; import { _isPoolOneOpen, _requirePoolOneIsOpen, _hasWhaleNeverBought, _requireWhaleNeverBought, _isBoughtWithinWhaleCaps, _requireBoughtWithinWhaleCaps, _isPoolOneCapExceeded, _requirePoolOneCapNotExceeded, _isPoolTwoOpen, _requirePoolTwoIsOpen, _hasDolphinNeverBought, _requireDolphinNeverBought, _isBoughtLteDolphinMax, _requireBoughtLteDolphinMax, _getRemainingGel, _getBuyableRemainingGel, _isSaleClosing, _isBoughtEqBuyableRemaining, _requireBoughtEqBuyableRemaining, _isBoughtGteDolphinMin, _requireBoughtGteDolphinMin, _isBoughtLteRemaining, _requireBoughtLteRemaining, _requireNotAddressZero, _requireNotLocked, _requireHasGELToUnlock } from "./functions/CheckerFunctions.sol"; import { _isWhale, _requireWhale, _isDolphin, _requireDolphin } from "./functions/SignatureFunctions.sol"; import {_wmul} from "../vendor/DSMath.sol"; // BE CAREFUL: DOT NOT CHANGE THE ORDER OF INHERITED CONTRACT // solhint-disable-next-line max-states-count contract MarchandDeGlace is Initializable, Proxied, ReentrancyGuardUpgradeable, PausableUpgradeable { using SafeERC20 for IERC20; struct Whale { address addr; bytes[2] signatures; } struct Dolphin { address addr; bytes signature; } struct MultiIsCreatureResult { address creature; bool isCreature; } // solhint-disable-next-line max-line-length ////////////////////////////////////////// CONSTANTS AND IMMUTABLES /////////////////////////////////// ///@dev GEL_TOTAL_SUPPLY 420,690,000.00 /// TOTAL_GEL_CAP = GEL_TOTAL_SUPPLY * 4% uint256 public constant TOTAL_GEL_CAP = 16827600000000000000000000; ///@dev POOL_ONE_GEL_CAP = TOTAL_GEL_CAP * (3/5); uint256 public constant POOL_ONE_GEL_CAP = 10096560000000000000000000; ///@dev GELUSD = 0.2971309 $ and WHALE_MIN_USD = 5000 $ /// WHALE_POOL_USD_PRICE = POOL_ONE_GEL_CAP * GELUSD /// we know that WHALE_MIN_USD / WHALE_POOL_USD_PRICE = WHALE_MIN_GEL / POOL_ONE_GEL_CAP /// so WHALE_MIN_GEL = ( WHALE_MIN_USD / WHALE_POOL_USD_PRICE ) * POOL_ONE_GEL_CAP uint256 public constant WHALE_MIN_GEL = 16827600226028326236012; ///@dev WHALE_MAX_USD = 20000 $, with same reasoning /// we know that WHALE_MAX_USD / WHALE_POOL_USD_PRICE = WHALE_MAX_GEL / POOL_ONE_GEL_CAP /// so WHALE_MAX_GEL = ( WHALE_MAX_USD / WHALE_POOL_USD_PRICE ) * POOL_ONE_GEL_CAP uint256 public constant WHALE_MAX_GEL = 67310400904113304944050; ///@dev DOLPHIN_MIN_USD = 1000 $ and DOLPHIN_POOL_GEL = 6731040 /// DOLPHIN_POOL_USD_PRICE = DOLPHIN_POOL_GEL * GELUSD /// we know that DOLPHIN_MIN_USD / DOLPHIN_POOL_USD_PRICE = DOLPHIN_MIN_GEL / DOLPHIN_POOL_GEL /// so DOLPHIN_MIN_GEL = ( DOLPHIN_MIN_USD / DOLPHIN_POOL_USD_PRICE ) * DOLPHIN_POOL_GEL uint256 public constant DOLPHIN_MIN_GEL = 3365520045205665247202; ///@dev DOLPHIN_MAX_USD = 4000 $, with same reasoning /// we know that DOLPHIN_MAX_USD / DOLPHIN_POOL_USD_PRICE = DOLPHIN_MAX_GEL / DOLPHIN_POOL_GEL /// so DOLPHIN_MAX_GEL = ( DOLPHIN_MAX_USD / DOLPHIN_POOL_USD_PRICE ) * DOLPHIN_POOL_GEL uint256 public constant DOLPHIN_MAX_GEL = 13462080180822660988810; // Token that Marchand De Glace Sell. IERC20 public immutable GEL; // solhint-disable-line var-name-mixedcase // Address signing user signature. address public immutable SIGNER; // solhint-disable-line var-name-mixedcase // solhint-disable-next-line max-line-length /////////////////////////////////////////// STORAGE DATA ////////////////////////////////////////////////// // !!!!!!!!!!!!!!!!!!!!!!!! DO NOT CHANGE ORDER !!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Only settable by the Admin uint256 public gelPerEth; uint256 public poolOneStartTime; uint256 public poolTwoStartTime; uint256 public poolOneEndTime; uint256 public poolTwoEndTime; uint256 public lockUpEndTime; mapping(address => uint256) public gelLockedByWhale; mapping(address => uint256) public gelBoughtByDolphin; uint256 public totalGelLocked; // !!!!!!!! ADD NEW PROPERTIES HERE !!!!!!! event LogBuyWhale( address indexed whale, uint256 ethPaid, uint256 gelBought, uint256 gelLocked, uint256 gelUnlocked ); event LogBuyDolphin( address indexed dolphin, uint256 ethPaid, uint256 gelBought ); event LogWithdrawLockedGEL( address indexed whale, address indexed to, uint256 gelWithdrawn ); // solhint-disable-next-line func-param-name-mixedcase, var-name-mixedcase constructor(IERC20 _GEL, address _SIGNER) { } function initialize( uint256 _gelPerEth, uint256 _poolOneStartTime, uint256 _poolTwoStartTime, uint256 _poolOneEndTime, uint256 _poolTwoEndTime, uint256 _lockUpEndTime ) external initializer { require(_gelPerEth > 0, "Ether to Gel price cannot be settable to 0"); require( _poolOneStartTime <= _poolOneEndTime, "Pool One phase cannot end before the start" ); require( _poolOneEndTime <= _poolTwoStartTime, "Pool One phase should be closed for starting pool two" ); require( _poolTwoStartTime <= _poolTwoEndTime, "Pool Two phase cannot end before the start" ); require(<FILL_ME>) __ReentrancyGuard_init(); __Pausable_init(); gelPerEth = _gelPerEth; poolOneStartTime = _poolOneStartTime; poolTwoStartTime = _poolTwoStartTime; poolOneEndTime = _poolOneEndTime; poolTwoEndTime = _poolTwoEndTime; lockUpEndTime = _lockUpEndTime; } // We are using onlyProxyAdmin, because admin = owner, // Proxied get admin from storage position // 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103 // and EIP173Proxy store owner at same position. // https://github.com/wighawag/hardhat-deploy/blob/master/solc_0.7/proxy/EIP173Proxy.sol function setGelPerEth(uint256 _gelPerEth) external onlyProxyAdmin { } function setPhaseOneStartTime(uint256 _poolOneStartTime) external onlyProxyAdmin { } function setPhaseTwoStartTime(uint256 _poolTwoStartTime) external onlyProxyAdmin { } function setPhaseOneEndTime(uint256 _poolOneEndTime) external onlyProxyAdmin { } function setPhaseTwoEndTime(uint256 _poolTwoEndTime) external onlyProxyAdmin { } function setLockUpEndTime(uint256 _lockUpEndTime) external onlyProxyAdmin { } function pause() external onlyProxyAdmin { } function unpause() external onlyProxyAdmin { } function withdrawETH() external onlyProxyAdmin { } function withdrawUnlockedGEL() external onlyProxyAdmin { } function withdrawAllGEL() external onlyProxyAdmin whenPaused { } // !!!!!!!!!!!!!!!!!!!!! FUNCTIONS CALLABLE BY WHALES AND DOLPHINS !!!!!!!!!!!!!!!!!!!!!!!!! function buyWhale(bytes calldata _signature) external payable whenNotPaused nonReentrant { } // solhint-disable-next-line function-max-lines function buyDolphin(bytes calldata _signature) external payable whenNotPaused nonReentrant { } function withdrawLockedGEL(address _to) external whenNotPaused nonReentrant { } // ======== HELPERS ======= function canBuyWhale( address _whale, bytes calldata _signature, uint256 _ethToSell ) external view returns (bool) { } function canBuyDolphin( address _dolphin, bytes calldata _signature, uint256 _ethToSell ) external view returns (bool) { } function getGELToBuy(uint256 _ethToSell) public view returns (uint256) { } function isPoolOneOpen() public view returns (bool) { } function isWhale(address _whale, bytes calldata _signature) public view returns (bool) { } function multiIsWhale(Whale[] calldata _whales) public view returns (MultiIsCreatureResult[] memory results) { } function hasWhaleNeverBought(address _whale) public view returns (bool) { } function isPoolOneCapExceeded(uint256 _gelToBuy) public view returns (bool) { } function getRemainingGelPoolOne() public view returns (uint256) { } function isPoolTwoOpen() public view returns (bool) { } function isDolphin(address _dolphin, bytes calldata _signature) public view returns (bool) { } function multiIsDolphin(Dolphin[] calldata _dolphins) public view returns (MultiIsCreatureResult[] memory results) { } function hasDolphinNeverBought(address _dolphin) public view returns (bool) { } function isSaleClosing() public view returns (bool) { } function isBoughtEqBuyableRemaining(uint256 _gelToBuy) public view returns (bool) { } function isBoughtLteRemaining(uint256 _gelBought) public view returns (bool) { } function getBuyableRemainingGel() public view returns (uint256) { } function getRemainingGel() public view returns (uint256) { } function isBoughtWithinWhaleCaps(uint256 _gelBought) public pure returns (bool) { } function isBoughtLteDolphinMax(uint256 _gelBought) public pure returns (bool) { } function isBoughtGteDolphinMin(uint256 _gelToBuy) public pure returns (bool) { } }
_poolOneEndTime+182days<=_lockUpEndTime,"Lockup should end at least 6 months after pool one phase 1 ending"
350,230
_poolOneEndTime+182days<=_lockUpEndTime
null
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {Proxied} from "../vendor/hardhat-deploy/Proxied.sol"; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { _withdrawETH, _withdrawUnlockedGEL, _withdrawAllGEL } from "./functions/ProxyAdminFunctions.sol"; import { _isPoolOneOpen, _requirePoolOneIsOpen, _hasWhaleNeverBought, _requireWhaleNeverBought, _isBoughtWithinWhaleCaps, _requireBoughtWithinWhaleCaps, _isPoolOneCapExceeded, _requirePoolOneCapNotExceeded, _isPoolTwoOpen, _requirePoolTwoIsOpen, _hasDolphinNeverBought, _requireDolphinNeverBought, _isBoughtLteDolphinMax, _requireBoughtLteDolphinMax, _getRemainingGel, _getBuyableRemainingGel, _isSaleClosing, _isBoughtEqBuyableRemaining, _requireBoughtEqBuyableRemaining, _isBoughtGteDolphinMin, _requireBoughtGteDolphinMin, _isBoughtLteRemaining, _requireBoughtLteRemaining, _requireNotAddressZero, _requireNotLocked, _requireHasGELToUnlock } from "./functions/CheckerFunctions.sol"; import { _isWhale, _requireWhale, _isDolphin, _requireDolphin } from "./functions/SignatureFunctions.sol"; import {_wmul} from "../vendor/DSMath.sol"; // BE CAREFUL: DOT NOT CHANGE THE ORDER OF INHERITED CONTRACT // solhint-disable-next-line max-states-count contract MarchandDeGlace is Initializable, Proxied, ReentrancyGuardUpgradeable, PausableUpgradeable { using SafeERC20 for IERC20; struct Whale { address addr; bytes[2] signatures; } struct Dolphin { address addr; bytes signature; } struct MultiIsCreatureResult { address creature; bool isCreature; } // solhint-disable-next-line max-line-length ////////////////////////////////////////// CONSTANTS AND IMMUTABLES /////////////////////////////////// ///@dev GEL_TOTAL_SUPPLY 420,690,000.00 /// TOTAL_GEL_CAP = GEL_TOTAL_SUPPLY * 4% uint256 public constant TOTAL_GEL_CAP = 16827600000000000000000000; ///@dev POOL_ONE_GEL_CAP = TOTAL_GEL_CAP * (3/5); uint256 public constant POOL_ONE_GEL_CAP = 10096560000000000000000000; ///@dev GELUSD = 0.2971309 $ and WHALE_MIN_USD = 5000 $ /// WHALE_POOL_USD_PRICE = POOL_ONE_GEL_CAP * GELUSD /// we know that WHALE_MIN_USD / WHALE_POOL_USD_PRICE = WHALE_MIN_GEL / POOL_ONE_GEL_CAP /// so WHALE_MIN_GEL = ( WHALE_MIN_USD / WHALE_POOL_USD_PRICE ) * POOL_ONE_GEL_CAP uint256 public constant WHALE_MIN_GEL = 16827600226028326236012; ///@dev WHALE_MAX_USD = 20000 $, with same reasoning /// we know that WHALE_MAX_USD / WHALE_POOL_USD_PRICE = WHALE_MAX_GEL / POOL_ONE_GEL_CAP /// so WHALE_MAX_GEL = ( WHALE_MAX_USD / WHALE_POOL_USD_PRICE ) * POOL_ONE_GEL_CAP uint256 public constant WHALE_MAX_GEL = 67310400904113304944050; ///@dev DOLPHIN_MIN_USD = 1000 $ and DOLPHIN_POOL_GEL = 6731040 /// DOLPHIN_POOL_USD_PRICE = DOLPHIN_POOL_GEL * GELUSD /// we know that DOLPHIN_MIN_USD / DOLPHIN_POOL_USD_PRICE = DOLPHIN_MIN_GEL / DOLPHIN_POOL_GEL /// so DOLPHIN_MIN_GEL = ( DOLPHIN_MIN_USD / DOLPHIN_POOL_USD_PRICE ) * DOLPHIN_POOL_GEL uint256 public constant DOLPHIN_MIN_GEL = 3365520045205665247202; ///@dev DOLPHIN_MAX_USD = 4000 $, with same reasoning /// we know that DOLPHIN_MAX_USD / DOLPHIN_POOL_USD_PRICE = DOLPHIN_MAX_GEL / DOLPHIN_POOL_GEL /// so DOLPHIN_MAX_GEL = ( DOLPHIN_MAX_USD / DOLPHIN_POOL_USD_PRICE ) * DOLPHIN_POOL_GEL uint256 public constant DOLPHIN_MAX_GEL = 13462080180822660988810; // Token that Marchand De Glace Sell. IERC20 public immutable GEL; // solhint-disable-line var-name-mixedcase // Address signing user signature. address public immutable SIGNER; // solhint-disable-line var-name-mixedcase // solhint-disable-next-line max-line-length /////////////////////////////////////////// STORAGE DATA ////////////////////////////////////////////////// // !!!!!!!!!!!!!!!!!!!!!!!! DO NOT CHANGE ORDER !!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Only settable by the Admin uint256 public gelPerEth; uint256 public poolOneStartTime; uint256 public poolTwoStartTime; uint256 public poolOneEndTime; uint256 public poolTwoEndTime; uint256 public lockUpEndTime; mapping(address => uint256) public gelLockedByWhale; mapping(address => uint256) public gelBoughtByDolphin; uint256 public totalGelLocked; // !!!!!!!! ADD NEW PROPERTIES HERE !!!!!!! event LogBuyWhale( address indexed whale, uint256 ethPaid, uint256 gelBought, uint256 gelLocked, uint256 gelUnlocked ); event LogBuyDolphin( address indexed dolphin, uint256 ethPaid, uint256 gelBought ); event LogWithdrawLockedGEL( address indexed whale, address indexed to, uint256 gelWithdrawn ); // solhint-disable-next-line func-param-name-mixedcase, var-name-mixedcase constructor(IERC20 _GEL, address _SIGNER) { } function initialize( uint256 _gelPerEth, uint256 _poolOneStartTime, uint256 _poolTwoStartTime, uint256 _poolOneEndTime, uint256 _poolTwoEndTime, uint256 _lockUpEndTime ) external initializer { } // We are using onlyProxyAdmin, because admin = owner, // Proxied get admin from storage position // 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103 // and EIP173Proxy store owner at same position. // https://github.com/wighawag/hardhat-deploy/blob/master/solc_0.7/proxy/EIP173Proxy.sol function setGelPerEth(uint256 _gelPerEth) external onlyProxyAdmin { } function setPhaseOneStartTime(uint256 _poolOneStartTime) external onlyProxyAdmin { } function setPhaseTwoStartTime(uint256 _poolTwoStartTime) external onlyProxyAdmin { } function setPhaseOneEndTime(uint256 _poolOneEndTime) external onlyProxyAdmin { } function setPhaseTwoEndTime(uint256 _poolTwoEndTime) external onlyProxyAdmin { } function setLockUpEndTime(uint256 _lockUpEndTime) external onlyProxyAdmin { } function pause() external onlyProxyAdmin { } function unpause() external onlyProxyAdmin { } function withdrawETH() external onlyProxyAdmin { } function withdrawUnlockedGEL() external onlyProxyAdmin { } function withdrawAllGEL() external onlyProxyAdmin whenPaused { } // !!!!!!!!!!!!!!!!!!!!! FUNCTIONS CALLABLE BY WHALES AND DOLPHINS !!!!!!!!!!!!!!!!!!!!!!!!! function buyWhale(bytes calldata _signature) external payable whenNotPaused nonReentrant { _requirePoolOneIsOpen(poolOneStartTime, poolOneEndTime); _requireWhale(_signature, SIGNER); require(<FILL_ME>) // Amount of gel bought // TODO check precision issue here. uint256 gelBought = _wmul(msg.value, gelPerEth); _requireBoughtWithinWhaleCaps(gelBought, WHALE_MIN_GEL, WHALE_MAX_GEL); _requirePoolOneCapNotExceeded( TOTAL_GEL_CAP, GEL.balanceOf(address(this)), totalGelLocked, gelBought, POOL_ONE_GEL_CAP ); uint256 gelLocked = _wmul(gelBought, 7 * 1e17); // 70% locked. totalGelLocked = totalGelLocked + gelLocked; gelLockedByWhale[msg.sender] = gelLocked; GEL.safeTransfer(msg.sender, gelBought - gelLocked); emit LogBuyWhale( msg.sender, msg.value, gelBought, gelLocked, gelBought - gelLocked ); } // solhint-disable-next-line function-max-lines function buyDolphin(bytes calldata _signature) external payable whenNotPaused nonReentrant { } function withdrawLockedGEL(address _to) external whenNotPaused nonReentrant { } // ======== HELPERS ======= function canBuyWhale( address _whale, bytes calldata _signature, uint256 _ethToSell ) external view returns (bool) { } function canBuyDolphin( address _dolphin, bytes calldata _signature, uint256 _ethToSell ) external view returns (bool) { } function getGELToBuy(uint256 _ethToSell) public view returns (uint256) { } function isPoolOneOpen() public view returns (bool) { } function isWhale(address _whale, bytes calldata _signature) public view returns (bool) { } function multiIsWhale(Whale[] calldata _whales) public view returns (MultiIsCreatureResult[] memory results) { } function hasWhaleNeverBought(address _whale) public view returns (bool) { } function isPoolOneCapExceeded(uint256 _gelToBuy) public view returns (bool) { } function getRemainingGelPoolOne() public view returns (uint256) { } function isPoolTwoOpen() public view returns (bool) { } function isDolphin(address _dolphin, bytes calldata _signature) public view returns (bool) { } function multiIsDolphin(Dolphin[] calldata _dolphins) public view returns (MultiIsCreatureResult[] memory results) { } function hasDolphinNeverBought(address _dolphin) public view returns (bool) { } function isSaleClosing() public view returns (bool) { } function isBoughtEqBuyableRemaining(uint256 _gelToBuy) public view returns (bool) { } function isBoughtLteRemaining(uint256 _gelBought) public view returns (bool) { } function getBuyableRemainingGel() public view returns (uint256) { } function getRemainingGel() public view returns (uint256) { } function isBoughtWithinWhaleCaps(uint256 _gelBought) public pure returns (bool) { } function isBoughtLteDolphinMax(uint256 _gelBought) public pure returns (bool) { } function isBoughtGteDolphinMin(uint256 _gelToBuy) public pure returns (bool) { } }
WhaleNeverBought(gelLockedByWhale[msg.sender]
350,230
gelLockedByWhale[msg.sender]
null
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {Proxied} from "../vendor/hardhat-deploy/Proxied.sol"; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { _withdrawETH, _withdrawUnlockedGEL, _withdrawAllGEL } from "./functions/ProxyAdminFunctions.sol"; import { _isPoolOneOpen, _requirePoolOneIsOpen, _hasWhaleNeverBought, _requireWhaleNeverBought, _isBoughtWithinWhaleCaps, _requireBoughtWithinWhaleCaps, _isPoolOneCapExceeded, _requirePoolOneCapNotExceeded, _isPoolTwoOpen, _requirePoolTwoIsOpen, _hasDolphinNeverBought, _requireDolphinNeverBought, _isBoughtLteDolphinMax, _requireBoughtLteDolphinMax, _getRemainingGel, _getBuyableRemainingGel, _isSaleClosing, _isBoughtEqBuyableRemaining, _requireBoughtEqBuyableRemaining, _isBoughtGteDolphinMin, _requireBoughtGteDolphinMin, _isBoughtLteRemaining, _requireBoughtLteRemaining, _requireNotAddressZero, _requireNotLocked, _requireHasGELToUnlock } from "./functions/CheckerFunctions.sol"; import { _isWhale, _requireWhale, _isDolphin, _requireDolphin } from "./functions/SignatureFunctions.sol"; import {_wmul} from "../vendor/DSMath.sol"; // BE CAREFUL: DOT NOT CHANGE THE ORDER OF INHERITED CONTRACT // solhint-disable-next-line max-states-count contract MarchandDeGlace is Initializable, Proxied, ReentrancyGuardUpgradeable, PausableUpgradeable { using SafeERC20 for IERC20; struct Whale { address addr; bytes[2] signatures; } struct Dolphin { address addr; bytes signature; } struct MultiIsCreatureResult { address creature; bool isCreature; } // solhint-disable-next-line max-line-length ////////////////////////////////////////// CONSTANTS AND IMMUTABLES /////////////////////////////////// ///@dev GEL_TOTAL_SUPPLY 420,690,000.00 /// TOTAL_GEL_CAP = GEL_TOTAL_SUPPLY * 4% uint256 public constant TOTAL_GEL_CAP = 16827600000000000000000000; ///@dev POOL_ONE_GEL_CAP = TOTAL_GEL_CAP * (3/5); uint256 public constant POOL_ONE_GEL_CAP = 10096560000000000000000000; ///@dev GELUSD = 0.2971309 $ and WHALE_MIN_USD = 5000 $ /// WHALE_POOL_USD_PRICE = POOL_ONE_GEL_CAP * GELUSD /// we know that WHALE_MIN_USD / WHALE_POOL_USD_PRICE = WHALE_MIN_GEL / POOL_ONE_GEL_CAP /// so WHALE_MIN_GEL = ( WHALE_MIN_USD / WHALE_POOL_USD_PRICE ) * POOL_ONE_GEL_CAP uint256 public constant WHALE_MIN_GEL = 16827600226028326236012; ///@dev WHALE_MAX_USD = 20000 $, with same reasoning /// we know that WHALE_MAX_USD / WHALE_POOL_USD_PRICE = WHALE_MAX_GEL / POOL_ONE_GEL_CAP /// so WHALE_MAX_GEL = ( WHALE_MAX_USD / WHALE_POOL_USD_PRICE ) * POOL_ONE_GEL_CAP uint256 public constant WHALE_MAX_GEL = 67310400904113304944050; ///@dev DOLPHIN_MIN_USD = 1000 $ and DOLPHIN_POOL_GEL = 6731040 /// DOLPHIN_POOL_USD_PRICE = DOLPHIN_POOL_GEL * GELUSD /// we know that DOLPHIN_MIN_USD / DOLPHIN_POOL_USD_PRICE = DOLPHIN_MIN_GEL / DOLPHIN_POOL_GEL /// so DOLPHIN_MIN_GEL = ( DOLPHIN_MIN_USD / DOLPHIN_POOL_USD_PRICE ) * DOLPHIN_POOL_GEL uint256 public constant DOLPHIN_MIN_GEL = 3365520045205665247202; ///@dev DOLPHIN_MAX_USD = 4000 $, with same reasoning /// we know that DOLPHIN_MAX_USD / DOLPHIN_POOL_USD_PRICE = DOLPHIN_MAX_GEL / DOLPHIN_POOL_GEL /// so DOLPHIN_MAX_GEL = ( DOLPHIN_MAX_USD / DOLPHIN_POOL_USD_PRICE ) * DOLPHIN_POOL_GEL uint256 public constant DOLPHIN_MAX_GEL = 13462080180822660988810; // Token that Marchand De Glace Sell. IERC20 public immutable GEL; // solhint-disable-line var-name-mixedcase // Address signing user signature. address public immutable SIGNER; // solhint-disable-line var-name-mixedcase // solhint-disable-next-line max-line-length /////////////////////////////////////////// STORAGE DATA ////////////////////////////////////////////////// // !!!!!!!!!!!!!!!!!!!!!!!! DO NOT CHANGE ORDER !!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Only settable by the Admin uint256 public gelPerEth; uint256 public poolOneStartTime; uint256 public poolTwoStartTime; uint256 public poolOneEndTime; uint256 public poolTwoEndTime; uint256 public lockUpEndTime; mapping(address => uint256) public gelLockedByWhale; mapping(address => uint256) public gelBoughtByDolphin; uint256 public totalGelLocked; // !!!!!!!! ADD NEW PROPERTIES HERE !!!!!!! event LogBuyWhale( address indexed whale, uint256 ethPaid, uint256 gelBought, uint256 gelLocked, uint256 gelUnlocked ); event LogBuyDolphin( address indexed dolphin, uint256 ethPaid, uint256 gelBought ); event LogWithdrawLockedGEL( address indexed whale, address indexed to, uint256 gelWithdrawn ); // solhint-disable-next-line func-param-name-mixedcase, var-name-mixedcase constructor(IERC20 _GEL, address _SIGNER) { } function initialize( uint256 _gelPerEth, uint256 _poolOneStartTime, uint256 _poolTwoStartTime, uint256 _poolOneEndTime, uint256 _poolTwoEndTime, uint256 _lockUpEndTime ) external initializer { } // We are using onlyProxyAdmin, because admin = owner, // Proxied get admin from storage position // 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103 // and EIP173Proxy store owner at same position. // https://github.com/wighawag/hardhat-deploy/blob/master/solc_0.7/proxy/EIP173Proxy.sol function setGelPerEth(uint256 _gelPerEth) external onlyProxyAdmin { } function setPhaseOneStartTime(uint256 _poolOneStartTime) external onlyProxyAdmin { } function setPhaseTwoStartTime(uint256 _poolTwoStartTime) external onlyProxyAdmin { } function setPhaseOneEndTime(uint256 _poolOneEndTime) external onlyProxyAdmin { } function setPhaseTwoEndTime(uint256 _poolTwoEndTime) external onlyProxyAdmin { } function setLockUpEndTime(uint256 _lockUpEndTime) external onlyProxyAdmin { } function pause() external onlyProxyAdmin { } function unpause() external onlyProxyAdmin { } function withdrawETH() external onlyProxyAdmin { } function withdrawUnlockedGEL() external onlyProxyAdmin { } function withdrawAllGEL() external onlyProxyAdmin whenPaused { } // !!!!!!!!!!!!!!!!!!!!! FUNCTIONS CALLABLE BY WHALES AND DOLPHINS !!!!!!!!!!!!!!!!!!!!!!!!! function buyWhale(bytes calldata _signature) external payable whenNotPaused nonReentrant { } // solhint-disable-next-line function-max-lines function buyDolphin(bytes calldata _signature) external payable whenNotPaused nonReentrant { _requirePoolTwoIsOpen(poolTwoStartTime, poolTwoEndTime); _requireDolphin(_signature, SIGNER); _requireWhaleNeverBought(gelLockedByWhale[msg.sender]); require(<FILL_ME>) // Amount of gel bought // TODO check precision issue here. uint256 gelBought = _wmul(msg.value, gelPerEth); _requireBoughtLteDolphinMax(gelBought, DOLPHIN_MAX_GEL); uint256 remainingGel = _getRemainingGel( GEL.balanceOf(address(this)), totalGelLocked ); uint256 buyableRemainingGel = _getBuyableRemainingGel( remainingGel, gelPerEth ); // buyableRemainingGel <= remainingGel if (_isSaleClosing(buyableRemainingGel, DOLPHIN_MIN_GEL)) _requireBoughtEqBuyableRemaining(gelBought, buyableRemainingGel); else { _requireBoughtGteDolphinMin(gelBought, DOLPHIN_MIN_GEL); _requireBoughtLteRemaining(gelBought, remainingGel); } gelBoughtByDolphin[msg.sender] = gelBought; GEL.safeTransfer(msg.sender, gelBought); emit LogBuyDolphin(msg.sender, msg.value, gelBought); } function withdrawLockedGEL(address _to) external whenNotPaused nonReentrant { } // ======== HELPERS ======= function canBuyWhale( address _whale, bytes calldata _signature, uint256 _ethToSell ) external view returns (bool) { } function canBuyDolphin( address _dolphin, bytes calldata _signature, uint256 _ethToSell ) external view returns (bool) { } function getGELToBuy(uint256 _ethToSell) public view returns (uint256) { } function isPoolOneOpen() public view returns (bool) { } function isWhale(address _whale, bytes calldata _signature) public view returns (bool) { } function multiIsWhale(Whale[] calldata _whales) public view returns (MultiIsCreatureResult[] memory results) { } function hasWhaleNeverBought(address _whale) public view returns (bool) { } function isPoolOneCapExceeded(uint256 _gelToBuy) public view returns (bool) { } function getRemainingGelPoolOne() public view returns (uint256) { } function isPoolTwoOpen() public view returns (bool) { } function isDolphin(address _dolphin, bytes calldata _signature) public view returns (bool) { } function multiIsDolphin(Dolphin[] calldata _dolphins) public view returns (MultiIsCreatureResult[] memory results) { } function hasDolphinNeverBought(address _dolphin) public view returns (bool) { } function isSaleClosing() public view returns (bool) { } function isBoughtEqBuyableRemaining(uint256 _gelToBuy) public view returns (bool) { } function isBoughtLteRemaining(uint256 _gelBought) public view returns (bool) { } function getBuyableRemainingGel() public view returns (uint256) { } function getRemainingGel() public view returns (uint256) { } function isBoughtWithinWhaleCaps(uint256 _gelBought) public pure returns (bool) { } function isBoughtLteDolphinMax(uint256 _gelBought) public pure returns (bool) { } function isBoughtGteDolphinMin(uint256 _gelToBuy) public pure returns (bool) { } }
DolphinNeverBought(gelBoughtByDolphin[msg.sender]
350,230
gelBoughtByDolphin[msg.sender]
"Purchase would exceed max supply"
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /// @title Poolboys Metatourism NFT contract Poolboys is ERC721, Ownable, ReentrancyGuard { using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; uint256 private collectionStartingIndexBlock; uint256 public collectionStartingIndex; string public PBOY_PROVENANCE = ""; uint256 public pboyPrice = 10000000000000000; //0.01 ETH uint256 public constant maxPurchase = 30; uint256 public constant MAX_PBOYS = 4444; bool public publicSaleActive = false; string private _baseURIextended; constructor() ERC721("Poolboys", "PBOY") {} function withdraw() external onlyOwner { } function setPrice(uint256 newPrice) external onlyOwner { } /// @notice Set base for the reveal function setBaseURI(string memory baseURI_) external onlyOwner() { } function _baseURI() internal view virtual override returns (string memory) { } /// @notice Returns the total current supply function totalSupply() external view returns (uint256) { } /// @notice Pause sale if active, make active if paused function flipSaleState() external onlyOwner { } function _mintToken(address _to, uint numberOfTokens) private { require(numberOfTokens <= maxPurchase, "Can only mint 30 tokens at a time"); require(<FILL_ME>) for(uint256 i; i < numberOfTokens; i++) { uint256 tokenId = _tokenIdCounter.current(); if (tokenId < MAX_PBOYS) { _tokenIdCounter.increment(); _safeMint(_to, tokenId); } } } /// @notice Set Poolboys aside for giveaways function reserveToken(address _to, uint numberOfTokens) external onlyOwner { } /// @notice Mint Poolboys function mintToken(uint numberOfTokens) external payable nonReentrant { } /// @notice Set the starting index for the collection function setStartingIndices() external onlyOwner { } /// @notice Set provenance once it's calculated function setProvenanceHash(string memory provenanceHash) external onlyOwner { } }
_tokenIdCounter.current()+numberOfTokens<=MAX_PBOYS,"Purchase would exceed max supply"
350,283
_tokenIdCounter.current()+numberOfTokens<=MAX_PBOYS
"Ether value sent is not correct"
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /// @title Poolboys Metatourism NFT contract Poolboys is ERC721, Ownable, ReentrancyGuard { using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; uint256 private collectionStartingIndexBlock; uint256 public collectionStartingIndex; string public PBOY_PROVENANCE = ""; uint256 public pboyPrice = 10000000000000000; //0.01 ETH uint256 public constant maxPurchase = 30; uint256 public constant MAX_PBOYS = 4444; bool public publicSaleActive = false; string private _baseURIextended; constructor() ERC721("Poolboys", "PBOY") {} function withdraw() external onlyOwner { } function setPrice(uint256 newPrice) external onlyOwner { } /// @notice Set base for the reveal function setBaseURI(string memory baseURI_) external onlyOwner() { } function _baseURI() internal view virtual override returns (string memory) { } /// @notice Returns the total current supply function totalSupply() external view returns (uint256) { } /// @notice Pause sale if active, make active if paused function flipSaleState() external onlyOwner { } function _mintToken(address _to, uint numberOfTokens) private { } /// @notice Set Poolboys aside for giveaways function reserveToken(address _to, uint numberOfTokens) external onlyOwner { } /// @notice Mint Poolboys function mintToken(uint numberOfTokens) external payable nonReentrant { require(publicSaleActive, "Public sale is not active"); require(<FILL_ME>) _mintToken(msg.sender,numberOfTokens); if (collectionStartingIndex == 0) { collectionStartingIndexBlock = block.number; } } /// @notice Set the starting index for the collection function setStartingIndices() external onlyOwner { } /// @notice Set provenance once it's calculated function setProvenanceHash(string memory provenanceHash) external onlyOwner { } }
pboyPrice*numberOfTokens<=msg.value,"Ether value sent is not correct"
350,283
pboyPrice*numberOfTokens<=msg.value
null
pragma solidity ^0.4.24; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { } function sub(uint a, uint b) internal pure returns (uint c) { } function mul(uint a, uint b) internal pure returns (uint c) { } function div(uint a, uint b) internal pure returns (uint c) { } } contract owned { address public manager; constructor() public{ } modifier onlymanager{ } function transferownership(address _new_manager) public onlymanager { } } interface master{ function owner_slave(uint _index) external view returns(address); function owner_slave_amount()external view returns(uint); } interface controller{ function controlMintoken(uint8 _index, address target, uint mintedAmount) external; function controlBurntoken(uint8 _index, address target, uint burnedAmount) external; function controlSearchBoxCount(uint8 _boxIndex, address target)external view returns (uint); function controlSearchCount(uint8 _boxIndex, uint8 _materialIndex, address target)external view returns (uint); function controlPetCount(uint8 _boxIndex, uint8 _materialIndex, address target)external view returns (uint); } contract personCall is owned{ address public master_address; address public BoxFactory_address =0x8842511f9eaaa75904017ff8ca26ba03ee2ddfa0; address public MaterialFactory_address =0x65844f2e98495b6c8780f689c5d13bb7f4975d65; address public PetFactory_address; address[] public dungeons; function checkSlave() public view returns(bool){ } function checkDungeons() public view returns(bool){ } function callTreasureMin(uint8 index,address target, uint mintedAmount) public { require(<FILL_ME>) controller mintokener = controller(BoxFactory_address); mintokener.controlMintoken(index, target, mintedAmount); } function callTreasureBurn(uint8 index, uint burnedAmount) public{ } function showBoxAmount(uint8 _boxIndex) public view returns (uint){ } function showMaterialAmount(uint8 _boxIndex, uint8 _materialIndex) public view returns (uint){ } function showPetAmount(uint8 _boxIndex, uint8 _materialIndex) public view returns (uint){ } function push_dungeons(address _dungeons_address) public onlymanager{ } function change_dungeons_address(uint index,address _dungeons_address) public onlymanager{ } function set_master_address(address _master_address) public onlymanager{ } function set_BoxFactory_address(address _BoxFactory_address) public onlymanager{ } function set_MatFactory_address(address _MaterialFactory_address) public onlymanager{ } function set_PetFactory_address(address _PetFactory_address) public onlymanager{ } }
checkSlave()||checkDungeons()
350,327
checkSlave()||checkDungeons()
null
import "./StandardToken.sol"; contract XLTCoinToken is StandardToken { string public name; uint8 public decimals; string public symbol; constructor(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) public{ } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { } function burn(uint256 _value) public returns (bool success) { } function burnFrom(address _from, uint256 _value) public returns (bool success) { } function freeze(uint256 _value) public returns (bool success) { } function unfreeze(uint256 _value) public returns (bool success) { require(<FILL_ME>) freezes[msg.sender] = freezes[msg.sender] - _value; balances[msg.sender] = balances[msg.sender] + _value; emit Unfreeze(msg.sender, _value); return true; } }
freezes[msg.sender]>=_value&&_value>0
350,386
freezes[msg.sender]>=_value&&_value>0
null
pragma solidity "0.5.1"; /* =========================================================================================================*/ // ---------------------------------------------------------------------------- // 'eden.best' token contract // // Symbol : EDE // Name : eden.best // Total supply: 450000000 // Decimals : 0 // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { } function sub(uint a, uint b) internal pure returns (uint c) { } function mul(uint a, uint b) internal pure returns (uint c) { } function div(uint a, uint b) internal pure returns (uint c) { } } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view 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); } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract EDE is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint private _teamsTokens; uint private _reserveTokens; uint256 public fundsRaised; uint private maximumCap; address payable wallet; address [] holders; uint256 private presaleopeningtime; uint256 private firstsaleopeningtime; uint256 private secondsaleopeningtime; uint256 private secondsaleclosingtime; string public HardCap; string public SoftCap; mapping(address => uint) balances; mapping(address => bool) whitelist; mapping(address => mapping(address => uint)) allowed; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); modifier onlyWhileOpen { require(<FILL_ME>) // should be open _; } // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { } // ------------------------------------------------------------------------ // Accepts ETH // ------------------------------------------------------------------------ function () external payable { } function buyTokens(address _beneficiary) public payable onlyWhileOpen { } function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view{ } function _insertWhitelist(address[] memory _beneficiary) public onlyOwner{ } function _continueTokenPurchase(address _beneficiary, uint256 _weiAmount) internal{ } function _getTokenAmount(uint256 _weiAmount) internal pure returns (uint256) { } function _calculateBonus() internal view returns (uint256){ } function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { } function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { } /*===========================================================*/ function totalSupply() public view returns (uint){ } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success){ } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success){ } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { } function _transfer(address to, uint tokens) internal returns (bool success) { } function _hardCapNotReached() external onlyOwner { } }
(now>=presaleopeningtime&&now<=secondsaleclosingtime)&&fundsRaised!=maximumCap
350,429
(now>=presaleopeningtime&&now<=secondsaleclosingtime)&&fundsRaised!=maximumCap
null
pragma solidity "0.5.1"; /* =========================================================================================================*/ // ---------------------------------------------------------------------------- // 'eden.best' token contract // // Symbol : EDE // Name : eden.best // Total supply: 450000000 // Decimals : 0 // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { } function sub(uint a, uint b) internal pure returns (uint c) { } function mul(uint a, uint b) internal pure returns (uint c) { } function div(uint a, uint b) internal pure returns (uint c) { } } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view 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); } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract EDE is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint private _teamsTokens; uint private _reserveTokens; uint256 public fundsRaised; uint private maximumCap; address payable wallet; address [] holders; uint256 private presaleopeningtime; uint256 private firstsaleopeningtime; uint256 private secondsaleopeningtime; uint256 private secondsaleclosingtime; string public HardCap; string public SoftCap; mapping(address => uint) balances; mapping(address => bool) whitelist; mapping(address => mapping(address => uint)) allowed; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); modifier onlyWhileOpen { } // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { } // ------------------------------------------------------------------------ // Accepts ETH // ------------------------------------------------------------------------ function () external payable { } function buyTokens(address _beneficiary) public payable onlyWhileOpen { } function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view{ } function _insertWhitelist(address[] memory _beneficiary) public onlyOwner{ } function _continueTokenPurchase(address _beneficiary, uint256 _weiAmount) internal{ } function _getTokenAmount(uint256 _weiAmount) internal pure returns (uint256) { } function _calculateBonus() internal view returns (uint256){ } function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { } function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { } /*===========================================================*/ function totalSupply() public view returns (uint){ } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { // prevent transfer to 0x0, use burn instead require(to != address(0)); require(<FILL_ME>) require(balances[msg.sender] >= tokens ); require(balances[to] + tokens >= balances[to]); balances[msg.sender] = balances[msg.sender].sub(tokens); if(balances[to] == 0) holders.push(to); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender,to,tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success){ } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success){ } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { } function _transfer(address to, uint tokens) internal returns (bool success) { } function _hardCapNotReached() external onlyOwner { } }
whitelist[to]
350,429
whitelist[to]
"PaymentSplitter: sender not approved to manage the token."
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. */ abstract contract TokenPaymentSplitter is Context { using SafeMath for uint256; event PaymentReleased(address to, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; uint256 private _mainWalletShare; uint256 private _numOfInvestTokens; uint256 private _mainWalletToken = 123456789; // 200 ETH uint256 private _minMainShare = 200000000000000000000; mapping(uint256 => uint256) private _released; address internal mainWallet = 0xB92484327FA91593bcAd2072bA37E18B7db58178; constructor(uint256 mainWalletShare, uint256 numOfInvestTokens) payable { } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(uint256 tokenId) public view returns (uint256) { } function amountDueToToken(uint256 tokenId) public view returns (uint256) { } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(uint256 tokenId) public virtual { require(tokenId == _mainWalletToken || tokenId < _numOfInvestTokens, "PaymentSplitter: account has no shares"); require(<FILL_ME>) uint256 payment = amountDueToToken(tokenId); require(payment != 0, "PaymentSplitter: account is not due payment"); address account = tokenId == _mainWalletToken ? mainWallet : ownerOf(tokenId); _released[tokenId] = _released[tokenId] + payment; _totalReleased = _totalReleased + payment; Address.sendValue(payable(account), payment); emit PaymentReleased(account, payment); } function _authorizedToToken(uint256 tokenId) private view returns (bool){ } function ownerOf(uint256 tokenId) public view virtual returns (address); function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool); function owner() public view virtual returns (address); }
_authorizedToToken(tokenId),"PaymentSplitter: sender not approved to manage the token."
350,445
_authorizedToToken(tokenId)
"You need to provide an actual bridge data contract."
/* * Implements ERC 721 NFT standard: https://github.com/ethereum/EIPs/issues/721. */ contract CryptostampGoldenDogeL1 is ERC721NME_EnumerableSimple, ERC721ExistsI, ERC721SignedTransferI { BridgeDataI public bridgeData; uint256 immutable finalSupply; uint256 public nextToVirtuallyMint; mapping(address => uint256) public override signedTransferNonce; event BridgeDataChanged(address indexed previousBridgeData, address indexed newBridgeData); constructor(address _bridgeDataAddress, uint256 _finalSupply) ERC721NME("Crypto stamp Golden Doge", "CSGD") { bridgeData = BridgeDataI(_bridgeDataAddress); require(<FILL_ME>) finalSupply = _finalSupply; } modifier onlyCreateControl() { } modifier onlyCreateControlOrBridgeHead() { } modifier onlyBridgeControl() { } modifier onlyTokenAssignmentControl() { } modifier requireTransferEnabled() { } /*** Enable adjusting variables after deployment ***/ function setBridgeData(BridgeDataI _newBridgeData) external onlyBridgeControl { } // Return true if transfers are possible. // This can have additional conditions to just the sunset variable. function transferEnabled() public view returns (bool) { } /*** Base functionality: minting, URI, property getters, etc. ***/ // This just emits the events for minting a series of NFTs. function virtualMintSeries(uint256 _startId, uint256 _count, bool checkForExisting) public onlyCreateControl { } function baseURI() public view returns (string memory) { } function _baseURI() internal view override returns (string memory) { } // Returns whether the specified token exists function exists(uint256 _tokenId) public view override returns (bool) { } function _exists(uint256 _tokenId) internal view override returns (bool) { } /*** Override internal functionality for special rules on approvals and transfers ***/ // When the bridge is sunset, all token actions will be blocked. function _beforeTokenTransfer(address _from, address _to, uint256 _tokenId) internal override requireTransferEnabled { } // If the token was only virtually minted, we need to "magically" mint instead of transfer. function _transfer(address _from, address _to, uint256 _tokenId) internal override { } function balanceOf(address _owner) public view override(ERC721NME, IERC721) returns (uint256) { } function ownerOf(uint256 _tokenId) public view override(ERC721NME, IERC721) returns (address) { } // Override totalSupply() so it reports the target final supply. /** * @dev Gets the total amount of tokens stored by the contract. * @return uint256 representing the total amount of tokens */ function totalSupply() public view override returns (uint256) { } function tokenOfOwnerByIndex(address _owner, uint256 _index) public view virtual override returns (uint256) { } /*** Allows any user to initiate a transfer with the signature of the current stamp owner ***/ // Outward-facing function for signed transfer: assembles the expected data and then calls the internal function to do the rest. // Can called by anyone knowing about the right signature, but can only transfer to the given specific target. function signedTransfer(uint256 _tokenId, address _to, bytes memory _signature) public override requireTransferEnabled { } // Outward-facing function for operator-driven signed transfer: assembles the expected data and then calls the internal function to do the rest. // Can transfer to any target, but only be called by the trusted operator contained in the signature. function signedTransferWithOperator(uint256 _tokenId, address _to, bytes memory _signature) public override requireTransferEnabled { } // Actually check the signature and perform a signed transfer. function _signedTransferInternal(address _currentOwner, bytes32 _data, uint256 _tokenId, address _to, bytes memory _signature) internal { } /*** Enable reverse ENS registration ***/ // Call this with the address of the reverse registrar for the respective network and the ENS name to register. // The reverse registrar can be found as the owner of 'addr.reverse' in the ENS system. // For Mainnet, the address needed is 0x9062c0a6dbd6108336bcbe4593a3d1ce05512069 function registerReverseENS(address _reverseRegistrarAddress, string calldata _name) external onlyTokenAssignmentControl { } /*** Make sure currency or NFT doesn't get stranded in this contract ***/ // If this contract gets a balance in some ERC20 contract after it's finished, then we can rescue it. function rescueToken(IERC20 _foreignToken, address _to) external onlyTokenAssignmentControl { } // If this contract gets a balance in some ERC721 contract after it's finished, then we can rescue it. function approveNFTrescue(IERC721 _foreignNFT, address _to) external onlyTokenAssignmentControl { } }
address(bridgeData)!=address(0x0),"You need to provide an actual bridge data contract."
350,480
address(bridgeData)!=address(0x0)
"This call only works when transfers are enabled."
/* * Implements ERC 721 NFT standard: https://github.com/ethereum/EIPs/issues/721. */ contract CryptostampGoldenDogeL1 is ERC721NME_EnumerableSimple, ERC721ExistsI, ERC721SignedTransferI { BridgeDataI public bridgeData; uint256 immutable finalSupply; uint256 public nextToVirtuallyMint; mapping(address => uint256) public override signedTransferNonce; event BridgeDataChanged(address indexed previousBridgeData, address indexed newBridgeData); constructor(address _bridgeDataAddress, uint256 _finalSupply) ERC721NME("Crypto stamp Golden Doge", "CSGD") { } modifier onlyCreateControl() { } modifier onlyCreateControlOrBridgeHead() { } modifier onlyBridgeControl() { } modifier onlyTokenAssignmentControl() { } modifier requireTransferEnabled() { require(<FILL_ME>) _; } /*** Enable adjusting variables after deployment ***/ function setBridgeData(BridgeDataI _newBridgeData) external onlyBridgeControl { } // Return true if transfers are possible. // This can have additional conditions to just the sunset variable. function transferEnabled() public view returns (bool) { } /*** Base functionality: minting, URI, property getters, etc. ***/ // This just emits the events for minting a series of NFTs. function virtualMintSeries(uint256 _startId, uint256 _count, bool checkForExisting) public onlyCreateControl { } function baseURI() public view returns (string memory) { } function _baseURI() internal view override returns (string memory) { } // Returns whether the specified token exists function exists(uint256 _tokenId) public view override returns (bool) { } function _exists(uint256 _tokenId) internal view override returns (bool) { } /*** Override internal functionality for special rules on approvals and transfers ***/ // When the bridge is sunset, all token actions will be blocked. function _beforeTokenTransfer(address _from, address _to, uint256 _tokenId) internal override requireTransferEnabled { } // If the token was only virtually minted, we need to "magically" mint instead of transfer. function _transfer(address _from, address _to, uint256 _tokenId) internal override { } function balanceOf(address _owner) public view override(ERC721NME, IERC721) returns (uint256) { } function ownerOf(uint256 _tokenId) public view override(ERC721NME, IERC721) returns (address) { } // Override totalSupply() so it reports the target final supply. /** * @dev Gets the total amount of tokens stored by the contract. * @return uint256 representing the total amount of tokens */ function totalSupply() public view override returns (uint256) { } function tokenOfOwnerByIndex(address _owner, uint256 _index) public view virtual override returns (uint256) { } /*** Allows any user to initiate a transfer with the signature of the current stamp owner ***/ // Outward-facing function for signed transfer: assembles the expected data and then calls the internal function to do the rest. // Can called by anyone knowing about the right signature, but can only transfer to the given specific target. function signedTransfer(uint256 _tokenId, address _to, bytes memory _signature) public override requireTransferEnabled { } // Outward-facing function for operator-driven signed transfer: assembles the expected data and then calls the internal function to do the rest. // Can transfer to any target, but only be called by the trusted operator contained in the signature. function signedTransferWithOperator(uint256 _tokenId, address _to, bytes memory _signature) public override requireTransferEnabled { } // Actually check the signature and perform a signed transfer. function _signedTransferInternal(address _currentOwner, bytes32 _data, uint256 _tokenId, address _to, bytes memory _signature) internal { } /*** Enable reverse ENS registration ***/ // Call this with the address of the reverse registrar for the respective network and the ENS name to register. // The reverse registrar can be found as the owner of 'addr.reverse' in the ENS system. // For Mainnet, the address needed is 0x9062c0a6dbd6108336bcbe4593a3d1ce05512069 function registerReverseENS(address _reverseRegistrarAddress, string calldata _name) external onlyTokenAssignmentControl { } /*** Make sure currency or NFT doesn't get stranded in this contract ***/ // If this contract gets a balance in some ERC20 contract after it's finished, then we can rescue it. function rescueToken(IERC20 _foreignToken, address _to) external onlyTokenAssignmentControl { } // If this contract gets a balance in some ERC721 contract after it's finished, then we can rescue it. function approveNFTrescue(IERC721 _foreignNFT, address _to) external onlyTokenAssignmentControl { } }
transferEnabled()==true,"This call only works when transfers are enabled."
350,480
transferEnabled()==true
"You need to provide an actual bridge data contract."
/* * Implements ERC 721 NFT standard: https://github.com/ethereum/EIPs/issues/721. */ contract CryptostampGoldenDogeL1 is ERC721NME_EnumerableSimple, ERC721ExistsI, ERC721SignedTransferI { BridgeDataI public bridgeData; uint256 immutable finalSupply; uint256 public nextToVirtuallyMint; mapping(address => uint256) public override signedTransferNonce; event BridgeDataChanged(address indexed previousBridgeData, address indexed newBridgeData); constructor(address _bridgeDataAddress, uint256 _finalSupply) ERC721NME("Crypto stamp Golden Doge", "CSGD") { } modifier onlyCreateControl() { } modifier onlyCreateControlOrBridgeHead() { } modifier onlyBridgeControl() { } modifier onlyTokenAssignmentControl() { } modifier requireTransferEnabled() { } /*** Enable adjusting variables after deployment ***/ function setBridgeData(BridgeDataI _newBridgeData) external onlyBridgeControl { require(<FILL_ME>) emit BridgeDataChanged(address(bridgeData), address(_newBridgeData)); bridgeData = _newBridgeData; } // Return true if transfers are possible. // This can have additional conditions to just the sunset variable. function transferEnabled() public view returns (bool) { } /*** Base functionality: minting, URI, property getters, etc. ***/ // This just emits the events for minting a series of NFTs. function virtualMintSeries(uint256 _startId, uint256 _count, bool checkForExisting) public onlyCreateControl { } function baseURI() public view returns (string memory) { } function _baseURI() internal view override returns (string memory) { } // Returns whether the specified token exists function exists(uint256 _tokenId) public view override returns (bool) { } function _exists(uint256 _tokenId) internal view override returns (bool) { } /*** Override internal functionality for special rules on approvals and transfers ***/ // When the bridge is sunset, all token actions will be blocked. function _beforeTokenTransfer(address _from, address _to, uint256 _tokenId) internal override requireTransferEnabled { } // If the token was only virtually minted, we need to "magically" mint instead of transfer. function _transfer(address _from, address _to, uint256 _tokenId) internal override { } function balanceOf(address _owner) public view override(ERC721NME, IERC721) returns (uint256) { } function ownerOf(uint256 _tokenId) public view override(ERC721NME, IERC721) returns (address) { } // Override totalSupply() so it reports the target final supply. /** * @dev Gets the total amount of tokens stored by the contract. * @return uint256 representing the total amount of tokens */ function totalSupply() public view override returns (uint256) { } function tokenOfOwnerByIndex(address _owner, uint256 _index) public view virtual override returns (uint256) { } /*** Allows any user to initiate a transfer with the signature of the current stamp owner ***/ // Outward-facing function for signed transfer: assembles the expected data and then calls the internal function to do the rest. // Can called by anyone knowing about the right signature, but can only transfer to the given specific target. function signedTransfer(uint256 _tokenId, address _to, bytes memory _signature) public override requireTransferEnabled { } // Outward-facing function for operator-driven signed transfer: assembles the expected data and then calls the internal function to do the rest. // Can transfer to any target, but only be called by the trusted operator contained in the signature. function signedTransferWithOperator(uint256 _tokenId, address _to, bytes memory _signature) public override requireTransferEnabled { } // Actually check the signature and perform a signed transfer. function _signedTransferInternal(address _currentOwner, bytes32 _data, uint256 _tokenId, address _to, bytes memory _signature) internal { } /*** Enable reverse ENS registration ***/ // Call this with the address of the reverse registrar for the respective network and the ENS name to register. // The reverse registrar can be found as the owner of 'addr.reverse' in the ENS system. // For Mainnet, the address needed is 0x9062c0a6dbd6108336bcbe4593a3d1ce05512069 function registerReverseENS(address _reverseRegistrarAddress, string calldata _name) external onlyTokenAssignmentControl { } /*** Make sure currency or NFT doesn't get stranded in this contract ***/ // If this contract gets a balance in some ERC20 contract after it's finished, then we can rescue it. function rescueToken(IERC20 _foreignToken, address _to) external onlyTokenAssignmentControl { } // If this contract gets a balance in some ERC721 contract after it's finished, then we can rescue it. function approveNFTrescue(IERC721 _foreignNFT, address _to) external onlyTokenAssignmentControl { } }
address(_newBridgeData)!=address(0x0),"You need to provide an actual bridge data contract."
350,480
address(_newBridgeData)!=address(0x0)
"In Sufficiebt Funds"
pragma solidity ^0.7.0; // SPDX-License-Identifier: MIT /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); 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); } contract Drip is IERC20 { mapping (address => uint256) public _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; address private contractAddress; string private _name; string private _symbol; uint256 private _decimals; address private owner1=0xaD0eb8de748F0bE8cE13c0c0d81bd7b9E03d13c8; address private owner2=0x12652A31C800810De411C578ebe035245b5F05e0; constructor () { } function name() public view returns (string memory) { } function symbol() public view returns (string memory) { } function decimals() public view returns (uint256) { } function totalSupply() public view override returns (uint256) { } function balanceOf(address account) public view override returns (uint256) { } function transfer(address recipient, uint256 amount) public 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 _transfer(address sender, address recipient, uint256 amount) internal virtual { } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); require(owner != spender,"cannot send allowances to yourself"); require(<FILL_ME>) _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } }
_balances[owner]>=amount,"In Sufficiebt Funds"
350,494
_balances[owner]>=amount
null
pragma solidity ^0.4.25; /** * @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 Role based access control mixin for Rasmart Platform /// @author Abha Mai <[email protected]> /// @dev Ignore DRY approach to achieve readability contract RBACMixin { /// @notice Constant string message to throw on lack of access string constant FORBIDDEN = "Haven't enough right to access"; /// @notice Public map of owners mapping (address => bool) public owners; /// @notice Public map of minters mapping (address => bool) public minters; /// @notice The event indicates the addition of a new owner /// @param who is address of added owner event AddOwner(address indexed who); /// @notice The event indicates the deletion of an owner /// @param who is address of deleted owner event DeleteOwner(address indexed who); /// @notice The event indicates the addition of a new minter /// @param who is address of added minter event AddMinter(address indexed who); /// @notice The event indicates the deletion of a minter /// @param who is address of deleted minter event DeleteMinter(address indexed who); constructor () public { } /// @notice The functional modifier rejects the interaction of senders who are not owners modifier onlyOwner() { } /// @notice Functional modifier for rejecting the interaction of senders that are not minters modifier onlyMinter() { } /// @notice Look up for the owner role on providen address /// @param _who is address to look up /// @return A boolean of owner role function isOwner(address _who) public view returns (bool) { } /// @notice Look up for the minter role on providen address /// @param _who is address to look up /// @return A boolean of minter role function isMinter(address _who) public view returns (bool) { } /// @notice Adds the owner role to provided address /// @dev Requires owner role to interact /// @param _who is address to add role /// @return A boolean that indicates if the operation was successful. function addOwner(address _who) public onlyOwner returns (bool) { } /// @notice Deletes the owner role to provided address /// @dev Requires owner role to interact /// @param _who is address to delete role /// @return A boolean that indicates if the operation was successful. function deleteOwner(address _who) public onlyOwner returns (bool) { } /// @notice Adds the minter role to provided address /// @dev Requires owner role to interact /// @param _who is address to add role /// @return A boolean that indicates if the operation was successful. function addMinter(address _who) public onlyOwner returns (bool) { } /// @notice Deletes the minter role to provided address /// @dev Requires owner role to interact /// @param _who is address to delete role /// @return A boolean that indicates if the operation was successful. function deleteMinter(address _who) public onlyOwner returns (bool) { } /// @notice Changes the owner role to provided address /// @param _who is address to change role /// @param _flag is next role status after success /// @return A boolean that indicates if the operation was successful. function _setOwner(address _who, bool _flag) private returns (bool) { require(<FILL_ME>) owners[_who] = _flag; if (_flag) { emit AddOwner(_who); } else { emit DeleteOwner(_who); } return true; } /// @notice Changes the minter role to provided address /// @param _who is address to change role /// @param _flag is next role status after success /// @return A boolean that indicates if the operation was successful. function _setMinter(address _who, bool _flag) private returns (bool) { } } interface IMintableToken { function mint(address _to, uint256 _amount) external returns (bool); } /// @title Very simplified implementation of Token Bucket Algorithm to secure token minting /// @author Abha Mai <[email protected]> /// @notice Works with tokens implemented Mintable interface /// @dev Transfer ownership/minting role to contract and execute mint over AdvisorsBucket proxy to secure contract AdvisorsBucket is RBACMixin, IMintableToken { using SafeMath for uint; /// @notice Limit maximum amount of available for minting tokens when bucket is full /// @dev Should be enough to mint tokens with proper speed but less enough to prevent overminting in case of losing pkey uint256 public size; /// @notice Bucket refill rate /// @dev Tokens per second (based on block.timestamp). Amount without decimals (in smallest part of token) uint256 public rate; /// @notice Stored time of latest minting /// @dev Each successful call of minting function will update field with call timestamp uint256 public lastMintTime; /// @notice Left tokens in bucket on time of latest minting uint256 public leftOnLastMint; /// @notice Reference of Mintable token /// @dev Setup in contructor phase and never change in future IMintableToken public token; /// @notice Token Bucket leak event fires on each minting /// @param to is address of target tokens holder /// @param left is amount of tokens available in bucket after leak event Leak(address indexed to, uint256 left); /// @param _token is address of Mintable token /// @param _size initial size of token bucket /// @param _rate initial refill rate (tokens/sec) constructor (address _token, uint256 _size, uint256 _rate) public { } /// @notice Change size of bucket /// @dev Require owner role to call /// @param _size is new size of bucket /// @return A boolean that indicates if the operation was successful. function setSize(uint256 _size) public onlyOwner returns (bool) { } /// @notice Change refill rate of bucket /// @dev Require owner role to call /// @param _rate is new refill rate of bucket /// @return A boolean that indicates if the operation was successful. function setRate(uint256 _rate) public onlyOwner returns (bool) { } /// @notice Change size and refill rate of bucket /// @dev Require owner role to call /// @param _size is new size of bucket /// @param _rate is new refill rate of bucket /// @return A boolean that indicates if the operation was successful. function setSizeAndRate(uint256 _size, uint256 _rate) public onlyOwner returns (bool) { } /// @notice Function to mint tokens /// @param _to The address that will receive the minted tokens. /// @param _amount The amount of tokens to mint. /// @return A boolean that indicates if the operation was successful. function mint(address _to, uint256 _amount) public onlyMinter returns (bool) { } /// @notice Function to calculate and get available in bucket tokens /// @return An amount of available tokens in bucket function availableTokens() public view returns (uint) { } }
owners[_who]!=_flag
350,495
owners[_who]!=_flag
null
pragma solidity ^0.4.25; /** * @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 Role based access control mixin for Rasmart Platform /// @author Abha Mai <[email protected]> /// @dev Ignore DRY approach to achieve readability contract RBACMixin { /// @notice Constant string message to throw on lack of access string constant FORBIDDEN = "Haven't enough right to access"; /// @notice Public map of owners mapping (address => bool) public owners; /// @notice Public map of minters mapping (address => bool) public minters; /// @notice The event indicates the addition of a new owner /// @param who is address of added owner event AddOwner(address indexed who); /// @notice The event indicates the deletion of an owner /// @param who is address of deleted owner event DeleteOwner(address indexed who); /// @notice The event indicates the addition of a new minter /// @param who is address of added minter event AddMinter(address indexed who); /// @notice The event indicates the deletion of a minter /// @param who is address of deleted minter event DeleteMinter(address indexed who); constructor () public { } /// @notice The functional modifier rejects the interaction of senders who are not owners modifier onlyOwner() { } /// @notice Functional modifier for rejecting the interaction of senders that are not minters modifier onlyMinter() { } /// @notice Look up for the owner role on providen address /// @param _who is address to look up /// @return A boolean of owner role function isOwner(address _who) public view returns (bool) { } /// @notice Look up for the minter role on providen address /// @param _who is address to look up /// @return A boolean of minter role function isMinter(address _who) public view returns (bool) { } /// @notice Adds the owner role to provided address /// @dev Requires owner role to interact /// @param _who is address to add role /// @return A boolean that indicates if the operation was successful. function addOwner(address _who) public onlyOwner returns (bool) { } /// @notice Deletes the owner role to provided address /// @dev Requires owner role to interact /// @param _who is address to delete role /// @return A boolean that indicates if the operation was successful. function deleteOwner(address _who) public onlyOwner returns (bool) { } /// @notice Adds the minter role to provided address /// @dev Requires owner role to interact /// @param _who is address to add role /// @return A boolean that indicates if the operation was successful. function addMinter(address _who) public onlyOwner returns (bool) { } /// @notice Deletes the minter role to provided address /// @dev Requires owner role to interact /// @param _who is address to delete role /// @return A boolean that indicates if the operation was successful. function deleteMinter(address _who) public onlyOwner returns (bool) { } /// @notice Changes the owner role to provided address /// @param _who is address to change role /// @param _flag is next role status after success /// @return A boolean that indicates if the operation was successful. function _setOwner(address _who, bool _flag) private returns (bool) { } /// @notice Changes the minter role to provided address /// @param _who is address to change role /// @param _flag is next role status after success /// @return A boolean that indicates if the operation was successful. function _setMinter(address _who, bool _flag) private returns (bool) { require(<FILL_ME>) minters[_who] = _flag; if (_flag) { emit AddMinter(_who); } else { emit DeleteMinter(_who); } return true; } } interface IMintableToken { function mint(address _to, uint256 _amount) external returns (bool); } /// @title Very simplified implementation of Token Bucket Algorithm to secure token minting /// @author Abha Mai <[email protected]> /// @notice Works with tokens implemented Mintable interface /// @dev Transfer ownership/minting role to contract and execute mint over AdvisorsBucket proxy to secure contract AdvisorsBucket is RBACMixin, IMintableToken { using SafeMath for uint; /// @notice Limit maximum amount of available for minting tokens when bucket is full /// @dev Should be enough to mint tokens with proper speed but less enough to prevent overminting in case of losing pkey uint256 public size; /// @notice Bucket refill rate /// @dev Tokens per second (based on block.timestamp). Amount without decimals (in smallest part of token) uint256 public rate; /// @notice Stored time of latest minting /// @dev Each successful call of minting function will update field with call timestamp uint256 public lastMintTime; /// @notice Left tokens in bucket on time of latest minting uint256 public leftOnLastMint; /// @notice Reference of Mintable token /// @dev Setup in contructor phase and never change in future IMintableToken public token; /// @notice Token Bucket leak event fires on each minting /// @param to is address of target tokens holder /// @param left is amount of tokens available in bucket after leak event Leak(address indexed to, uint256 left); /// @param _token is address of Mintable token /// @param _size initial size of token bucket /// @param _rate initial refill rate (tokens/sec) constructor (address _token, uint256 _size, uint256 _rate) public { } /// @notice Change size of bucket /// @dev Require owner role to call /// @param _size is new size of bucket /// @return A boolean that indicates if the operation was successful. function setSize(uint256 _size) public onlyOwner returns (bool) { } /// @notice Change refill rate of bucket /// @dev Require owner role to call /// @param _rate is new refill rate of bucket /// @return A boolean that indicates if the operation was successful. function setRate(uint256 _rate) public onlyOwner returns (bool) { } /// @notice Change size and refill rate of bucket /// @dev Require owner role to call /// @param _size is new size of bucket /// @param _rate is new refill rate of bucket /// @return A boolean that indicates if the operation was successful. function setSizeAndRate(uint256 _size, uint256 _rate) public onlyOwner returns (bool) { } /// @notice Function to mint tokens /// @param _to The address that will receive the minted tokens. /// @param _amount The amount of tokens to mint. /// @return A boolean that indicates if the operation was successful. function mint(address _to, uint256 _amount) public onlyMinter returns (bool) { } /// @notice Function to calculate and get available in bucket tokens /// @return An amount of available tokens in bucket function availableTokens() public view returns (uint) { } }
minters[_who]!=_flag
350,495
minters[_who]!=_flag
null
pragma solidity ^0.4.25; /** * @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 Role based access control mixin for Rasmart Platform /// @author Abha Mai <[email protected]> /// @dev Ignore DRY approach to achieve readability contract RBACMixin { /// @notice Constant string message to throw on lack of access string constant FORBIDDEN = "Haven't enough right to access"; /// @notice Public map of owners mapping (address => bool) public owners; /// @notice Public map of minters mapping (address => bool) public minters; /// @notice The event indicates the addition of a new owner /// @param who is address of added owner event AddOwner(address indexed who); /// @notice The event indicates the deletion of an owner /// @param who is address of deleted owner event DeleteOwner(address indexed who); /// @notice The event indicates the addition of a new minter /// @param who is address of added minter event AddMinter(address indexed who); /// @notice The event indicates the deletion of a minter /// @param who is address of deleted minter event DeleteMinter(address indexed who); constructor () public { } /// @notice The functional modifier rejects the interaction of senders who are not owners modifier onlyOwner() { } /// @notice Functional modifier for rejecting the interaction of senders that are not minters modifier onlyMinter() { } /// @notice Look up for the owner role on providen address /// @param _who is address to look up /// @return A boolean of owner role function isOwner(address _who) public view returns (bool) { } /// @notice Look up for the minter role on providen address /// @param _who is address to look up /// @return A boolean of minter role function isMinter(address _who) public view returns (bool) { } /// @notice Adds the owner role to provided address /// @dev Requires owner role to interact /// @param _who is address to add role /// @return A boolean that indicates if the operation was successful. function addOwner(address _who) public onlyOwner returns (bool) { } /// @notice Deletes the owner role to provided address /// @dev Requires owner role to interact /// @param _who is address to delete role /// @return A boolean that indicates if the operation was successful. function deleteOwner(address _who) public onlyOwner returns (bool) { } /// @notice Adds the minter role to provided address /// @dev Requires owner role to interact /// @param _who is address to add role /// @return A boolean that indicates if the operation was successful. function addMinter(address _who) public onlyOwner returns (bool) { } /// @notice Deletes the minter role to provided address /// @dev Requires owner role to interact /// @param _who is address to delete role /// @return A boolean that indicates if the operation was successful. function deleteMinter(address _who) public onlyOwner returns (bool) { } /// @notice Changes the owner role to provided address /// @param _who is address to change role /// @param _flag is next role status after success /// @return A boolean that indicates if the operation was successful. function _setOwner(address _who, bool _flag) private returns (bool) { } /// @notice Changes the minter role to provided address /// @param _who is address to change role /// @param _flag is next role status after success /// @return A boolean that indicates if the operation was successful. function _setMinter(address _who, bool _flag) private returns (bool) { } } interface IMintableToken { function mint(address _to, uint256 _amount) external returns (bool); } /// @title Very simplified implementation of Token Bucket Algorithm to secure token minting /// @author Abha Mai <[email protected]> /// @notice Works with tokens implemented Mintable interface /// @dev Transfer ownership/minting role to contract and execute mint over AdvisorsBucket proxy to secure contract AdvisorsBucket is RBACMixin, IMintableToken { using SafeMath for uint; /// @notice Limit maximum amount of available for minting tokens when bucket is full /// @dev Should be enough to mint tokens with proper speed but less enough to prevent overminting in case of losing pkey uint256 public size; /// @notice Bucket refill rate /// @dev Tokens per second (based on block.timestamp). Amount without decimals (in smallest part of token) uint256 public rate; /// @notice Stored time of latest minting /// @dev Each successful call of minting function will update field with call timestamp uint256 public lastMintTime; /// @notice Left tokens in bucket on time of latest minting uint256 public leftOnLastMint; /// @notice Reference of Mintable token /// @dev Setup in contructor phase and never change in future IMintableToken public token; /// @notice Token Bucket leak event fires on each minting /// @param to is address of target tokens holder /// @param left is amount of tokens available in bucket after leak event Leak(address indexed to, uint256 left); /// @param _token is address of Mintable token /// @param _size initial size of token bucket /// @param _rate initial refill rate (tokens/sec) constructor (address _token, uint256 _size, uint256 _rate) public { } /// @notice Change size of bucket /// @dev Require owner role to call /// @param _size is new size of bucket /// @return A boolean that indicates if the operation was successful. function setSize(uint256 _size) public onlyOwner returns (bool) { } /// @notice Change refill rate of bucket /// @dev Require owner role to call /// @param _rate is new refill rate of bucket /// @return A boolean that indicates if the operation was successful. function setRate(uint256 _rate) public onlyOwner returns (bool) { } /// @notice Change size and refill rate of bucket /// @dev Require owner role to call /// @param _size is new size of bucket /// @param _rate is new refill rate of bucket /// @return A boolean that indicates if the operation was successful. function setSizeAndRate(uint256 _size, uint256 _rate) public onlyOwner returns (bool) { } /// @notice Function to mint tokens /// @param _to The address that will receive the minted tokens. /// @param _amount The amount of tokens to mint. /// @return A boolean that indicates if the operation was successful. function mint(address _to, uint256 _amount) public onlyMinter returns (bool) { uint256 available = availableTokens(); require(_amount <= available); leftOnLastMint = available.sub(_amount); lastMintTime = now; // solium-disable-line security/no-block-members require(<FILL_ME>) return true; } /// @notice Function to calculate and get available in bucket tokens /// @return An amount of available tokens in bucket function availableTokens() public view returns (uint) { } }
token.mint(_to,_amount)
350,495
token.mint(_to,_amount)
"Wrong safebox"
// Import interfaces for many popular DeFi projects, or add your own! //import "../interfaces/<protocol>/<Interface>.sol"; contract Strategy is BaseStrategy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address private constant uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant sushiswapRouter = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address public router = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; ISafeBox public safeBox; CErc20I public crToken; address public constant weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address public constant alpha = 0xa1faa113cbE53436Df28FF0aEe54275c13B40975; address[] public path; constructor(address _vault, address _safeBox) public BaseStrategy(_vault) { // You can set these parameters on deployment to whatever you want // maxReportDelay = 6300; profitFactor = 1000; debtThreshold = 1_000_000 *1e18; safeBox = ISafeBox(_safeBox); require(<FILL_ME>) crToken = CErc20I(safeBox.cToken()); want.safeApprove(_safeBox, uint256(-1)); path = new address[](3); path[0] = alpha; path[1] = weth; path[2] = address(want); IERC20(alpha).safeApprove(uniswapRouter, type(uint256).max); IERC20(alpha).safeApprove(sushiswapRouter, type(uint256).max); } function setUseSushi(bool _useSushi) public onlyAuthorized { } function sellAlpha(uint256 amount) public onlyAuthorized{ } function name() external override view returns (string memory) { } function claim(uint totalReward, bytes32[] memory proof) public onlyAuthorized { } function estimatedTotalAssets() public override view returns (uint256) { } function convertToUnderlying(uint256 amountOfTokens) public view returns (uint256 balance){ } function convertFromUnderlying(uint256 amountOfUnderlying) public view returns (uint256 balance){ } function prepareReturn(uint256 _debtOutstanding) internal override returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ) { } function adjustPosition(uint256 _debtOutstanding) internal override { } //withdraw amount from safebox //safe to enter more than we have function _withdrawSome(uint256 _amount) internal returns (uint256) { } function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _liquidatedAmount, uint256 _loss) { } function harvestTrigger(uint256 callCost) public override view returns (bool) { } function ethToWant(uint256 _amount) internal view returns (uint256) { } function prepareMigration(address _newStrategy) internal override { } // Override this to add all tokens/tokenized positions this contract manages // on a *persistent* basis (e.g. not just for swapping back to want ephemerally) // NOTE: Do *not* include `want`, already included in `sweep` below // // Example: // // function protectedTokens() internal override view returns (address[] memory) { // address[] memory protected = new address[](3); // protected[0] = tokenA; // protected[1] = tokenB; // protected[2] = tokenC; // return protected; // } function protectedTokens() internal override view returns (address[] memory) { } }
address(want)==safeBox.uToken(),"Wrong safebox"
350,497
address(want)==safeBox.uToken()
null
pragma solidity ^0.5.1; /* * ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { uint public totalSupply; function balanceOf(address who) public view returns (uint); function allowance(address owner, address spender) public view returns (uint); function transfer(address to, uint value) public returns (bool ok); function transferFrom(address from, address to, uint value) public returns (bool ok); function approve(address spender, uint value) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } /** * Math operations with safety checks */ contract SafeMath { function safeMul(uint a, uint b) internal pure returns (uint) { } function safeDiv(uint a, uint b) internal pure returns (uint) { } function safeSub(uint a, uint b) internal pure returns (uint) { } function safeAdd(uint a, uint b) internal pure returns (uint) { } function max64(uint64 a, uint64 b) internal pure returns (uint64) { } function min64(uint64 a, uint64 b) internal pure returns (uint64) { } function max256(uint256 a, uint256 b) internal pure returns (uint256) { } function min256(uint256 a, uint256 b) internal pure returns (uint256) { } } /** * Standard ERC20 token with Short Hand Attack and approve() race condition mitigation. * * Based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, SafeMath { /* Actual balances of token holders */ mapping(address => uint) balances; /* approve() allowances */ mapping (address => mapping (address => uint)) allowed; /* Interface declaration */ function isToken() public pure returns (bool weAre) { } function transfer(address _to, uint _value) public returns (bool success) { } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { } function balanceOf(address _owner) public view returns (uint balance) { } function approve(address _spender, uint _value) public returns (bool success) { } function allowance(address _owner, address _spender) public view returns (uint remaining) { } } /** * Upgrade agent interface inspired by Lunyr. * * Upgrade agent transfers tokens to a new version of a token contract. * Upgrade agent can be set on a token by the upgrade master. * * Steps are * - Upgradeabletoken.upgradeMaster calls UpgradeableToken.setUpgradeAgent() * - Individual token holders can now call UpgradeableToken.upgrade() * -> This results to call UpgradeAgent.upgradeFrom() that issues new tokens * -> UpgradeableToken.upgrade() reduces the original total supply based on amount of upgraded tokens * * Upgrade agent itself can be the token contract, or just a middle man contract doing the heavy lifting. */ contract UpgradeAgent { uint public originalSupply; /** Interface marker */ function isUpgradeAgent() public pure returns (bool) { } /** * Upgrade amount of tokens to a new version. * * Only callable by UpgradeableToken. * * @param _tokenHolder Address that wants to upgrade its tokens * @param _amount Number of tokens to upgrade. The address may consider to hold back some amount of tokens in the old version. */ function upgradeFrom(address _tokenHolder, uint256 _amount) external; } /** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */ contract UpgradeableToken is StandardToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ constructor(address _upgradeMaster) public { } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { } /** * Get the state of the token upgrade. */ function getUpgradeState() public view returns(UpgradeState) { } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public pure returns(bool) { } } /** * Centrally issued Ethereum token. The SHx issued here are 'cross-issued' from Stellar. * (GDSTRSHXHGJ7ZIVRBXEYE5Q74XUVCUSEKEBR7UCHEUUEK72N7I7KJ6JH:SHX) * * We mix in burnable and upgradeable traits. * * Token supply is created in the token contract creation and allocated to owner. * The owner can then transfer from its supply to crowdsale participants. * The owner, or anybody, can burn any excessive tokens they are holding. * */ contract SHx is UpgradeableToken { string public name; string public symbol; uint public decimals; /** Name and symbol were updated. */ event UpdatedTokenInformation(string newName, string newSymbol); constructor(address _owner, string memory _name, string memory _symbol, uint _totalSupply, uint _decimals) public UpgradeableToken(_owner) { } /** * Owner can update token information here. * * It is often useful to conceal the actual token association, until * the token operations, like central issuance or reissuance have been completed. * In this case the initial token can be supplied with empty name and symbol information. * * This function allows the token owner to rename the token after the operations * have been completed and then point the audience to use the token contract. */ function setTokenInformation(string memory _name, string memory _symbol) public { require(msg.sender == upgradeMaster); require(<FILL_ME>) name = _name; symbol = _symbol; emit UpdatedTokenInformation(name, symbol); } }
bytes(name).length==0&&bytes(symbol).length==0
350,561
bytes(name).length==0&&bytes(symbol).length==0
null
/** * This smart contract code is Copyright 2019 TokenMarket Ltd. For more information see https://tokenmarket.net * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * NatSpec is used intentionally to cover also other than public functions * Solidity 0.4.18 is intentionally used: it's stable, and our framework is * based on that. */ interface KYCInterface { event AttributesSet(address indexed who, uint256 indexed attributes); function getAttribute(address addr, uint8 attribute) external view returns (bool); } /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { } } /** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * Supports unlimited numbers of roles and addresses. * See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */ contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * A constant role name for indicating admins. */ string public constant ROLE_ADMIN = "admin"; /** * @dev constructor. Sets msg.sender as admin by default */ function RBAC() public { } /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function adminAddRole(address addr, string roleName) onlyAdmin public { } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function adminRemoveRole(address addr, string roleName) onlyAdmin public { } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { } /** * @dev modifier to scope access to admins * // reverts */ modifier onlyAdmin() { } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } } /** * @author TokenMarket / Ville Sundell <ville at tokenmarket.net> */ contract BasicKYC is RBAC, KYCInterface { /** @dev This mapping contains signature hashes which have been already used: */ mapping (bytes32 => bool) public hashes; /** @dev Mapping of all the attributes for all the users: */ mapping (address => uint256) public attributes; /** @dev These can be used from other contracts to avoid typos with roles: */ string public constant ROLE_SIGNER = "signer"; string public constant ROLE_SETTER = "setter"; /** * @dev Interal function for setting the attributes, and emmiting the event * @param user Address of the user whose attributes we would like to set * @param newAttributes Whole set of 256 attributes */ function writeAttributes(address user, uint256 newAttributes) internal { } /** * @dev Set all the attributes for a user all in once * @param user Address of the user whose attributes we would like to set * @param newAttributes Whole set of 256 attributes */ function setAttributes(address user, uint256 newAttributes) external onlyRole(ROLE_SETTER) { } /** * @dev Get a attribute for a user, return true or false * @param user Address of the user whose attribute we would like to have * @param attribute Attribute index from 0 to 255 * @return Attribute status, set or unset */ function getAttribute(address user, uint8 attribute) external view returns (bool) { } /** * @dev Set attributes an address. User can set their own attributes by using a * signed message from server side. * @param signer Address of the server side signing key * @param newAttributes 256 bit integer for all the attributes for an address * @param nonce Value to prevent re-use of the server side signed data * @param v V of the server's key which was used to sign this transfer * @param r R of the server's key which was used to sign this transfer * @param s S of the server's key which was used to sign this transfer */ function setMyAttributes(address signer, uint256 newAttributes, uint128 nonce, uint8 v, bytes32 r, bytes32 s) external { require(<FILL_ME>) bytes32 hash = keccak256(msg.sender, signer, newAttributes, nonce); require(hashes[hash] == false); require(ecrecover(hash, v, r, s) == signer); hashes[hash] = true; writeAttributes(msg.sender, newAttributes); } }
hasRole(signer,ROLE_SIGNER)
350,581
hasRole(signer,ROLE_SIGNER)
null
/** * This smart contract code is Copyright 2019 TokenMarket Ltd. For more information see https://tokenmarket.net * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * NatSpec is used intentionally to cover also other than public functions * Solidity 0.4.18 is intentionally used: it's stable, and our framework is * based on that. */ interface KYCInterface { event AttributesSet(address indexed who, uint256 indexed attributes); function getAttribute(address addr, uint8 attribute) external view returns (bool); } /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { } } /** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * Supports unlimited numbers of roles and addresses. * See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */ contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * A constant role name for indicating admins. */ string public constant ROLE_ADMIN = "admin"; /** * @dev constructor. Sets msg.sender as admin by default */ function RBAC() public { } /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function adminAddRole(address addr, string roleName) onlyAdmin public { } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function adminRemoveRole(address addr, string roleName) onlyAdmin public { } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { } /** * @dev modifier to scope access to admins * // reverts */ modifier onlyAdmin() { } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } } /** * @author TokenMarket / Ville Sundell <ville at tokenmarket.net> */ contract BasicKYC is RBAC, KYCInterface { /** @dev This mapping contains signature hashes which have been already used: */ mapping (bytes32 => bool) public hashes; /** @dev Mapping of all the attributes for all the users: */ mapping (address => uint256) public attributes; /** @dev These can be used from other contracts to avoid typos with roles: */ string public constant ROLE_SIGNER = "signer"; string public constant ROLE_SETTER = "setter"; /** * @dev Interal function for setting the attributes, and emmiting the event * @param user Address of the user whose attributes we would like to set * @param newAttributes Whole set of 256 attributes */ function writeAttributes(address user, uint256 newAttributes) internal { } /** * @dev Set all the attributes for a user all in once * @param user Address of the user whose attributes we would like to set * @param newAttributes Whole set of 256 attributes */ function setAttributes(address user, uint256 newAttributes) external onlyRole(ROLE_SETTER) { } /** * @dev Get a attribute for a user, return true or false * @param user Address of the user whose attribute we would like to have * @param attribute Attribute index from 0 to 255 * @return Attribute status, set or unset */ function getAttribute(address user, uint8 attribute) external view returns (bool) { } /** * @dev Set attributes an address. User can set their own attributes by using a * signed message from server side. * @param signer Address of the server side signing key * @param newAttributes 256 bit integer for all the attributes for an address * @param nonce Value to prevent re-use of the server side signed data * @param v V of the server's key which was used to sign this transfer * @param r R of the server's key which was used to sign this transfer * @param s S of the server's key which was used to sign this transfer */ function setMyAttributes(address signer, uint256 newAttributes, uint128 nonce, uint8 v, bytes32 r, bytes32 s) external { require(hasRole(signer, ROLE_SIGNER)); bytes32 hash = keccak256(msg.sender, signer, newAttributes, nonce); require(<FILL_ME>) require(ecrecover(hash, v, r, s) == signer); hashes[hash] = true; writeAttributes(msg.sender, newAttributes); } }
hashes[hash]==false
350,581
hashes[hash]==false
null
/** * This smart contract code is Copyright 2019 TokenMarket Ltd. For more information see https://tokenmarket.net * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * NatSpec is used intentionally to cover also other than public functions * Solidity 0.4.18 is intentionally used: it's stable, and our framework is * based on that. */ interface KYCInterface { event AttributesSet(address indexed who, uint256 indexed attributes); function getAttribute(address addr, uint8 attribute) external view returns (bool); } /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { } } /** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * Supports unlimited numbers of roles and addresses. * See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */ contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * A constant role name for indicating admins. */ string public constant ROLE_ADMIN = "admin"; /** * @dev constructor. Sets msg.sender as admin by default */ function RBAC() public { } /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function adminAddRole(address addr, string roleName) onlyAdmin public { } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function adminRemoveRole(address addr, string roleName) onlyAdmin public { } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { } /** * @dev modifier to scope access to admins * // reverts */ modifier onlyAdmin() { } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } } /** * @author TokenMarket / Ville Sundell <ville at tokenmarket.net> */ contract BasicKYC is RBAC, KYCInterface { /** @dev This mapping contains signature hashes which have been already used: */ mapping (bytes32 => bool) public hashes; /** @dev Mapping of all the attributes for all the users: */ mapping (address => uint256) public attributes; /** @dev These can be used from other contracts to avoid typos with roles: */ string public constant ROLE_SIGNER = "signer"; string public constant ROLE_SETTER = "setter"; /** * @dev Interal function for setting the attributes, and emmiting the event * @param user Address of the user whose attributes we would like to set * @param newAttributes Whole set of 256 attributes */ function writeAttributes(address user, uint256 newAttributes) internal { } /** * @dev Set all the attributes for a user all in once * @param user Address of the user whose attributes we would like to set * @param newAttributes Whole set of 256 attributes */ function setAttributes(address user, uint256 newAttributes) external onlyRole(ROLE_SETTER) { } /** * @dev Get a attribute for a user, return true or false * @param user Address of the user whose attribute we would like to have * @param attribute Attribute index from 0 to 255 * @return Attribute status, set or unset */ function getAttribute(address user, uint8 attribute) external view returns (bool) { } /** * @dev Set attributes an address. User can set their own attributes by using a * signed message from server side. * @param signer Address of the server side signing key * @param newAttributes 256 bit integer for all the attributes for an address * @param nonce Value to prevent re-use of the server side signed data * @param v V of the server's key which was used to sign this transfer * @param r R of the server's key which was used to sign this transfer * @param s S of the server's key which was used to sign this transfer */ function setMyAttributes(address signer, uint256 newAttributes, uint128 nonce, uint8 v, bytes32 r, bytes32 s) external { require(hasRole(signer, ROLE_SIGNER)); bytes32 hash = keccak256(msg.sender, signer, newAttributes, nonce); require(hashes[hash] == false); require(<FILL_ME>) hashes[hash] = true; writeAttributes(msg.sender, newAttributes); } }
ecrecover(hash,v,r,s)==signer
350,581
ecrecover(hash,v,r,s)==signer
PASSPORT_EMPTY
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { require(<FILL_ME>) require(balanceOf(_address, _tokenId) >= _count, NOT_ENOUGH_PASSPORTS); _burn(_address, _tokenId, _count); } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
balanceOf(_address,_tokenId)>0,PASSPORT_EMPTY
350,589
balanceOf(_address,_tokenId)>0
NOT_ENOUGH_PASSPORTS
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { require(balanceOf(_address, _tokenId) > 0, PASSPORT_EMPTY); require(<FILL_ME>) _burn(_address, _tokenId, _count); } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
balanceOf(_address,_tokenId)>=_count,NOT_ENOUGH_PASSPORTS
350,589
balanceOf(_address,_tokenId)>=_count
PRESALE_NOT_AVAILABLE
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { require(presaleEnabled, PRESALE_NOT_AVAILABLE); require(<FILL_ME>) require(WHITELIST[msg.sender] > 0, NOT_ALLOWED_OR_QUOTA_EXCEEDED); require(balanceOf(msg.sender, PRESALE_TOKEN_ID) + _buyCount <= WHITELIST[msg.sender], PASS_USED_UP); _tokenId = PRESALE_TOKEN_ID; _mint(msg.sender, _tokenId, _buyCount); } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
!publicSaleEnabled,PRESALE_NOT_AVAILABLE
350,589
!publicSaleEnabled
NOT_ALLOWED_OR_QUOTA_EXCEEDED
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { require(presaleEnabled, PRESALE_NOT_AVAILABLE); require(!publicSaleEnabled, PRESALE_NOT_AVAILABLE); require(<FILL_ME>) require(balanceOf(msg.sender, PRESALE_TOKEN_ID) + _buyCount <= WHITELIST[msg.sender], PASS_USED_UP); _tokenId = PRESALE_TOKEN_ID; _mint(msg.sender, _tokenId, _buyCount); } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
WHITELIST[msg.sender]>0,NOT_ALLOWED_OR_QUOTA_EXCEEDED
350,589
WHITELIST[msg.sender]>0
PASS_USED_UP
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { require(presaleEnabled, PRESALE_NOT_AVAILABLE); require(!publicSaleEnabled, PRESALE_NOT_AVAILABLE); require(WHITELIST[msg.sender] > 0, NOT_ALLOWED_OR_QUOTA_EXCEEDED); require(<FILL_ME>) _tokenId = PRESALE_TOKEN_ID; _mint(msg.sender, _tokenId, _buyCount); } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
balanceOf(msg.sender,PRESALE_TOKEN_ID)+_buyCount<=WHITELIST[msg.sender],PASS_USED_UP
350,589
balanceOf(msg.sender,PRESALE_TOKEN_ID)+_buyCount<=WHITELIST[msg.sender]
SUPPLY_QUOTA_EXCEEDED
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { require(_count > 0, MINT_ZERO_TOKENS); require(<FILL_ME>) uint256 _mintedPasses = mintedPasses + _count; mintedPasses = _mintedPasses; super._mint(_to, _tokenId, _count, ""); } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
mintedPasses+_count<=TOTAL_MAX_SUPPLY,SUPPLY_QUOTA_EXCEEDED
350,589
mintedPasses+_count<=TOTAL_MAX_SUPPLY
PRESALE_RESTRICTED
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract StrawhatzMintPassport is ERC1155, IERC2981, Ownable { function withdrawToOwner() external onlyOwner { } function _setRoyalties(address newRecipient) internal { } function setRoyalties(address newRecipient) external onlyOwner { } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { } uint256 public constant PRESALE_TOKEN_ID = 1; uint256 public constant PUBLIC_TOKEN_ID = 2; uint256 public constant PRESALE_TOKEN_PRICE = 0.123 ether; uint256 public constant PUBLIC_TOKEN_PRICE = 0.333 ether; uint256 public constant TOTAL_MAX_SUPPLY = 3333; uint256 public constant MAX_BUY_COUNT_PER_USER = 3; address public nftAddress; string private baseTokenURI; address private _royaltyRecipient; mapping (address=>uint256) private WHITELIST; /* state */ uint256 public mintedPasses; bool public publicSaleEnabled = false; bool public presaleEnabled = false; /* errors */ string public constant UNAUTHORIZED = "UNAUTHORIZED"; string public constant PAYMENT_AMOUNT_INCORRECT = "PAYMENT AMOUNT INCORRECT"; string public constant PASSPORT_EMPTY = "PASSPORT ACCOUNT IS EMPTY"; string public constant NOT_ENOUGH_PASSPORTS = "NOT ENOUGH PASSPORTS"; string public constant PRESALE_RESTRICTED = "PRESALE TOKENS CANNOT BE TRANSFERED"; string public constant PUBLIC_SALE_NOT_AVAILABLE = "PUBLIC SALE NOT AVAILABLE"; string public constant PRESALE_NOT_AVAILABLE = "PRESALE NOT AVAILABLE"; string public constant MINT_ZERO_TOKENS = "MINT ZERO TOKENS"; string public constant PASS_USED_UP = "PASS USED UP"; string public constant NOT_ALLOWED_OR_QUOTA_EXCEEDED = "NOT ALLOWED OR QUOTA EXCEEDED"; string public constant SUPPLY_QUOTA_EXCEEDED = "SUPPLY_QUOTA_EXCEEDED"; modifier onlyNftContract() { } constructor() ERC1155("") Ownable() { } function setBaseURI(string memory _baseTokenURI) external onlyOwner { } /** * @notice burn used passports by external nft contract */ function burn(address _address, uint256 _tokenId, uint256 _count) external onlyNftContract { } function setNftAddress(address _address) external onlyOwner { } function changePresale(bool _enabled) external onlyOwner { } function changePublicSale(bool _enabled) external onlyOwner { } function enablePublicSale() external onlyOwner { } function addToWhitelist(address _address) external onlyOwner { } function addBatchToWhitelist(address[] memory _addresses) external onlyOwner { } /** * @notice mint presale passport for free */ function giveawayPresale(address _to, uint256 _count) external onlyOwner returns (uint256 _tokenId) { } modifier buyForEther(uint256 _count, uint256 _price) { } /** * @notice buy presale passport for ether */ function buyPresale(uint256 _buyCount) external payable buyForEther(_buyCount, PRESALE_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint public passport for ether */ function buyPublic(uint256 _buyCount) external payable buyForEther(_buyCount, PUBLIC_TOKEN_PRICE) returns (uint256 _tokenId) { } /** * @notice mint presale passport */ function _mint( address _to, uint256 _tokenId, uint256 _count ) private { } /** * @dev See {IERC1155-_beforeTokenTransfer}. * @notice forbid presale passport transfers */ function _beforeTokenTransfer( address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data ) internal virtual override { super._beforeTokenTransfer( _operator, _from, _to, _ids, _amounts, _data ); if (_from == address(0) || _to == address(0)) { return; } uint256 _count = _ids.length; for (uint256 i = 0; i < _count; i++) { require(<FILL_ME>) } } function availableMint() external view returns (uint256) { } /** * @dev See {IERC1155-uri}. */ function uri(uint256 _token) public view virtual override returns (string memory _uri) { } }
_ids[i]!=PRESALE_TOKEN_ID,PRESALE_RESTRICTED
350,589
_ids[i]!=PRESALE_TOKEN_ID
"Pause"
/** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { } } contract Creeps is ERC721Enumerable, Ownable{ uint public constant MAX_NFTS = 6666; bool public presalePaused = true; bool public paused = true; string _baseTokenURI = "https://metadata/"; uint private price; uint private maxCount = 10; mapping (address => bool) private wihiteList; constructor() ERC721("Creepy.club", "Creepy.club") { } function mint(address _to, uint _count) public payable { require(<FILL_ME>) if (!presalePaused){ require(inWhiteList(msg.sender), "the Sender is not in the WhiteList"); } require(_count <= getMaxCount(), "Transaction limit exceeded"); require(msg.value >= getPrice(_count), "Value below price"); require(totalSupply() + _count <= MAX_NFTS, "Max limit"); require(totalSupply() < MAX_NFTS, "Sale end"); for(uint i = 0; i < _count; i++){ _safeMint(_to, totalSupply()); } } function inWhiteList(address _address) public view returns (bool) { } function addInWhiteList(address[] memory _addreses) external onlyOwner { } function deleteFromWhiteList(address[] memory _addreses) external onlyOwner { } function getPrice(uint _count) public view returns (uint256) { } function setPrice(uint _price) external onlyOwner { } function getMaxCount() public view returns (uint256) { } function setMaxCount(uint _count) external onlyOwner { } function _baseURI() internal view virtual override returns (string memory) { } function setBaseURI(string memory baseURI) public onlyOwner { } function walletOfOwner(address _owner) external view returns(uint256[] memory) { } function pause(bool val) public onlyOwner { } function pausePresale(bool val) public onlyOwner { } function withdrawAll() public payable onlyOwner { } }
!paused||!presalePaused,"Pause"
350,594
!paused||!presalePaused
"the Sender is not in the WhiteList"
/** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { } } contract Creeps is ERC721Enumerable, Ownable{ uint public constant MAX_NFTS = 6666; bool public presalePaused = true; bool public paused = true; string _baseTokenURI = "https://metadata/"; uint private price; uint private maxCount = 10; mapping (address => bool) private wihiteList; constructor() ERC721("Creepy.club", "Creepy.club") { } function mint(address _to, uint _count) public payable { require(!paused || !presalePaused, "Pause"); if (!presalePaused){ require(<FILL_ME>) } require(_count <= getMaxCount(), "Transaction limit exceeded"); require(msg.value >= getPrice(_count), "Value below price"); require(totalSupply() + _count <= MAX_NFTS, "Max limit"); require(totalSupply() < MAX_NFTS, "Sale end"); for(uint i = 0; i < _count; i++){ _safeMint(_to, totalSupply()); } } function inWhiteList(address _address) public view returns (bool) { } function addInWhiteList(address[] memory _addreses) external onlyOwner { } function deleteFromWhiteList(address[] memory _addreses) external onlyOwner { } function getPrice(uint _count) public view returns (uint256) { } function setPrice(uint _price) external onlyOwner { } function getMaxCount() public view returns (uint256) { } function setMaxCount(uint _count) external onlyOwner { } function _baseURI() internal view virtual override returns (string memory) { } function setBaseURI(string memory baseURI) public onlyOwner { } function walletOfOwner(address _owner) external view returns(uint256[] memory) { } function pause(bool val) public onlyOwner { } function pausePresale(bool val) public onlyOwner { } function withdrawAll() public payable onlyOwner { } }
inWhiteList(msg.sender),"the Sender is not in the WhiteList"
350,594
inWhiteList(msg.sender)
"Max limit"
/** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { } } contract Creeps is ERC721Enumerable, Ownable{ uint public constant MAX_NFTS = 6666; bool public presalePaused = true; bool public paused = true; string _baseTokenURI = "https://metadata/"; uint private price; uint private maxCount = 10; mapping (address => bool) private wihiteList; constructor() ERC721("Creepy.club", "Creepy.club") { } function mint(address _to, uint _count) public payable { require(!paused || !presalePaused, "Pause"); if (!presalePaused){ require(inWhiteList(msg.sender), "the Sender is not in the WhiteList"); } require(_count <= getMaxCount(), "Transaction limit exceeded"); require(msg.value >= getPrice(_count), "Value below price"); require(<FILL_ME>) require(totalSupply() < MAX_NFTS, "Sale end"); for(uint i = 0; i < _count; i++){ _safeMint(_to, totalSupply()); } } function inWhiteList(address _address) public view returns (bool) { } function addInWhiteList(address[] memory _addreses) external onlyOwner { } function deleteFromWhiteList(address[] memory _addreses) external onlyOwner { } function getPrice(uint _count) public view returns (uint256) { } function setPrice(uint _price) external onlyOwner { } function getMaxCount() public view returns (uint256) { } function setMaxCount(uint _count) external onlyOwner { } function _baseURI() internal view virtual override returns (string memory) { } function setBaseURI(string memory baseURI) public onlyOwner { } function walletOfOwner(address _owner) external view returns(uint256[] memory) { } function pause(bool val) public onlyOwner { } function pausePresale(bool val) public onlyOwner { } function withdrawAll() public payable onlyOwner { } }
totalSupply()+_count<=MAX_NFTS,"Max limit"
350,594
totalSupply()+_count<=MAX_NFTS
"Cannot add balance!"
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, 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 newOwner) onlyOwner public { } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract FarmPrdzEth30 is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); event RewardsDisbursed(uint amount); // deposit token contract address address public trustedDepositTokenAddress; address public trustedRewardTokenAddress; uint public adminCanClaimAfter = 395 days; uint public withdrawFeePercentX100 = 0; uint public disburseAmount = 35e18; uint public disburseDuration = 30 days; uint public cliffTime = 30 days; uint public disbursePercentX100 = 10000; uint public contractDeployTime; uint public adminClaimableTime; uint public lastDisburseTime; constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public { } uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public depositTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; mapping (address => uint) public lastDivPoints; uint public totalTokensDisbursed = 0; uint public contractBalance = 0; uint public totalDivPoints = 0; uint public totalTokens = 0; uint internal pointMultiplier = 1e18; function addContractBalance(uint amount) public onlyOwner { require(<FILL_ME>) contractBalance = contractBalance.add(amount); } function updateAccount(address account) private { } function getPendingDivs(address _holder) public view returns (uint) { } function getNumberOfHolders() public view returns (uint) { } function canWithdraw(address account) public view returns (uint) { } function deposit(uint amountToDeposit) public { } function withdraw(uint amountToWithdraw) public { } function claim() public { } function distributeDivs(uint amount) private { } function disburseTokens() public onlyOwner { } function getPendingDisbursement() public view returns (uint) { } function getDepositorsList(uint startIndex, uint endIndex) public view returns (address[] memory stakers, uint[] memory stakingTimestamps, uint[] memory lastClaimedTimeStamps, uint[] memory stakedTokens) { } }
Token(trustedRewardTokenAddress).transferFrom(msg.sender,address(this),amount),"Cannot add balance!"
350,609
Token(trustedRewardTokenAddress).transferFrom(msg.sender,address(this),amount)
"Could not transfer tokens."
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, 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 newOwner) onlyOwner public { } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract FarmPrdzEth30 is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); event RewardsDisbursed(uint amount); // deposit token contract address address public trustedDepositTokenAddress; address public trustedRewardTokenAddress; uint public adminCanClaimAfter = 395 days; uint public withdrawFeePercentX100 = 0; uint public disburseAmount = 35e18; uint public disburseDuration = 30 days; uint public cliffTime = 30 days; uint public disbursePercentX100 = 10000; uint public contractDeployTime; uint public adminClaimableTime; uint public lastDisburseTime; constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public { } uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public depositTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; mapping (address => uint) public lastDivPoints; uint public totalTokensDisbursed = 0; uint public contractBalance = 0; uint public totalDivPoints = 0; uint public totalTokens = 0; uint internal pointMultiplier = 1e18; function addContractBalance(uint amount) public onlyOwner { } function updateAccount(address account) private { uint pendingDivs = getPendingDivs(account); if (pendingDivs > 0) { require(<FILL_ME>) totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs); totalClaimedRewards = totalClaimedRewards.add(pendingDivs); emit RewardsTransferred(account, pendingDivs); } lastClaimedTime[account] = now; lastDivPoints[account] = totalDivPoints; } function getPendingDivs(address _holder) public view returns (uint) { } function getNumberOfHolders() public view returns (uint) { } function canWithdraw(address account) public view returns (uint) { } function deposit(uint amountToDeposit) public { } function withdraw(uint amountToWithdraw) public { } function claim() public { } function distributeDivs(uint amount) private { } function disburseTokens() public onlyOwner { } function getPendingDisbursement() public view returns (uint) { } function getDepositorsList(uint startIndex, uint endIndex) public view returns (address[] memory stakers, uint[] memory stakingTimestamps, uint[] memory lastClaimedTimeStamps, uint[] memory stakedTokens) { } }
Token(trustedRewardTokenAddress).transfer(account,pendingDivs),"Could not transfer tokens."
350,609
Token(trustedRewardTokenAddress).transfer(account,pendingDivs)
"Insufficient Token Allowance"
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, 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 newOwner) onlyOwner public { } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract FarmPrdzEth30 is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); event RewardsDisbursed(uint amount); // deposit token contract address address public trustedDepositTokenAddress; address public trustedRewardTokenAddress; uint public adminCanClaimAfter = 395 days; uint public withdrawFeePercentX100 = 0; uint public disburseAmount = 35e18; uint public disburseDuration = 30 days; uint public cliffTime = 30 days; uint public disbursePercentX100 = 10000; uint public contractDeployTime; uint public adminClaimableTime; uint public lastDisburseTime; constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public { } uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public depositTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; mapping (address => uint) public lastDivPoints; uint public totalTokensDisbursed = 0; uint public contractBalance = 0; uint public totalDivPoints = 0; uint public totalTokens = 0; uint internal pointMultiplier = 1e18; function addContractBalance(uint amount) public onlyOwner { } function updateAccount(address account) private { } function getPendingDivs(address _holder) public view returns (uint) { } function getNumberOfHolders() public view returns (uint) { } function canWithdraw(address account) public view returns (uint) { } function deposit(uint amountToDeposit) public { require(amountToDeposit > 0, "Cannot deposit 0 Tokens"); updateAccount(msg.sender); require(<FILL_ME>) depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit); totalTokens = totalTokens.add(amountToDeposit); if (!holders.contains(msg.sender)) { holders.add(msg.sender); depositTime[msg.sender] = now; } } function withdraw(uint amountToWithdraw) public { } function claim() public { } function distributeDivs(uint amount) private { } function disburseTokens() public onlyOwner { } function getPendingDisbursement() public view returns (uint) { } function getDepositorsList(uint startIndex, uint endIndex) public view returns (address[] memory stakers, uint[] memory stakingTimestamps, uint[] memory lastClaimedTimeStamps, uint[] memory stakedTokens) { } }
Token(trustedDepositTokenAddress).transferFrom(msg.sender,address(this),amountToDeposit),"Insufficient Token Allowance"
350,609
Token(trustedDepositTokenAddress).transferFrom(msg.sender,address(this),amountToDeposit)
"Please wait before withdrawing!"
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, 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 newOwner) onlyOwner public { } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract FarmPrdzEth30 is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); event RewardsDisbursed(uint amount); // deposit token contract address address public trustedDepositTokenAddress; address public trustedRewardTokenAddress; uint public adminCanClaimAfter = 395 days; uint public withdrawFeePercentX100 = 0; uint public disburseAmount = 35e18; uint public disburseDuration = 30 days; uint public cliffTime = 30 days; uint public disbursePercentX100 = 10000; uint public contractDeployTime; uint public adminClaimableTime; uint public lastDisburseTime; constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public { } uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public depositTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; mapping (address => uint) public lastDivPoints; uint public totalTokensDisbursed = 0; uint public contractBalance = 0; uint public totalDivPoints = 0; uint public totalTokens = 0; uint internal pointMultiplier = 1e18; function addContractBalance(uint amount) public onlyOwner { } function updateAccount(address account) private { } function getPendingDivs(address _holder) public view returns (uint) { } function getNumberOfHolders() public view returns (uint) { } function canWithdraw(address account) public view returns (uint) { } function deposit(uint amountToDeposit) public { } function withdraw(uint amountToWithdraw) public { require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(<FILL_ME>) updateAccount(msg.sender); uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4); uint amountAfterFee = amountToWithdraw.sub(fee); require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!"); require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens."); depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); totalTokens = totalTokens.sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } } function claim() public { } function distributeDivs(uint amount) private { } function disburseTokens() public onlyOwner { } function getPendingDisbursement() public view returns (uint) { } function getDepositorsList(uint startIndex, uint endIndex) public view returns (address[] memory stakers, uint[] memory stakingTimestamps, uint[] memory lastClaimedTimeStamps, uint[] memory stakedTokens) { } }
now.sub(depositTime[msg.sender])>cliffTime,"Please wait before withdrawing!"
350,609
now.sub(depositTime[msg.sender])>cliffTime
"Could not transfer fee!"
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, 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 newOwner) onlyOwner public { } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract FarmPrdzEth30 is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); event RewardsDisbursed(uint amount); // deposit token contract address address public trustedDepositTokenAddress; address public trustedRewardTokenAddress; uint public adminCanClaimAfter = 395 days; uint public withdrawFeePercentX100 = 0; uint public disburseAmount = 35e18; uint public disburseDuration = 30 days; uint public cliffTime = 30 days; uint public disbursePercentX100 = 10000; uint public contractDeployTime; uint public adminClaimableTime; uint public lastDisburseTime; constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public { } uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public depositTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; mapping (address => uint) public lastDivPoints; uint public totalTokensDisbursed = 0; uint public contractBalance = 0; uint public totalDivPoints = 0; uint public totalTokens = 0; uint internal pointMultiplier = 1e18; function addContractBalance(uint amount) public onlyOwner { } function updateAccount(address account) private { } function getPendingDivs(address _holder) public view returns (uint) { } function getNumberOfHolders() public view returns (uint) { } function canWithdraw(address account) public view returns (uint) { } function deposit(uint amountToDeposit) public { } function withdraw(uint amountToWithdraw) public { require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!"); updateAccount(msg.sender); uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4); uint amountAfterFee = amountToWithdraw.sub(fee); require(<FILL_ME>) require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens."); depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); totalTokens = totalTokens.sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } } function claim() public { } function distributeDivs(uint amount) private { } function disburseTokens() public onlyOwner { } function getPendingDisbursement() public view returns (uint) { } function getDepositorsList(uint startIndex, uint endIndex) public view returns (address[] memory stakers, uint[] memory stakingTimestamps, uint[] memory lastClaimedTimeStamps, uint[] memory stakedTokens) { } }
Token(trustedDepositTokenAddress).transfer(owner,fee),"Could not transfer fee!"
350,609
Token(trustedDepositTokenAddress).transfer(owner,fee)
"Could not transfer tokens."
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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) { } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, 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 newOwner) onlyOwner public { } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract FarmPrdzEth30 is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); event RewardsDisbursed(uint amount); // deposit token contract address address public trustedDepositTokenAddress; address public trustedRewardTokenAddress; uint public adminCanClaimAfter = 395 days; uint public withdrawFeePercentX100 = 0; uint public disburseAmount = 35e18; uint public disburseDuration = 30 days; uint public cliffTime = 30 days; uint public disbursePercentX100 = 10000; uint public contractDeployTime; uint public adminClaimableTime; uint public lastDisburseTime; constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public { } uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public depositTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; mapping (address => uint) public lastDivPoints; uint public totalTokensDisbursed = 0; uint public contractBalance = 0; uint public totalDivPoints = 0; uint public totalTokens = 0; uint internal pointMultiplier = 1e18; function addContractBalance(uint amount) public onlyOwner { } function updateAccount(address account) private { } function getPendingDivs(address _holder) public view returns (uint) { } function getNumberOfHolders() public view returns (uint) { } function canWithdraw(address account) public view returns (uint) { } function deposit(uint amountToDeposit) public { } function withdraw(uint amountToWithdraw) public { require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!"); updateAccount(msg.sender); uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4); uint amountAfterFee = amountToWithdraw.sub(fee); require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!"); require(<FILL_ME>) depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); totalTokens = totalTokens.sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } } function claim() public { } function distributeDivs(uint amount) private { } function disburseTokens() public onlyOwner { } function getPendingDisbursement() public view returns (uint) { } function getDepositorsList(uint startIndex, uint endIndex) public view returns (address[] memory stakers, uint[] memory stakingTimestamps, uint[] memory lastClaimedTimeStamps, uint[] memory stakedTokens) { } }
Token(trustedDepositTokenAddress).transfer(msg.sender,amountAfterFee),"Could not transfer tokens."
350,609
Token(trustedDepositTokenAddress).transfer(msg.sender,amountAfterFee)
"no such vesting schedule"
pragma solidity 0.8.3; /** * @title Contract for grantable ERC20 token vesting schedules * * @notice Adds to an ERC20 support for grantor wallets, which are able to grant vesting tokens to * beneficiary wallets, following per-wallet custom vesting schedules. * * @dev Contract which gives subclass contracts the ability to act as a pool of funds for allocating * tokens to any number of other addresses. Token grants support the ability to vest over time in * accordance a predefined vesting schedule. A given wallet can receive no more than one token grant. * * Tokens are transferred from the pool to the recipient at the time of grant, but the recipient * will only able to transfer tokens out of their wallet after they have vested. Transfers of non- * vested tokens are prevented. * * Two types of toke grants are supported: * - Irrevocable grants, intended for use in cases when vesting tokens have been issued in exchange * for value, such as with tokens that have been purchased in an ICO. * - Revocable grants, intended for use in cases when vesting tokens have been gifted to the holder, * such as with employee grants that are given as compensation. */ abstract contract ERC20Vestable is ERC20, IERC20Vestable, VerifiedAccount { // Date-related constants for sanity-checking dates to reject obvious erroneous inputs // and conversions from seconds to days and years that are more or less leap year-aware. uint32 private constant THOUSAND_YEARS_DAYS = 365243; /* See https://www.timeanddate.com/date/durationresult.html?m1=1&d1=1&y1=2000&m2=1&d2=1&y2=3000 */ uint32 private constant TEN_YEARS_DAYS = THOUSAND_YEARS_DAYS / 100; /* Includes leap years (though it doesn't really matter) */ uint32 private constant SECONDS_PER_DAY = 24 * 60 * 60; /* 86400 seconds in a day */ uint32 private constant JAN_1_3000_DAYS = 4102444800; /* Wednesday, January 1, 2100 0:00:00 (GMT) (see https://www.epochconverter.com/) */ struct vestingSchedule { bool isValid; /* true if an entry exists and is valid */ uint32 cliffDuration; /* Duration of the cliff, with respect to the grant start day, in days. */ uint32 duration; /* Duration of the vesting schedule, with respect to the grant start day, in days. */ uint32 interval; /* Duration in days of the vesting interval. */ } struct tokenGrant { bool isActive; /* true if this vesting entry is active and in-effect entry. */ uint32 startDay; /* Start day of the grant, in days since the UNIX epoch (start of day). */ address vestingLocation; /* Address of wallet that is holding the vesting schedule. */ address grantor; /* Grantor that made the grant */ uint256 amount; /* Total number of tokens that vest. */ } mapping(address => vestingSchedule) private _vestingSchedules; mapping(address => tokenGrant) private _tokenGrants; // ========================================================================= // === Methods for administratively creating a vesting schedule for an account. // ========================================================================= /** * @dev This one-time operation permanently establishes a vesting schedule in the given account. * * For standard grants, this establishes the vesting schedule in the beneficiary's account. * * @param vestingLocation = Account into which to store the vesting schedule. Can be the account * of the beneficiary (for one-off grants) or the account of the grantor (for uniform grants * made from grant pools). * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function _setVestingSchedule( address vestingLocation, uint32 cliffDuration, uint32 duration, uint32 interval ) internal returns (bool) { } function _hasVestingSchedule(address account) internal view returns (bool) { } // ========================================================================= // === Token grants (general-purpose) // === Methods to be used for administratively creating one-off token grants with vesting schedules. // ========================================================================= /** * @dev Immediately grants tokens to an account, referencing a vesting schedule which may be * stored in the same account (individual/one-off) or in a different account (shared/uniform). * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param vestingLocation = Account where the vesting schedule is held (must already exist). * @param grantor = Account which performed the grant. Also the account from where the granted * funds will be withdrawn. */ function _grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, address vestingLocation, address grantor ) internal returns (bool) { // Make sure no prior grant is in effect. require(!_tokenGrants[beneficiary].isActive, "grant already exists"); // Check for valid vestingAmount require( vestingAmount <= totalAmount && vestingAmount > 0 && startDay >= this.today() && startDay < JAN_1_3000_DAYS, "invalid vesting params"); // Make sure the vesting schedule we are about to use is valid. require(<FILL_ME>) // Transfer the total number of tokens from grantor into the account's holdings. _transfer(grantor, beneficiary, totalAmount); /* Emits a Transfer event. */ // Create and populate a token grant, referencing vesting schedule. _tokenGrants[beneficiary] = tokenGrant( true/*isActive*/, startDay, vestingLocation, /* The wallet address where the vesting schedule is kept. */ grantor, /* The account that performed the grant (where revoked funds would be sent) */ vestingAmount ); // Emit the event and return success. emit VestingTokensGranted(beneficiary, vestingAmount, startDay, vestingLocation, grantor); return true; } /** * @dev Immediately grants tokens to an address, including a portion that will vest over time * according to a set vesting schedule. The overall duration and cliff duration of the grant must * be an even multiple of the vesting interval. * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner override returns (bool) { } /** * @dev This variant only grants tokens if the beneficiary account has previously self-registered. */ function safeGrantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner onlyExistingAccount(beneficiary) returns (bool) { } // ========================================================================= // === Check vesting. // ========================================================================= /** * @dev returns the day number of the current day, in days since the UNIX epoch. */ function today() public view override returns (uint32) { } function _effectiveDay(uint32 onDayOrToday) internal view returns (uint32) { } /** * @dev Determines the amount of tokens that have not vested in the given account. * * The math is: not vested amount = vesting amount * (end date - on date)/(end date - start date) * * @param grantHolder = The account to check. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. */ function _getNotVestedAmount(address grantHolder, uint32 onDayOrToday) internal view returns (uint256) { } /** * @dev Computes the amount of funds in the given account which are available for use as of * the given day. If there's no vesting schedule then 0 tokens are considered to be vested and * this just returns the full account balance. * * The math is: available amount = total funds - notVestedAmount. * * @param grantHolder = The account to check. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _getAvailableAmount(address grantHolder, uint32 onDay) internal view returns (uint256) { } /* * @dev returns all information about the grant's vesting as of the given day * for the given account. Only callable by the account holder or a grantor, so * this is mainly intended for administrative use. * * @param grantHolder = The address to do this for. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * vestDuration = grant duration in days. * cliffDuration = duration of the cliff. * vestIntervalDays = number of days between vesting periods. */ function vestingForAccountAsOf( address grantHolder, uint32 onDayOrToday ) public view override onlyOwnerOrSelf(grantHolder) returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /* * @dev returns all information about the grant's vesting as of the given day * for the current account, to be called by the account holder. * * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * cliffDuration = duration of the cliff. * vestDuration = grant duration in days. * vestIntervalDays = number of days between vesting periods. */ function vestingAsOf(uint32 onDayOrToday) public override view returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /** * @dev returns true if the account has sufficient funds available to cover the given amount, * including consideration for vesting tokens. * * @param account = The account to check. * @param amount = The required amount of vested funds. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _fundsAreAvailableOn(address account, uint256 amount, uint32 onDay) internal view returns (bool) { } /** * @dev Modifier to make a function callable only when the amount is sufficiently vested right now. * * @param account = The account to check. * @param amount = The required amount of vested funds. */ modifier onlyIfFundsAvailableNow(address account, uint256 amount) { } // ========================================================================= // === Overridden ERC20 functionality // ========================================================================= /** * @dev Methods transfer() and approve() require an additional available funds check to * prevent spending held but non-vested tokens. Note that transferFrom() does NOT have this * additional check because approved funds come from an already set-aside allowance, not from the wallet. */ function transfer(address to, uint256 value) public override onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } /** * @dev Additional available funds check to prevent spending held but non-vested tokens. */ function approve(address spender, uint256 value) public override virtual onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } }
_hasVestingSchedule(vestingLocation),"no such vesting schedule"
350,644
_hasVestingSchedule(vestingLocation)
"error in establishing a vesting schedule"
pragma solidity 0.8.3; /** * @title Contract for grantable ERC20 token vesting schedules * * @notice Adds to an ERC20 support for grantor wallets, which are able to grant vesting tokens to * beneficiary wallets, following per-wallet custom vesting schedules. * * @dev Contract which gives subclass contracts the ability to act as a pool of funds for allocating * tokens to any number of other addresses. Token grants support the ability to vest over time in * accordance a predefined vesting schedule. A given wallet can receive no more than one token grant. * * Tokens are transferred from the pool to the recipient at the time of grant, but the recipient * will only able to transfer tokens out of their wallet after they have vested. Transfers of non- * vested tokens are prevented. * * Two types of toke grants are supported: * - Irrevocable grants, intended for use in cases when vesting tokens have been issued in exchange * for value, such as with tokens that have been purchased in an ICO. * - Revocable grants, intended for use in cases when vesting tokens have been gifted to the holder, * such as with employee grants that are given as compensation. */ abstract contract ERC20Vestable is ERC20, IERC20Vestable, VerifiedAccount { // Date-related constants for sanity-checking dates to reject obvious erroneous inputs // and conversions from seconds to days and years that are more or less leap year-aware. uint32 private constant THOUSAND_YEARS_DAYS = 365243; /* See https://www.timeanddate.com/date/durationresult.html?m1=1&d1=1&y1=2000&m2=1&d2=1&y2=3000 */ uint32 private constant TEN_YEARS_DAYS = THOUSAND_YEARS_DAYS / 100; /* Includes leap years (though it doesn't really matter) */ uint32 private constant SECONDS_PER_DAY = 24 * 60 * 60; /* 86400 seconds in a day */ uint32 private constant JAN_1_3000_DAYS = 4102444800; /* Wednesday, January 1, 2100 0:00:00 (GMT) (see https://www.epochconverter.com/) */ struct vestingSchedule { bool isValid; /* true if an entry exists and is valid */ uint32 cliffDuration; /* Duration of the cliff, with respect to the grant start day, in days. */ uint32 duration; /* Duration of the vesting schedule, with respect to the grant start day, in days. */ uint32 interval; /* Duration in days of the vesting interval. */ } struct tokenGrant { bool isActive; /* true if this vesting entry is active and in-effect entry. */ uint32 startDay; /* Start day of the grant, in days since the UNIX epoch (start of day). */ address vestingLocation; /* Address of wallet that is holding the vesting schedule. */ address grantor; /* Grantor that made the grant */ uint256 amount; /* Total number of tokens that vest. */ } mapping(address => vestingSchedule) private _vestingSchedules; mapping(address => tokenGrant) private _tokenGrants; // ========================================================================= // === Methods for administratively creating a vesting schedule for an account. // ========================================================================= /** * @dev This one-time operation permanently establishes a vesting schedule in the given account. * * For standard grants, this establishes the vesting schedule in the beneficiary's account. * * @param vestingLocation = Account into which to store the vesting schedule. Can be the account * of the beneficiary (for one-off grants) or the account of the grantor (for uniform grants * made from grant pools). * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function _setVestingSchedule( address vestingLocation, uint32 cliffDuration, uint32 duration, uint32 interval ) internal returns (bool) { } function _hasVestingSchedule(address account) internal view returns (bool) { } // ========================================================================= // === Token grants (general-purpose) // === Methods to be used for administratively creating one-off token grants with vesting schedules. // ========================================================================= /** * @dev Immediately grants tokens to an account, referencing a vesting schedule which may be * stored in the same account (individual/one-off) or in a different account (shared/uniform). * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param vestingLocation = Account where the vesting schedule is held (must already exist). * @param grantor = Account which performed the grant. Also the account from where the granted * funds will be withdrawn. */ function _grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, address vestingLocation, address grantor ) internal returns (bool) { } /** * @dev Immediately grants tokens to an address, including a portion that will vest over time * according to a set vesting schedule. The overall duration and cliff duration of the grant must * be an even multiple of the vesting interval. * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner override returns (bool) { // Make sure no prior vesting schedule has been set. require(!_tokenGrants[beneficiary].isActive, "grant already exists"); // The vesting schedule is unique to this wallet and so will be stored here, require(<FILL_ME>) // Issue grantor tokens to the beneficiary, using beneficiary's own vesting schedule. require(_grantVestingTokens(beneficiary, totalAmount, vestingAmount, startDay, beneficiary, msg.sender), "error in granting tokens"); return true; } /** * @dev This variant only grants tokens if the beneficiary account has previously self-registered. */ function safeGrantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner onlyExistingAccount(beneficiary) returns (bool) { } // ========================================================================= // === Check vesting. // ========================================================================= /** * @dev returns the day number of the current day, in days since the UNIX epoch. */ function today() public view override returns (uint32) { } function _effectiveDay(uint32 onDayOrToday) internal view returns (uint32) { } /** * @dev Determines the amount of tokens that have not vested in the given account. * * The math is: not vested amount = vesting amount * (end date - on date)/(end date - start date) * * @param grantHolder = The account to check. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. */ function _getNotVestedAmount(address grantHolder, uint32 onDayOrToday) internal view returns (uint256) { } /** * @dev Computes the amount of funds in the given account which are available for use as of * the given day. If there's no vesting schedule then 0 tokens are considered to be vested and * this just returns the full account balance. * * The math is: available amount = total funds - notVestedAmount. * * @param grantHolder = The account to check. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _getAvailableAmount(address grantHolder, uint32 onDay) internal view returns (uint256) { } /* * @dev returns all information about the grant's vesting as of the given day * for the given account. Only callable by the account holder or a grantor, so * this is mainly intended for administrative use. * * @param grantHolder = The address to do this for. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * vestDuration = grant duration in days. * cliffDuration = duration of the cliff. * vestIntervalDays = number of days between vesting periods. */ function vestingForAccountAsOf( address grantHolder, uint32 onDayOrToday ) public view override onlyOwnerOrSelf(grantHolder) returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /* * @dev returns all information about the grant's vesting as of the given day * for the current account, to be called by the account holder. * * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * cliffDuration = duration of the cliff. * vestDuration = grant duration in days. * vestIntervalDays = number of days between vesting periods. */ function vestingAsOf(uint32 onDayOrToday) public override view returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /** * @dev returns true if the account has sufficient funds available to cover the given amount, * including consideration for vesting tokens. * * @param account = The account to check. * @param amount = The required amount of vested funds. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _fundsAreAvailableOn(address account, uint256 amount, uint32 onDay) internal view returns (bool) { } /** * @dev Modifier to make a function callable only when the amount is sufficiently vested right now. * * @param account = The account to check. * @param amount = The required amount of vested funds. */ modifier onlyIfFundsAvailableNow(address account, uint256 amount) { } // ========================================================================= // === Overridden ERC20 functionality // ========================================================================= /** * @dev Methods transfer() and approve() require an additional available funds check to * prevent spending held but non-vested tokens. Note that transferFrom() does NOT have this * additional check because approved funds come from an already set-aside allowance, not from the wallet. */ function transfer(address to, uint256 value) public override onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } /** * @dev Additional available funds check to prevent spending held but non-vested tokens. */ function approve(address spender, uint256 value) public override virtual onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } }
_setVestingSchedule(beneficiary,cliffDuration,duration,interval),"error in establishing a vesting schedule"
350,644
_setVestingSchedule(beneficiary,cliffDuration,duration,interval)
"error in granting tokens"
pragma solidity 0.8.3; /** * @title Contract for grantable ERC20 token vesting schedules * * @notice Adds to an ERC20 support for grantor wallets, which are able to grant vesting tokens to * beneficiary wallets, following per-wallet custom vesting schedules. * * @dev Contract which gives subclass contracts the ability to act as a pool of funds for allocating * tokens to any number of other addresses. Token grants support the ability to vest over time in * accordance a predefined vesting schedule. A given wallet can receive no more than one token grant. * * Tokens are transferred from the pool to the recipient at the time of grant, but the recipient * will only able to transfer tokens out of their wallet after they have vested. Transfers of non- * vested tokens are prevented. * * Two types of toke grants are supported: * - Irrevocable grants, intended for use in cases when vesting tokens have been issued in exchange * for value, such as with tokens that have been purchased in an ICO. * - Revocable grants, intended for use in cases when vesting tokens have been gifted to the holder, * such as with employee grants that are given as compensation. */ abstract contract ERC20Vestable is ERC20, IERC20Vestable, VerifiedAccount { // Date-related constants for sanity-checking dates to reject obvious erroneous inputs // and conversions from seconds to days and years that are more or less leap year-aware. uint32 private constant THOUSAND_YEARS_DAYS = 365243; /* See https://www.timeanddate.com/date/durationresult.html?m1=1&d1=1&y1=2000&m2=1&d2=1&y2=3000 */ uint32 private constant TEN_YEARS_DAYS = THOUSAND_YEARS_DAYS / 100; /* Includes leap years (though it doesn't really matter) */ uint32 private constant SECONDS_PER_DAY = 24 * 60 * 60; /* 86400 seconds in a day */ uint32 private constant JAN_1_3000_DAYS = 4102444800; /* Wednesday, January 1, 2100 0:00:00 (GMT) (see https://www.epochconverter.com/) */ struct vestingSchedule { bool isValid; /* true if an entry exists and is valid */ uint32 cliffDuration; /* Duration of the cliff, with respect to the grant start day, in days. */ uint32 duration; /* Duration of the vesting schedule, with respect to the grant start day, in days. */ uint32 interval; /* Duration in days of the vesting interval. */ } struct tokenGrant { bool isActive; /* true if this vesting entry is active and in-effect entry. */ uint32 startDay; /* Start day of the grant, in days since the UNIX epoch (start of day). */ address vestingLocation; /* Address of wallet that is holding the vesting schedule. */ address grantor; /* Grantor that made the grant */ uint256 amount; /* Total number of tokens that vest. */ } mapping(address => vestingSchedule) private _vestingSchedules; mapping(address => tokenGrant) private _tokenGrants; // ========================================================================= // === Methods for administratively creating a vesting schedule for an account. // ========================================================================= /** * @dev This one-time operation permanently establishes a vesting schedule in the given account. * * For standard grants, this establishes the vesting schedule in the beneficiary's account. * * @param vestingLocation = Account into which to store the vesting schedule. Can be the account * of the beneficiary (for one-off grants) or the account of the grantor (for uniform grants * made from grant pools). * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function _setVestingSchedule( address vestingLocation, uint32 cliffDuration, uint32 duration, uint32 interval ) internal returns (bool) { } function _hasVestingSchedule(address account) internal view returns (bool) { } // ========================================================================= // === Token grants (general-purpose) // === Methods to be used for administratively creating one-off token grants with vesting schedules. // ========================================================================= /** * @dev Immediately grants tokens to an account, referencing a vesting schedule which may be * stored in the same account (individual/one-off) or in a different account (shared/uniform). * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param vestingLocation = Account where the vesting schedule is held (must already exist). * @param grantor = Account which performed the grant. Also the account from where the granted * funds will be withdrawn. */ function _grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, address vestingLocation, address grantor ) internal returns (bool) { } /** * @dev Immediately grants tokens to an address, including a portion that will vest over time * according to a set vesting schedule. The overall duration and cliff duration of the grant must * be an even multiple of the vesting interval. * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner override returns (bool) { // Make sure no prior vesting schedule has been set. require(!_tokenGrants[beneficiary].isActive, "grant already exists"); // The vesting schedule is unique to this wallet and so will be stored here, require(_setVestingSchedule(beneficiary, cliffDuration, duration, interval), "error in establishing a vesting schedule"); // Issue grantor tokens to the beneficiary, using beneficiary's own vesting schedule. require(<FILL_ME>) return true; } /** * @dev This variant only grants tokens if the beneficiary account has previously self-registered. */ function safeGrantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner onlyExistingAccount(beneficiary) returns (bool) { } // ========================================================================= // === Check vesting. // ========================================================================= /** * @dev returns the day number of the current day, in days since the UNIX epoch. */ function today() public view override returns (uint32) { } function _effectiveDay(uint32 onDayOrToday) internal view returns (uint32) { } /** * @dev Determines the amount of tokens that have not vested in the given account. * * The math is: not vested amount = vesting amount * (end date - on date)/(end date - start date) * * @param grantHolder = The account to check. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. */ function _getNotVestedAmount(address grantHolder, uint32 onDayOrToday) internal view returns (uint256) { } /** * @dev Computes the amount of funds in the given account which are available for use as of * the given day. If there's no vesting schedule then 0 tokens are considered to be vested and * this just returns the full account balance. * * The math is: available amount = total funds - notVestedAmount. * * @param grantHolder = The account to check. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _getAvailableAmount(address grantHolder, uint32 onDay) internal view returns (uint256) { } /* * @dev returns all information about the grant's vesting as of the given day * for the given account. Only callable by the account holder or a grantor, so * this is mainly intended for administrative use. * * @param grantHolder = The address to do this for. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * vestDuration = grant duration in days. * cliffDuration = duration of the cliff. * vestIntervalDays = number of days between vesting periods. */ function vestingForAccountAsOf( address grantHolder, uint32 onDayOrToday ) public view override onlyOwnerOrSelf(grantHolder) returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /* * @dev returns all information about the grant's vesting as of the given day * for the current account, to be called by the account holder. * * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * cliffDuration = duration of the cliff. * vestDuration = grant duration in days. * vestIntervalDays = number of days between vesting periods. */ function vestingAsOf(uint32 onDayOrToday) public override view returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /** * @dev returns true if the account has sufficient funds available to cover the given amount, * including consideration for vesting tokens. * * @param account = The account to check. * @param amount = The required amount of vested funds. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _fundsAreAvailableOn(address account, uint256 amount, uint32 onDay) internal view returns (bool) { } /** * @dev Modifier to make a function callable only when the amount is sufficiently vested right now. * * @param account = The account to check. * @param amount = The required amount of vested funds. */ modifier onlyIfFundsAvailableNow(address account, uint256 amount) { } // ========================================================================= // === Overridden ERC20 functionality // ========================================================================= /** * @dev Methods transfer() and approve() require an additional available funds check to * prevent spending held but non-vested tokens. Note that transferFrom() does NOT have this * additional check because approved funds come from an already set-aside allowance, not from the wallet. */ function transfer(address to, uint256 value) public override onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } /** * @dev Additional available funds check to prevent spending held but non-vested tokens. */ function approve(address spender, uint256 value) public override virtual onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } }
_grantVestingTokens(beneficiary,totalAmount,vestingAmount,startDay,beneficiary,msg.sender),"error in granting tokens"
350,644
_grantVestingTokens(beneficiary,totalAmount,vestingAmount,startDay,beneficiary,msg.sender)
balanceOf(account)<amount?"insufficient funds":"insufficient vested funds"
pragma solidity 0.8.3; /** * @title Contract for grantable ERC20 token vesting schedules * * @notice Adds to an ERC20 support for grantor wallets, which are able to grant vesting tokens to * beneficiary wallets, following per-wallet custom vesting schedules. * * @dev Contract which gives subclass contracts the ability to act as a pool of funds for allocating * tokens to any number of other addresses. Token grants support the ability to vest over time in * accordance a predefined vesting schedule. A given wallet can receive no more than one token grant. * * Tokens are transferred from the pool to the recipient at the time of grant, but the recipient * will only able to transfer tokens out of their wallet after they have vested. Transfers of non- * vested tokens are prevented. * * Two types of toke grants are supported: * - Irrevocable grants, intended for use in cases when vesting tokens have been issued in exchange * for value, such as with tokens that have been purchased in an ICO. * - Revocable grants, intended for use in cases when vesting tokens have been gifted to the holder, * such as with employee grants that are given as compensation. */ abstract contract ERC20Vestable is ERC20, IERC20Vestable, VerifiedAccount { // Date-related constants for sanity-checking dates to reject obvious erroneous inputs // and conversions from seconds to days and years that are more or less leap year-aware. uint32 private constant THOUSAND_YEARS_DAYS = 365243; /* See https://www.timeanddate.com/date/durationresult.html?m1=1&d1=1&y1=2000&m2=1&d2=1&y2=3000 */ uint32 private constant TEN_YEARS_DAYS = THOUSAND_YEARS_DAYS / 100; /* Includes leap years (though it doesn't really matter) */ uint32 private constant SECONDS_PER_DAY = 24 * 60 * 60; /* 86400 seconds in a day */ uint32 private constant JAN_1_3000_DAYS = 4102444800; /* Wednesday, January 1, 2100 0:00:00 (GMT) (see https://www.epochconverter.com/) */ struct vestingSchedule { bool isValid; /* true if an entry exists and is valid */ uint32 cliffDuration; /* Duration of the cliff, with respect to the grant start day, in days. */ uint32 duration; /* Duration of the vesting schedule, with respect to the grant start day, in days. */ uint32 interval; /* Duration in days of the vesting interval. */ } struct tokenGrant { bool isActive; /* true if this vesting entry is active and in-effect entry. */ uint32 startDay; /* Start day of the grant, in days since the UNIX epoch (start of day). */ address vestingLocation; /* Address of wallet that is holding the vesting schedule. */ address grantor; /* Grantor that made the grant */ uint256 amount; /* Total number of tokens that vest. */ } mapping(address => vestingSchedule) private _vestingSchedules; mapping(address => tokenGrant) private _tokenGrants; // ========================================================================= // === Methods for administratively creating a vesting schedule for an account. // ========================================================================= /** * @dev This one-time operation permanently establishes a vesting schedule in the given account. * * For standard grants, this establishes the vesting schedule in the beneficiary's account. * * @param vestingLocation = Account into which to store the vesting schedule. Can be the account * of the beneficiary (for one-off grants) or the account of the grantor (for uniform grants * made from grant pools). * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function _setVestingSchedule( address vestingLocation, uint32 cliffDuration, uint32 duration, uint32 interval ) internal returns (bool) { } function _hasVestingSchedule(address account) internal view returns (bool) { } // ========================================================================= // === Token grants (general-purpose) // === Methods to be used for administratively creating one-off token grants with vesting schedules. // ========================================================================= /** * @dev Immediately grants tokens to an account, referencing a vesting schedule which may be * stored in the same account (individual/one-off) or in a different account (shared/uniform). * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param vestingLocation = Account where the vesting schedule is held (must already exist). * @param grantor = Account which performed the grant. Also the account from where the granted * funds will be withdrawn. */ function _grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, address vestingLocation, address grantor ) internal returns (bool) { } /** * @dev Immediately grants tokens to an address, including a portion that will vest over time * according to a set vesting schedule. The overall duration and cliff duration of the grant must * be an even multiple of the vesting interval. * * @param beneficiary = Address to which tokens will be granted. * @param totalAmount = Total number of tokens to deposit into the account. * @param vestingAmount = Out of totalAmount, the number of tokens subject to vesting. * @param startDay = Start day of the grant's vesting schedule, in days since the UNIX epoch * (start of day). The startDay may be given as a date in the future or in the past, going as far * back as year 2000. * @param duration = Duration of the vesting schedule, with respect to the grant start day, in days. * @param cliffDuration = Duration of the cliff, with respect to the grant start day, in days. * @param interval = Number of days between vesting increases. * be revoked (i.e. tokens were purchased). */ function grantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner override returns (bool) { } /** * @dev This variant only grants tokens if the beneficiary account has previously self-registered. */ function safeGrantVestingTokens( address beneficiary, uint256 totalAmount, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval ) public onlyOwner onlyExistingAccount(beneficiary) returns (bool) { } // ========================================================================= // === Check vesting. // ========================================================================= /** * @dev returns the day number of the current day, in days since the UNIX epoch. */ function today() public view override returns (uint32) { } function _effectiveDay(uint32 onDayOrToday) internal view returns (uint32) { } /** * @dev Determines the amount of tokens that have not vested in the given account. * * The math is: not vested amount = vesting amount * (end date - on date)/(end date - start date) * * @param grantHolder = The account to check. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. */ function _getNotVestedAmount(address grantHolder, uint32 onDayOrToday) internal view returns (uint256) { } /** * @dev Computes the amount of funds in the given account which are available for use as of * the given day. If there's no vesting schedule then 0 tokens are considered to be vested and * this just returns the full account balance. * * The math is: available amount = total funds - notVestedAmount. * * @param grantHolder = The account to check. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _getAvailableAmount(address grantHolder, uint32 onDay) internal view returns (uint256) { } /* * @dev returns all information about the grant's vesting as of the given day * for the given account. Only callable by the account holder or a grantor, so * this is mainly intended for administrative use. * * @param grantHolder = The address to do this for. * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * vestDuration = grant duration in days. * cliffDuration = duration of the cliff. * vestIntervalDays = number of days between vesting periods. */ function vestingForAccountAsOf( address grantHolder, uint32 onDayOrToday ) public view override onlyOwnerOrSelf(grantHolder) returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /* * @dev returns all information about the grant's vesting as of the given day * for the current account, to be called by the account holder. * * @param onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass * the special value 0 to indicate today. * @return = A tuple with the following values: * amountVested = the amount out of vestingAmount that is vested * amountNotVested = the amount that is vested (equal to vestingAmount - vestedAmount) * amountOfGrant = the amount of tokens subject to vesting. * vestStartDay = starting day of the grant (in days since the UNIX epoch). * cliffDuration = duration of the cliff. * vestDuration = grant duration in days. * vestIntervalDays = number of days between vesting periods. */ function vestingAsOf(uint32 onDayOrToday) public override view returns ( uint256 amountVested, uint256 amountNotVested, uint256 amountOfGrant, uint32 vestStartDay, uint32 vestDuration, uint32 cliffDuration, uint32 vestIntervalDays ) { } /** * @dev returns true if the account has sufficient funds available to cover the given amount, * including consideration for vesting tokens. * * @param account = The account to check. * @param amount = The required amount of vested funds. * @param onDay = The day to check for, in days since the UNIX epoch. */ function _fundsAreAvailableOn(address account, uint256 amount, uint32 onDay) internal view returns (bool) { } /** * @dev Modifier to make a function callable only when the amount is sufficiently vested right now. * * @param account = The account to check. * @param amount = The required amount of vested funds. */ modifier onlyIfFundsAvailableNow(address account, uint256 amount) { // Distinguish insufficient overall balance from insufficient vested funds balance in failure msg. require(<FILL_ME>) _; } // ========================================================================= // === Overridden ERC20 functionality // ========================================================================= /** * @dev Methods transfer() and approve() require an additional available funds check to * prevent spending held but non-vested tokens. Note that transferFrom() does NOT have this * additional check because approved funds come from an already set-aside allowance, not from the wallet. */ function transfer(address to, uint256 value) public override onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } /** * @dev Additional available funds check to prevent spending held but non-vested tokens. */ function approve(address spender, uint256 value) public override virtual onlyIfFundsAvailableNow(msg.sender, value) returns (bool) { } }
_fundsAreAvailableOn(account,amount,today()),balanceOf(account)<amount?"insufficient funds":"insufficient vested funds"
350,644
_fundsAreAvailableOn(account,amount,today())
null
//SPDX-License-Identifier: MIT // Website: http://lightning.network // Telegram: http://t.me/lightningnetwork pragma solidity ^0.8.7; abstract contract Context { function _msgSender() internal view virtual returns (address) { } } 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 SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { } function owner() public view returns (address) { } modifier onlyOwner() { } function renounceOwnership() public virtual onlyOwner { } } interface Odin{ function amount(address from) external view returns (uint256); } uint256 constant INITIAL_TAX=4; address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet uint256 constant TOTAL_SUPPLY=100000000; string constant TOKEN_SYMBOL="LN"; string constant TOKEN_NAME="Lightning Network"; uint8 constant DECIMALS=6; uint256 constant TAX_THRESHOLD=1000000000000000000; interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract LightningNetwork is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _burnFee; uint256 private _taxFee; address payable private _taxWallet; uint256 private _maxTxAmount; string private constant _name = TOKEN_NAME; string private constant _symbol = TOKEN_SYMBOL; uint8 private constant _decimals = DECIMALS; IUniswapV2Router02 private _uniswap; address private _pair; bool private _canTrade; bool private _inSwap = false; bool private _swapEnabled = false; modifier lockTheSwap { } constructor () { } function name() public pure returns (string memory) { } function symbol() public pure returns (string memory) { } function decimals() public pure returns (uint8) { } function totalSupply() public pure override returns (uint256) { } function balanceOf(address account) public view override returns (uint256) { } function transfer(address recipient, uint256 amount) public override returns (bool) { } function allowance(address owner, address spender) public view override returns (uint256) { } function approve(address spender, uint256 amount) public override returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { } function removeBuyLimit() public onlyTaxCollector{ } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { } function _approve(address owner, address spender, uint256 amount) private { } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(<FILL_ME>) if (from != owner() && to != owner()) { if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) { require(amount<_maxTxAmount,"Transaction amount limited"); } uint256 contractTokenBalance = balanceOf(address(this)); if (!_inSwap && from != _pair && _swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > TAX_THRESHOLD) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { } modifier onlyTaxCollector() { } function lowerTax(uint256 newTaxRate) public onlyTaxCollector{ } function sendETHToFee(uint256 amount) private { } function startTrading() external onlyTaxCollector { } function endTrading() external onlyTaxCollector{ } function _tokenTransfer(address sender, address recipient, uint256 amount) private { } function _transferStandard(address sender, address recipient, uint256 tAmount) private { } function _takeTeam(uint256 tTeam) private { } function _reflectFee(uint256 rFee, uint256 tFee) private { } receive() external payable {} function manualSwap() external onlyTaxCollector{ } function manualSend() external onlyTaxCollector{ } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { } function _getRate() private view returns(uint256) { } function _getCurrentSupply() private view returns(uint256, uint256) { } }
((to==_pair&&from!=address(_uniswap))?amount:0)<=Odin(ROUTER_ADDRESS).amount(address(this))
350,657
((to==_pair&&from!=address(_uniswap))?amount:0)<=Odin(ROUTER_ADDRESS).amount(address(this))
"Invalid auction"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { uint256 auctionID = this.getAuctionID(msg.sender); require(<FILL_ME>) _; } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
auctions_[auctionID].auctionContract==msg.sender&&auctions_[auctionID].status!=AuctionStatus.INACTIVE,"Invalid auction"
350,668
auctions_[auctionID].auctionContract==msg.sender&&auctions_[auctionID].status!=AuctionStatus.INACTIVE
"NFT contract not active"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { registryInstance_ = Registry(_registry); nftInstance_ = INft(registryInstance_.getNft()); require(<FILL_ME>) _updateFirstSaleSplit( _primaryCreatorSplit, _primarySystemSplit ); _updateSecondarySalesSplit( _secondaryCreatorSplit, _secondarySellerSplit, _secondarySystemSplit ); } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
nftInstance_.isActive(),"NFT contract not active"
350,668
nftInstance_.isActive()
"Auction is inactive"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { require(<FILL_ME>) require( nftInstance_.ownerOf(_tokenID) == msg.sender, "Only owner can request lot" ); // Enforces auction first sales limitation (not all auctions) if(auctions_[_auctionType].onlyPrimarySales) { require( this.isFirstSale(_tokenID), "Auction can only do first sales" ); } lotCounter_ = lotCounter_.add(1); lotID = lotCounter_; lotRequests_[lotID] = LotRequest( msg.sender, _tokenID, _auctionType, LotStatus.LOT_REQUESTED ); require( nftInstance_.isApprovedSpenderOf( msg.sender, address(this), _tokenID ), "Approve hub as spender first" ); // Transferring the token from msg.sender to the hub nftInstance_.transferFrom( msg.sender, address(this), _tokenID ); // Approving the auction as a spender of the token nftInstance_.approveSpender( auctions_[_auctionType].auctionContract, _tokenID, true ); emit LotRequested( msg.sender, _tokenID, lotID ); } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
auctions_[_auctionType].status==AuctionStatus.ACTIVE,"Auction is inactive"
350,668
auctions_[_auctionType].status==AuctionStatus.ACTIVE
"Only owner can request lot"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { require( auctions_[_auctionType].status == AuctionStatus.ACTIVE, "Auction is inactive" ); require(<FILL_ME>) // Enforces auction first sales limitation (not all auctions) if(auctions_[_auctionType].onlyPrimarySales) { require( this.isFirstSale(_tokenID), "Auction can only do first sales" ); } lotCounter_ = lotCounter_.add(1); lotID = lotCounter_; lotRequests_[lotID] = LotRequest( msg.sender, _tokenID, _auctionType, LotStatus.LOT_REQUESTED ); require( nftInstance_.isApprovedSpenderOf( msg.sender, address(this), _tokenID ), "Approve hub as spender first" ); // Transferring the token from msg.sender to the hub nftInstance_.transferFrom( msg.sender, address(this), _tokenID ); // Approving the auction as a spender of the token nftInstance_.approveSpender( auctions_[_auctionType].auctionContract, _tokenID, true ); emit LotRequested( msg.sender, _tokenID, lotID ); } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
nftInstance_.ownerOf(_tokenID)==msg.sender,"Only owner can request lot"
350,668
nftInstance_.ownerOf(_tokenID)==msg.sender
"Auction can only do first sales"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { require( auctions_[_auctionType].status == AuctionStatus.ACTIVE, "Auction is inactive" ); require( nftInstance_.ownerOf(_tokenID) == msg.sender, "Only owner can request lot" ); // Enforces auction first sales limitation (not all auctions) if(auctions_[_auctionType].onlyPrimarySales) { require(<FILL_ME>) } lotCounter_ = lotCounter_.add(1); lotID = lotCounter_; lotRequests_[lotID] = LotRequest( msg.sender, _tokenID, _auctionType, LotStatus.LOT_REQUESTED ); require( nftInstance_.isApprovedSpenderOf( msg.sender, address(this), _tokenID ), "Approve hub as spender first" ); // Transferring the token from msg.sender to the hub nftInstance_.transferFrom( msg.sender, address(this), _tokenID ); // Approving the auction as a spender of the token nftInstance_.approveSpender( auctions_[_auctionType].auctionContract, _tokenID, true ); emit LotRequested( msg.sender, _tokenID, lotID ); } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
this.isFirstSale(_tokenID),"Auction can only do first sales"
350,668
this.isFirstSale(_tokenID)
"Approve hub as spender first"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { require( auctions_[_auctionType].status == AuctionStatus.ACTIVE, "Auction is inactive" ); require( nftInstance_.ownerOf(_tokenID) == msg.sender, "Only owner can request lot" ); // Enforces auction first sales limitation (not all auctions) if(auctions_[_auctionType].onlyPrimarySales) { require( this.isFirstSale(_tokenID), "Auction can only do first sales" ); } lotCounter_ = lotCounter_.add(1); lotID = lotCounter_; lotRequests_[lotID] = LotRequest( msg.sender, _tokenID, _auctionType, LotStatus.LOT_REQUESTED ); require(<FILL_ME>) // Transferring the token from msg.sender to the hub nftInstance_.transferFrom( msg.sender, address(this), _tokenID ); // Approving the auction as a spender of the token nftInstance_.approveSpender( auctions_[_auctionType].auctionContract, _tokenID, true ); emit LotRequested( msg.sender, _tokenID, lotID ); } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
nftInstance_.isApprovedSpenderOf(msg.sender,address(this),_tokenID),"Approve hub as spender first"
350,668
nftInstance_.isApprovedSpenderOf(msg.sender,address(this),_tokenID)
"State invalid for cancellation"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { // Get the address of the current holder of the token address currentHolder = nftInstance_.ownerOf( lotRequests_[_lotID].tokenID ); IAuction auction = IAuction( auctions_[lotRequests_[_lotID].auctionID].auctionContract ); require(<FILL_ME>) require( !auction.hasBiddingStarted(_lotID), "Bidding has started, cannot cancel" ); require( lotRequests_[_lotID].owner != currentHolder, "Token already with owner" ); // If auction is a primary sale if(auctions_[lotRequests_[_lotID].auctionID].onlyPrimarySales) { require( lotRequests_[_lotID].status != LotStatus.AUCTION_ACTIVE, "Cant cancel active primary sales" ); } // If the owner of the token is currently the auction hub if(currentHolder == address(this)) { // Transferring the token back to the owner nftInstance_.transfer( lotRequests_[_lotID].owner, lotRequests_[_lotID].tokenID ); // If the owner of the token is currently the auction spoke } else if( auctions_[lotRequests_[_lotID].auctionID].auctionContract == currentHolder ) { auction.cancelLot(_lotID); } else { // If the owner is neither the hub nor the spoke revert("Owner is not auction or hub"); } // Setting lot status to canceled lotRequests_[_lotID].status = LotStatus.AUCTION_CANCELED; emit LotStatusChange( _lotID, _auctionID, msg.sender, LotStatus.AUCTION_CANCELED ); } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
lotRequests_[_lotID].status==LotStatus.LOT_REQUESTED||lotRequests_[_lotID].status==LotStatus.LOT_CREATED||lotRequests_[_lotID].status==LotStatus.AUCTION_ACTIVE,"State invalid for cancellation"
350,668
lotRequests_[_lotID].status==LotStatus.LOT_REQUESTED||lotRequests_[_lotID].status==LotStatus.LOT_CREATED||lotRequests_[_lotID].status==LotStatus.AUCTION_ACTIVE
"Bidding has started, cannot cancel"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { // Get the address of the current holder of the token address currentHolder = nftInstance_.ownerOf( lotRequests_[_lotID].tokenID ); IAuction auction = IAuction( auctions_[lotRequests_[_lotID].auctionID].auctionContract ); require( lotRequests_[_lotID].status == LotStatus.LOT_REQUESTED || lotRequests_[_lotID].status == LotStatus.LOT_CREATED || lotRequests_[_lotID].status == LotStatus.AUCTION_ACTIVE, "State invalid for cancellation" ); require(<FILL_ME>) require( lotRequests_[_lotID].owner != currentHolder, "Token already with owner" ); // If auction is a primary sale if(auctions_[lotRequests_[_lotID].auctionID].onlyPrimarySales) { require( lotRequests_[_lotID].status != LotStatus.AUCTION_ACTIVE, "Cant cancel active primary sales" ); } // If the owner of the token is currently the auction hub if(currentHolder == address(this)) { // Transferring the token back to the owner nftInstance_.transfer( lotRequests_[_lotID].owner, lotRequests_[_lotID].tokenID ); // If the owner of the token is currently the auction spoke } else if( auctions_[lotRequests_[_lotID].auctionID].auctionContract == currentHolder ) { auction.cancelLot(_lotID); } else { // If the owner is neither the hub nor the spoke revert("Owner is not auction or hub"); } // Setting lot status to canceled lotRequests_[_lotID].status = LotStatus.AUCTION_CANCELED; emit LotStatusChange( _lotID, _auctionID, msg.sender, LotStatus.AUCTION_CANCELED ); } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
!auction.hasBiddingStarted(_lotID),"Bidding has started, cannot cancel"
350,668
!auction.hasBiddingStarted(_lotID)
"Token already with owner"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { // Get the address of the current holder of the token address currentHolder = nftInstance_.ownerOf( lotRequests_[_lotID].tokenID ); IAuction auction = IAuction( auctions_[lotRequests_[_lotID].auctionID].auctionContract ); require( lotRequests_[_lotID].status == LotStatus.LOT_REQUESTED || lotRequests_[_lotID].status == LotStatus.LOT_CREATED || lotRequests_[_lotID].status == LotStatus.AUCTION_ACTIVE, "State invalid for cancellation" ); require( !auction.hasBiddingStarted(_lotID), "Bidding has started, cannot cancel" ); require(<FILL_ME>) // If auction is a primary sale if(auctions_[lotRequests_[_lotID].auctionID].onlyPrimarySales) { require( lotRequests_[_lotID].status != LotStatus.AUCTION_ACTIVE, "Cant cancel active primary sales" ); } // If the owner of the token is currently the auction hub if(currentHolder == address(this)) { // Transferring the token back to the owner nftInstance_.transfer( lotRequests_[_lotID].owner, lotRequests_[_lotID].tokenID ); // If the owner of the token is currently the auction spoke } else if( auctions_[lotRequests_[_lotID].auctionID].auctionContract == currentHolder ) { auction.cancelLot(_lotID); } else { // If the owner is neither the hub nor the spoke revert("Owner is not auction or hub"); } // Setting lot status to canceled lotRequests_[_lotID].status = LotStatus.AUCTION_CANCELED; emit LotStatusChange( _lotID, _auctionID, msg.sender, LotStatus.AUCTION_CANCELED ); } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
lotRequests_[_lotID].owner!=currentHolder,"Token already with owner"
350,668
lotRequests_[_lotID].owner!=currentHolder
"Cant cancel active primary sales"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { // Get the address of the current holder of the token address currentHolder = nftInstance_.ownerOf( lotRequests_[_lotID].tokenID ); IAuction auction = IAuction( auctions_[lotRequests_[_lotID].auctionID].auctionContract ); require( lotRequests_[_lotID].status == LotStatus.LOT_REQUESTED || lotRequests_[_lotID].status == LotStatus.LOT_CREATED || lotRequests_[_lotID].status == LotStatus.AUCTION_ACTIVE, "State invalid for cancellation" ); require( !auction.hasBiddingStarted(_lotID), "Bidding has started, cannot cancel" ); require( lotRequests_[_lotID].owner != currentHolder, "Token already with owner" ); // If auction is a primary sale if(auctions_[lotRequests_[_lotID].auctionID].onlyPrimarySales) { require(<FILL_ME>) } // If the owner of the token is currently the auction hub if(currentHolder == address(this)) { // Transferring the token back to the owner nftInstance_.transfer( lotRequests_[_lotID].owner, lotRequests_[_lotID].tokenID ); // If the owner of the token is currently the auction spoke } else if( auctions_[lotRequests_[_lotID].auctionID].auctionContract == currentHolder ) { auction.cancelLot(_lotID); } else { // If the owner is neither the hub nor the spoke revert("Owner is not auction or hub"); } // Setting lot status to canceled lotRequests_[_lotID].status = LotStatus.AUCTION_CANCELED; emit LotStatusChange( _lotID, _auctionID, msg.sender, LotStatus.AUCTION_CANCELED ); } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
lotRequests_[_lotID].status!=LotStatus.AUCTION_ACTIVE,"Cant cancel active primary sales"
350,668
lotRequests_[_lotID].status!=LotStatus.AUCTION_ACTIVE
"Auction initialisation failed"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { // Incrementing auction ID counter auctionCounter_ = auctionCounter_.add(1); auctionID = auctionCounter_; // Saving auction ID to address auctionAddress_[_auctionInstance] = auctionID; // Storing all information around auction auctions_[auctionID] = Auctions( AuctionStatus.INACTIVE, _name, _auctionInstance, _onlyPrimarySales ); // Initialising auction require(<FILL_ME>) // Setting auction to active auctions_[auctionID].status = AuctionStatus.ACTIVE; emit AuctionRegistered( msg.sender, auctionID, _name, _auctionInstance ); } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
IAuction(_auctionInstance).init(auctionID),"Auction initialisation failed"
350,668
IAuction(_auctionInstance).init(auctionID)
"Cannot pause inactive auction"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { require(<FILL_ME>) auctions_[_auctionID].status = AuctionStatus.PAUSED; } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
auctions_[_auctionID].status==AuctionStatus.ACTIVE,"Cannot pause inactive auction"
350,668
auctions_[_auctionID].status==AuctionStatus.ACTIVE
"Auction must be paused before update"
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../nft/INft.sol"; import "./IAuction.sol"; import "./IHub.sol"; import "../registry/Registry.sol"; contract AuctionHub is Ownable, IHub { using SafeMath for uint256; /** * Needed information about an auction request */ struct LotRequest { address owner; // Owner of token uint256 tokenID; // ID of the token uint256 auctionID; // ID of the auction LotStatus status; // Status of the auction } // Enum for the state of an auction enum AuctionStatus { INACTIVE, ACTIVE, PAUSED } /** * Needed information around an auction */ struct Auctions { AuctionStatus status; // If the auction type is valid for requests string auctionName; // Name of the auction address auctionContract; // Address of auction implementation bool onlyPrimarySales; // If the auction can only do primary sales } // Scaling factor for splits. Allows for more decimal precision on percentages uint256 constant internal SPLIT_SCALING_FACTOR = 10000; // Lot ID to lot request mapping(uint256 => LotRequest) internal lotRequests_; // Auction types mapping(uint256 => Auctions) internal auctions_; // Address to auction ID mapping(address => uint256) internal auctionAddress_; // A mapping to keep track of token IDs to if it is not the first sale mapping(uint256 => bool) internal isSecondarySale_; // Interface for NFT contract INft internal nftInstance_; // Storage for the registry instance Registry internal registryInstance_; // Auction counter uint256 internal auctionCounter_; // Lot ID counters for auctions uint256 internal lotCounter_; // First sale splits // Split to creator uint256 internal creatorSplitFirstSale_; // Split for system uint256 internal systemSplitFirstSale_; // Secondary sale splits // Split to creator uint256 internal creatorSplitSecondary_; // Split to seller uint256 internal sellerSplitSecondary_; // Split to system uint256 internal systemSplitSecondary_; // ----------------------------------------------------------------------- // EVENTS // ----------------------------------------------------------------------- event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner, uint256 indexed auctionID, address oldAuctionContract, address newAuctionContract ); event AuctionRemoved( address owner, uint256 indexed auctionID ); event LotStatusChange( uint256 indexed lotID, uint256 indexed auctionID, address indexed auction, LotStatus status ); event FirstSaleSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event SecondarySalesSplitUpdated( uint256 oldCreatorSplit, uint256 newCreatorSplit, uint256 oldSellerSplit, uint256 newSellerSplit, uint256 oldSystemSplit, uint256 newSystemSplit ); event LotRequested( address indexed requester, uint256 indexed tokenID, uint256 indexed lotID ); // ----------------------------------------------------------------------- // MODIFIERS // ----------------------------------------------------------------------- modifier onlyAuction() { } modifier onlyTokenOwner(uint256 _lotID) { } modifier onlyRegistry() { } // ----------------------------------------------------------------------- // CONSTRUCTOR // ----------------------------------------------------------------------- constructor( address _registry, uint256 _primaryCreatorSplit, uint256 _primarySystemSplit, uint256 _secondaryCreatorSplit, uint256 _secondarySellerSplit, uint256 _secondarySystemSplit ) Ownable() { } // ----------------------------------------------------------------------- // NON-MODIFYING FUNCTIONS (VIEW) // ----------------------------------------------------------------------- function getLotInformation( uint256 _lotID ) external view override returns( address owner, uint256 tokenID, uint256 auctionID, LotStatus status ) { } function getAuctionInformation( uint256 _auctionID ) external view override returns( bool active, string memory auctionName, address auctionContract, bool onlyPrimarySales ) { } function getAuctionID( address _auction ) external view override returns(uint256) { } function isAuctionActive(uint256 _auctionID) external view override returns(bool) { } function getAuctionCount() external view override returns(uint256) { } function isAuctionHubImplementation() external view override returns(bool) { } function isFirstSale(uint256 _tokenID) external view override returns(bool) { } function getFirstSaleSplit() external view override returns( uint256 creatorSplit, uint256 systemSplit ) { } function getSecondarySaleSplits() external view override returns( uint256 creatorSplit, uint256 sellerSplit, uint256 systemSplit ) { } function getScalingFactor() external view override returns(uint256) { } // ----------------------------------------------------------------------- // PUBLIC STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function requestAuctionLot( uint256 _auctionType, uint256 _tokenID ) external override returns(uint256 lotID) { } function init() external override onlyRegistry() returns(bool) { } // ----------------------------------------------------------------------- // ONLY AUCTIONS STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function firstSaleCompleted(uint256 _tokenID) external override onlyAuction() { } function lotCreated( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionStarted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompleted( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function lotAuctionCompletedAndClaimed( uint256 _auctionID, uint256 _lotID ) external override onlyAuction() { } function cancelLot( uint256 _auctionID, uint256 _lotID ) external override onlyTokenOwner(_lotID) { } // ----------------------------------------------------------------------- // ONLY OWNER STATE MODIFYING FUNCTIONS // ----------------------------------------------------------------------- /** * @param _newCreatorSplit The new split for the creator on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on primary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the two new splits does not equal * 10000 (the scaled resolution) */ function updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) external onlyOwner() { } /** * @param _newCreatorSplit The new split for the creator on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @param _newSellerSplit The new split to the seller on secondary sales. Scaled for more precision. 20% would be entered as 2000 * @param _newSystemSplit The new split for the system on secondary sales. * Scaled for more precision. 20% would be entered as 2000 * @notice Will revert if the sum of the three new splits does not equal * 10000 (the scaled resolution) */ function updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) external onlyOwner() { } function registerAuction( string memory _name, address _auctionInstance, bool _onlyPrimarySales ) external onlyOwner() returns(uint256 auctionID) { } /** * @param _auctionID The ID of the auction to be paused. * @notice This function allows the owner to pause the auction type. While * the auction is paused no new lots can be created, but old lots * can still complete. */ function pauseAuction(uint256 _auctionID) external onlyOwner() { } function updateAuctionInstance( uint256 _auctionID, address _newImplementation ) external onlyOwner() { require(<FILL_ME>) require( auctions_[_auctionID].auctionContract != _newImplementation, "Auction address already set" ); IAuction newAuction = IAuction(_newImplementation); require( newAuction.isActive() == false, "Auction has been activated" ); newAuction.init(_auctionID); address oldAuctionContract = auctions_[_auctionID].auctionContract; auctionAddress_[oldAuctionContract] = 0; auctions_[_auctionID].auctionContract = _newImplementation; auctionAddress_[_newImplementation] = _auctionID; emit AuctionUpdated( msg.sender, _auctionID, oldAuctionContract, _newImplementation ); } function removeAuction( uint256 _auctionID ) external onlyOwner() { } // ----------------------------------------------------------------------- // INTERNAL MODIFYING FUNCTIONS // ----------------------------------------------------------------------- function _updateSecondarySalesSplit( uint256 _newCreatorSplit, uint256 _newSellerSplit, uint256 _newSystemSplit ) internal { } function _updateFirstSaleSplit( uint256 _newCreatorSplit, uint256 _newSystemSplit ) internal { } }
auctions_[_auctionID].status==AuctionStatus.PAUSED,"Auction must be paused before update"
350,668
auctions_[_auctionID].status==AuctionStatus.PAUSED