comment
stringlengths
1
211
input
stringlengths
155
20k
label
stringlengths
4
1k
original_idx
int64
203
514k
predicate
stringlengths
1
1k
"Not for sale"
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; /// @author Alchemy Team /// @title Alchemy /// @notice The Alchemy contract wraps nfts into erc20 contract Alchemy is IERC20 { // using Openzeppelin contracts for SafeMath and Address using SafeMath for uint256; using Address for address; // presenting the total supply uint256 internal _totalSupply; // representing the name of the governance token string internal _name; // representing the symbol of the governance token string internal _symbol; // representing the decimals of the governance token uint8 internal constant _decimals = 18; // a record of balance of a specific account by address mapping(address => uint256) private _balances; // a record of allowances for a specific address by address to address mapping mapping(address => mapping(address => uint256)) private _allowances; // presenting the shares for sale uint256 public _sharesForSale; // struct for raised nfts struct _raisedNftStruct { IERC721 nftaddress; bool forSale; uint256 tokenid; uint256 price; } // The total number of NfTs in the DAO uint256 public _nftCount; // array for raised nfts _raisedNftStruct[] public _raisedNftArray; // mapping to store the already owned nfts mapping (address => mapping( uint256 => bool)) public _ownedAlready; // the owner and creator of the contract address public _owner; // the buyout price. once its met, all nfts will be transferred to the buyer uint256 public _buyoutPrice; // the address which has bought the dao address public _buyoutAddress; // representing the governance contract of the nft address public _governor; // representing the timelock address of the nft for the governor address public _timelock; // factory contract address address public _factoryContract; // A record of each accounts delegate mapping (address => address) public delegates; // A checkpoint for marking number of votes from a given block struct Checkpoint { uint256 votes; uint32 fromBlock; } // A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; // The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; // A record of states for signing / validating signatures mapping (address => uint) public nonces; // An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); // An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); constructor() { } function initialize( IERC721 nftAddress_, address owner_, uint256 tokenId_, uint256 totalSupply_, string memory name_, string memory symbol_, uint256 buyoutPrice_, address factoryContract, address governor_, address timelock_ ) external { } /** * @notice modifier only timelock can call these functions */ modifier onlyTimeLock() { } /** * @notice modifier only if buyoutAddress is not initialized */ modifier stillToBuy() { } /** * @dev Destroys `amount` tokens from `account`, reducing * and updating burn tokens for abstraction * * @param amount the amount to be burned */ function _burn(uint256 amount) internal { } /** * @dev After a buyout token holders can burn their tokens and get a proportion of the contract balance as a reward */ function burnForETH() external { } /** * @notice Lets any user buy shares if there are shares to be sold * * @param amount the amount to be bought */ function buyShares(uint256 amount) external payable { } /** * @notice view function to get the discounted buyout price * * @param account the account */ function getBuyoutPriceWithDiscount(address account) public view returns (uint256) { } /** * @notice Lets anyone buyout the whole dao if they send ETH according to the buyout price * all nfts will be transferred to the buyer * also a fee will be distributed 0.5% */ function buyout() external payable stillToBuy { } /** * @notice transfers specific nfts after the buyout happened * * @param nftids the aray of nft ids */ function buyoutWithdraw(uint[] memory nftids) external { } /** * @notice decreases shares for sale on the open market * * @param amount the amount to be burned */ function burnSharesForSale(uint256 amount) onlyTimeLock external { } /** * @notice increases shares for sale on the open market * * @param amount the amount to be minted */ function mintSharesForSale(uint256 amount) onlyTimeLock external { } /** * @notice changes the buyout price for the whole dao * * @param amount to set the new price */ function changeBuyoutPrice(uint256 amount) onlyTimeLock external { } /** * @notice allows the dao to set a specific nft on sale or to close the sale * * @param nftarrayid the nftarray id * @param price the buyout price for the specific nft * @param sale bool indicates the sale status */ function setNftSale(uint256 nftarrayid, uint256 price, bool sale) onlyTimeLock external { } /** * @notice allows anyone to buy a specific nft if it is on sale * takes a fee of 0.5% on sale * @param nftarrayid the nftarray id */ function buySingleNft(uint256 nftarrayid) stillToBuy external payable { _raisedNftStruct memory singleNft = _raisedNftArray[nftarrayid]; require(<FILL_ME>) require(msg.value == singleNft.price, "Price too low"); singleNft.nftaddress.safeTransferFrom(address(this), msg.sender, singleNft.tokenid); // Take 0.5% fee address payable alchemyRouter = IAlchemyFactory(_factoryContract).getAlchemyRouter(); IAlchemyRouter(alchemyRouter).deposit{value:singleNft.price / 200}(); _ownedAlready[address(singleNft.nftaddress)][singleNft.tokenid] = false; _nftCount--; for (uint i = nftarrayid; i < _raisedNftArray.length - 1; i++) { _raisedNftArray[i] = _raisedNftArray[i+1]; } _raisedNftArray.pop(); } /** * @notice adds a new nft to the nft array * must be approved an transferred seperately * * @param new_nft the address of the new nft * @param tokenid the if of the nft token */ function addNft(address new_nft, uint256 tokenid) onlyTimeLock public { } /** * @notice transfers an NFT to the DAO contract (called by executeTransaction function) * * @param new_nft the address of the new nft * @param tokenid the if of the nft token */ function transferFromAndAdd(address new_nft, uint256 tokenid) onlyTimeLock public { } /** * @notice returns the nft to the dao owner if allowed by the dao */ function sendNftBackToOwner(uint256 nftarrayid) onlyTimeLock public { } /** * @notice executes any transaction * * @param target the target of the call * @param value the value of the call * @param signature the signature of the function call * @param data the calldata */ function executeTransaction(address target, uint256 value, string memory signature, bytes memory data) onlyTimeLock external payable returns (bytes memory) { } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public pure returns (uint8) { } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public override view returns (uint256) { } /** * @dev See {IERC20-balanceOf}. Uses burn abstraction for balance updates without gas and universally. */ function balanceOf(address account) public override view returns (uint256) { } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address dst, uint256 rawAmount) external override returns (bool) { } /** * fallback function for collection funds */ fallback() external payable {} receive() external payable {} /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public override view returns (uint256) { } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public override returns (bool) { } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero ress. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address src, address dst, uint256 rawAmount) external override returns (bool) { } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal { } function _transfer( address sender, address recipient, uint256 amount ) internal { } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) public { } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) public view returns (uint256) { } function _delegate(address delegator, address delegatee) internal { } function _transferTokens(address src, address dst, uint256 amount) internal { } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { } function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) internal { } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { } function getChainId() internal pure returns (uint) { } } interface IAlchemyFactory { function getAlchemyRouter() external view returns (address payable); } interface IAlchemyRouter { function deposit() external payable; }
singleNft.forSale,"Not for sale"
3,056
singleNft.forSale
"ALC: Cant add duplicate NFT"
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; /// @author Alchemy Team /// @title Alchemy /// @notice The Alchemy contract wraps nfts into erc20 contract Alchemy is IERC20 { // using Openzeppelin contracts for SafeMath and Address using SafeMath for uint256; using Address for address; // presenting the total supply uint256 internal _totalSupply; // representing the name of the governance token string internal _name; // representing the symbol of the governance token string internal _symbol; // representing the decimals of the governance token uint8 internal constant _decimals = 18; // a record of balance of a specific account by address mapping(address => uint256) private _balances; // a record of allowances for a specific address by address to address mapping mapping(address => mapping(address => uint256)) private _allowances; // presenting the shares for sale uint256 public _sharesForSale; // struct for raised nfts struct _raisedNftStruct { IERC721 nftaddress; bool forSale; uint256 tokenid; uint256 price; } // The total number of NfTs in the DAO uint256 public _nftCount; // array for raised nfts _raisedNftStruct[] public _raisedNftArray; // mapping to store the already owned nfts mapping (address => mapping( uint256 => bool)) public _ownedAlready; // the owner and creator of the contract address public _owner; // the buyout price. once its met, all nfts will be transferred to the buyer uint256 public _buyoutPrice; // the address which has bought the dao address public _buyoutAddress; // representing the governance contract of the nft address public _governor; // representing the timelock address of the nft for the governor address public _timelock; // factory contract address address public _factoryContract; // A record of each accounts delegate mapping (address => address) public delegates; // A checkpoint for marking number of votes from a given block struct Checkpoint { uint256 votes; uint32 fromBlock; } // A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; // The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; // A record of states for signing / validating signatures mapping (address => uint) public nonces; // An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); // An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); constructor() { } function initialize( IERC721 nftAddress_, address owner_, uint256 tokenId_, uint256 totalSupply_, string memory name_, string memory symbol_, uint256 buyoutPrice_, address factoryContract, address governor_, address timelock_ ) external { } /** * @notice modifier only timelock can call these functions */ modifier onlyTimeLock() { } /** * @notice modifier only if buyoutAddress is not initialized */ modifier stillToBuy() { } /** * @dev Destroys `amount` tokens from `account`, reducing * and updating burn tokens for abstraction * * @param amount the amount to be burned */ function _burn(uint256 amount) internal { } /** * @dev After a buyout token holders can burn their tokens and get a proportion of the contract balance as a reward */ function burnForETH() external { } /** * @notice Lets any user buy shares if there are shares to be sold * * @param amount the amount to be bought */ function buyShares(uint256 amount) external payable { } /** * @notice view function to get the discounted buyout price * * @param account the account */ function getBuyoutPriceWithDiscount(address account) public view returns (uint256) { } /** * @notice Lets anyone buyout the whole dao if they send ETH according to the buyout price * all nfts will be transferred to the buyer * also a fee will be distributed 0.5% */ function buyout() external payable stillToBuy { } /** * @notice transfers specific nfts after the buyout happened * * @param nftids the aray of nft ids */ function buyoutWithdraw(uint[] memory nftids) external { } /** * @notice decreases shares for sale on the open market * * @param amount the amount to be burned */ function burnSharesForSale(uint256 amount) onlyTimeLock external { } /** * @notice increases shares for sale on the open market * * @param amount the amount to be minted */ function mintSharesForSale(uint256 amount) onlyTimeLock external { } /** * @notice changes the buyout price for the whole dao * * @param amount to set the new price */ function changeBuyoutPrice(uint256 amount) onlyTimeLock external { } /** * @notice allows the dao to set a specific nft on sale or to close the sale * * @param nftarrayid the nftarray id * @param price the buyout price for the specific nft * @param sale bool indicates the sale status */ function setNftSale(uint256 nftarrayid, uint256 price, bool sale) onlyTimeLock external { } /** * @notice allows anyone to buy a specific nft if it is on sale * takes a fee of 0.5% on sale * @param nftarrayid the nftarray id */ function buySingleNft(uint256 nftarrayid) stillToBuy external payable { } /** * @notice adds a new nft to the nft array * must be approved an transferred seperately * * @param new_nft the address of the new nft * @param tokenid the if of the nft token */ function addNft(address new_nft, uint256 tokenid) onlyTimeLock public { require(<FILL_ME>) _raisedNftStruct memory temp_struct; temp_struct.nftaddress = IERC721(new_nft); temp_struct.tokenid = tokenid; _raisedNftArray.push(temp_struct); _nftCount++; _ownedAlready[new_nft][tokenid] = true; } /** * @notice transfers an NFT to the DAO contract (called by executeTransaction function) * * @param new_nft the address of the new nft * @param tokenid the if of the nft token */ function transferFromAndAdd(address new_nft, uint256 tokenid) onlyTimeLock public { } /** * @notice returns the nft to the dao owner if allowed by the dao */ function sendNftBackToOwner(uint256 nftarrayid) onlyTimeLock public { } /** * @notice executes any transaction * * @param target the target of the call * @param value the value of the call * @param signature the signature of the function call * @param data the calldata */ function executeTransaction(address target, uint256 value, string memory signature, bytes memory data) onlyTimeLock external payable returns (bytes memory) { } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public pure returns (uint8) { } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public override view returns (uint256) { } /** * @dev See {IERC20-balanceOf}. Uses burn abstraction for balance updates without gas and universally. */ function balanceOf(address account) public override view returns (uint256) { } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address dst, uint256 rawAmount) external override returns (bool) { } /** * fallback function for collection funds */ fallback() external payable {} receive() external payable {} /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public override view returns (uint256) { } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public override returns (bool) { } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero ress. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address src, address dst, uint256 rawAmount) external override returns (bool) { } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal { } function _transfer( address sender, address recipient, uint256 amount ) internal { } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) public { } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) public view returns (uint256) { } function _delegate(address delegator, address delegatee) internal { } function _transferTokens(address src, address dst, uint256 amount) internal { } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { } function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) internal { } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { } function getChainId() internal pure returns (uint) { } } interface IAlchemyFactory { function getAlchemyRouter() external view returns (address payable); } interface IAlchemyRouter { function deposit() external payable; }
_ownedAlready[new_nft][tokenid]==false,"ALC: Cant add duplicate NFT"
3,056
_ownedAlready[new_nft][tokenid]==false
"This custy is already existing"
pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; /// Contract of Custy NFT collection contract Custy is ERC721URIStorage, Ownable, IERC2981 { using Counters for Counters.Counter; Counters.Counter private _tokenIds; string private constant baseURI = "ipfs://"; uint16 private constant totalSupply = 6000; uint16 private customerMintedCount; /// Quantitiy of custies for owners (for owner's, giveaway, etc) uint8 private oftheyearMintedCount; /// Address which will be able to mint 100 Custies for early birds and giveaways, etc address private constant ofTheYearWalletAddress = 0xbEfd893738193c5979C67e3E2EDD622931510c0C; /// Initial state is 0 /// Will be set after community bank will be deployed address private communityBankAddress = address(0); /// We save amount of eth which was received from custy sales only /// Doesn't include the royalty uint256 private ethReceivedFromSales = 0; /// Each custy has its own unique hash value which represents the params of custy /// E.g. head shape, body shape, accessories etc. uint256[] private _custyHashValues; mapping(uint256 => bool) private isCustyHashValueExistByHashes; mapping(uint256 => string) private _tokenURIsById; bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a; constructor() ERC721("Custies", "CST") { } function allMintedHashes() public view returns (uint256[] memory) { } function nextTokenNumberToBeMinted() public view returns (uint) { } /// Minting selected custy: /// 1. Write custy's hash value to prevent dublicates /// 2. Mint using tokenId and recipient address /// 3. Setting roylaty to nft. 2,5 % /// 4. Save the all amount received eth for custy to withdraw only this amount. /// The all remained money will be assumed as received royalty /// We reserve 100 Custies for oftheyear /// oftheyear will use 100 reserved custies for giveaways and early birds function mintCusty( uint256 _custyHashValue, address _recipient, string memory _tokenURI ) public payable { uint256 _totalAvailableCustiesForCustomers = totalSupply - oftheyearMintedCount; require(<FILL_ME>) if (_recipient != ofTheYearWalletAddress) { require( _totalAvailableCustiesForCustomers >= customerMintedCount, "All custies have been sold" ); require( msg.value >= 0.04 ether, "Custy's price is 0.04 ether" ); } else { require(oftheyearMintedCount <= 100, "Tebe bolwe nelzya"); } require(_recipient != address(0), "Incorrect recipient's address"); // ID of custy _tokenIds.increment(); // Minting uint256 newItemId = _tokenIds.current(); _mint(_recipient, _tokenURI, newItemId); if (_recipient == ofTheYearWalletAddress) { oftheyearMintedCount++; } else { customerMintedCount++; } // Save data about custy (Hash and owner) _custyHashValues.push(_custyHashValue); isCustyHashValueExistByHashes[_custyHashValue] = true; // Saving amount of eth which was recieved for custy ethReceivedFromSales += msg.value; } function _mint( address _recipient, string memory _tokenURI, uint256 _itemId ) private { } /// Withdraw only eth which were recieved for custy /// Royalty eth will remains on contract function withdraw() public onlyOwner { } function setCommunityBankAddress(address _bankAddress) public onlyOwner { } function withdrawToCommunityBank() public { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) { } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { } }
!isCustyHashValueExistByHashes[_custyHashValue],"This custy is already existing"
3,111
!isCustyHashValueExistByHashes[_custyHashValue]
"invalid message must be 'rotate'"
pragma solidity ^0.6.10; struct Observation { uint timestamp; uint acc; } contract UniswapAnchoredView is UniswapConfig { using FixedPoint for *; /// @notice The Open Oracle Price Data contract OpenOraclePriceData public immutable priceData; /// @notice The number of wei in 1 ETH uint public constant ethBaseUnit = 1e18; /// @notice A common scaling factor to maintain precision uint public constant expScale = 1e18; /// @notice The Open Oracle Reporter address public immutable reporter; /// @notice The highest ratio of the new price to the anchor price that will still trigger the price to be updated uint public immutable upperBoundAnchorRatio; /// @notice The lowest ratio of the new price to the anchor price that will still trigger the price to be updated uint public immutable lowerBoundAnchorRatio; uint public immutable upperBoundAnchorRatio2; uint public immutable lowerBoundAnchorRatio2; /// @notice The minimum amount of time in seconds required for the old uniswap price accumulator to be replaced uint public immutable anchorPeriod; /// @notice Official prices by symbol hash mapping(bytes32 => uint) public prices; /// @notice Circuit breaker for using anchor price oracle directly, ignoring reporter bool public reporterInvalidated; /// @notice The old observation for each symbolHash mapping(bytes32 => Observation) public oldUniswapObservations; /// @notice The new observation for each symbolHash mapping(bytes32 => Observation) public newUniswapObservations; /// @notice The old observation for each symbolHash mapping(bytes32 => Observation) public oldSashimiswapObservations; /// @notice The new observation for each symbolHash mapping(bytes32 => Observation) public newSashimiswapObservations; /// @notice The event emitted when new prices are posted but the stored price is not updated due to the anchor event PriceGuarded(string symbol, uint reporter, uint anchor); /// @notice The event emitted when the stored price is updated event PriceUpdated(string symbol, uint price); /// @notice The event emitted when anchor price is updated event AnchorPriceUpdated(string symbol, uint anchorPrice, uint oldTimestamp, uint newTimestamp); /// @notice The event emitted when the uniswap window changes event UniswapWindowUpdated(bytes32 indexed symbolHash, uint oldTimestamp, uint newTimestamp, uint oldPrice, uint newPrice); /// @notice The event emitted when the uniswap window changes event SashimiswapWindowUpdated(bytes32 indexed symbolHash, uint oldTimestamp, uint newTimestamp, uint oldPrice, uint newPrice); /// @notice The event emitted when reporter invalidates itself event ReporterInvalidated(address reporter); bytes32 constant ethHash = keccak256(abi.encodePacked("ETH")); bytes32 constant rotateHash = keccak256(abi.encodePacked("rotate")); /** * @notice Construct a uniswap anchored view for a set of token configurations * @dev Note that to avoid immature TWAPs, the system must run for at least a single anchorPeriod before using. * @param reporter_ The reporter whose prices are to be used * @param anchorToleranceMantissa_ The percentage tolerance that the reporter may deviate from the uniswap anchor * @param anchorPeriod_ The minimum amount of time required for the old uniswap price accumulator to be replaced * @param configs The static token configurations which define what prices are supported and how */ constructor(OpenOraclePriceData priceData_, address reporter_, uint anchorToleranceMantissa_, uint anchorPeriod_, TokenConfig[] memory configs) UniswapConfig(configs) public { } /** * @notice Get the official price for a symbol * @param symbol The symbol to fetch the price of * @return Price denominated in USD, with 6 decimals */ function price(string memory symbol) external view returns (uint) { } function priceInternal(TokenConfig memory config) internal view returns (uint) { } /** * @notice Get the underlying price of a slToken * @dev Implements the PriceOracle interface for Compound v2. * @param slToken The slToken address for price retrieval * @return Price denominated in USD, with 18 decimals, for the given slToken address */ function getUnderlyingPrice(address slToken) external view returns (uint) { } /** * @notice Post open oracle reporter prices, and recalculate stored price by comparing to anchor * @dev We let anyone pay to post anything, but only prices from configured reporter will be stored in the view. * @param messages The messages to post to the oracle * @param signatures The signatures for the corresponding messages * @param symbols The symbols to compare to anchor for authoritative reading */ function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) external { } function postPriceInternal(string memory symbol, uint ethPrice) internal { } function isWithinAnchor(uint reporterPrice, uint anchorPrice, TokenConfig memory config) internal view returns (bool) { } /** * @dev Fetches the current token/eth price accumulator from uniswap. */ function currentCumulativePrice(address swapMarket, bool isSwapReversed) internal view returns (uint) { } /** * @dev Fetches the current eth/usd price from uniswap, with 6 decimals of precision. * Conversion factor is 1e18 for eth/usdc market, since we decode uniswap price statically with 18 decimals. */ function fetchEthPrice() internal returns (uint) { } /** * @dev Fetches the current token/usd price from uniswap, with 6 decimals of precision. * @param conversionFactor 1e18 if seeking the ETH price, and a 6 decimal ETH-USDC price in the case of other assets */ function fetchAnchorPrice(string memory symbol, TokenConfig memory config, uint conversionFactor) internal virtual returns (uint) { } function getPriceAverage(uint nowCumulativePrice, uint oldCumulativePrice, uint oldTimestamp) internal view returns (uint){ } /** * @dev Get time-weighted average prices for a token at the current timestamp. * Update new and old observations of lagging window if period elapsed. */ function pokeUniswapWindowValues(bytes32 symbolHash, address swapMarket,bool isSwapReversed) internal returns (uint, uint, uint) { } /** * @dev Get time-weighted average prices for a token at the current timestamp. * Update new and old observations of lagging window if period elapsed. */ function pokeSashimiswapWindowValues(bytes32 symbolHash, address swapMarket,bool isSwapReversed) internal returns (uint, uint, uint) { } /** * @notice Invalidate the reporter, and fall back to using anchor directly in all cases * @dev Only the reporter may sign a message which allows it to invalidate itself. * To be used in cases of emergency, if the reporter thinks their key may be compromised. * @param message The data that was presumably signed * @param signature The fingerprint of the data + private key */ function invalidateReporter(bytes memory message, bytes memory signature) external { (string memory decodedMessage, ) = abi.decode(message, (string, address)); require(<FILL_ME>) require(source(message, signature) == reporter, "invalidation message must come from the reporter"); reporterInvalidated = true; emit ReporterInvalidated(reporter); } /** * @notice Recovers the source address which signed a message * @dev Comparing to a claimed address would add nothing, * as the caller could simply perform the recover and claim that address. * @param message The data that was presumably signed * @param signature The fingerprint of the data + private key * @return The source address which signed the message, presumably */ function source(bytes memory message, bytes memory signature) public pure returns (address) { } /// @dev Overflow proof multiplication function mul(uint a, uint b) internal pure returns (uint) { } }
keccak256(abi.encodePacked(decodedMessage))==rotateHash,"invalid message must be 'rotate'"
3,216
keccak256(abi.encodePacked(decodedMessage))==rotateHash
"invalidation message must come from the reporter"
pragma solidity ^0.6.10; struct Observation { uint timestamp; uint acc; } contract UniswapAnchoredView is UniswapConfig { using FixedPoint for *; /// @notice The Open Oracle Price Data contract OpenOraclePriceData public immutable priceData; /// @notice The number of wei in 1 ETH uint public constant ethBaseUnit = 1e18; /// @notice A common scaling factor to maintain precision uint public constant expScale = 1e18; /// @notice The Open Oracle Reporter address public immutable reporter; /// @notice The highest ratio of the new price to the anchor price that will still trigger the price to be updated uint public immutable upperBoundAnchorRatio; /// @notice The lowest ratio of the new price to the anchor price that will still trigger the price to be updated uint public immutable lowerBoundAnchorRatio; uint public immutable upperBoundAnchorRatio2; uint public immutable lowerBoundAnchorRatio2; /// @notice The minimum amount of time in seconds required for the old uniswap price accumulator to be replaced uint public immutable anchorPeriod; /// @notice Official prices by symbol hash mapping(bytes32 => uint) public prices; /// @notice Circuit breaker for using anchor price oracle directly, ignoring reporter bool public reporterInvalidated; /// @notice The old observation for each symbolHash mapping(bytes32 => Observation) public oldUniswapObservations; /// @notice The new observation for each symbolHash mapping(bytes32 => Observation) public newUniswapObservations; /// @notice The old observation for each symbolHash mapping(bytes32 => Observation) public oldSashimiswapObservations; /// @notice The new observation for each symbolHash mapping(bytes32 => Observation) public newSashimiswapObservations; /// @notice The event emitted when new prices are posted but the stored price is not updated due to the anchor event PriceGuarded(string symbol, uint reporter, uint anchor); /// @notice The event emitted when the stored price is updated event PriceUpdated(string symbol, uint price); /// @notice The event emitted when anchor price is updated event AnchorPriceUpdated(string symbol, uint anchorPrice, uint oldTimestamp, uint newTimestamp); /// @notice The event emitted when the uniswap window changes event UniswapWindowUpdated(bytes32 indexed symbolHash, uint oldTimestamp, uint newTimestamp, uint oldPrice, uint newPrice); /// @notice The event emitted when the uniswap window changes event SashimiswapWindowUpdated(bytes32 indexed symbolHash, uint oldTimestamp, uint newTimestamp, uint oldPrice, uint newPrice); /// @notice The event emitted when reporter invalidates itself event ReporterInvalidated(address reporter); bytes32 constant ethHash = keccak256(abi.encodePacked("ETH")); bytes32 constant rotateHash = keccak256(abi.encodePacked("rotate")); /** * @notice Construct a uniswap anchored view for a set of token configurations * @dev Note that to avoid immature TWAPs, the system must run for at least a single anchorPeriod before using. * @param reporter_ The reporter whose prices are to be used * @param anchorToleranceMantissa_ The percentage tolerance that the reporter may deviate from the uniswap anchor * @param anchorPeriod_ The minimum amount of time required for the old uniswap price accumulator to be replaced * @param configs The static token configurations which define what prices are supported and how */ constructor(OpenOraclePriceData priceData_, address reporter_, uint anchorToleranceMantissa_, uint anchorPeriod_, TokenConfig[] memory configs) UniswapConfig(configs) public { } /** * @notice Get the official price for a symbol * @param symbol The symbol to fetch the price of * @return Price denominated in USD, with 6 decimals */ function price(string memory symbol) external view returns (uint) { } function priceInternal(TokenConfig memory config) internal view returns (uint) { } /** * @notice Get the underlying price of a slToken * @dev Implements the PriceOracle interface for Compound v2. * @param slToken The slToken address for price retrieval * @return Price denominated in USD, with 18 decimals, for the given slToken address */ function getUnderlyingPrice(address slToken) external view returns (uint) { } /** * @notice Post open oracle reporter prices, and recalculate stored price by comparing to anchor * @dev We let anyone pay to post anything, but only prices from configured reporter will be stored in the view. * @param messages The messages to post to the oracle * @param signatures The signatures for the corresponding messages * @param symbols The symbols to compare to anchor for authoritative reading */ function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) external { } function postPriceInternal(string memory symbol, uint ethPrice) internal { } function isWithinAnchor(uint reporterPrice, uint anchorPrice, TokenConfig memory config) internal view returns (bool) { } /** * @dev Fetches the current token/eth price accumulator from uniswap. */ function currentCumulativePrice(address swapMarket, bool isSwapReversed) internal view returns (uint) { } /** * @dev Fetches the current eth/usd price from uniswap, with 6 decimals of precision. * Conversion factor is 1e18 for eth/usdc market, since we decode uniswap price statically with 18 decimals. */ function fetchEthPrice() internal returns (uint) { } /** * @dev Fetches the current token/usd price from uniswap, with 6 decimals of precision. * @param conversionFactor 1e18 if seeking the ETH price, and a 6 decimal ETH-USDC price in the case of other assets */ function fetchAnchorPrice(string memory symbol, TokenConfig memory config, uint conversionFactor) internal virtual returns (uint) { } function getPriceAverage(uint nowCumulativePrice, uint oldCumulativePrice, uint oldTimestamp) internal view returns (uint){ } /** * @dev Get time-weighted average prices for a token at the current timestamp. * Update new and old observations of lagging window if period elapsed. */ function pokeUniswapWindowValues(bytes32 symbolHash, address swapMarket,bool isSwapReversed) internal returns (uint, uint, uint) { } /** * @dev Get time-weighted average prices for a token at the current timestamp. * Update new and old observations of lagging window if period elapsed. */ function pokeSashimiswapWindowValues(bytes32 symbolHash, address swapMarket,bool isSwapReversed) internal returns (uint, uint, uint) { } /** * @notice Invalidate the reporter, and fall back to using anchor directly in all cases * @dev Only the reporter may sign a message which allows it to invalidate itself. * To be used in cases of emergency, if the reporter thinks their key may be compromised. * @param message The data that was presumably signed * @param signature The fingerprint of the data + private key */ function invalidateReporter(bytes memory message, bytes memory signature) external { (string memory decodedMessage, ) = abi.decode(message, (string, address)); require(keccak256(abi.encodePacked(decodedMessage)) == rotateHash, "invalid message must be 'rotate'"); require(<FILL_ME>) reporterInvalidated = true; emit ReporterInvalidated(reporter); } /** * @notice Recovers the source address which signed a message * @dev Comparing to a claimed address would add nothing, * as the caller could simply perform the recover and claim that address. * @param message The data that was presumably signed * @param signature The fingerprint of the data + private key * @return The source address which signed the message, presumably */ function source(bytes memory message, bytes memory signature) public pure returns (address) { } /// @dev Overflow proof multiplication function mul(uint a, uint b) internal pure returns (uint) { } }
source(message,signature)==reporter,"invalidation message must come from the reporter"
3,216
source(message,signature)==reporter
null
/* * LocalCoinSwap Cryptoshare Source Code * www.localcoinswap.com */ pragma solidity ^0.4.19; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract 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. */ function Ownable() 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) public onlyOwner { } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract 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) { } /** * @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) { } } contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract 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) { } } contract DerivativeTokenInterface { function mint(address _to, uint256 _amount) public returns (bool); } contract LCS is StandardToken, BurnableToken, Ownable { string public constant name = "LocalCoinSwap Cryptoshare"; string public constant symbol = "LCS"; uint256 public constant decimals = 18; uint256 public constant initialSupply = 100000000 * (10 ** 18); // Array of derivative token addresses DerivativeTokenInterface[] public derivativeTokens; bool public nextDerivativeTokenScheduled = false; // Time until next token distribution uint256 public nextDerivativeTokenTime; // Next token to be distrubuted DerivativeTokenInterface public nextDerivativeToken; // Index of last token claimed by LCS holder, required for holder to claim unclaimed tokens mapping (address => uint256) lastDerivativeTokens; function LCS() public { } // Event for token distribution event DistributeDerivativeTokens(address indexed to, uint256 number, uint256 amount); // Modifier to handle token distribution modifier handleDerivativeTokens(address from) { } // Claim unclaimed derivative tokens function claimDerivativeTokens() public handleDerivativeTokens(msg.sender) returns (bool) { } // Set the address and release time of the next token distribution function scheduleNewDerivativeToken(address _address, uint256 _time) public onlyOwner returns (bool) { require(<FILL_ME>) nextDerivativeTokenScheduled = true; nextDerivativeTokenTime = _time; nextDerivativeToken = DerivativeTokenInterface(_address); return true; } // Make sure derivative tokens are handled for the _from and _to addresses function transferFrom(address _from, address _to, uint256 _value) public handleDerivativeTokens(_from) handleDerivativeTokens(_to) returns (bool) { } // Make sure derivative tokens are handled for the msg.sender and _to addresses function transfer(address _to, uint256 _value) public handleDerivativeTokens(msg.sender) handleDerivativeTokens(_to) returns (bool) { } }
!nextDerivativeTokenScheduled
3,217
!nextDerivativeTokenScheduled
"onlyAdapter"
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../core/DaoRegistry.sol"; import "../extensions/IExtension.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract AdapterGuard { /** * @dev Only registered adapters are allowed to execute the function call. */ modifier onlyAdapter(DaoRegistry dao) { require(<FILL_ME>) _; } modifier reentrancyGuard(DaoRegistry dao) { } modifier hasAccess(DaoRegistry dao, DaoRegistry.AclFlag flag) { } function creationModeCheck(DaoRegistry dao) internal view returns (bool) { } }
(dao.state()==DaoRegistry.DaoState.CREATION&&creationModeCheck(dao))||dao.isAdapter(msg.sender),"onlyAdapter"
3,278
(dao.state()==DaoRegistry.DaoState.CREATION&&creationModeCheck(dao))||dao.isAdapter(msg.sender)
"reentrancy guard"
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../core/DaoRegistry.sol"; import "../extensions/IExtension.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract AdapterGuard { /** * @dev Only registered adapters are allowed to execute the function call. */ modifier onlyAdapter(DaoRegistry dao) { } modifier reentrancyGuard(DaoRegistry dao) { require(<FILL_ME>) dao.lockSession(); _; dao.unlockSession(); } modifier hasAccess(DaoRegistry dao, DaoRegistry.AclFlag flag) { } function creationModeCheck(DaoRegistry dao) internal view returns (bool) { } }
dao.lockedAt()!=block.number,"reentrancy guard"
3,278
dao.lockedAt()!=block.number
"accessDenied"
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../core/DaoRegistry.sol"; import "../extensions/IExtension.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract AdapterGuard { /** * @dev Only registered adapters are allowed to execute the function call. */ modifier onlyAdapter(DaoRegistry dao) { } modifier reentrancyGuard(DaoRegistry dao) { } modifier hasAccess(DaoRegistry dao, DaoRegistry.AclFlag flag) { require(<FILL_ME>) _; } function creationModeCheck(DaoRegistry dao) internal view returns (bool) { } }
(dao.state()==DaoRegistry.DaoState.CREATION&&creationModeCheck(dao))||dao.hasAdapterAccess(msg.sender,flag),"accessDenied"
3,278
(dao.state()==DaoRegistry.DaoState.CREATION&&creationModeCheck(dao))||dao.hasAdapterAccess(msg.sender,flag)
null
library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; // Detect overflow when multiplying MIN_INT256 with -1 require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require(<FILL_ME>) return c; } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Subtracts two int256 variables and fails on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Adds two int256 variables and fails on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Converts to absolute value, and fails on overflow. */ function abs(int256 a) internal pure returns (int256) { } function toUint256Safe(int256 a) internal pure returns (uint256) { } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } pragma solidity >=0.7.5; library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { } function increment(Counter storage counter) internal { } function decrement(Counter storage counter) internal { } }
(b==0)||(c/b==a)
3,301
(b==0)||(c/b==a)
null
library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(<FILL_ME>) // Solidity already throws when dividing by 0. return a / b; } /** * @dev Subtracts two int256 variables and fails on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Adds two int256 variables and fails on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Converts to absolute value, and fails on overflow. */ function abs(int256 a) internal pure returns (int256) { } function toUint256Safe(int256 a) internal pure returns (uint256) { } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } pragma solidity >=0.7.5; library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { } function increment(Counter storage counter) internal { } function decrement(Counter storage counter) internal { } }
b!=-1||a!=MIN_INT256
3,301
b!=-1||a!=MIN_INT256
null
library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Subtracts two int256 variables and fails on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require(<FILL_ME>) return c; } /** * @dev Adds two int256 variables and fails on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Converts to absolute value, and fails on overflow. */ function abs(int256 a) internal pure returns (int256) { } function toUint256Safe(int256 a) internal pure returns (uint256) { } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } pragma solidity >=0.7.5; library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { } function increment(Counter storage counter) internal { } function decrement(Counter storage counter) internal { } }
(b>=0&&c<=a)||(b<0&&c>a)
3,301
(b>=0&&c<=a)||(b<0&&c>a)
null
library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Subtracts two int256 variables and fails on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { } /** * @dev Adds two int256 variables and fails on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require(<FILL_ME>) return c; } /** * @dev Converts to absolute value, and fails on overflow. */ function abs(int256 a) internal pure returns (int256) { } function toUint256Safe(int256 a) internal pure returns (uint256) { } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } pragma solidity >=0.7.5; library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { } function increment(Counter storage counter) internal { } function decrement(Counter storage counter) internal { } }
(b>=0&&c>=a)||(b<0&&c<a)
3,301
(b>=0&&c>=a)||(b<0&&c<a)
"ERR_MAX_TOTAL_WEIGHT"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { require(newWeight >= BalancerConstants.MIN_WEIGHT, "ERR_MIN_WEIGHT"); require(newWeight <= BalancerConstants.MAX_WEIGHT, "ERR_MAX_WEIGHT"); uint256 currentWeight = bPool.getDenormalizedWeight(token); // Save gas; return immediately on NOOP if (currentWeight == newWeight) { return; } uint256 currentBalance = bPool.getBalance(token); uint256 totalSupply = self.totalSupply(); uint256 totalWeight = bPool.getTotalDenormalizedWeight(); uint256 poolShares; uint256 deltaBalance; uint256 deltaWeight; uint256 newBalance; if (newWeight < currentWeight) { // This means the controller will withdraw tokens to keep price // So they need to redeem PCTokens deltaWeight = BalancerSafeMath.bsub(currentWeight, newWeight); // poolShares = totalSupply * (deltaWeight / totalWeight) poolShares = BalancerSafeMath.bmul( totalSupply, BalancerSafeMath.bdiv(deltaWeight, totalWeight) ); // deltaBalance = currentBalance * (deltaWeight / currentWeight) deltaBalance = BalancerSafeMath.bmul( currentBalance, BalancerSafeMath.bdiv(deltaWeight, currentWeight) ); // New balance cannot be lower than MIN_BALANCE newBalance = BalancerSafeMath.bsub(currentBalance, deltaBalance); require( newBalance >= BalancerConstants.MIN_BALANCE, "ERR_MIN_BALANCE" ); // First get the tokens from this contract (Pool Controller) to msg.sender bPool.rebind(token, newBalance, newWeight); // Now with the tokens this contract can send them to msg.sender bool xfer = IERC20(token).transfer(msg.sender, deltaBalance); require(xfer, "ERR_ERC20_FALSE"); self.pullPoolShareFromLib(msg.sender, poolShares); self.burnPoolShareFromLib(poolShares); } else { // This means the controller will deposit tokens to keep the price. // They will be minted and given PCTokens deltaWeight = BalancerSafeMath.bsub(newWeight, currentWeight); require(<FILL_ME>) // poolShares = totalSupply * (deltaWeight / totalWeight) poolShares = BalancerSafeMath.bmul( totalSupply, BalancerSafeMath.bdiv(deltaWeight, totalWeight) ); // deltaBalance = currentBalance * (deltaWeight / currentWeight) deltaBalance = BalancerSafeMath.bmul( currentBalance, BalancerSafeMath.bdiv(deltaWeight, currentWeight) ); // First gets the tokens from msg.sender to this contract (Pool Controller) bool xfer = IERC20(token).transferFrom( msg.sender, address(this), deltaBalance ); require(xfer, "ERR_ERC20_FALSE"); // Now with the tokens this contract can bind them to the pool it controls bPool.rebind( token, BalancerSafeMath.badd(currentBalance, deltaBalance), newWeight ); self.mintPoolShareFromLib(poolShares); self.pushPoolShareFromLib(msg.sender, poolShares); } } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
BalancerSafeMath.badd(totalWeight,deltaWeight)<=BalancerConstants.MAX_TOTAL_WEIGHT,"ERR_MAX_TOTAL_WEIGHT"
3,330
BalancerSafeMath.badd(totalWeight,deltaWeight)<=BalancerConstants.MAX_TOTAL_WEIGHT
"ERR_IS_BOUND"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { require(<FILL_ME>) require( denormalizedWeight <= BalancerConstants.MAX_WEIGHT, "ERR_WEIGHT_ABOVE_MAX" ); require( denormalizedWeight >= BalancerConstants.MIN_WEIGHT, "ERR_WEIGHT_BELOW_MIN" ); require( BalancerSafeMath.badd( bPool.getTotalDenormalizedWeight(), denormalizedWeight ) <= BalancerConstants.MAX_TOTAL_WEIGHT, "ERR_MAX_TOTAL_WEIGHT" ); require( balance >= BalancerConstants.MIN_BALANCE, "ERR_BALANCE_BELOW_MIN" ); newToken.addr = token; newToken.balance = balance; newToken.denorm = denormalizedWeight; newToken.commitBlock = block.number; newToken.isCommitted = true; } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
!bPool.isBound(token),"ERR_IS_BOUND"
3,330
!bPool.isBound(token)
"ERR_MAX_TOTAL_WEIGHT"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { require(!bPool.isBound(token), "ERR_IS_BOUND"); require( denormalizedWeight <= BalancerConstants.MAX_WEIGHT, "ERR_WEIGHT_ABOVE_MAX" ); require( denormalizedWeight >= BalancerConstants.MIN_WEIGHT, "ERR_WEIGHT_BELOW_MIN" ); require(<FILL_ME>) require( balance >= BalancerConstants.MIN_BALANCE, "ERR_BALANCE_BELOW_MIN" ); newToken.addr = token; newToken.balance = balance; newToken.denorm = denormalizedWeight; newToken.commitBlock = block.number; newToken.isCommitted = true; } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
BalancerSafeMath.badd(bPool.getTotalDenormalizedWeight(),denormalizedWeight)<=BalancerConstants.MAX_TOTAL_WEIGHT,"ERR_MAX_TOTAL_WEIGHT"
3,330
BalancerSafeMath.badd(bPool.getTotalDenormalizedWeight(),denormalizedWeight)<=BalancerConstants.MAX_TOTAL_WEIGHT
"ERR_NO_TOKEN_COMMIT"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { require(<FILL_ME>) require( BalancerSafeMath.bsub(block.number, newToken.commitBlock) >= addTokenTimeLockInBlocks, "ERR_TIMELOCK_STILL_COUNTING" ); uint256 totalSupply = self.totalSupply(); // poolShares = totalSupply * newTokenWeight / totalWeight uint256 poolShares = BalancerSafeMath.bdiv( BalancerSafeMath.bmul(totalSupply, newToken.denorm), bPool.getTotalDenormalizedWeight() ); // Clear this to allow adding more tokens newToken.isCommitted = false; // First gets the tokens from msg.sender to this contract (Pool Controller) bool returnValue = IERC20(newToken.addr).transferFrom( self.getController(), address(self), newToken.balance ); require(returnValue, "ERR_ERC20_FALSE"); // Now with the tokens this contract can bind them to the pool it controls // Approves bPool to pull from this controller // Approve unlimited, same as when creating the pool, so they can join pools later returnValue = SafeApprove.safeApprove( IERC20(newToken.addr), address(bPool), BalancerConstants.MAX_UINT ); require(returnValue, "ERR_ERC20_FALSE"); bPool.bind(newToken.addr, newToken.balance, newToken.denorm); self.mintPoolShareFromLib(poolShares); self.pushPoolShareFromLib(msg.sender, poolShares); } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
newToken.isCommitted,"ERR_NO_TOKEN_COMMIT"
3,330
newToken.isCommitted
"ERR_TIMELOCK_STILL_COUNTING"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { require(newToken.isCommitted, "ERR_NO_TOKEN_COMMIT"); require(<FILL_ME>) uint256 totalSupply = self.totalSupply(); // poolShares = totalSupply * newTokenWeight / totalWeight uint256 poolShares = BalancerSafeMath.bdiv( BalancerSafeMath.bmul(totalSupply, newToken.denorm), bPool.getTotalDenormalizedWeight() ); // Clear this to allow adding more tokens newToken.isCommitted = false; // First gets the tokens from msg.sender to this contract (Pool Controller) bool returnValue = IERC20(newToken.addr).transferFrom( self.getController(), address(self), newToken.balance ); require(returnValue, "ERR_ERC20_FALSE"); // Now with the tokens this contract can bind them to the pool it controls // Approves bPool to pull from this controller // Approve unlimited, same as when creating the pool, so they can join pools later returnValue = SafeApprove.safeApprove( IERC20(newToken.addr), address(bPool), BalancerConstants.MAX_UINT ); require(returnValue, "ERR_ERC20_FALSE"); bPool.bind(newToken.addr, newToken.balance, newToken.denorm); self.mintPoolShareFromLib(poolShares); self.pushPoolShareFromLib(msg.sender, poolShares); } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
BalancerSafeMath.bsub(block.number,newToken.commitBlock)>=addTokenTimeLockInBlocks,"ERR_TIMELOCK_STILL_COUNTING"
3,330
BalancerSafeMath.bsub(block.number,newToken.commitBlock)>=addTokenTimeLockInBlocks
"ERR_WEIGHT_CHANGE_TIME_BELOW_MIN"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { require(block.number < endBlock, "ERR_GRADUAL_UPDATE_TIME_TRAVEL"); if (block.number > startBlock) { // This means the weight update should start ASAP // Moving the start block up prevents a big jump/discontinuity in the weights gradualUpdate.startBlock = block.number; } else { gradualUpdate.startBlock = startBlock; } // Enforce a minimum time over which to make the changes // The also prevents endBlock <= startBlock require(<FILL_ME>) address[] memory tokens = bPool.getCurrentTokens(); // Must specify weights for all tokens require( newWeights.length == tokens.length, "ERR_START_WEIGHTS_MISMATCH" ); uint256 weightsSum = 0; gradualUpdate.startWeights = new uint256[](tokens.length); // Check that endWeights are valid now to avoid reverting in a future pokeWeights call // // This loop contains external calls // External calls are to math libraries or the underlying pool, so low risk for (uint256 i = 0; i < tokens.length; i++) { require( newWeights[i] <= BalancerConstants.MAX_WEIGHT, "ERR_WEIGHT_ABOVE_MAX" ); require( newWeights[i] >= BalancerConstants.MIN_WEIGHT, "ERR_WEIGHT_BELOW_MIN" ); weightsSum = BalancerSafeMath.badd(weightsSum, newWeights[i]); gradualUpdate.startWeights[i] = bPool.getDenormalizedWeight( tokens[i] ); } require( weightsSum <= BalancerConstants.MAX_TOTAL_WEIGHT, "ERR_MAX_TOTAL_WEIGHT" ); gradualUpdate.endBlock = endBlock; gradualUpdate.endWeights = newWeights; } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
BalancerSafeMath.bsub(endBlock,gradualUpdate.startBlock)>=minimumWeightChangeBlockPeriod,"ERR_WEIGHT_CHANGE_TIME_BELOW_MIN"
3,330
BalancerSafeMath.bsub(endBlock,gradualUpdate.startBlock)>=minimumWeightChangeBlockPeriod
"ERR_WEIGHT_ABOVE_MAX"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { require(block.number < endBlock, "ERR_GRADUAL_UPDATE_TIME_TRAVEL"); if (block.number > startBlock) { // This means the weight update should start ASAP // Moving the start block up prevents a big jump/discontinuity in the weights gradualUpdate.startBlock = block.number; } else { gradualUpdate.startBlock = startBlock; } // Enforce a minimum time over which to make the changes // The also prevents endBlock <= startBlock require( BalancerSafeMath.bsub(endBlock, gradualUpdate.startBlock) >= minimumWeightChangeBlockPeriod, "ERR_WEIGHT_CHANGE_TIME_BELOW_MIN" ); address[] memory tokens = bPool.getCurrentTokens(); // Must specify weights for all tokens require( newWeights.length == tokens.length, "ERR_START_WEIGHTS_MISMATCH" ); uint256 weightsSum = 0; gradualUpdate.startWeights = new uint256[](tokens.length); // Check that endWeights are valid now to avoid reverting in a future pokeWeights call // // This loop contains external calls // External calls are to math libraries or the underlying pool, so low risk for (uint256 i = 0; i < tokens.length; i++) { require(<FILL_ME>) require( newWeights[i] >= BalancerConstants.MIN_WEIGHT, "ERR_WEIGHT_BELOW_MIN" ); weightsSum = BalancerSafeMath.badd(weightsSum, newWeights[i]); gradualUpdate.startWeights[i] = bPool.getDenormalizedWeight( tokens[i] ); } require( weightsSum <= BalancerConstants.MAX_TOTAL_WEIGHT, "ERR_MAX_TOTAL_WEIGHT" ); gradualUpdate.endBlock = endBlock; gradualUpdate.endWeights = newWeights; } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
newWeights[i]<=BalancerConstants.MAX_WEIGHT,"ERR_WEIGHT_ABOVE_MAX"
3,330
newWeights[i]<=BalancerConstants.MAX_WEIGHT
"ERR_WEIGHT_BELOW_MIN"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { require(block.number < endBlock, "ERR_GRADUAL_UPDATE_TIME_TRAVEL"); if (block.number > startBlock) { // This means the weight update should start ASAP // Moving the start block up prevents a big jump/discontinuity in the weights gradualUpdate.startBlock = block.number; } else { gradualUpdate.startBlock = startBlock; } // Enforce a minimum time over which to make the changes // The also prevents endBlock <= startBlock require( BalancerSafeMath.bsub(endBlock, gradualUpdate.startBlock) >= minimumWeightChangeBlockPeriod, "ERR_WEIGHT_CHANGE_TIME_BELOW_MIN" ); address[] memory tokens = bPool.getCurrentTokens(); // Must specify weights for all tokens require( newWeights.length == tokens.length, "ERR_START_WEIGHTS_MISMATCH" ); uint256 weightsSum = 0; gradualUpdate.startWeights = new uint256[](tokens.length); // Check that endWeights are valid now to avoid reverting in a future pokeWeights call // // This loop contains external calls // External calls are to math libraries or the underlying pool, so low risk for (uint256 i = 0; i < tokens.length; i++) { require( newWeights[i] <= BalancerConstants.MAX_WEIGHT, "ERR_WEIGHT_ABOVE_MAX" ); require(<FILL_ME>) weightsSum = BalancerSafeMath.badd(weightsSum, newWeights[i]); gradualUpdate.startWeights[i] = bPool.getDenormalizedWeight( tokens[i] ); } require( weightsSum <= BalancerConstants.MAX_TOTAL_WEIGHT, "ERR_MAX_TOTAL_WEIGHT" ); gradualUpdate.endBlock = endBlock; gradualUpdate.endWeights = newWeights; } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
newWeights[i]>=BalancerConstants.MIN_WEIGHT,"ERR_WEIGHT_BELOW_MIN"
3,330
newWeights[i]>=BalancerConstants.MIN_WEIGHT
"ERR_NOT_BOUND"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { require(<FILL_ME>) require( tokenAmountIn <= BalancerSafeMath.bmul( bPool.getBalance(tokenIn), BalancerConstants.MAX_IN_RATIO ), "ERR_MAX_IN_RATIO" ); poolAmountOut = bPool.calcPoolOutGivenSingleIn( bPool.getBalance(tokenIn), bPool.getDenormalizedWeight(tokenIn), self.totalSupply(), bPool.getTotalDenormalizedWeight(), tokenAmountIn, bPool.getSwapFee() ); require(poolAmountOut >= minPoolAmountOut, "ERR_LIMIT_OUT"); } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
bPool.isBound(tokenIn),"ERR_NOT_BOUND"
3,330
bPool.isBound(tokenIn)
"ERR_NOT_BOUND"
// Imports /** * @author Balancer Labs * @title Factor out the weight updates */ library SmartPoolManager { // Type declarations struct NewTokenParams { address addr; bool isCommitted; uint256 commitBlock; uint256 denorm; uint256 balance; } // For blockwise, automated weight updates // Move weights linearly from startWeights to endWeights, // between startBlock and endBlock struct GradualUpdateParams { uint256 startBlock; uint256 endBlock; uint256[] startWeights; uint256[] endWeights; } // updateWeight and pokeWeights are unavoidably long /* solhint-disable function-max-lines */ /** * @notice Update the weight of an existing token * @dev Refactored to library to make CRPFactory deployable * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to be reweighted * @param newWeight - new weight of the token */ function updateWeight( IConfigurableRightsPool self, IBPool bPool, address token, uint256 newWeight ) external { } /** * @notice External function called to make the contract update weights according to plan * @param bPool - Core BPool the CRP is wrapping * @param gradualUpdate - gradual update parameters from the CRP */ function pokeWeights( IBPool bPool, GradualUpdateParams storage gradualUpdate ) external { } /* solhint-enable function-max-lines */ /** * @notice Schedule (commit) a token to be added; must call applyAddToken after a fixed * number of blocks to actually add the token * @param bPool - Core BPool the CRP is wrapping * @param token - the token to be added * @param balance - how much to be added * @param denormalizedWeight - the desired token weight * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function commitAddToken( IBPool bPool, address token, uint256 balance, uint256 denormalizedWeight, NewTokenParams storage newToken ) external { } /** * @notice Add the token previously committed (in commitAddToken) to the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param addTokenTimeLockInBlocks - Wait time between committing and applying a new token * @param newToken - NewTokenParams struct used to hold the token data (in CRP storage) */ function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { } /** * @notice Remove a token from the pool * @dev Logic in the CRP controls when ths can be called. There are two related permissions: * AddRemoveTokens - which allows removing down to the underlying BPool limit of two * RemoveAllTokens - which allows completely draining the pool by removing all tokens * This can result in a non-viable pool with 0 or 1 tokens (by design), * meaning all swapping or binding operations would fail in this state * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param token - token to remove */ function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid * @param token - The prospective token to verify */ function verifyTokenCompliance(address token) external { } /** * @notice Non ERC20-conforming tokens are problematic; don't allow them in pools * @dev Will revert if invalid - overloaded to save space in the main contract * @param tokens - The prospective tokens to verify */ function verifyTokenCompliance(address[] calldata tokens) external { } /** * @notice Update weights in a predetermined way, between startBlock and endBlock, * through external cals to pokeWeights * @param bPool - Core BPool the CRP is wrapping * @param newWeights - final weights we want to get to * @param startBlock - when weights should start to change * @param endBlock - when weights will be at their final values * @param minimumWeightChangeBlockPeriod - needed to validate the block period */ function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock, uint256 minimumWeightChangeBlockPeriod ) external { } /** * @notice Join a pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountOut - number of pool tokens to receive * @param maxAmountsIn - Max amount of asset tokens to spend * @return actualAmountsIn - calculated values of the tokens to pull in */ function joinPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountOut, uint256[] calldata maxAmountsIn ) external view returns (uint256[] memory actualAmountsIn) { } /** * @notice Exit a pool - redeem pool tokens for underlying assets * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountsOut - minimum amount of asset tokens to receive * @return exitFee - calculated exit fee * @return pAiAfterExitFee - final amount in (after accounting for exit fee) * @return actualAmountsOut - calculated amounts of each token to pull */ function exitPool( IConfigurableRightsPool self, IBPool bPool, uint256 poolAmountIn, uint256[] calldata minAmountsOut ) external view returns ( uint256 exitFee, uint256 pAiAfterExitFee, uint256[] memory actualAmountsOut ) { } /** * @notice Join by swapping a fixed amount of an external token in (must be present in the pool) * System calculates the pool token amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in * @param tokenAmountIn - amount of deposit * @param minPoolAmountOut - minimum of pool tokens to receive * @return poolAmountOut - amount of pool tokens minted and transferred */ function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external view returns (uint256 poolAmountOut) { } /** * @notice Join by swapping an external token in (must be present in the pool) * To receive an exact amount of pool tokens out. System calculates the deposit amount * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenIn - which token we're transferring in (system calculates amount required) * @param poolAmountOut - amount of pool tokens to be received * @param maxAmountIn - Maximum asset tokens that can be pulled to pay for the pool tokens * @return tokenAmountIn - amount of asset tokens transferred in to purchase the pool tokens */ function joinswapPoolAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external view returns (uint256 tokenAmountIn) { } /** * @notice Exit a pool - redeem a specific number of pool tokens for an underlying asset * Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param poolAmountIn - amount of pool tokens to redeem * @param minAmountOut - minimum asset tokens to receive * @return exitFee - calculated exit fee * @return tokenAmountOut - amount of asset tokens returned */ function exitswapPoolAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external view returns (uint256 exitFee, uint256 tokenAmountOut) { require(<FILL_ME>) tokenAmountOut = bPool.calcSingleOutGivenPoolIn( bPool.getBalance(tokenOut), bPool.getDenormalizedWeight(tokenOut), self.totalSupply(), bPool.getTotalDenormalizedWeight(), poolAmountIn, bPool.getSwapFee() ); require(tokenAmountOut >= minAmountOut, "ERR_LIMIT_OUT"); require( tokenAmountOut <= BalancerSafeMath.bmul( bPool.getBalance(tokenOut), BalancerConstants.MAX_OUT_RATIO ), "ERR_MAX_OUT_RATIO" ); exitFee = BalancerSafeMath.bmul( poolAmountIn, BalancerConstants.EXIT_FEE ); } /** * @notice Exit a pool - redeem pool tokens for a specific amount of underlying assets * Asset must be present in the pool * @param self - ConfigurableRightsPool instance calling the library * @param bPool - Core BPool the CRP is wrapping * @param tokenOut - which token the caller wants to receive * @param tokenAmountOut - amount of underlying asset tokens to receive * @param maxPoolAmountIn - maximum pool tokens to be redeemed * @return exitFee - calculated exit fee * @return poolAmountIn - amount of pool tokens redeemed */ function exitswapExternAmountOut( IConfigurableRightsPool self, IBPool bPool, address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external view returns (uint256 exitFee, uint256 poolAmountIn) { } // Internal functions // Check for zero transfer, and make sure it returns true to returnValue function verifyTokenComplianceInternal(address token) internal { } }
bPool.isBound(tokenOut),"ERR_NOT_BOUND"
3,330
bPool.isBound(tokenOut)
null
contract ZuniTreasury is Ownable { using SafeMath for uint256; using Address for address; ConfigurableRightsPool public crp; IERC20 public zuni; IBPool public bPool; address public zuniBadge; uint256 public constant MAX_VAL = 2**256 - 1; uint256 public constant WEI_POINT = 10**18; uint256 public constant DEFAULT_ISSURANCE_AMOUNT = WEI_POINT * 100; constructor(IERC20 _zuni) public { } modifier onlyZuniBadge() { } function smartPoolAddress() external view returns (address) { } function setZuniBadge(address _zuniBadge) external onlyOwner { } function setCRP(address _crpAddress) external onlyOwner { require(<FILL_ME>) crp = ConfigurableRightsPool(_crpAddress); bPool = IBPool(crp.bPool()); } function setZuniToken(IERC20 _zuni) external onlyOwner { } function _issue(uint256 tokenAmountOut) internal { } function giveZuniReward(address to, uint256 amount) external onlyZuniBadge { } function issue(uint256 tokenAmountOut) external onlyOwner { } function buyback(uint256 tokenAmountIn) external onlyOwner { } function capitalization(address token, uint256 tokenAmountOut) external onlyOwner { } function withdrawToken( address token, address to, uint256 amount ) external onlyOwner { } // external functions only can be called by owner to config CRP function setSwapFee(uint256 swapFee) external onlyOwner { } function setCap(uint256 newCap) external onlyOwner { } function setPublicSwap(bool publicSwap) external onlyOwner { } function updateWeight(address token, uint256 newWeight) external onlyOwner { } function updateWeightsGradually( uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock ) external onlyOwner { } function pokeWeights() external onlyOwner { } function commitAddToken( address token, uint256 balance, uint256 denormalizedWeight ) external onlyOwner { } function applyAddToken() external onlyOwner { } function removeToken(address token) external onlyOwner { } function whitelistLiquidityProvider(address provider) external onlyOwner { } function removeWhitelistedLiquidityProvider(address provider) external onlyOwner { } }
address(crp)==address(0x0)
3,332
address(crp)==address(0x0)
null
contract ZuniTreasury is Ownable { using SafeMath for uint256; using Address for address; ConfigurableRightsPool public crp; IERC20 public zuni; IBPool public bPool; address public zuniBadge; uint256 public constant MAX_VAL = 2**256 - 1; uint256 public constant WEI_POINT = 10**18; uint256 public constant DEFAULT_ISSURANCE_AMOUNT = WEI_POINT * 100; constructor(IERC20 _zuni) public { } modifier onlyZuniBadge() { } function smartPoolAddress() external view returns (address) { } function setZuniBadge(address _zuniBadge) external onlyOwner { } function setCRP(address _crpAddress) external onlyOwner { } function setZuniToken(IERC20 _zuni) external onlyOwner { } function _issue(uint256 tokenAmountOut) internal { } function giveZuniReward(address to, uint256 amount) external onlyZuniBadge { if (IERC20(address(zuni)).balanceOf(address(this)) < amount) { _issue(amount.add(DEFAULT_ISSURANCE_AMOUNT)); } require(<FILL_ME>) } function issue(uint256 tokenAmountOut) external onlyOwner { } function buyback(uint256 tokenAmountIn) external onlyOwner { } function capitalization(address token, uint256 tokenAmountOut) external onlyOwner { } function withdrawToken( address token, address to, uint256 amount ) external onlyOwner { } // external functions only can be called by owner to config CRP function setSwapFee(uint256 swapFee) external onlyOwner { } function setCap(uint256 newCap) external onlyOwner { } function setPublicSwap(bool publicSwap) external onlyOwner { } function updateWeight(address token, uint256 newWeight) external onlyOwner { } function updateWeightsGradually( uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock ) external onlyOwner { } function pokeWeights() external onlyOwner { } function commitAddToken( address token, uint256 balance, uint256 denormalizedWeight ) external onlyOwner { } function applyAddToken() external onlyOwner { } function removeToken(address token) external onlyOwner { } function whitelistLiquidityProvider(address provider) external onlyOwner { } function removeWhitelistedLiquidityProvider(address provider) external onlyOwner { } }
IERC20(address(zuni)).transfer(to,amount)
3,332
IERC20(address(zuni)).transfer(to,amount)
"ZuniTreasury: zuni balance is not enough"
contract ZuniTreasury is Ownable { using SafeMath for uint256; using Address for address; ConfigurableRightsPool public crp; IERC20 public zuni; IBPool public bPool; address public zuniBadge; uint256 public constant MAX_VAL = 2**256 - 1; uint256 public constant WEI_POINT = 10**18; uint256 public constant DEFAULT_ISSURANCE_AMOUNT = WEI_POINT * 100; constructor(IERC20 _zuni) public { } modifier onlyZuniBadge() { } function smartPoolAddress() external view returns (address) { } function setZuniBadge(address _zuniBadge) external onlyOwner { } function setCRP(address _crpAddress) external onlyOwner { } function setZuniToken(IERC20 _zuni) external onlyOwner { } function _issue(uint256 tokenAmountOut) internal { } function giveZuniReward(address to, uint256 amount) external onlyZuniBadge { } function issue(uint256 tokenAmountOut) external onlyOwner { } function buyback(uint256 tokenAmountIn) external onlyOwner { require(<FILL_ME>) uint256 minPoolAmountOut = bPool.calcPoolOutGivenSingleIn( bPool.getBalance(address(zuni)), bPool.getDenormalizedWeight(address(zuni)), crp.totalSupply(), bPool.getTotalDenormalizedWeight(), tokenAmountIn, bPool.getSwapFee() ); minPoolAmountOut = minPoolAmountOut.mul(99).div(100); require(IERC20(address(zuni)).approve(address(crp), tokenAmountIn)); crp.joinswapExternAmountIn( address(zuni), tokenAmountIn, minPoolAmountOut ); } function capitalization(address token, uint256 tokenAmountOut) external onlyOwner { } function withdrawToken( address token, address to, uint256 amount ) external onlyOwner { } // external functions only can be called by owner to config CRP function setSwapFee(uint256 swapFee) external onlyOwner { } function setCap(uint256 newCap) external onlyOwner { } function setPublicSwap(bool publicSwap) external onlyOwner { } function updateWeight(address token, uint256 newWeight) external onlyOwner { } function updateWeightsGradually( uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock ) external onlyOwner { } function pokeWeights() external onlyOwner { } function commitAddToken( address token, uint256 balance, uint256 denormalizedWeight ) external onlyOwner { } function applyAddToken() external onlyOwner { } function removeToken(address token) external onlyOwner { } function whitelistLiquidityProvider(address provider) external onlyOwner { } function removeWhitelistedLiquidityProvider(address provider) external onlyOwner { } }
IERC20(address(zuni)).balanceOf(address(this))>=tokenAmountIn,"ZuniTreasury: zuni balance is not enough"
3,332
IERC20(address(zuni)).balanceOf(address(this))>=tokenAmountIn
null
contract ZuniTreasury is Ownable { using SafeMath for uint256; using Address for address; ConfigurableRightsPool public crp; IERC20 public zuni; IBPool public bPool; address public zuniBadge; uint256 public constant MAX_VAL = 2**256 - 1; uint256 public constant WEI_POINT = 10**18; uint256 public constant DEFAULT_ISSURANCE_AMOUNT = WEI_POINT * 100; constructor(IERC20 _zuni) public { } modifier onlyZuniBadge() { } function smartPoolAddress() external view returns (address) { } function setZuniBadge(address _zuniBadge) external onlyOwner { } function setCRP(address _crpAddress) external onlyOwner { } function setZuniToken(IERC20 _zuni) external onlyOwner { } function _issue(uint256 tokenAmountOut) internal { } function giveZuniReward(address to, uint256 amount) external onlyZuniBadge { } function issue(uint256 tokenAmountOut) external onlyOwner { } function buyback(uint256 tokenAmountIn) external onlyOwner { require( IERC20(address(zuni)).balanceOf(address(this)) >= tokenAmountIn, "ZuniTreasury: zuni balance is not enough" ); uint256 minPoolAmountOut = bPool.calcPoolOutGivenSingleIn( bPool.getBalance(address(zuni)), bPool.getDenormalizedWeight(address(zuni)), crp.totalSupply(), bPool.getTotalDenormalizedWeight(), tokenAmountIn, bPool.getSwapFee() ); minPoolAmountOut = minPoolAmountOut.mul(99).div(100); require(<FILL_ME>) crp.joinswapExternAmountIn( address(zuni), tokenAmountIn, minPoolAmountOut ); } function capitalization(address token, uint256 tokenAmountOut) external onlyOwner { } function withdrawToken( address token, address to, uint256 amount ) external onlyOwner { } // external functions only can be called by owner to config CRP function setSwapFee(uint256 swapFee) external onlyOwner { } function setCap(uint256 newCap) external onlyOwner { } function setPublicSwap(bool publicSwap) external onlyOwner { } function updateWeight(address token, uint256 newWeight) external onlyOwner { } function updateWeightsGradually( uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock ) external onlyOwner { } function pokeWeights() external onlyOwner { } function commitAddToken( address token, uint256 balance, uint256 denormalizedWeight ) external onlyOwner { } function applyAddToken() external onlyOwner { } function removeToken(address token) external onlyOwner { } function whitelistLiquidityProvider(address provider) external onlyOwner { } function removeWhitelistedLiquidityProvider(address provider) external onlyOwner { } }
IERC20(address(zuni)).approve(address(crp),tokenAmountIn)
3,332
IERC20(address(zuni)).approve(address(crp),tokenAmountIn)
"ZuniTreasury: token balance is not enough"
contract ZuniTreasury is Ownable { using SafeMath for uint256; using Address for address; ConfigurableRightsPool public crp; IERC20 public zuni; IBPool public bPool; address public zuniBadge; uint256 public constant MAX_VAL = 2**256 - 1; uint256 public constant WEI_POINT = 10**18; uint256 public constant DEFAULT_ISSURANCE_AMOUNT = WEI_POINT * 100; constructor(IERC20 _zuni) public { } modifier onlyZuniBadge() { } function smartPoolAddress() external view returns (address) { } function setZuniBadge(address _zuniBadge) external onlyOwner { } function setCRP(address _crpAddress) external onlyOwner { } function setZuniToken(IERC20 _zuni) external onlyOwner { } function _issue(uint256 tokenAmountOut) internal { } function giveZuniReward(address to, uint256 amount) external onlyZuniBadge { } function issue(uint256 tokenAmountOut) external onlyOwner { } function buyback(uint256 tokenAmountIn) external onlyOwner { } function capitalization(address token, uint256 tokenAmountOut) external onlyOwner { } function withdrawToken( address token, address to, uint256 amount ) external onlyOwner { require(<FILL_ME>) require(IERC20(address(token)).transfer(to, amount)); } // external functions only can be called by owner to config CRP function setSwapFee(uint256 swapFee) external onlyOwner { } function setCap(uint256 newCap) external onlyOwner { } function setPublicSwap(bool publicSwap) external onlyOwner { } function updateWeight(address token, uint256 newWeight) external onlyOwner { } function updateWeightsGradually( uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock ) external onlyOwner { } function pokeWeights() external onlyOwner { } function commitAddToken( address token, uint256 balance, uint256 denormalizedWeight ) external onlyOwner { } function applyAddToken() external onlyOwner { } function removeToken(address token) external onlyOwner { } function whitelistLiquidityProvider(address provider) external onlyOwner { } function removeWhitelistedLiquidityProvider(address provider) external onlyOwner { } }
IERC20(address(token)).balanceOf(address(this))>=amount,"ZuniTreasury: token balance is not enough"
3,332
IERC20(address(token)).balanceOf(address(this))>=amount
null
contract ZuniTreasury is Ownable { using SafeMath for uint256; using Address for address; ConfigurableRightsPool public crp; IERC20 public zuni; IBPool public bPool; address public zuniBadge; uint256 public constant MAX_VAL = 2**256 - 1; uint256 public constant WEI_POINT = 10**18; uint256 public constant DEFAULT_ISSURANCE_AMOUNT = WEI_POINT * 100; constructor(IERC20 _zuni) public { } modifier onlyZuniBadge() { } function smartPoolAddress() external view returns (address) { } function setZuniBadge(address _zuniBadge) external onlyOwner { } function setCRP(address _crpAddress) external onlyOwner { } function setZuniToken(IERC20 _zuni) external onlyOwner { } function _issue(uint256 tokenAmountOut) internal { } function giveZuniReward(address to, uint256 amount) external onlyZuniBadge { } function issue(uint256 tokenAmountOut) external onlyOwner { } function buyback(uint256 tokenAmountIn) external onlyOwner { } function capitalization(address token, uint256 tokenAmountOut) external onlyOwner { } function withdrawToken( address token, address to, uint256 amount ) external onlyOwner { require( IERC20(address(token)).balanceOf(address(this)) >= amount, "ZuniTreasury: token balance is not enough" ); require(<FILL_ME>) } // external functions only can be called by owner to config CRP function setSwapFee(uint256 swapFee) external onlyOwner { } function setCap(uint256 newCap) external onlyOwner { } function setPublicSwap(bool publicSwap) external onlyOwner { } function updateWeight(address token, uint256 newWeight) external onlyOwner { } function updateWeightsGradually( uint256[] calldata newWeights, uint256 startBlock, uint256 endBlock ) external onlyOwner { } function pokeWeights() external onlyOwner { } function commitAddToken( address token, uint256 balance, uint256 denormalizedWeight ) external onlyOwner { } function applyAddToken() external onlyOwner { } function removeToken(address token) external onlyOwner { } function whitelistLiquidityProvider(address provider) external onlyOwner { } function removeWhitelistedLiquidityProvider(address provider) external onlyOwner { } }
IERC20(address(token)).transfer(to,amount)
3,332
IERC20(address(token)).transfer(to,amount)
"Transfer failed."
pragma solidity 0.5.4; contract ERC1594 is IERC1594, IHasIssuership, Moderated, ERC20Redeemable, IssuerRole { bool public isIssuable = true; event Issued(address indexed operator, address indexed to, uint256 value, bytes data); event Redeemed(address indexed operator, address indexed from, uint256 value, bytes data); event IssuershipTransferred(address indexed from, address indexed to); event IssuanceFinished(); /** * @notice Modifier to check token issuance status */ modifier whenIssuable() { } /** * @notice Transfer the token's singleton Issuer role to another address. */ function transferIssuership(address _newIssuer) public whenIssuable onlyIssuer { } /** * @notice End token issuance period permanently. */ function finishIssuance() public whenIssuable onlyIssuer { } function issue(address _tokenHolder, uint256 _value, bytes memory _data) public whenIssuable onlyIssuer { } function redeem(uint256 _value, bytes memory _data) public { } function redeemFrom(address _tokenHolder, uint256 _value, bytes memory _data) public { } function transfer(address _to, uint256 _value) public returns (bool success) { } function transferWithData(address _to, uint256 _value, bytes memory _data) public { bool allowed; (allowed, , ) = canTransfer(_to, _value, _data); require(allowed, "Transfer is not allowed."); require(<FILL_ME>) } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { } function transferFromWithData(address _from, address _to, uint256 _value, bytes memory _data) public { } function canTransfer(address _to, uint256 _value, bytes memory _data) public view returns (bool success, byte statusCode, bytes32 applicationCode) { } function canTransferFrom(address _from, address _to, uint256 _value, bytes memory _data) public view returns (bool success, byte statusCode, bytes32 applicationCode) { } }
super.transfer(_to,_value),"Transfer failed."
3,368
super.transfer(_to,_value)
"TransferFrom failed."
pragma solidity 0.5.4; contract ERC1594 is IERC1594, IHasIssuership, Moderated, ERC20Redeemable, IssuerRole { bool public isIssuable = true; event Issued(address indexed operator, address indexed to, uint256 value, bytes data); event Redeemed(address indexed operator, address indexed from, uint256 value, bytes data); event IssuershipTransferred(address indexed from, address indexed to); event IssuanceFinished(); /** * @notice Modifier to check token issuance status */ modifier whenIssuable() { } /** * @notice Transfer the token's singleton Issuer role to another address. */ function transferIssuership(address _newIssuer) public whenIssuable onlyIssuer { } /** * @notice End token issuance period permanently. */ function finishIssuance() public whenIssuable onlyIssuer { } function issue(address _tokenHolder, uint256 _value, bytes memory _data) public whenIssuable onlyIssuer { } function redeem(uint256 _value, bytes memory _data) public { } function redeemFrom(address _tokenHolder, uint256 _value, bytes memory _data) public { } function transfer(address _to, uint256 _value) public returns (bool success) { } function transferWithData(address _to, uint256 _value, bytes memory _data) public { } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { } function transferFromWithData(address _from, address _to, uint256 _value, bytes memory _data) public { bool allowed; (allowed, , ) = canTransferFrom(_from, _to, _value, _data); require(allowed, "TransferFrom is not allowed."); require(<FILL_ME>) } function canTransfer(address _to, uint256 _value, bytes memory _data) public view returns (bool success, byte statusCode, bytes32 applicationCode) { } function canTransferFrom(address _from, address _to, uint256 _value, bytes memory _data) public view returns (bool success, byte statusCode, bytes32 applicationCode) { } }
super.transferFrom(_from,_to,_value),"TransferFrom failed."
3,368
super.transferFrom(_from,_to,_value)
null
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./markets/MarketRegistry.sol"; import "./SpecialTransferHelper.sol"; import "../../interfaces/markets/tokens/IERC20.sol"; import "../../interfaces/markets/tokens/IERC721.sol"; import "../../interfaces/markets/tokens/IERC1155.sol"; contract GenieSwap is SpecialTransferHelper, Ownable, ReentrancyGuard { struct ERC20Details { address[] tokenAddrs; uint256[] amounts; } struct ERC1155Details { address tokenAddr; uint256[] ids; uint256[] amounts; } struct ConverstionDetails { bytes conversionData; } struct AffiliateDetails { address affiliate; bool isActive; } struct SponsoredMarket { uint256 marketId; bool isActive; } address public constant GOV = 0xE43aA28716b0B7531293557D5397F8b12f3F5aBc; address public guardian; address public converter; address public punkProxy; uint256 public baseFees; bool public openForTrades; bool public openForFreeTrades; MarketRegistry public marketRegistry; AffiliateDetails[] public affiliates; SponsoredMarket[] public sponsoredMarkets; modifier isOpenForTrades() { } modifier isOpenForFreeTrades() { } constructor(address _marketRegistry, address _converter, address _guardian) { } function setUp() external onlyOwner { } // @audit This function is used to approve specific tokens to specific market contracts with high volume. // This is done in very rare cases for the gas optimization purposes. function setOneTimeApproval(IERC20 token, address operator, uint256 amount) external onlyOwner { } function updateGuardian(address _guardian) external onlyOwner { } function addAffiliate(address _affiliate) external onlyOwner { } function updateAffiliate(uint256 _affiliateIndex, address _affiliate, bool _IsActive) external onlyOwner { } function addSponsoredMarket(uint256 _marketId) external onlyOwner { } function updateSponsoredMarket(uint256 _marketIndex, uint256 _marketId, bool _isActive) external onlyOwner { } function setBaseFees(uint256 _baseFees) external onlyOwner { } function setOpenForTrades(bool _openForTrades) external onlyOwner { } function setOpenForFreeTrades(bool _openForFreeTrades) external onlyOwner { } // @audit we will setup a system that will monitor the contract for any leftover // assets. In case any asset is leftover, the system should be able to trigger this // function to close all the trades until the leftover assets are rescued. function closeAllTrades() external { require(<FILL_ME>) openForTrades = false; openForFreeTrades = false; } function setConverter(address _converter) external onlyOwner { } function setMarketRegistry(MarketRegistry _marketRegistry) external onlyOwner { } function _transferEth(address _to, uint256 _amount) internal { } function _collectFee(uint256[2] memory feeDetails) internal { } function _checkCallResult(bool _success) internal pure { } function _transferFromHelper( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details ) internal { } function _conversionHelper( ConverstionDetails[] memory _converstionDetails ) internal { } function _trade( MarketRegistry.TradeDetails[] memory _tradeDetails ) internal { } function _tradeSponsored( MarketRegistry.TradeDetails[] memory _tradeDetails, uint256 sponsoredMarketId ) internal returns (bool isSponsored) { } function _returnDust(address[] memory _tokens) internal { } // swaps any combination of ERC-20/721/1155 // User needs to approve assets before invoking swap // WARNING: DO NOT SEND TOKENS TO THIS FUNCTION DIRECTLY!!! function multiAssetSwap( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details, ConverstionDetails[] memory converstionDetails, MarketRegistry.TradeDetails[] memory tradeDetails, address[] memory dustTokens, uint256[2] memory feeDetails // [affiliateIndex, ETH fee in Wei] ) payable external isOpenForTrades nonReentrant { } // Utility function that is used for free swaps for sponsored markets // WARNING: DO NOT SEND TOKENS TO THIS FUNCTION DIRECTLY!!! function multiAssetSwapWithoutFee( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details, ConverstionDetails[] memory converstionDetails, MarketRegistry.TradeDetails[] memory tradeDetails, address[] memory dustTokens, uint256 sponsoredMarketIndex ) payable external isOpenForFreeTrades nonReentrant { } function onERC1155Received( address, address, uint256, uint256, bytes calldata ) public virtual returns (bytes4) { } function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) public virtual returns (bytes4) { } function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { } // Used by ERC721BasicToken.sol function onERC721Received( address, uint256, bytes calldata ) external virtual returns (bytes4) { } function supportsInterface(bytes4 interfaceId) external virtual view returns (bool) { } receive() external payable {} // Emergency function: In case any ETH get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueETH(address recipient) onlyOwner external { } // Emergency function: In case any ERC20 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC20(address asset, address recipient) onlyOwner external { } // Emergency function: In case any ERC721 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC721(address asset, uint256[] calldata ids, address recipient) onlyOwner external { } // Emergency function: In case any ERC1155 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC1155(address asset, uint256[] calldata ids, uint256[] calldata amounts, address recipient) onlyOwner external { } }
_msgSender()==guardian
3,393
_msgSender()==guardian
"Insufficient fee"
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./markets/MarketRegistry.sol"; import "./SpecialTransferHelper.sol"; import "../../interfaces/markets/tokens/IERC20.sol"; import "../../interfaces/markets/tokens/IERC721.sol"; import "../../interfaces/markets/tokens/IERC1155.sol"; contract GenieSwap is SpecialTransferHelper, Ownable, ReentrancyGuard { struct ERC20Details { address[] tokenAddrs; uint256[] amounts; } struct ERC1155Details { address tokenAddr; uint256[] ids; uint256[] amounts; } struct ConverstionDetails { bytes conversionData; } struct AffiliateDetails { address affiliate; bool isActive; } struct SponsoredMarket { uint256 marketId; bool isActive; } address public constant GOV = 0xE43aA28716b0B7531293557D5397F8b12f3F5aBc; address public guardian; address public converter; address public punkProxy; uint256 public baseFees; bool public openForTrades; bool public openForFreeTrades; MarketRegistry public marketRegistry; AffiliateDetails[] public affiliates; SponsoredMarket[] public sponsoredMarkets; modifier isOpenForTrades() { } modifier isOpenForFreeTrades() { } constructor(address _marketRegistry, address _converter, address _guardian) { } function setUp() external onlyOwner { } // @audit This function is used to approve specific tokens to specific market contracts with high volume. // This is done in very rare cases for the gas optimization purposes. function setOneTimeApproval(IERC20 token, address operator, uint256 amount) external onlyOwner { } function updateGuardian(address _guardian) external onlyOwner { } function addAffiliate(address _affiliate) external onlyOwner { } function updateAffiliate(uint256 _affiliateIndex, address _affiliate, bool _IsActive) external onlyOwner { } function addSponsoredMarket(uint256 _marketId) external onlyOwner { } function updateSponsoredMarket(uint256 _marketIndex, uint256 _marketId, bool _isActive) external onlyOwner { } function setBaseFees(uint256 _baseFees) external onlyOwner { } function setOpenForTrades(bool _openForTrades) external onlyOwner { } function setOpenForFreeTrades(bool _openForFreeTrades) external onlyOwner { } // @audit we will setup a system that will monitor the contract for any leftover // assets. In case any asset is leftover, the system should be able to trigger this // function to close all the trades until the leftover assets are rescued. function closeAllTrades() external { } function setConverter(address _converter) external onlyOwner { } function setMarketRegistry(MarketRegistry _marketRegistry) external onlyOwner { } function _transferEth(address _to, uint256 _amount) internal { } function _collectFee(uint256[2] memory feeDetails) internal { require(<FILL_ME>) if (feeDetails[1] > 0) { AffiliateDetails memory affiliateDetails = affiliates[feeDetails[0]]; affiliateDetails.isActive ? _transferEth(affiliateDetails.affiliate, feeDetails[1]) : _transferEth(GOV, feeDetails[1]); } } function _checkCallResult(bool _success) internal pure { } function _transferFromHelper( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details ) internal { } function _conversionHelper( ConverstionDetails[] memory _converstionDetails ) internal { } function _trade( MarketRegistry.TradeDetails[] memory _tradeDetails ) internal { } function _tradeSponsored( MarketRegistry.TradeDetails[] memory _tradeDetails, uint256 sponsoredMarketId ) internal returns (bool isSponsored) { } function _returnDust(address[] memory _tokens) internal { } // swaps any combination of ERC-20/721/1155 // User needs to approve assets before invoking swap // WARNING: DO NOT SEND TOKENS TO THIS FUNCTION DIRECTLY!!! function multiAssetSwap( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details, ConverstionDetails[] memory converstionDetails, MarketRegistry.TradeDetails[] memory tradeDetails, address[] memory dustTokens, uint256[2] memory feeDetails // [affiliateIndex, ETH fee in Wei] ) payable external isOpenForTrades nonReentrant { } // Utility function that is used for free swaps for sponsored markets // WARNING: DO NOT SEND TOKENS TO THIS FUNCTION DIRECTLY!!! function multiAssetSwapWithoutFee( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details, ConverstionDetails[] memory converstionDetails, MarketRegistry.TradeDetails[] memory tradeDetails, address[] memory dustTokens, uint256 sponsoredMarketIndex ) payable external isOpenForFreeTrades nonReentrant { } function onERC1155Received( address, address, uint256, uint256, bytes calldata ) public virtual returns (bytes4) { } function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) public virtual returns (bytes4) { } function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { } // Used by ERC721BasicToken.sol function onERC721Received( address, uint256, bytes calldata ) external virtual returns (bytes4) { } function supportsInterface(bytes4 interfaceId) external virtual view returns (bool) { } receive() external payable {} // Emergency function: In case any ETH get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueETH(address recipient) onlyOwner external { } // Emergency function: In case any ERC20 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC20(address asset, address recipient) onlyOwner external { } // Emergency function: In case any ERC721 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC721(address asset, uint256[] calldata ids, address recipient) onlyOwner external { } // Emergency function: In case any ERC1155 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC1155(address asset, uint256[] calldata ids, uint256[] calldata amounts, address recipient) onlyOwner external { } }
feeDetails[1]>=baseFees,"Insufficient fee"
3,393
feeDetails[1]>=baseFees
"multiAssetSwapWithoutFee: InActive sponsored market"
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./markets/MarketRegistry.sol"; import "./SpecialTransferHelper.sol"; import "../../interfaces/markets/tokens/IERC20.sol"; import "../../interfaces/markets/tokens/IERC721.sol"; import "../../interfaces/markets/tokens/IERC1155.sol"; contract GenieSwap is SpecialTransferHelper, Ownable, ReentrancyGuard { struct ERC20Details { address[] tokenAddrs; uint256[] amounts; } struct ERC1155Details { address tokenAddr; uint256[] ids; uint256[] amounts; } struct ConverstionDetails { bytes conversionData; } struct AffiliateDetails { address affiliate; bool isActive; } struct SponsoredMarket { uint256 marketId; bool isActive; } address public constant GOV = 0xE43aA28716b0B7531293557D5397F8b12f3F5aBc; address public guardian; address public converter; address public punkProxy; uint256 public baseFees; bool public openForTrades; bool public openForFreeTrades; MarketRegistry public marketRegistry; AffiliateDetails[] public affiliates; SponsoredMarket[] public sponsoredMarkets; modifier isOpenForTrades() { } modifier isOpenForFreeTrades() { } constructor(address _marketRegistry, address _converter, address _guardian) { } function setUp() external onlyOwner { } // @audit This function is used to approve specific tokens to specific market contracts with high volume. // This is done in very rare cases for the gas optimization purposes. function setOneTimeApproval(IERC20 token, address operator, uint256 amount) external onlyOwner { } function updateGuardian(address _guardian) external onlyOwner { } function addAffiliate(address _affiliate) external onlyOwner { } function updateAffiliate(uint256 _affiliateIndex, address _affiliate, bool _IsActive) external onlyOwner { } function addSponsoredMarket(uint256 _marketId) external onlyOwner { } function updateSponsoredMarket(uint256 _marketIndex, uint256 _marketId, bool _isActive) external onlyOwner { } function setBaseFees(uint256 _baseFees) external onlyOwner { } function setOpenForTrades(bool _openForTrades) external onlyOwner { } function setOpenForFreeTrades(bool _openForFreeTrades) external onlyOwner { } // @audit we will setup a system that will monitor the contract for any leftover // assets. In case any asset is leftover, the system should be able to trigger this // function to close all the trades until the leftover assets are rescued. function closeAllTrades() external { } function setConverter(address _converter) external onlyOwner { } function setMarketRegistry(MarketRegistry _marketRegistry) external onlyOwner { } function _transferEth(address _to, uint256 _amount) internal { } function _collectFee(uint256[2] memory feeDetails) internal { } function _checkCallResult(bool _success) internal pure { } function _transferFromHelper( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details ) internal { } function _conversionHelper( ConverstionDetails[] memory _converstionDetails ) internal { } function _trade( MarketRegistry.TradeDetails[] memory _tradeDetails ) internal { } function _tradeSponsored( MarketRegistry.TradeDetails[] memory _tradeDetails, uint256 sponsoredMarketId ) internal returns (bool isSponsored) { } function _returnDust(address[] memory _tokens) internal { } // swaps any combination of ERC-20/721/1155 // User needs to approve assets before invoking swap // WARNING: DO NOT SEND TOKENS TO THIS FUNCTION DIRECTLY!!! function multiAssetSwap( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details, ConverstionDetails[] memory converstionDetails, MarketRegistry.TradeDetails[] memory tradeDetails, address[] memory dustTokens, uint256[2] memory feeDetails // [affiliateIndex, ETH fee in Wei] ) payable external isOpenForTrades nonReentrant { } // Utility function that is used for free swaps for sponsored markets // WARNING: DO NOT SEND TOKENS TO THIS FUNCTION DIRECTLY!!! function multiAssetSwapWithoutFee( ERC20Details memory erc20Details, SpecialTransferHelper.ERC721Details[] memory erc721Details, ERC1155Details[] memory erc1155Details, ConverstionDetails[] memory converstionDetails, MarketRegistry.TradeDetails[] memory tradeDetails, address[] memory dustTokens, uint256 sponsoredMarketIndex ) payable external isOpenForFreeTrades nonReentrant { // fetch the marketId of the sponsored market SponsoredMarket memory sponsoredMarket = sponsoredMarkets[sponsoredMarketIndex]; // check if the market is active require(<FILL_ME>) // transfer all tokens _transferFromHelper( erc20Details, erc721Details, erc1155Details ); // Convert any assets if needed _conversionHelper(converstionDetails); // execute trades bool isSponsored = _tradeSponsored(tradeDetails, sponsoredMarket.marketId); // check if the trades include the sponsored market require(isSponsored, "multiAssetSwapWithoutFee: trades do not include sponsored market"); // return dust tokens (if any) _returnDust(dustTokens); } function onERC1155Received( address, address, uint256, uint256, bytes calldata ) public virtual returns (bytes4) { } function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) public virtual returns (bytes4) { } function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { } // Used by ERC721BasicToken.sol function onERC721Received( address, uint256, bytes calldata ) external virtual returns (bytes4) { } function supportsInterface(bytes4 interfaceId) external virtual view returns (bool) { } receive() external payable {} // Emergency function: In case any ETH get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueETH(address recipient) onlyOwner external { } // Emergency function: In case any ERC20 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC20(address asset, address recipient) onlyOwner external { } // Emergency function: In case any ERC721 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC721(address asset, uint256[] calldata ids, address recipient) onlyOwner external { } // Emergency function: In case any ERC1155 tokens get stuck in the contract unintentionally // Only owner can retrieve the asset balance to a recipient address function rescueERC1155(address asset, uint256[] calldata ids, uint256[] calldata amounts, address recipient) onlyOwner external { } }
sponsoredMarket.isActive,"multiAssetSwapWithoutFee: InActive sponsored market"
3,393
sponsoredMarket.isActive
"Not enough NFTs available"
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2021 pragma solidity ^0.8.10; import "./pagzi/ERC721Enum.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract Raksasas is ERC721Enum, Ownable, ReentrancyGuard { using Strings for uint256; uint256 public cost = 0.025 ether; uint256 public allowListCost = 0.01 ether; uint256 public maxSupply = 8888; uint256 public maxMintAmount = 20; uint256 private reserved = 888; uint256 public nftPerAddressLimit = 1; bool inside; bool public paused = true; string public baseURI; string public baseExtension = ".json"; address[] public whitelistedAddresses; address an = 0x7a0876cBa8146f9Ad39876d83593D99B2A0ffc7b; address gu = 0xE35374A6Db102187c9a77c54CEA1E891B32839e7; address hu = 0x66e4D5FB3B9710C1C30fe34F968A9ad45a9A855e; address je = 0x7B85A22dB64690f7229Cbf494614f395274efacb; address lu = 0xBb18BB346C421BC998788A2F3D0a5ed9Fa3F8060; address va = 0xCf5482620e3283A015575d106d14fa877529eCD5; mapping(address => uint256) public addressMintedBalance; constructor(string memory _initBaseURI) ERC721P("Raksasas", "RAKS") { } function mint(uint256 _mintAmount) public payable nonReentrant { require(!paused, "Sales are paused!"); require( _mintAmount > 0 && _mintAmount <= maxMintAmount, "Too many NFTs to mint" ); uint256 supply = totalSupply(); require(<FILL_ME>) require(msg.value >= cost * _mintAmount); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, supply + i, ""); } } function mintWhiteListed(uint256 _mintAmount) public payable nonReentrant { } function giveAway( uint256[] calldata quantityList, address[] calldata addressList ) external onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function isWhitelisted(address _user) public view returns (bool) { } function _baseURI() internal view virtual returns (string memory) { } function remainingReserved() public view returns (uint256) { } function setCost(uint256 _newCost) public onlyOwner { } function setAllowedListCost(uint256 _newCost) public onlyOwner { } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { } function whitelistUsers(address[] calldata _users) public onlyOwner { } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { } function setBaseURI(string memory _newBaseURI) public onlyOwner { } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { } function setTogglePause() public onlyOwner { } function sendEth(address destination, uint256 amount) internal { } function withdrawAll() public payable onlyOwner { } }
supply+_mintAmount<=maxSupply-reserved,"Not enough NFTs available"
3,404
supply+_mintAmount<=maxSupply-reserved
"User is not whitelisted"
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2021 pragma solidity ^0.8.10; import "./pagzi/ERC721Enum.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract Raksasas is ERC721Enum, Ownable, ReentrancyGuard { using Strings for uint256; uint256 public cost = 0.025 ether; uint256 public allowListCost = 0.01 ether; uint256 public maxSupply = 8888; uint256 public maxMintAmount = 20; uint256 private reserved = 888; uint256 public nftPerAddressLimit = 1; bool inside; bool public paused = true; string public baseURI; string public baseExtension = ".json"; address[] public whitelistedAddresses; address an = 0x7a0876cBa8146f9Ad39876d83593D99B2A0ffc7b; address gu = 0xE35374A6Db102187c9a77c54CEA1E891B32839e7; address hu = 0x66e4D5FB3B9710C1C30fe34F968A9ad45a9A855e; address je = 0x7B85A22dB64690f7229Cbf494614f395274efacb; address lu = 0xBb18BB346C421BC998788A2F3D0a5ed9Fa3F8060; address va = 0xCf5482620e3283A015575d106d14fa877529eCD5; mapping(address => uint256) public addressMintedBalance; constructor(string memory _initBaseURI) ERC721P("Raksasas", "RAKS") { } function mint(uint256 _mintAmount) public payable nonReentrant { } function mintWhiteListed(uint256 _mintAmount) public payable nonReentrant { require(!paused, "Sales are paused!"); require( _mintAmount > 0 && _mintAmount <= nftPerAddressLimit, "Too many NFTs to mint" ); uint256 supply = totalSupply(); require( supply + _mintAmount <= maxSupply - reserved, "Not enough NFTs available" ); require(<FILL_ME>) uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require( ownerMintedCount + _mintAmount <= nftPerAddressLimit, "Max NFT per address exceeded" ); require(msg.value >= allowListCost * _mintAmount); reserved -= _mintAmount; addressMintedBalance[msg.sender] += _mintAmount; for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, supply + i, ""); } } function giveAway( uint256[] calldata quantityList, address[] calldata addressList ) external onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function isWhitelisted(address _user) public view returns (bool) { } function _baseURI() internal view virtual returns (string memory) { } function remainingReserved() public view returns (uint256) { } function setCost(uint256 _newCost) public onlyOwner { } function setAllowedListCost(uint256 _newCost) public onlyOwner { } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { } function whitelistUsers(address[] calldata _users) public onlyOwner { } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { } function setBaseURI(string memory _newBaseURI) public onlyOwner { } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { } function setTogglePause() public onlyOwner { } function sendEth(address destination, uint256 amount) internal { } function withdrawAll() public payable onlyOwner { } }
isWhitelisted(msg.sender),"User is not whitelisted"
3,404
isWhitelisted(msg.sender)
"Max NFT per address exceeded"
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2021 pragma solidity ^0.8.10; import "./pagzi/ERC721Enum.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract Raksasas is ERC721Enum, Ownable, ReentrancyGuard { using Strings for uint256; uint256 public cost = 0.025 ether; uint256 public allowListCost = 0.01 ether; uint256 public maxSupply = 8888; uint256 public maxMintAmount = 20; uint256 private reserved = 888; uint256 public nftPerAddressLimit = 1; bool inside; bool public paused = true; string public baseURI; string public baseExtension = ".json"; address[] public whitelistedAddresses; address an = 0x7a0876cBa8146f9Ad39876d83593D99B2A0ffc7b; address gu = 0xE35374A6Db102187c9a77c54CEA1E891B32839e7; address hu = 0x66e4D5FB3B9710C1C30fe34F968A9ad45a9A855e; address je = 0x7B85A22dB64690f7229Cbf494614f395274efacb; address lu = 0xBb18BB346C421BC998788A2F3D0a5ed9Fa3F8060; address va = 0xCf5482620e3283A015575d106d14fa877529eCD5; mapping(address => uint256) public addressMintedBalance; constructor(string memory _initBaseURI) ERC721P("Raksasas", "RAKS") { } function mint(uint256 _mintAmount) public payable nonReentrant { } function mintWhiteListed(uint256 _mintAmount) public payable nonReentrant { require(!paused, "Sales are paused!"); require( _mintAmount > 0 && _mintAmount <= nftPerAddressLimit, "Too many NFTs to mint" ); uint256 supply = totalSupply(); require( supply + _mintAmount <= maxSupply - reserved, "Not enough NFTs available" ); require(isWhitelisted(msg.sender), "User is not whitelisted"); uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require(<FILL_ME>) require(msg.value >= allowListCost * _mintAmount); reserved -= _mintAmount; addressMintedBalance[msg.sender] += _mintAmount; for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, supply + i, ""); } } function giveAway( uint256[] calldata quantityList, address[] calldata addressList ) external onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function isWhitelisted(address _user) public view returns (bool) { } function _baseURI() internal view virtual returns (string memory) { } function remainingReserved() public view returns (uint256) { } function setCost(uint256 _newCost) public onlyOwner { } function setAllowedListCost(uint256 _newCost) public onlyOwner { } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { } function whitelistUsers(address[] calldata _users) public onlyOwner { } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { } function setBaseURI(string memory _newBaseURI) public onlyOwner { } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { } function setTogglePause() public onlyOwner { } function sendEth(address destination, uint256 amount) internal { } function withdrawAll() public payable onlyOwner { } }
ownerMintedCount+_mintAmount<=nftPerAddressLimit,"Max NFT per address exceeded"
3,404
ownerMintedCount+_mintAmount<=nftPerAddressLimit
"Too many NFTs t o mint"
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2021 pragma solidity ^0.8.10; import "./pagzi/ERC721Enum.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract Raksasas is ERC721Enum, Ownable, ReentrancyGuard { using Strings for uint256; uint256 public cost = 0.025 ether; uint256 public allowListCost = 0.01 ether; uint256 public maxSupply = 8888; uint256 public maxMintAmount = 20; uint256 private reserved = 888; uint256 public nftPerAddressLimit = 1; bool inside; bool public paused = true; string public baseURI; string public baseExtension = ".json"; address[] public whitelistedAddresses; address an = 0x7a0876cBa8146f9Ad39876d83593D99B2A0ffc7b; address gu = 0xE35374A6Db102187c9a77c54CEA1E891B32839e7; address hu = 0x66e4D5FB3B9710C1C30fe34F968A9ad45a9A855e; address je = 0x7B85A22dB64690f7229Cbf494614f395274efacb; address lu = 0xBb18BB346C421BC998788A2F3D0a5ed9Fa3F8060; address va = 0xCf5482620e3283A015575d106d14fa877529eCD5; mapping(address => uint256) public addressMintedBalance; constructor(string memory _initBaseURI) ERC721P("Raksasas", "RAKS") { } function mint(uint256 _mintAmount) public payable nonReentrant { } function mintWhiteListed(uint256 _mintAmount) public payable nonReentrant { } function giveAway( uint256[] calldata quantityList, address[] calldata addressList ) external onlyOwner { require(quantityList.length == addressList.length, "Wrong Inputs"); uint256 totalQuantity = 0; uint256 supply = totalSupply(); for (uint256 i = 0; i < quantityList.length; ++i) { totalQuantity += quantityList[i]; } require(totalQuantity <= reserved, "Exceeds reserved supply"); require(<FILL_ME>) reserved -= totalQuantity; delete totalQuantity; for (uint256 i = 0; i < addressList.length; ++i) { for (uint256 j = 0; j < quantityList[i]; ++j) { _safeMint(addressList[i], supply++, ""); } } } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function isWhitelisted(address _user) public view returns (bool) { } function _baseURI() internal view virtual returns (string memory) { } function remainingReserved() public view returns (uint256) { } function setCost(uint256 _newCost) public onlyOwner { } function setAllowedListCost(uint256 _newCost) public onlyOwner { } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { } function whitelistUsers(address[] calldata _users) public onlyOwner { } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { } function setBaseURI(string memory _newBaseURI) public onlyOwner { } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { } function setTogglePause() public onlyOwner { } function sendEth(address destination, uint256 amount) internal { } function withdrawAll() public payable onlyOwner { } }
supply+totalQuantity<=maxSupply,"Too many NFTs t o mint"
3,404
supply+totalQuantity<=maxSupply
"no rentrancy"
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2021 pragma solidity ^0.8.10; import "./pagzi/ERC721Enum.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract Raksasas is ERC721Enum, Ownable, ReentrancyGuard { using Strings for uint256; uint256 public cost = 0.025 ether; uint256 public allowListCost = 0.01 ether; uint256 public maxSupply = 8888; uint256 public maxMintAmount = 20; uint256 private reserved = 888; uint256 public nftPerAddressLimit = 1; bool inside; bool public paused = true; string public baseURI; string public baseExtension = ".json"; address[] public whitelistedAddresses; address an = 0x7a0876cBa8146f9Ad39876d83593D99B2A0ffc7b; address gu = 0xE35374A6Db102187c9a77c54CEA1E891B32839e7; address hu = 0x66e4D5FB3B9710C1C30fe34F968A9ad45a9A855e; address je = 0x7B85A22dB64690f7229Cbf494614f395274efacb; address lu = 0xBb18BB346C421BC998788A2F3D0a5ed9Fa3F8060; address va = 0xCf5482620e3283A015575d106d14fa877529eCD5; mapping(address => uint256) public addressMintedBalance; constructor(string memory _initBaseURI) ERC721P("Raksasas", "RAKS") { } function mint(uint256 _mintAmount) public payable nonReentrant { } function mintWhiteListed(uint256 _mintAmount) public payable nonReentrant { } function giveAway( uint256[] calldata quantityList, address[] calldata addressList ) external onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function isWhitelisted(address _user) public view returns (bool) { } function _baseURI() internal view virtual returns (string memory) { } function remainingReserved() public view returns (uint256) { } function setCost(uint256 _newCost) public onlyOwner { } function setAllowedListCost(uint256 _newCost) public onlyOwner { } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { } function whitelistUsers(address[] calldata _users) public onlyOwner { } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { } function setBaseURI(string memory _newBaseURI) public onlyOwner { } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { } function setTogglePause() public onlyOwner { } function sendEth(address destination, uint256 amount) internal { } function withdrawAll() public payable onlyOwner { require(<FILL_ME>) inside = true; uint256 percent = address(this).balance / 100; sendEth(an, percent * 16); sendEth(gu, percent * 16); sendEth(hu, percent * 16); sendEth(je, percent * 16); sendEth(lu, percent * 16); sendEth(va, address(this).balance); inside = false; } }
!inside,"no rentrancy"
3,404
!inside
"Extension must implement IERC721CreatorExtensionApproveTransfer"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../extensions/ERC721/IERC721CreatorExtensionApproveTransfer.sol"; import "../extensions/ERC721/IERC721CreatorExtensionBurnable.sol"; import "../permissions/ERC721/IERC721CreatorMintPermissions.sol"; import "./IERC721CreatorCore.sol"; import "./CreatorCore.sol"; /** * @dev Core ERC721 creator implementation */ abstract contract ERC721CreatorCore is CreatorCore, IERC721CreatorCore { using EnumerableSet for EnumerableSet.AddressSet; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) { } /** * @dev See {ICreatorCore-setApproveTransferExtension}. */ function setApproveTransferExtension(bool enabled) external override extensionRequired { require(<FILL_ME>) if (_extensionApproveTransfers[msg.sender] != enabled) { _extensionApproveTransfers[msg.sender] = enabled; emit ExtensionApproveTransferUpdated(msg.sender, enabled); } } /** * @dev Set mint permissions for an extension */ function _setMintPermissions(address extension, address permissions) internal { } /** * Check if an extension can mint */ function _checkMintPermissions(address to, uint256 tokenId) internal { } /** * Override for post mint actions */ function _postMintBase(address, uint256) internal virtual {} /** * Override for post mint actions */ function _postMintExtension(address, uint256) internal virtual {} /** * Post-burning callback and metadata cleanup */ function _postBurn(address owner, uint256 tokenId) internal virtual { } /** * Approve a transfer */ function _approveTransfer(address from, address to, uint256 tokenId) internal { } }
!enabled||ERC165Checker.supportsInterface(msg.sender,type(IERC721CreatorExtensionApproveTransfer).interfaceId),"Extension must implement IERC721CreatorExtensionApproveTransfer"
3,407
!enabled||ERC165Checker.supportsInterface(msg.sender,type(IERC721CreatorExtensionApproveTransfer).interfaceId)
"CreatorCore: Invalid extension"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../extensions/ERC721/IERC721CreatorExtensionApproveTransfer.sol"; import "../extensions/ERC721/IERC721CreatorExtensionBurnable.sol"; import "../permissions/ERC721/IERC721CreatorMintPermissions.sol"; import "./IERC721CreatorCore.sol"; import "./CreatorCore.sol"; /** * @dev Core ERC721 creator implementation */ abstract contract ERC721CreatorCore is CreatorCore, IERC721CreatorCore { using EnumerableSet for EnumerableSet.AddressSet; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) { } /** * @dev See {ICreatorCore-setApproveTransferExtension}. */ function setApproveTransferExtension(bool enabled) external override extensionRequired { } /** * @dev Set mint permissions for an extension */ function _setMintPermissions(address extension, address permissions) internal { require(<FILL_ME>) require(permissions == address(0x0) || ERC165Checker.supportsInterface(permissions, type(IERC721CreatorMintPermissions).interfaceId), "Invalid address"); if (_extensionPermissions[extension] != permissions) { _extensionPermissions[extension] = permissions; emit MintPermissionsUpdated(extension, permissions, msg.sender); } } /** * Check if an extension can mint */ function _checkMintPermissions(address to, uint256 tokenId) internal { } /** * Override for post mint actions */ function _postMintBase(address, uint256) internal virtual {} /** * Override for post mint actions */ function _postMintExtension(address, uint256) internal virtual {} /** * Post-burning callback and metadata cleanup */ function _postBurn(address owner, uint256 tokenId) internal virtual { } /** * Approve a transfer */ function _approveTransfer(address from, address to, uint256 tokenId) internal { } }
_extensions.contains(extension),"CreatorCore: Invalid extension"
3,407
_extensions.contains(extension)
"ERC721Creator: Extension approval failure"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../extensions/ERC721/IERC721CreatorExtensionApproveTransfer.sol"; import "../extensions/ERC721/IERC721CreatorExtensionBurnable.sol"; import "../permissions/ERC721/IERC721CreatorMintPermissions.sol"; import "./IERC721CreatorCore.sol"; import "./CreatorCore.sol"; /** * @dev Core ERC721 creator implementation */ abstract contract ERC721CreatorCore is CreatorCore, IERC721CreatorCore { using EnumerableSet for EnumerableSet.AddressSet; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) { } /** * @dev See {ICreatorCore-setApproveTransferExtension}. */ function setApproveTransferExtension(bool enabled) external override extensionRequired { } /** * @dev Set mint permissions for an extension */ function _setMintPermissions(address extension, address permissions) internal { } /** * Check if an extension can mint */ function _checkMintPermissions(address to, uint256 tokenId) internal { } /** * Override for post mint actions */ function _postMintBase(address, uint256) internal virtual {} /** * Override for post mint actions */ function _postMintExtension(address, uint256) internal virtual {} /** * Post-burning callback and metadata cleanup */ function _postBurn(address owner, uint256 tokenId) internal virtual { } /** * Approve a transfer */ function _approveTransfer(address from, address to, uint256 tokenId) internal { if (_extensionApproveTransfers[_tokensExtension[tokenId]]) { require(<FILL_ME>) } } }
IERC721CreatorExtensionApproveTransfer(_tokensExtension[tokenId]).approveTransfer(from,to,tokenId),"ERC721Creator: Extension approval failure"
3,407
IERC721CreatorExtensionApproveTransfer(_tokensExtension[tokenId]).approveTransfer(from,to,tokenId)
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { require(<FILL_ME>) _; } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
!(msg.data.length<size+4)
3,426
!(msg.data.length<size+4)
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require(<FILL_ME>) allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
!((_value!=0)&&(allowed[msg.sender][_spender]!=0))
3,426
!((_value!=0)&&(allowed[msg.sender][_spender]!=0))
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { require(<FILL_ME>) uint dirtyFunds = balanceOf(_blackListedUser); balances[_blackListedUser] = 0; _totalSupply -= dirtyFunds; DestroyedBlackFunds(_blackListedUser, dirtyFunds); } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
isBlackListed[_blackListedUser]
3,426
isBlackListed[_blackListedUser]
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { require(<FILL_ME>) if (deprecated) { return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value); } else { return super.transfer(_to, _value); } } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
!isBlackListed[msg.sender]
3,426
!isBlackListed[msg.sender]
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { require(<FILL_ME>) if (deprecated) { return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value); } else { return super.transferFrom(_from, _to, _value); } } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
!isBlackListed[_from]
3,426
!isBlackListed[_from]
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { require(<FILL_ME>) require(balances[owner] + amount > balances[owner]); balances[owner] += amount; _totalSupply += amount; Issue(amount); } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
_totalSupply+amount>_totalSupply
3,426
_totalSupply+amount>_totalSupply
null
/** *Submitted for verification at Etherscan.io on 2017-11-28 */ pragma solidity ^0.4.17; /** * @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 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; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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) public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public _totalSupply; function totalSupply() public constant returns (uint); function balanceOf(address who) public constant returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is Ownable, ERC20Basic { using SafeMath for uint; mapping(address => uint) public balances; // additional variables for use if transaction fees ever became necessary uint public basisPointsRate = 0; uint public maximumFee = 0; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { } /** * @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, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint balance) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping (address => mapping (address => uint)) public allowed; uint public constant MAX_UINT = 2**256 - 1; /** * @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 uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } /** * @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint remaining) { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } contract BlackList is Ownable, BasicToken { /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// function getBlackListStatus(address _maker) external constant returns (bool) { } function getOwner() external constant returns (address) { } mapping (address => bool) public isBlackListed; function addBlackList (address _evilUser) public onlyOwner { } function removeBlackList (address _clearedUser) public onlyOwner { } function destroyBlackFunds (address _blackListedUser) public onlyOwner { } event DestroyedBlackFunds(address _blackListedUser, uint _balance); event AddedBlackList(address _user); event RemovedBlackList(address _user); } contract UpgradedStandardToken is StandardToken{ // those methods are called by the legacy contract // and they must ensure msg.sender to be the contract address function transferByLegacy(address from, address to, uint value) public; function transferFromByLegacy(address sender, address from, address spender, uint value) public; function approveByLegacy(address from, address spender, uint value) public; } contract TetherToken is Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals; address public upgradedAddress; bool public deprecated; // The contract can be initialized with a number of tokens // All the tokens are deposited to the owner address // // @param _balance Initial supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transfer(address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function transferFrom(address _from, address _to, uint _value) public whenNotPaused { } // Forward ERC20 methods to upgraded contract if this one is deprecated function balanceOf(address who) public constant returns (uint) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { } // Forward ERC20 methods to upgraded contract if this one is deprecated function allowance(address _owner, address _spender) public constant returns (uint remaining) { } // deprecate current contract in favour of a new one function deprecate(address _upgradedAddress) public onlyOwner { } // deprecate current contract if favour of a new one function totalSupply() public constant returns (uint) { } // Issue a new amount of tokens // these tokens are deposited into the owner address // // @param _amount Number of tokens to be issued function issue(uint amount) public onlyOwner { require(_totalSupply + amount > _totalSupply); require(<FILL_ME>) balances[owner] += amount; _totalSupply += amount; Issue(amount); } // Redeem tokens. // These tokens are withdrawn from the owner address // if the balance must be enough to cover the redeem // or the call will fail. // @param _amount Number of tokens to be issued function redeem(uint amount) public onlyOwner { } function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { } // Called when new token are issued event Issue(uint amount); // Called when tokens are redeemed event Redeem(uint amount); // Called when contract is deprecated event Deprecate(address newAddress); // Called if contract ever adds fees event Params(uint feeBasisPoints, uint maxFee); }
balances[owner]+amount>balances[owner]
3,426
balances[owner]+amount>balances[owner]
"Must be multiple of 0.01%"
/* Copyright 2019 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; library ScaleValidations { using SafeMath for uint256; uint256 private constant ONE_HUNDRED_PERCENT = 1e18; uint256 private constant ONE_BASIS_POINT = 1e14; function validateLessThanEqualOneHundredPercent(uint256 _value) internal view { } function validateMultipleOfBasisPoint(uint256 _value) internal view { require(<FILL_ME>) } }
_value.mod(ONE_BASIS_POINT)==0,"Must be multiple of 0.01%"
3,437
_value.mod(ONE_BASIS_POINT)==0
null
pragma solidity ^0.4.18; contract DogCoreInterface { address public ceoAddress; address public cfoAddress; function getDog(uint256 _id) external view returns ( uint256 cooldownIndex, uint256 nextActionAt, uint256 siringWithId, uint256 birthTime, uint256 matronId, uint256 sireId, uint256 generation, uint256 genes, uint8 variation, uint256 gen0 ); function ownerOf(uint256 _tokenId) external view returns (address); function transferFrom(address _from, address _to, uint256 _tokenId) external; function sendMoney(address _to, uint256 _money) external; function totalSupply() external view returns (uint); function getOwner(uint256 _tokenId) public view returns(address); function getAvailableBlance() external view returns(uint256); } contract LotteryBase { uint8 public currentGene; uint256 public lastBlockNumber; uint256 randomSeed = 1; struct CLottery { uint8[7] luckyGenes; uint256 totalAmount; uint256 openBlock; bool isReward; bool noFirstReward; } CLottery[] public CLotteries; address public finalLottery; uint256 public SpoolAmount = 0; DogCoreInterface public dogCore; event OpenLottery(uint8 currentGene, uint8 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount); event OpenCarousel(uint256 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount); modifier onlyCEO() { } modifier onlyCFO() { } function toLotteryPool(uint amount) public onlyCFO { } function _isCarousal(uint256 currentTerm) external view returns(bool) { } function getCurrentTerm() external view returns (uint256) { } } contract LotteryGenes is LotteryBase { function convertGeneArray(uint256 gene) public pure returns(uint8[7]) { } function convertGene(uint8[7] luckyGenes) public pure returns(uint256) { } } contract SetLottery is LotteryGenes { function random(uint8 seed) internal returns(uint8) { } function openLottery(uint8 _viewId) public returns(uint8,uint8) { } function random2() internal view returns (uint256) { } function openCarousel() public { uint256 currentTerm = CLotteries.length - 1; CLottery storage clottery = CLotteries[currentTerm]; if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) { OpenCarousel(convertGene(clottery.luckyGenes), currentTerm, clottery.openBlock, clottery.totalAmount); } if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == true) { CLottery memory _clottery; _clottery.luckyGenes = [0,0,0,0,0,0,0]; _clottery.totalAmount = uint256(0); _clottery.isReward = false; _clottery.openBlock = uint256(0); currentTerm = CLotteries.push(_clottery) - 1; } uint256 bonusBlance = dogCore.getAvailableBlance(); require(<FILL_ME>) uint256 genes = _getValidRandomGenes(); require (genes > 0); uint8[7] memory luckyGenes = convertGeneArray(genes); OpenCarousel(genes, currentTerm, block.number, bonusBlance); CLotteries[currentTerm].luckyGenes = luckyGenes; CLotteries[currentTerm].openBlock = block.number; CLotteries[currentTerm].totalAmount = bonusBlance; } function _getValidRandomGenes() internal view returns (uint256) { } function _validGenes(uint256 dogId) internal view returns (uint256) { } } contract LotteryCore is SetLottery { function LotteryCore(address _ktAddress) public { } function setFinalLotteryAddress(address _flAddress) public onlyCEO { } function getCLottery() public view returns ( uint8[7] luckyGenes, uint256 totalAmount, uint256 openBlock, bool isReward, uint256 term ) { } function rewardLottery(bool isMore) external { } function toSPool(uint amount) external { } } contract FinalLottery { bool public isLottery = true; LotteryCore public lotteryCore; DogCoreInterface public dogCore; uint8[7] public luckyGenes; uint256 totalAmount; uint256 openBlock; bool isReward; uint256 currentTerm; uint256 public duration; uint8 public lotteryRatio; uint8[7] public lotteryParam; uint8 public carousalRatio; uint8[7] public carousalParam; struct FLottery { address[] owners0; uint256[] dogs0; address[] owners1; uint256[] dogs1; address[] owners2; uint256[] dogs2; address[] owners3; uint256[] dogs3; address[] owners4; uint256[] dogs4; address[] owners5; uint256[] dogs5; address[] owners6; uint256[] dogs6; uint256[] reward; } mapping(uint256 => FLottery) flotteries; function FinalLottery(address _lcAddress) public { } event DistributeLottery(uint256[] rewardArray, uint256 currentTerm); event RegisterLottery(uint256 dogId, address owner, uint8 lotteryClass, string result); function setLotteryDuration(uint256 durationBlocks) public { } function registerLottery(uint256 dogId) public returns (uint8) { } function distributeLottery() public returns (uint8) { } function _getGen0Address(uint256 dogId) internal view returns(address) { } function _getLuckyList(uint256 currentTerm1, uint8 lotclass) public view returns (uint256[] kts, address[] ons) { } function _pushLuckyInfo(uint256 currentTerm1, uint8 _lotteryClass, address owner, uint256 _dogId) internal { } function getLotteryClass(uint8[7] luckyGenesArray, uint256 genes) internal view returns(uint8) { } function checkLottery(uint256 genes) public view returns(uint8) { } function getCLottery() public view returns ( uint8[7] luckyGenes1, uint256 totalAmount1, uint256 openBlock1, bool isReward1, uint256 term1, uint8 currentGenes1, uint256 tSupply, uint256 sPoolAmount1, uint256[] reward1 ) { } }
this._isCarousal(currentTerm)
3,492
this._isCarousal(currentTerm)
null
pragma solidity ^0.4.18; contract DogCoreInterface { address public ceoAddress; address public cfoAddress; function getDog(uint256 _id) external view returns ( uint256 cooldownIndex, uint256 nextActionAt, uint256 siringWithId, uint256 birthTime, uint256 matronId, uint256 sireId, uint256 generation, uint256 genes, uint8 variation, uint256 gen0 ); function ownerOf(uint256 _tokenId) external view returns (address); function transferFrom(address _from, address _to, uint256 _tokenId) external; function sendMoney(address _to, uint256 _money) external; function totalSupply() external view returns (uint); function getOwner(uint256 _tokenId) public view returns(address); function getAvailableBlance() external view returns(uint256); } contract LotteryBase { uint8 public currentGene; uint256 public lastBlockNumber; uint256 randomSeed = 1; struct CLottery { uint8[7] luckyGenes; uint256 totalAmount; uint256 openBlock; bool isReward; bool noFirstReward; } CLottery[] public CLotteries; address public finalLottery; uint256 public SpoolAmount = 0; DogCoreInterface public dogCore; event OpenLottery(uint8 currentGene, uint8 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount); event OpenCarousel(uint256 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount); modifier onlyCEO() { } modifier onlyCFO() { } function toLotteryPool(uint amount) public onlyCFO { } function _isCarousal(uint256 currentTerm) external view returns(bool) { } function getCurrentTerm() external view returns (uint256) { } } contract LotteryGenes is LotteryBase { function convertGeneArray(uint256 gene) public pure returns(uint8[7]) { } function convertGene(uint8[7] luckyGenes) public pure returns(uint256) { } } contract SetLottery is LotteryGenes { function random(uint8 seed) internal returns(uint8) { } function openLottery(uint8 _viewId) public returns(uint8,uint8) { } function random2() internal view returns (uint256) { } function openCarousel() public { } function _getValidRandomGenes() internal view returns (uint256) { } function _validGenes(uint256 dogId) internal view returns (uint256) { } } contract LotteryCore is SetLottery { function LotteryCore(address _ktAddress) public { } function setFinalLotteryAddress(address _flAddress) public onlyCEO { } function getCLottery() public view returns ( uint8[7] luckyGenes, uint256 totalAmount, uint256 openBlock, bool isReward, uint256 term ) { } function rewardLottery(bool isMore) external { } function toSPool(uint amount) external { } } contract FinalLottery { bool public isLottery = true; LotteryCore public lotteryCore; DogCoreInterface public dogCore; uint8[7] public luckyGenes; uint256 totalAmount; uint256 openBlock; bool isReward; uint256 currentTerm; uint256 public duration; uint8 public lotteryRatio; uint8[7] public lotteryParam; uint8 public carousalRatio; uint8[7] public carousalParam; struct FLottery { address[] owners0; uint256[] dogs0; address[] owners1; uint256[] dogs1; address[] owners2; uint256[] dogs2; address[] owners3; uint256[] dogs3; address[] owners4; uint256[] dogs4; address[] owners5; uint256[] dogs5; address[] owners6; uint256[] dogs6; uint256[] reward; } mapping(uint256 => FLottery) flotteries; function FinalLottery(address _lcAddress) public { } event DistributeLottery(uint256[] rewardArray, uint256 currentTerm); event RegisterLottery(uint256 dogId, address owner, uint8 lotteryClass, string result); function setLotteryDuration(uint256 durationBlocks) public { } function registerLottery(uint256 dogId) public returns (uint8) { uint256 _dogId = dogId; (luckyGenes, totalAmount, openBlock, isReward, currentTerm) = lotteryCore.getCLottery(); address owner = dogCore.ownerOf(_dogId); require (owner != address(this)); require(<FILL_ME>) require(totalAmount > 0 && isReward == false && openBlock > (block.number-duration)); var(, , , birthTime, , ,generation,genes, variation,) = dogCore.getDog(_dogId); require(birthTime < openBlock); require(generation > 0); require(variation == 0); uint8 _lotteryClass = getLotteryClass(luckyGenes, genes); require(_lotteryClass < 7); address[] memory owners; uint256[] memory dogs; (dogs, owners) = _getLuckyList(currentTerm, _lotteryClass); for (uint i = 0; i < dogs.length; i++) { if (_dogId == dogs[i]) { RegisterLottery(_dogId, owner, _lotteryClass,"dog already registered"); return 5; } } _pushLuckyInfo(currentTerm, _lotteryClass, owner, _dogId); RegisterLottery(_dogId, owner, _lotteryClass,"successful"); return 0; } function distributeLottery() public returns (uint8) { } function _getGen0Address(uint256 dogId) internal view returns(address) { } function _getLuckyList(uint256 currentTerm1, uint8 lotclass) public view returns (uint256[] kts, address[] ons) { } function _pushLuckyInfo(uint256 currentTerm1, uint8 _lotteryClass, address owner, uint256 _dogId) internal { } function getLotteryClass(uint8[7] luckyGenesArray, uint256 genes) internal view returns(uint8) { } function checkLottery(uint256 genes) public view returns(uint8) { } function getCLottery() public view returns ( uint8[7] luckyGenes1, uint256 totalAmount1, uint256 openBlock1, bool isReward1, uint256 term1, uint8 currentGenes1, uint256 tSupply, uint256 sPoolAmount1, uint256[] reward1 ) { } }
address(dogCore)==msg.sender
3,492
address(dogCore)==msg.sender
"_bone is a zero address"
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract BasicBoneDistributor is Ownable { using SafeMath for uint256; IERC20 public bone; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('receiveApproval(address,uint256,address,uint256)'))); uint public lockPercentage = 67; constructor (IERC20 _bone) public { require(<FILL_ME>) bone = _bone; } function boneBalance() external view returns(uint) { } function withdrawBone(address _destination, address _lockDestination, uint256 _lockingPeriod, uint256 _amount) external onlyOwner { } function approveAndCall(address _spender, uint256 _value, uint256 _lockingPeriod) internal returns (bool success) { } function setLockPercentage(uint _lockPercentage) external onlyOwner { } }
address(_bone)!=address(0),"_bone is a zero address"
3,507
address(_bone)!=address(0)
"transfer: withdraw failed"
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract BasicBoneDistributor is Ownable { using SafeMath for uint256; IERC20 public bone; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('receiveApproval(address,uint256,address,uint256)'))); uint public lockPercentage = 67; constructor (IERC20 _bone) public { } function boneBalance() external view returns(uint) { } function withdrawBone(address _destination, address _lockDestination, uint256 _lockingPeriod, uint256 _amount) external onlyOwner { uint256 _lockAmount = _amount.mul(lockPercentage).div(100); require(<FILL_ME>) if(_lockAmount != 0){ approveAndCall(_lockDestination, _lockAmount, _lockingPeriod); } } function approveAndCall(address _spender, uint256 _value, uint256 _lockingPeriod) internal returns (bool success) { } function setLockPercentage(uint _lockPercentage) external onlyOwner { } }
bone.transfer(_destination,_amount.sub(_lockAmount)),"transfer: withdraw failed"
3,507
bone.transfer(_destination,_amount.sub(_lockAmount))
"Name is mandatory"
// SPDX_License_Identifier: MIT pragma solidity ^0.6.0; /** * @title EthItem - An improved ERC1155 token with ERC20 trading capabilities. * @dev In the EthItem standard, there is no a centralized storage where to save every objectId info. * In fact every NFT data is saved in a specific ERC20 token that can also work as a standalone one, and let transfer parts of an atomic object. * The ERC20 represents a unique Token Id, and its supply represents the entire supply of that Token Id. * You can instantiate a EthItem as a brand-new one, or as a wrapper for pre-existent classic ERC1155 NFT. * In the first case, you can introduce some particular permissions to mint new tokens. * In the second case, you need to send your NFTs to the Wrapped EthItem (using the classic safeTransferFrom or safeBatchTransferFrom methods) * and it will create a brand new ERC20 Token or mint new supply (in the case some tokens with the same id were transfered before yours). */ contract EthItemMainInterface is IEthItemMainInterface, Context, ERC165 { using SafeMath for uint256; using Address for address; bytes4 internal constant _INTERFACEobjectId_ERC1155 = 0xd9b67a26; string internal _name; string internal _symbol; mapping(uint256 => string) internal _objectUris; mapping(uint256 => address) internal _dest; mapping(address => bool) internal _isMine; mapping(address => mapping(address => bool)) internal _operatorApprovals; address internal _interoperableInterfaceModel; uint256 internal _interoperableInterfaceModelVersion; uint256 internal _decimals; /** * @dev Constructor * When you create a EthItem, you can specify if you want to create a brand new one, passing the classic data like name, symbol, amd URI, * or wrap a pre-existent ERC1155 NFT, passing its contract address. * You can use just one of the two modes at the same time. * In both cases, a ERC20 token address is mandatory. It will be used as a model to be cloned for every minted NFT. * @param erc20NFTWrapperModel the address of the ERC20 pre-deployed model. I will not be used in the procedure, but just cloned as a brand-new one every time a new NFT is minted. * @param name the name of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. * @param symbol the symbol of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. */ constructor( address erc20NFTWrapperModel, string memory name, string memory symbol ) public { } /** * @dev Utility method which contains the logic of the constructor. * This is a useful trick to instantiate a contract when it is cloned. */ function init( address interoperableInterfaceModel, string memory name, string memory symbol ) public virtual override { require( _interoperableInterfaceModel == address(0), "Init already called!" ); require( interoperableInterfaceModel != address(0), "Model should be a valid ethereum address" ); _interoperableInterfaceModelVersion = IEthItemInteroperableInterface(_interoperableInterfaceModel = interoperableInterfaceModel).interoperableInterfaceVersion(); require(<FILL_ME>) require( keccak256(bytes(symbol)) != keccak256(""), "Symbol is mandatory" ); _name = name; _symbol = symbol; _decimals = 18; _registerInterface(this.safeBatchTransferFrom.selector); _registerInterface(_INTERFACEobjectId_ERC1155); _registerInterface(this.balanceOf.selector); _registerInterface(this.balanceOfBatch.selector); _registerInterface(this.setApprovalForAll.selector); _registerInterface(this.isApprovedForAll.selector); _registerInterface(this.safeTransferFrom.selector); _registerInterface(this.uri.selector); _registerInterface(this.totalSupply.selector); _registerInterface(0x00ad800c); //name(uint256) _registerInterface(0x4e41a1fb); //symbol(uint256) _registerInterface(this.decimals.selector); _registerInterface(0x06fdde03); //name() _registerInterface(0x95d89b41); //symbol() } function mainInterfaceVersion() public pure virtual override returns(uint256) { } /** * @dev Mint * If the EthItem does not wrap a pre-existent NFT, this call is used to mint new NFTs, according to the permission rules provided by the Token creator. * @param amount The amount of tokens to be created. It must be greater than 1 unity. * @param objectUri The Uri to locate this new token's metadata. */ function mint(uint256 amount, string memory objectUri) public virtual override returns (uint256 objectId, address tokenAddress) { } /** * @dev Burn * You can choose to burn your NFTs. * In case this Token wraps a pre-existent ERC1155 NFT, you will receive the wrapped NFTs. */ function burn( uint256 objectId, uint256 amount ) public virtual override { } /** * @dev Burn Batch * Same as burn, but for multiple NFTs at the same time */ function burnBatch( uint256[] memory objectIds, uint256[] memory amounts ) public virtual override { } function _burn(address owner, uint256[] memory objectIds, uint256[] memory amounts) internal virtual { } /** * @dev get the address of the ERC20 Contract used as a model */ function interoperableInterfaceModel() public virtual override view returns (address, uint256) { } /** * @dev Gives back the address of the ERC20 Token representing this Token Id */ function asInteroperable(uint256 objectId) public virtual override view returns (IEthItemInteroperableInterface) { } /** * @dev Returns the total supply of the given token id * @param objectId the id of the token whose availability you want to know */ function totalSupply(uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Returns the name of the given token id * @param objectId the id of the token whose name you want to know */ function name(uint256 objectId) public virtual override view returns (string memory) { } function name() public virtual override view returns (string memory) { } /** * @dev Returns the symbol of the given token id * @param objectId the id of the token whose symbol you want to know */ function symbol(uint256 objectId) public virtual override view returns (string memory) { } function symbol() public virtual override view returns (string memory) { } /** * @dev Returns the decimals of the given token id */ function decimals(uint256) public virtual override view returns (uint256) { } /** * @dev Returns the uri of the given token id * @param objectId the id of the token whose uri you want to know */ function uri(uint256 objectId) public virtual override view returns (string memory) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOf(address account, uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOfBatch( address[] memory accounts, uint256[] memory objectIds ) public virtual override view returns (uint256[] memory balances) { } /** * @dev Classic ERC1155 Standard Method */ function setApprovalForAll(address operator, bool approved) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function isApprovedForAll(address account, address operator) public virtual override view returns (bool) { } /** * @dev Classic ERC1155 Standard Method */ function safeTransferFrom( address from, address to, uint256 objectId, uint256 amount, bytes memory data ) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function safeBatchTransferFrom( address from, address to, uint256[] memory objectIds, uint256[] memory amounts, bytes memory data ) public virtual override { } function emitTransferSingleEvent(address sender, address from, address to, uint256 objectId, uint256 amount) public override { } function toInteroperableInterfaceAmount(uint256 objectId, uint256 mainInterfaceAmount) public override virtual view returns (uint256 interoperableInterfaceAmount) { } function toMainInterfaceAmount(uint256 objectId, uint256 interoperableInterfaceAmount) public override virtual view returns (uint256 mainInterfaceAmount) { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _clone(address original) internal returns (address copy) { } function _mint( address from, uint256 amount ) internal virtual returns (uint256 objectId, address wrapperAddress) { } }
keccak256(bytes(name))!=keccak256(""),"Name is mandatory"
3,517
keccak256(bytes(name))!=keccak256("")
"Symbol is mandatory"
// SPDX_License_Identifier: MIT pragma solidity ^0.6.0; /** * @title EthItem - An improved ERC1155 token with ERC20 trading capabilities. * @dev In the EthItem standard, there is no a centralized storage where to save every objectId info. * In fact every NFT data is saved in a specific ERC20 token that can also work as a standalone one, and let transfer parts of an atomic object. * The ERC20 represents a unique Token Id, and its supply represents the entire supply of that Token Id. * You can instantiate a EthItem as a brand-new one, or as a wrapper for pre-existent classic ERC1155 NFT. * In the first case, you can introduce some particular permissions to mint new tokens. * In the second case, you need to send your NFTs to the Wrapped EthItem (using the classic safeTransferFrom or safeBatchTransferFrom methods) * and it will create a brand new ERC20 Token or mint new supply (in the case some tokens with the same id were transfered before yours). */ contract EthItemMainInterface is IEthItemMainInterface, Context, ERC165 { using SafeMath for uint256; using Address for address; bytes4 internal constant _INTERFACEobjectId_ERC1155 = 0xd9b67a26; string internal _name; string internal _symbol; mapping(uint256 => string) internal _objectUris; mapping(uint256 => address) internal _dest; mapping(address => bool) internal _isMine; mapping(address => mapping(address => bool)) internal _operatorApprovals; address internal _interoperableInterfaceModel; uint256 internal _interoperableInterfaceModelVersion; uint256 internal _decimals; /** * @dev Constructor * When you create a EthItem, you can specify if you want to create a brand new one, passing the classic data like name, symbol, amd URI, * or wrap a pre-existent ERC1155 NFT, passing its contract address. * You can use just one of the two modes at the same time. * In both cases, a ERC20 token address is mandatory. It will be used as a model to be cloned for every minted NFT. * @param erc20NFTWrapperModel the address of the ERC20 pre-deployed model. I will not be used in the procedure, but just cloned as a brand-new one every time a new NFT is minted. * @param name the name of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. * @param symbol the symbol of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. */ constructor( address erc20NFTWrapperModel, string memory name, string memory symbol ) public { } /** * @dev Utility method which contains the logic of the constructor. * This is a useful trick to instantiate a contract when it is cloned. */ function init( address interoperableInterfaceModel, string memory name, string memory symbol ) public virtual override { require( _interoperableInterfaceModel == address(0), "Init already called!" ); require( interoperableInterfaceModel != address(0), "Model should be a valid ethereum address" ); _interoperableInterfaceModelVersion = IEthItemInteroperableInterface(_interoperableInterfaceModel = interoperableInterfaceModel).interoperableInterfaceVersion(); require( keccak256(bytes(name)) != keccak256(""), "Name is mandatory" ); require(<FILL_ME>) _name = name; _symbol = symbol; _decimals = 18; _registerInterface(this.safeBatchTransferFrom.selector); _registerInterface(_INTERFACEobjectId_ERC1155); _registerInterface(this.balanceOf.selector); _registerInterface(this.balanceOfBatch.selector); _registerInterface(this.setApprovalForAll.selector); _registerInterface(this.isApprovedForAll.selector); _registerInterface(this.safeTransferFrom.selector); _registerInterface(this.uri.selector); _registerInterface(this.totalSupply.selector); _registerInterface(0x00ad800c); //name(uint256) _registerInterface(0x4e41a1fb); //symbol(uint256) _registerInterface(this.decimals.selector); _registerInterface(0x06fdde03); //name() _registerInterface(0x95d89b41); //symbol() } function mainInterfaceVersion() public pure virtual override returns(uint256) { } /** * @dev Mint * If the EthItem does not wrap a pre-existent NFT, this call is used to mint new NFTs, according to the permission rules provided by the Token creator. * @param amount The amount of tokens to be created. It must be greater than 1 unity. * @param objectUri The Uri to locate this new token's metadata. */ function mint(uint256 amount, string memory objectUri) public virtual override returns (uint256 objectId, address tokenAddress) { } /** * @dev Burn * You can choose to burn your NFTs. * In case this Token wraps a pre-existent ERC1155 NFT, you will receive the wrapped NFTs. */ function burn( uint256 objectId, uint256 amount ) public virtual override { } /** * @dev Burn Batch * Same as burn, but for multiple NFTs at the same time */ function burnBatch( uint256[] memory objectIds, uint256[] memory amounts ) public virtual override { } function _burn(address owner, uint256[] memory objectIds, uint256[] memory amounts) internal virtual { } /** * @dev get the address of the ERC20 Contract used as a model */ function interoperableInterfaceModel() public virtual override view returns (address, uint256) { } /** * @dev Gives back the address of the ERC20 Token representing this Token Id */ function asInteroperable(uint256 objectId) public virtual override view returns (IEthItemInteroperableInterface) { } /** * @dev Returns the total supply of the given token id * @param objectId the id of the token whose availability you want to know */ function totalSupply(uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Returns the name of the given token id * @param objectId the id of the token whose name you want to know */ function name(uint256 objectId) public virtual override view returns (string memory) { } function name() public virtual override view returns (string memory) { } /** * @dev Returns the symbol of the given token id * @param objectId the id of the token whose symbol you want to know */ function symbol(uint256 objectId) public virtual override view returns (string memory) { } function symbol() public virtual override view returns (string memory) { } /** * @dev Returns the decimals of the given token id */ function decimals(uint256) public virtual override view returns (uint256) { } /** * @dev Returns the uri of the given token id * @param objectId the id of the token whose uri you want to know */ function uri(uint256 objectId) public virtual override view returns (string memory) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOf(address account, uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOfBatch( address[] memory accounts, uint256[] memory objectIds ) public virtual override view returns (uint256[] memory balances) { } /** * @dev Classic ERC1155 Standard Method */ function setApprovalForAll(address operator, bool approved) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function isApprovedForAll(address account, address operator) public virtual override view returns (bool) { } /** * @dev Classic ERC1155 Standard Method */ function safeTransferFrom( address from, address to, uint256 objectId, uint256 amount, bytes memory data ) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function safeBatchTransferFrom( address from, address to, uint256[] memory objectIds, uint256[] memory amounts, bytes memory data ) public virtual override { } function emitTransferSingleEvent(address sender, address from, address to, uint256 objectId, uint256 amount) public override { } function toInteroperableInterfaceAmount(uint256 objectId, uint256 mainInterfaceAmount) public override virtual view returns (uint256 interoperableInterfaceAmount) { } function toMainInterfaceAmount(uint256 objectId, uint256 interoperableInterfaceAmount) public override virtual view returns (uint256 mainInterfaceAmount) { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _clone(address original) internal returns (address copy) { } function _mint( address from, uint256 amount ) internal virtual returns (uint256 objectId, address wrapperAddress) { } }
keccak256(bytes(symbol))!=keccak256(""),"Symbol is mandatory"
3,517
keccak256(bytes(symbol))!=keccak256("")
"Uri cannot be empty"
// SPDX_License_Identifier: MIT pragma solidity ^0.6.0; /** * @title EthItem - An improved ERC1155 token with ERC20 trading capabilities. * @dev In the EthItem standard, there is no a centralized storage where to save every objectId info. * In fact every NFT data is saved in a specific ERC20 token that can also work as a standalone one, and let transfer parts of an atomic object. * The ERC20 represents a unique Token Id, and its supply represents the entire supply of that Token Id. * You can instantiate a EthItem as a brand-new one, or as a wrapper for pre-existent classic ERC1155 NFT. * In the first case, you can introduce some particular permissions to mint new tokens. * In the second case, you need to send your NFTs to the Wrapped EthItem (using the classic safeTransferFrom or safeBatchTransferFrom methods) * and it will create a brand new ERC20 Token or mint new supply (in the case some tokens with the same id were transfered before yours). */ contract EthItemMainInterface is IEthItemMainInterface, Context, ERC165 { using SafeMath for uint256; using Address for address; bytes4 internal constant _INTERFACEobjectId_ERC1155 = 0xd9b67a26; string internal _name; string internal _symbol; mapping(uint256 => string) internal _objectUris; mapping(uint256 => address) internal _dest; mapping(address => bool) internal _isMine; mapping(address => mapping(address => bool)) internal _operatorApprovals; address internal _interoperableInterfaceModel; uint256 internal _interoperableInterfaceModelVersion; uint256 internal _decimals; /** * @dev Constructor * When you create a EthItem, you can specify if you want to create a brand new one, passing the classic data like name, symbol, amd URI, * or wrap a pre-existent ERC1155 NFT, passing its contract address. * You can use just one of the two modes at the same time. * In both cases, a ERC20 token address is mandatory. It will be used as a model to be cloned for every minted NFT. * @param erc20NFTWrapperModel the address of the ERC20 pre-deployed model. I will not be used in the procedure, but just cloned as a brand-new one every time a new NFT is minted. * @param name the name of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. * @param symbol the symbol of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. */ constructor( address erc20NFTWrapperModel, string memory name, string memory symbol ) public { } /** * @dev Utility method which contains the logic of the constructor. * This is a useful trick to instantiate a contract when it is cloned. */ function init( address interoperableInterfaceModel, string memory name, string memory symbol ) public virtual override { } function mainInterfaceVersion() public pure virtual override returns(uint256) { } /** * @dev Mint * If the EthItem does not wrap a pre-existent NFT, this call is used to mint new NFTs, according to the permission rules provided by the Token creator. * @param amount The amount of tokens to be created. It must be greater than 1 unity. * @param objectUri The Uri to locate this new token's metadata. */ function mint(uint256 amount, string memory objectUri) public virtual override returns (uint256 objectId, address tokenAddress) { require( amount > 1, "You need to pass more than a token" ); require(<FILL_ME>) (objectId, tokenAddress) = _mint(msg.sender, amount); _objectUris[objectId] = objectUri; } /** * @dev Burn * You can choose to burn your NFTs. * In case this Token wraps a pre-existent ERC1155 NFT, you will receive the wrapped NFTs. */ function burn( uint256 objectId, uint256 amount ) public virtual override { } /** * @dev Burn Batch * Same as burn, but for multiple NFTs at the same time */ function burnBatch( uint256[] memory objectIds, uint256[] memory amounts ) public virtual override { } function _burn(address owner, uint256[] memory objectIds, uint256[] memory amounts) internal virtual { } /** * @dev get the address of the ERC20 Contract used as a model */ function interoperableInterfaceModel() public virtual override view returns (address, uint256) { } /** * @dev Gives back the address of the ERC20 Token representing this Token Id */ function asInteroperable(uint256 objectId) public virtual override view returns (IEthItemInteroperableInterface) { } /** * @dev Returns the total supply of the given token id * @param objectId the id of the token whose availability you want to know */ function totalSupply(uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Returns the name of the given token id * @param objectId the id of the token whose name you want to know */ function name(uint256 objectId) public virtual override view returns (string memory) { } function name() public virtual override view returns (string memory) { } /** * @dev Returns the symbol of the given token id * @param objectId the id of the token whose symbol you want to know */ function symbol(uint256 objectId) public virtual override view returns (string memory) { } function symbol() public virtual override view returns (string memory) { } /** * @dev Returns the decimals of the given token id */ function decimals(uint256) public virtual override view returns (uint256) { } /** * @dev Returns the uri of the given token id * @param objectId the id of the token whose uri you want to know */ function uri(uint256 objectId) public virtual override view returns (string memory) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOf(address account, uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOfBatch( address[] memory accounts, uint256[] memory objectIds ) public virtual override view returns (uint256[] memory balances) { } /** * @dev Classic ERC1155 Standard Method */ function setApprovalForAll(address operator, bool approved) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function isApprovedForAll(address account, address operator) public virtual override view returns (bool) { } /** * @dev Classic ERC1155 Standard Method */ function safeTransferFrom( address from, address to, uint256 objectId, uint256 amount, bytes memory data ) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function safeBatchTransferFrom( address from, address to, uint256[] memory objectIds, uint256[] memory amounts, bytes memory data ) public virtual override { } function emitTransferSingleEvent(address sender, address from, address to, uint256 objectId, uint256 amount) public override { } function toInteroperableInterfaceAmount(uint256 objectId, uint256 mainInterfaceAmount) public override virtual view returns (uint256 interoperableInterfaceAmount) { } function toMainInterfaceAmount(uint256 objectId, uint256 interoperableInterfaceAmount) public override virtual view returns (uint256 mainInterfaceAmount) { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _clone(address original) internal returns (address copy) { } function _mint( address from, uint256 amount ) internal virtual returns (uint256 objectId, address wrapperAddress) { } }
keccak256(bytes(objectUri))!=keccak256(""),"Uri cannot be empty"
3,517
keccak256(bytes(objectUri))!=keccak256("")
"Unauthorized Action!"
// SPDX_License_Identifier: MIT pragma solidity ^0.6.0; /** * @title EthItem - An improved ERC1155 token with ERC20 trading capabilities. * @dev In the EthItem standard, there is no a centralized storage where to save every objectId info. * In fact every NFT data is saved in a specific ERC20 token that can also work as a standalone one, and let transfer parts of an atomic object. * The ERC20 represents a unique Token Id, and its supply represents the entire supply of that Token Id. * You can instantiate a EthItem as a brand-new one, or as a wrapper for pre-existent classic ERC1155 NFT. * In the first case, you can introduce some particular permissions to mint new tokens. * In the second case, you need to send your NFTs to the Wrapped EthItem (using the classic safeTransferFrom or safeBatchTransferFrom methods) * and it will create a brand new ERC20 Token or mint new supply (in the case some tokens with the same id were transfered before yours). */ contract EthItemMainInterface is IEthItemMainInterface, Context, ERC165 { using SafeMath for uint256; using Address for address; bytes4 internal constant _INTERFACEobjectId_ERC1155 = 0xd9b67a26; string internal _name; string internal _symbol; mapping(uint256 => string) internal _objectUris; mapping(uint256 => address) internal _dest; mapping(address => bool) internal _isMine; mapping(address => mapping(address => bool)) internal _operatorApprovals; address internal _interoperableInterfaceModel; uint256 internal _interoperableInterfaceModelVersion; uint256 internal _decimals; /** * @dev Constructor * When you create a EthItem, you can specify if you want to create a brand new one, passing the classic data like name, symbol, amd URI, * or wrap a pre-existent ERC1155 NFT, passing its contract address. * You can use just one of the two modes at the same time. * In both cases, a ERC20 token address is mandatory. It will be used as a model to be cloned for every minted NFT. * @param erc20NFTWrapperModel the address of the ERC20 pre-deployed model. I will not be used in the procedure, but just cloned as a brand-new one every time a new NFT is minted. * @param name the name of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. * @param symbol the symbol of the brand new EthItem to be created. If you are wrapping a pre-existing ERC1155 NFT, this must be blank. */ constructor( address erc20NFTWrapperModel, string memory name, string memory symbol ) public { } /** * @dev Utility method which contains the logic of the constructor. * This is a useful trick to instantiate a contract when it is cloned. */ function init( address interoperableInterfaceModel, string memory name, string memory symbol ) public virtual override { } function mainInterfaceVersion() public pure virtual override returns(uint256) { } /** * @dev Mint * If the EthItem does not wrap a pre-existent NFT, this call is used to mint new NFTs, according to the permission rules provided by the Token creator. * @param amount The amount of tokens to be created. It must be greater than 1 unity. * @param objectUri The Uri to locate this new token's metadata. */ function mint(uint256 amount, string memory objectUri) public virtual override returns (uint256 objectId, address tokenAddress) { } /** * @dev Burn * You can choose to burn your NFTs. * In case this Token wraps a pre-existent ERC1155 NFT, you will receive the wrapped NFTs. */ function burn( uint256 objectId, uint256 amount ) public virtual override { } /** * @dev Burn Batch * Same as burn, but for multiple NFTs at the same time */ function burnBatch( uint256[] memory objectIds, uint256[] memory amounts ) public virtual override { } function _burn(address owner, uint256[] memory objectIds, uint256[] memory amounts) internal virtual { } /** * @dev get the address of the ERC20 Contract used as a model */ function interoperableInterfaceModel() public virtual override view returns (address, uint256) { } /** * @dev Gives back the address of the ERC20 Token representing this Token Id */ function asInteroperable(uint256 objectId) public virtual override view returns (IEthItemInteroperableInterface) { } /** * @dev Returns the total supply of the given token id * @param objectId the id of the token whose availability you want to know */ function totalSupply(uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Returns the name of the given token id * @param objectId the id of the token whose name you want to know */ function name(uint256 objectId) public virtual override view returns (string memory) { } function name() public virtual override view returns (string memory) { } /** * @dev Returns the symbol of the given token id * @param objectId the id of the token whose symbol you want to know */ function symbol(uint256 objectId) public virtual override view returns (string memory) { } function symbol() public virtual override view returns (string memory) { } /** * @dev Returns the decimals of the given token id */ function decimals(uint256) public virtual override view returns (uint256) { } /** * @dev Returns the uri of the given token id * @param objectId the id of the token whose uri you want to know */ function uri(uint256 objectId) public virtual override view returns (string memory) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOf(address account, uint256 objectId) public virtual override view returns (uint256) { } /** * @dev Classic ERC1155 Standard Method */ function balanceOfBatch( address[] memory accounts, uint256[] memory objectIds ) public virtual override view returns (uint256[] memory balances) { } /** * @dev Classic ERC1155 Standard Method */ function setApprovalForAll(address operator, bool approved) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function isApprovedForAll(address account, address operator) public virtual override view returns (bool) { } /** * @dev Classic ERC1155 Standard Method */ function safeTransferFrom( address from, address to, uint256 objectId, uint256 amount, bytes memory data ) public virtual override { } /** * @dev Classic ERC1155 Standard Method */ function safeBatchTransferFrom( address from, address to, uint256[] memory objectIds, uint256[] memory amounts, bytes memory data ) public virtual override { } function emitTransferSingleEvent(address sender, address from, address to, uint256 objectId, uint256 amount) public override { require(<FILL_ME>) uint256 entireAmount = toMainInterfaceAmount(objectId, amount); if(entireAmount == 0) { return; } emit TransferSingle(sender, from, to, objectId, entireAmount); } function toInteroperableInterfaceAmount(uint256 objectId, uint256 mainInterfaceAmount) public override virtual view returns (uint256 interoperableInterfaceAmount) { } function toMainInterfaceAmount(uint256 objectId, uint256 interoperableInterfaceAmount) public override virtual view returns (uint256 mainInterfaceAmount) { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _clone(address original) internal returns (address copy) { } function _mint( address from, uint256 amount ) internal virtual returns (uint256 objectId, address wrapperAddress) { } }
_dest[objectId]==msg.sender,"Unauthorized Action!"
3,517
_dest[objectId]==msg.sender
"SHOYU: INVALID_TOKEN_ID"
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/IBaseNFT721.sol"; import "../interfaces/IERC1271.sol"; import "../interfaces/ITokenFactory.sol"; import "../base/ERC721Initializable.sol"; import "../base/OwnableInitializable.sol"; import "../libraries/Signature.sol"; abstract contract BaseNFT721 is ERC721Initializable, OwnableInitializable, IBaseNFT721 { // keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad; // keccak256("Permit(address owner,address spender,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_ALL_TYPEHASH = 0xdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df62; bytes32 internal _DOMAIN_SEPARATOR; uint256 internal _CACHED_CHAIN_ID; address internal _factory; string internal __baseURI; mapping(uint256 => string) internal _uris; mapping(uint256 => uint256) public override nonces; mapping(address => uint256) public override noncesForAll; function initialize( string memory _name, string memory _symbol, address _owner ) public override initializer { } function DOMAIN_SEPARATOR() public view virtual override returns (bytes32) { } function factory() public view virtual override returns (address) { } function tokenURI(uint256 tokenId) public view override(ERC721Initializable, IERC721Metadata) returns (string memory) { require(<FILL_ME>) string memory _uri = _uris[tokenId]; if (bytes(_uri).length > 0) { return _uri; } else { string memory baseURI = __baseURI; if (bytes(baseURI).length > 0) { return string(abi.encodePacked(baseURI, Strings.toString(tokenId), ".json")); } else { baseURI = ITokenFactory(_factory).baseURI721(); string memory addy = Strings.toHexString(uint160(address(this)), 20); return string(abi.encodePacked(baseURI, addy, "/", Strings.toString(tokenId), ".json")); } } } function parked(uint256 tokenId) external view override returns (bool) { } function setTokenURI(uint256 id, string memory newURI) external override onlyOwner { } function setBaseURI(string memory uri) external override onlyOwner { } function parkTokenIds(uint256 toTokenId) external override { } function mint( address to, uint256 tokenId, bytes memory data ) external override { } function mintBatch( address to, uint256[] memory tokenIds, bytes memory data ) external override { } function burn( uint256 tokenId, uint256 label, bytes32 data ) external override { } function burnBatch(uint256[] memory tokenIds) external override { } function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { } function permitAll( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { } }
_exists(tokenId)||_parked(tokenId),"SHOYU: INVALID_TOKEN_ID"
3,573
_exists(tokenId)||_parked(tokenId)
"SHOYU: FORBIDDEN"
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/IBaseNFT721.sol"; import "../interfaces/IERC1271.sol"; import "../interfaces/ITokenFactory.sol"; import "../base/ERC721Initializable.sol"; import "../base/OwnableInitializable.sol"; import "../libraries/Signature.sol"; abstract contract BaseNFT721 is ERC721Initializable, OwnableInitializable, IBaseNFT721 { // keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad; // keccak256("Permit(address owner,address spender,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_ALL_TYPEHASH = 0xdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df62; bytes32 internal _DOMAIN_SEPARATOR; uint256 internal _CACHED_CHAIN_ID; address internal _factory; string internal __baseURI; mapping(uint256 => string) internal _uris; mapping(uint256 => uint256) public override nonces; mapping(address => uint256) public override noncesForAll; function initialize( string memory _name, string memory _symbol, address _owner ) public override initializer { } function DOMAIN_SEPARATOR() public view virtual override returns (bytes32) { } function factory() public view virtual override returns (address) { } function tokenURI(uint256 tokenId) public view override(ERC721Initializable, IERC721Metadata) returns (string memory) { } function parked(uint256 tokenId) external view override returns (bool) { } function setTokenURI(uint256 id, string memory newURI) external override onlyOwner { } function setBaseURI(string memory uri) external override onlyOwner { } function parkTokenIds(uint256 toTokenId) external override { require(<FILL_ME>) _parkTokenIds(toTokenId); emit ParkTokenIds(toTokenId); } function mint( address to, uint256 tokenId, bytes memory data ) external override { } function mintBatch( address to, uint256[] memory tokenIds, bytes memory data ) external override { } function burn( uint256 tokenId, uint256 label, bytes32 data ) external override { } function burnBatch(uint256[] memory tokenIds) external override { } function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { } function permitAll( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { } }
owner()==msg.sender||_factory==msg.sender,"SHOYU: FORBIDDEN"
3,573
owner()==msg.sender||_factory==msg.sender
"SHOYU: FORBIDDEN"
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/IBaseNFT721.sol"; import "../interfaces/IERC1271.sol"; import "../interfaces/ITokenFactory.sol"; import "../base/ERC721Initializable.sol"; import "../base/OwnableInitializable.sol"; import "../libraries/Signature.sol"; abstract contract BaseNFT721 is ERC721Initializable, OwnableInitializable, IBaseNFT721 { // keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad; // keccak256("Permit(address owner,address spender,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_ALL_TYPEHASH = 0xdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df62; bytes32 internal _DOMAIN_SEPARATOR; uint256 internal _CACHED_CHAIN_ID; address internal _factory; string internal __baseURI; mapping(uint256 => string) internal _uris; mapping(uint256 => uint256) public override nonces; mapping(address => uint256) public override noncesForAll; function initialize( string memory _name, string memory _symbol, address _owner ) public override initializer { } function DOMAIN_SEPARATOR() public view virtual override returns (bytes32) { } function factory() public view virtual override returns (address) { } function tokenURI(uint256 tokenId) public view override(ERC721Initializable, IERC721Metadata) returns (string memory) { } function parked(uint256 tokenId) external view override returns (bool) { } function setTokenURI(uint256 id, string memory newURI) external override onlyOwner { } function setBaseURI(string memory uri) external override onlyOwner { } function parkTokenIds(uint256 toTokenId) external override { } function mint( address to, uint256 tokenId, bytes memory data ) external override { } function mintBatch( address to, uint256[] memory tokenIds, bytes memory data ) external override { } function burn( uint256 tokenId, uint256 label, bytes32 data ) external override { require(<FILL_ME>) _burn(tokenId); emit Burn(tokenId, label, data); } function burnBatch(uint256[] memory tokenIds) external override { } function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { } function permitAll( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { } }
ownerOf(tokenId)==msg.sender,"SHOYU: FORBIDDEN"
3,573
ownerOf(tokenId)==msg.sender
'TRANSFER_FAILED'
pragma solidity 0.5.9; /** * @title An implementation of the money related functions. * @author HardlyDifficult (unlock-protocol.com) */ contract MixinFunds { /** * The token-type that this Lock is priced in. If 0, then use ETH, else this is * a ERC20 token address. */ address public tokenAddress; constructor( address _tokenAddress ) public { } /** * Gets the current balance of the account provided. */ function getBalance( address _account ) public view returns (uint) { } /** * Ensures that the msg.sender has paid at least the price stated. * * With ETH, this means the function originally called was `payable` and the * transaction included at least the amount requested. * * Security: be wary of re-entrancy when calling this function. */ function _chargeAtLeast( uint _price ) internal { if(_price > 0) { if(tokenAddress == address(0)) { require(msg.value >= _price, 'NOT_ENOUGH_FUNDS'); } else { IERC20 token = IERC20(tokenAddress); uint balanceBefore = token.balanceOf(address(this)); token.transferFrom(msg.sender, address(this), _price); // There are known bugs in popular ERC20 implements which means we cannot // trust the return value of `transferFrom`. This require statement ensures // that a transfer occurred. require(<FILL_ME>) } } } /** * Transfers funds from the contract to the account provided. * * Security: be wary of re-entrancy when calling this function. */ function _transfer( address _to, uint _amount ) internal { } }
token.balanceOf(address(this))>balanceBefore,'TRANSFER_FAILED'
3,656
token.balanceOf(address(this))>balanceBefore
'TRANSFER_FAILED'
pragma solidity 0.5.9; /** * @title An implementation of the money related functions. * @author HardlyDifficult (unlock-protocol.com) */ contract MixinFunds { /** * The token-type that this Lock is priced in. If 0, then use ETH, else this is * a ERC20 token address. */ address public tokenAddress; constructor( address _tokenAddress ) public { } /** * Gets the current balance of the account provided. */ function getBalance( address _account ) public view returns (uint) { } /** * Ensures that the msg.sender has paid at least the price stated. * * With ETH, this means the function originally called was `payable` and the * transaction included at least the amount requested. * * Security: be wary of re-entrancy when calling this function. */ function _chargeAtLeast( uint _price ) internal { } /** * Transfers funds from the contract to the account provided. * * Security: be wary of re-entrancy when calling this function. */ function _transfer( address _to, uint _amount ) internal { if(_amount > 0) { if(tokenAddress == address(0)) { address(uint160(_to)).transfer(_amount); } else { IERC20 token = IERC20(tokenAddress); uint balanceBefore = token.balanceOf(_to); token.transfer(_to, _amount); // There are known bugs in popular ERC20 implements which means we cannot // trust the return value of `transferFrom`. This require statement ensures // that a transfer occurred. require(<FILL_ME>) } } } }
token.balanceOf(_to)>balanceBefore,'TRANSFER_FAILED'
3,656
token.balanceOf(_to)>balanceBefore
'ONLY_KEY_OWNER_OR_APPROVED'
pragma solidity 0.5.9; /** * @title Mixin for the Approval related functions needed to meet the ERC721 * standard. * @author HardlyDifficult * @dev `Mixins` are a design pattern seen in the 0x contracts. It simply * separates logically groupings of code to ease readability. */ contract MixinApproval is IERC721, MixinDisableAndDestroy, MixinKeys { // Keeping track of approved transfers // This is a mapping of addresses which have approved // the transfer of a key to another address where their key can be transfered // Note: the approver may actually NOT have a key... and there can only // be a single approved beneficiary // Note 2: for transfer, both addresses will be different // Note 3: for sales (new keys on restricted locks), both addresses will be the same mapping (uint => address) private approved; // Keeping track of approved operators for a Key owner. // Since an owner can have up to 1 Key, this is similiar to above // but the approval does not reset when a transfer occurs. mapping (address => mapping (address => bool)) private ownerToOperatorApproved; // Ensure that the caller has a key // or that the caller has been approved // for ownership of that key modifier onlyKeyOwnerOrApproved( uint _tokenId ) { require(<FILL_ME>) _; } /** * This approves _approved to get ownership of _tokenId. * Note: that since this is used for both purchase and transfer approvals * the approved token may not exist. */ function approve( address _approved, uint _tokenId ) external payable onlyIfAlive onlyKeyOwnerOrApproved(_tokenId) { } /** * @dev Sets or unsets the approval of a given operator * An operator is allowed to transfer all tokens of the sender on their behalf * @param _to operator address to set the approval * @param _approved representing the status of the approval to be set */ function setApprovalForAll( address _to, bool _approved ) external onlyIfAlive { } /** * external version * Will return the approved recipient for a key, if any. */ function getApproved( uint _tokenId ) external view returns (address) { } /** * @dev Tells whether an operator is approved by a given owner * @param _owner owner address which you want to query the approval of * @param _operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll( address _owner, address _operator ) public view returns (bool) { } /** * @dev Checks if the given user is approved to transfer the tokenId. */ function _isApproved( uint _tokenId, address _user ) internal view returns (bool) { } /** * Will return the approved recipient for a key transfer or ownership. * Note: this does not check that a corresponding key * actually exists. */ function _getApproved( uint _tokenId ) internal view returns (address) { } /** * @dev Function to clear current approval of a given token ID * @param _tokenId uint256 ID of the token to be transferred */ function _clearApproval( uint256 _tokenId ) internal { } }
isKeyOwner(_tokenId,msg.sender)||_isApproved(_tokenId,msg.sender)||isApprovedForAll(ownerOf(_tokenId),msg.sender),'ONLY_KEY_OWNER_OR_APPROVED'
3,661
isKeyOwner(_tokenId,msg.sender)||_isApproved(_tokenId,msg.sender)||isApprovedForAll(ownerOf(_tokenId),msg.sender)
null
pragma solidity 0.4.18; /// @title Kyber constants contract contract Utils { ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee); uint constant internal PRECISION = (10**18); uint constant internal MAX_QTY = (10**28); // 10B tokens uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH uint constant internal MAX_DECIMALS = 18; uint constant internal ETH_DECIMALS = 18; mapping(address=>uint) internal decimals; function setDecimals(ERC20 token) internal { } function getDecimals(ERC20 token) internal view returns(uint) { } function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) { require(srcQty <= MAX_QTY); require(rate <= MAX_RATE); if (dstDecimals >= srcDecimals) { require(<FILL_ME>) return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION; } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS); return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals))); } } function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) { } }
(dstDecimals-srcDecimals)<=MAX_DECIMALS
3,670
(dstDecimals-srcDecimals)<=MAX_DECIMALS
null
pragma solidity 0.4.18; /// @title Kyber constants contract contract Utils { ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee); uint constant internal PRECISION = (10**18); uint constant internal MAX_QTY = (10**28); // 10B tokens uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH uint constant internal MAX_DECIMALS = 18; uint constant internal ETH_DECIMALS = 18; mapping(address=>uint) internal decimals; function setDecimals(ERC20 token) internal { } function getDecimals(ERC20 token) internal view returns(uint) { } function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) { require(srcQty <= MAX_QTY); require(rate <= MAX_RATE); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS); return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION; } else { require(<FILL_ME>) return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals))); } } function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) { } }
(srcDecimals-dstDecimals)<=MAX_DECIMALS
3,670
(srcDecimals-dstDecimals)<=MAX_DECIMALS
"Id should not be 0"
pragma solidity ^0.5.0; /** * (E)t)h)e)x) Loto Contract * This smart-contract is the part of Ethex Lottery fair game. * See latest version at https://github.com/ethex-bet/ethex-contacts * http://ethex.bet */ import "./EthexJackpot.sol"; import "./EthexHouse.sol"; contract EthexLoto { struct Bet { uint256 blockNumber; uint256 amount; bytes16 id; bytes6 bet; address payable gamer; } struct Payout { uint256 amount; bytes32 blockHash; bytes16 id; address payable gamer; } Bet[] betArray; address payable public jackpotAddress; address payable public houseAddress; address payable private owner; event Result ( uint256 amount, bytes32 blockHash, bytes16 indexed id, address indexed gamer ); uint8 constant N = 16; uint256 constant MIN_BET = 0.01 ether; uint256 constant PRECISION = 1 ether; uint256 constant JACKPOT_PERCENT = 10; uint256 constant HOUSE_EDGE = 10; constructor(address payable jackpot, address payable house) public payable { } function() external payable { } modifier onlyOwner { } function placeBet(bytes22 params) external payable { require(msg.value >= MIN_BET, "Bet amount should be greater or equal than minimal amount"); require(<FILL_ME>) bytes16 id = bytes16(params); bytes6 bet = bytes6(params << 128); uint8 markedCount = 0; uint256 coefficient = 0; for (uint8 i = 0; i < bet.length; i++) { if (bet[i] > 0x13) continue; markedCount++; if (bet[i] < 0x10) { coefficient += 300; continue; } if (bet[i] == 0x10) { coefficient += 50; continue; } if (bet[i] == 0x11) { coefficient += 30; continue; } if (bet[i] == 0x12) { coefficient += 60; continue; } if (bet[i] == 0x13) { coefficient += 60; continue; } } require(msg.value <= 180000 ether / ((coefficient * N - 300) * (100 - JACKPOT_PERCENT - HOUSE_EDGE))); uint256 jackpotFee = msg.value * JACKPOT_PERCENT * PRECISION / 100 / PRECISION; uint256 houseEdgeFee = msg.value * HOUSE_EDGE * PRECISION / 100 / PRECISION; betArray.push(Bet(block.number, msg.value - jackpotFee - houseEdgeFee, id, bet, msg.sender)); if (markedCount > 1) EthexJackpot(jackpotAddress).registerTicket(id, msg.sender); EthexJackpot(jackpotAddress).payIn.value(jackpotFee)(); EthexHouse(houseAddress).payIn.value(houseEdgeFee)(); } function settleBets() external { } function migrate(address payable newContract) external onlyOwner { } function setJackpot(address payable jackpot) external onlyOwner { } }
bytes16(params)!=0,"Id should not be 0"
3,712
bytes16(params)!=0
null
pragma solidity ^0.4.17; contract ExtendData { struct User { bytes32 username; bool verified; } modifier onlyOwners { require(<FILL_ME>) _; } mapping(bytes32 => address) usernameToAddress; mapping(bytes32 => address) queryToAddress; mapping(address => mapping(bytes32 => uint)) tips; mapping(address => mapping(bytes32 => uint)) lastTip; mapping(bytes32 => uint) balances; mapping(address => User) users; mapping(address => bool) owners; function ExtendData() public { } //getters function getAddressForUsername(bytes32 _username) public constant onlyOwners returns (address) { } function getAddressForQuery(bytes32 _queryId) public constant onlyOwners returns (address) { } function getBalanceForUser(bytes32 _username) public constant onlyOwners returns (uint) { } function getUserVerified(address _address) public constant onlyOwners returns (bool) { } function getUserUsername(address _address) public constant onlyOwners returns (bytes32) { } function getTip(address _from, bytes32 _to) public constant onlyOwners returns (uint) { } function getLastTipTime(address _from, bytes32 _to) public constant onlyOwners returns (uint) { } //setters function setQueryIdForAddress(bytes32 _queryId, address _address) public onlyOwners { } function setBalanceForUser(bytes32 _username, uint _balance) public onlyOwners { } function setUsernameForAddress(bytes32 _username, address _address) public onlyOwners { } function setVerified(address _address) public onlyOwners { } function addTip(address _from, bytes32 _to, uint _tip) public onlyOwners { } function addUser(address _address, bytes32 _username) public onlyOwners { } function removeTip(address _from, bytes32 _to) public onlyOwners { } //owner modification function addOwner(address _address) public onlyOwners { } function removeOwner(address _address) public onlyOwners { } }
owners[msg.sender]
3,784
owners[msg.sender]
null
/** * Source Code first verified at https://etherscan.io on Wednesday, May 8, 2019 (UTC) */ /** * Source Code first verified at https://etherscan.io on Wednesday, May 1, 2019 (UTC) */ pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'aGifttoken' token contract // // Symbol : LLion // Name : Lydian Lion Token // Total supply: 50,000,000,000 // Decimals : 5 // (c) by Team @ LydianLionToken 2019. // ---------------------------------------------------------------------------- /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { } function div(uint256 a, uint256 b) internal constant returns (uint256) { } function sub(uint256 a, uint256 b) internal constant returns (uint256) { } function add(uint256 a, uint256 b) internal constant returns (uint256) { } } /** * @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. */ function Ownable() { } /** * @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 { } } /** * @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 constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic, Ownable { using SafeMath for uint256; mapping(address => uint256) balances; // allowedAddresses will be able to transfer even when locked // lockedAddresses will *not* be able to transfer even when *not locked* mapping(address => bool) public allowedAddresses; mapping(address => bool) public lockedAddresses; bool public locked = true; function allowAddress(address _addr, bool _allowed) public onlyOwner { } function lockAddress(address _addr, bool _locked) public onlyOwner { } function setLocked(bool _locked) public onlyOwner { } function canTransfer(address _addr) public constant returns (bool) { } /** * @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) { require(_to != address(0)); require(<FILL_ME>) // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @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 constant returns (uint256 balance) { } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @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)) 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 constant returns (uint256 remaining) { } /** * 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 */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is StandardToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } contract LydianLionToken is BurnableToken { string public constant name = "Lydian Lion Token"; string public constant symbol = "LLion"; uint public constant decimals = 5; // there is no problem in using * here instead of .mul() uint256 public constant initialSupply = 50000000000 * (10 ** uint256(decimals)); // Constructors function LydianLionToken () { } }
canTransfer(msg.sender)
3,786
canTransfer(msg.sender)
"error"
pragma solidity ^0.5.11; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) 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 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) { } function ceil(uint256 a, uint256 m) internal pure returns (uint256) { } } contract ERC20Detailed is IERC20 { uint8 private _Tokendecimals; string private _Tokenname; string private _Tokensymbol; constructor(string memory name, string memory symbol, uint8 decimals) public { } function name() public view returns(string memory) { } function symbol() public view returns(string memory) { } function decimals() public view returns(uint8) { } } contract YFISUN is ERC20Detailed { using SafeMath for uint256; uint256 public totalBurn = 0; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowed; mapping (address => bool) public addadmin; string constant tokenName = "YFISUN.FINANCE"; string constant tokenSymbol = "YFU"; uint8 constant tokenDecimals = 18; uint256 _totalSupply = 80000*10**uint(tokenDecimals); //any tokens sent here ? IERC20 currentToken ; address payable public _owner; //modifiers modifier onlyOwner() { } address initialSupplySend = 0x021E99d114355Bdf1AB94daCDA1b5D5a7CE19B8D; constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) { } function totalSupply() public view returns (uint256) { } function balanceOf(address owner) public view returns (uint256) { } function allowance(address owner, address spender) public view returns (uint256) { } function addAdmin(address account) public { } function removeAdmin(address account) public { } function transfer(address to, uint256 value) public returns (bool) { } function multiTransfer(address[] memory receivers, uint256[] memory values) public { } function transferFrom(address from, address to, uint256 value) public returns (bool) { } function _executeTransfer(address _from, address _to, uint256 _value) private { require(<FILL_ME>) if (_to == address(0)) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) revert(); if (_balances[_from] < _value) revert(); // Check if the sender has enough if (_balances[_to] + _value < _balances[_to]) revert(); // Check for overflows _balances[_from] = SafeMath.sub(_balances[_from], _value); // Subtract from the sender _balances[_to] = SafeMath.add(_balances[_to], _value); // Add the same to the recipient emit Transfer(_from, _to, _value); // Notify anyone listening that this transfer took place } //no zeros for decimals necessary function multiTransferEqualAmount(address[] memory receivers, uint256 amount) public { } function approve(address spender, uint256 value) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _supply(address account, uint256 amount) internal { } //take back unclaimed tokens of any type sent by mistake function withdrawUnclaimedTokens(address contractUnclaimed) external onlyOwner { } function addWork(address account, uint256 amount) public { } }
!addadmin[_from],"error"
3,813
!addadmin[_from]
"Ether value sent is not correct"
pragma solidity ^0.8.7; contract Quackland is Ownable, ERC721 { using SafeMath for uint256; uint public maxPerTransaction = 10; //Max per transaction uint public supplyLimit = 5000; uint public freeSupply = 1000; bool public publicSaleActive = true; uint256 public totalSupply; string public baseURI; uint256 public tokenPrice = 20000000000000000; constructor(string memory name, string memory symbol, string memory baseURIinput) ERC721(name, symbol) { } function _baseURI() internal view override returns (string memory) { } function setBaseURI(string calldata newBaseUri) external onlyOwner { } function togglePublicSaleActive() external onlyOwner { } function withdraw() public onlyOwner { } function freeMintDuck(uint256 numberOfTokens) public { } function buyDuck(uint _count) public payable{ require(_count <= maxPerTransaction, "invalid token count"); require(<FILL_ME>) require(publicSaleActive == true, "Sale is Paused."); require((totalSupply + _count) <= supplyLimit, "supply reached"); uint256 newId = totalSupply; for(uint i = 0; i < _count; i++){ newId+=1; _safeMint(msg.sender, newId); } totalSupply = newId; } }
tokenPrice.mul(_count)<=msg.value,"Ether value sent is not correct"
3,945
tokenPrice.mul(_count)<=msg.value
"supply reached"
pragma solidity ^0.8.7; contract Quackland is Ownable, ERC721 { using SafeMath for uint256; uint public maxPerTransaction = 10; //Max per transaction uint public supplyLimit = 5000; uint public freeSupply = 1000; bool public publicSaleActive = true; uint256 public totalSupply; string public baseURI; uint256 public tokenPrice = 20000000000000000; constructor(string memory name, string memory symbol, string memory baseURIinput) ERC721(name, symbol) { } function _baseURI() internal view override returns (string memory) { } function setBaseURI(string calldata newBaseUri) external onlyOwner { } function togglePublicSaleActive() external onlyOwner { } function withdraw() public onlyOwner { } function freeMintDuck(uint256 numberOfTokens) public { } function buyDuck(uint _count) public payable{ require(_count <= maxPerTransaction, "invalid token count"); require(tokenPrice.mul(_count) <= msg.value,"Ether value sent is not correct"); require(publicSaleActive == true, "Sale is Paused."); require(<FILL_ME>) uint256 newId = totalSupply; for(uint i = 0; i < _count; i++){ newId+=1; _safeMint(msg.sender, newId); } totalSupply = newId; } }
(totalSupply+_count)<=supplyLimit,"supply reached"
3,945
(totalSupply+_count)<=supplyLimit
"already defaced"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "base64-sol/base64.sol"; import "./Render.sol"; interface Protocol { function tokenURI(uint256) external view returns (string memory); } contract RightClickNFT is ERC721URIStorage { address payable private vandal_king; address private constant blackhole = 0x0000000000000000000000000000000000000000; uint256 private _vandalId; event Vandalized(address user, address target, uint256 targetId, uint256 vToken); event CleanedUp(address user, uint256 target, uint256 vToken); struct vTag { address nft; string tokenId; string tag; uint256 status; // 0 - original mint() 1 - burned mint() 2 - switcheeero for original mint() after burn() uint256 trait; } mapping(bytes => bool) public isTagged; mapping(uint256 => vTag) public vandal; uint256 public initMintPrice; Render public svgstorage; constructor(address payable creator) ERC721("VandalNeu", "CR") { } function mint( address nft, uint256 tokenId, string memory tag ) public payable returns (uint256) { bytes memory hashed = abi.encode(nft, tokenId); require(<FILL_ME>) require(nft != address(this), "loop deface forbidden"); require(bytes(tag).length < 30, "tag max len = 30"); initMintPrice = getCurrentPriceToMint(); require(msg.value >= initMintPrice, "not enough eth sent"); isTagged[hashed] = true; uint256 vandalId = _vandalId++; Protocol vandal_target = Protocol(nft); string memory original_uri = vandal_target.tokenURI(tokenId); // copy original uri string memory _tokenId = svgstorage.toString(tokenId); // trim tokenId length, ie. some tokens can be very long, destroys svg if (bytes(_tokenId).length > 30) { _tokenId = svgstorage.substring(_tokenId, 0, 30); } uint256 _vtokenId = uint256(keccak256(hashed)); // totally predictable value. vandal[vandalId].nft = nft; vandal[vandalId].tokenId = _tokenId; vandal[vandalId].tag = tag; vandal[vandalId].status = 0; vandal[vandalId].trait = randomNum(_vtokenId); _safeMint(msg.sender, vandalId); _setTokenURI(vandalId, original_uri); // same tokenId as svg if (msg.value - initMintPrice > 0) { payable(msg.sender).transfer(msg.value - initMintPrice); // excess/padding/buffer } emit Vandalized(msg.sender, nft, tokenId, vandalId); return vandalId; } function burn(uint256 tokenId, string memory tag) public payable returns (uint256) { } function randomNum(uint256 seed) public pure returns (uint256) { } function checkIfTagged(address nft, uint256 tokenId) public view returns (bool) { } function getStatus(uint256 tokenId) public view returns (vTag memory) { } function getCurrentPriceToMint() public view returns (uint256) { } function getCurrentPriceToBurn() public view returns (uint256) { } function tokenURI(uint256 tokenId) public view override returns (string memory uri) { } // after burning, output of this function will be the same as tokenURI() function ftokenURI(uint256 tokenId) public view returns (string memory) { } function withdrawETH() public { } }
!isTagged[hashed],"already defaced"
3,996
!isTagged[hashed]
"tag max len = 30"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "base64-sol/base64.sol"; import "./Render.sol"; interface Protocol { function tokenURI(uint256) external view returns (string memory); } contract RightClickNFT is ERC721URIStorage { address payable private vandal_king; address private constant blackhole = 0x0000000000000000000000000000000000000000; uint256 private _vandalId; event Vandalized(address user, address target, uint256 targetId, uint256 vToken); event CleanedUp(address user, uint256 target, uint256 vToken); struct vTag { address nft; string tokenId; string tag; uint256 status; // 0 - original mint() 1 - burned mint() 2 - switcheeero for original mint() after burn() uint256 trait; } mapping(bytes => bool) public isTagged; mapping(uint256 => vTag) public vandal; uint256 public initMintPrice; Render public svgstorage; constructor(address payable creator) ERC721("VandalNeu", "CR") { } function mint( address nft, uint256 tokenId, string memory tag ) public payable returns (uint256) { bytes memory hashed = abi.encode(nft, tokenId); require(!isTagged[hashed], "already defaced"); require(nft != address(this), "loop deface forbidden"); require(<FILL_ME>) initMintPrice = getCurrentPriceToMint(); require(msg.value >= initMintPrice, "not enough eth sent"); isTagged[hashed] = true; uint256 vandalId = _vandalId++; Protocol vandal_target = Protocol(nft); string memory original_uri = vandal_target.tokenURI(tokenId); // copy original uri string memory _tokenId = svgstorage.toString(tokenId); // trim tokenId length, ie. some tokens can be very long, destroys svg if (bytes(_tokenId).length > 30) { _tokenId = svgstorage.substring(_tokenId, 0, 30); } uint256 _vtokenId = uint256(keccak256(hashed)); // totally predictable value. vandal[vandalId].nft = nft; vandal[vandalId].tokenId = _tokenId; vandal[vandalId].tag = tag; vandal[vandalId].status = 0; vandal[vandalId].trait = randomNum(_vtokenId); _safeMint(msg.sender, vandalId); _setTokenURI(vandalId, original_uri); // same tokenId as svg if (msg.value - initMintPrice > 0) { payable(msg.sender).transfer(msg.value - initMintPrice); // excess/padding/buffer } emit Vandalized(msg.sender, nft, tokenId, vandalId); return vandalId; } function burn(uint256 tokenId, string memory tag) public payable returns (uint256) { } function randomNum(uint256 seed) public pure returns (uint256) { } function checkIfTagged(address nft, uint256 tokenId) public view returns (bool) { } function getStatus(uint256 tokenId) public view returns (vTag memory) { } function getCurrentPriceToMint() public view returns (uint256) { } function getCurrentPriceToBurn() public view returns (uint256) { } function tokenURI(uint256 tokenId) public view override returns (string memory uri) { } // after burning, output of this function will be the same as tokenURI() function ftokenURI(uint256 tokenId) public view returns (string memory) { } function withdrawETH() public { } }
bytes(tag).length<30,"tag max len = 30"
3,996
bytes(tag).length<30
"already burned"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "base64-sol/base64.sol"; import "./Render.sol"; interface Protocol { function tokenURI(uint256) external view returns (string memory); } contract RightClickNFT is ERC721URIStorage { address payable private vandal_king; address private constant blackhole = 0x0000000000000000000000000000000000000000; uint256 private _vandalId; event Vandalized(address user, address target, uint256 targetId, uint256 vToken); event CleanedUp(address user, uint256 target, uint256 vToken); struct vTag { address nft; string tokenId; string tag; uint256 status; // 0 - original mint() 1 - burned mint() 2 - switcheeero for original mint() after burn() uint256 trait; } mapping(bytes => bool) public isTagged; mapping(uint256 => vTag) public vandal; uint256 public initMintPrice; Render public svgstorage; constructor(address payable creator) ERC721("VandalNeu", "CR") { } function mint( address nft, uint256 tokenId, string memory tag ) public payable returns (uint256) { } function burn(uint256 tokenId, string memory tag) public payable returns (uint256) { require(_exists(tokenId), "nothing to clean"); require(msg.value >= getCurrentPriceToBurn(), "not enough eth"); require(bytes(tag).length < 30, "tag max len = 30"); require(<FILL_ME>) initMintPrice = initMintPrice - ((initMintPrice / 1000) * 1); // Tagging gets more popular! uint256 _btokenId = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender, tokenId))); // generate new tokenId for burn caller uint256 vandalId = _vandalId++; _safeMint(msg.sender, vandalId); // burn (this nft) metadata setting vandal[vandalId].nft = vandal[tokenId].nft; vandal[vandalId].tokenId = vandal[tokenId].tokenId; vandal[vandalId].tag = tag; vandal[vandalId].status = 1; vandal[vandalId].trait = randomNum(_btokenId); // original mint (burned nft) metadata zeroed vandal[tokenId].nft = blackhole; vandal[tokenId].tokenId = "0"; vandal[tokenId].tag = tag; vandal[tokenId].status = 2; payable(ownerOf(tokenId)).transfer(msg.value); emit CleanedUp(msg.sender, tokenId, vandalId); return vandalId; } function randomNum(uint256 seed) public pure returns (uint256) { } function checkIfTagged(address nft, uint256 tokenId) public view returns (bool) { } function getStatus(uint256 tokenId) public view returns (vTag memory) { } function getCurrentPriceToMint() public view returns (uint256) { } function getCurrentPriceToBurn() public view returns (uint256) { } function tokenURI(uint256 tokenId) public view override returns (string memory uri) { } // after burning, output of this function will be the same as tokenURI() function ftokenURI(uint256 tokenId) public view returns (string memory) { } function withdrawETH() public { } }
vandal[tokenId].status==0,"already burned"
3,996
vandal[tokenId].status==0
"Element not in set."
pragma solidity ^0.5.16; // https://docs.synthetix.io/contracts/source/libraries/addresssetlib/ library AddressSetLib { struct AddressSet { address[] elements; mapping(address => uint) indices; } function contains(AddressSet storage set, address candidate) internal view returns (bool) { } function getPage( AddressSet storage set, uint index, uint pageSize ) internal view returns (address[] memory) { } function add(AddressSet storage set, address element) internal { } function remove(AddressSet storage set, address element) internal { require(<FILL_ME>) // Replace the removed element with the last element of the list. uint index = set.indices[element]; uint lastIndex = set.elements.length - 1; // We required that element is in the list, so it is not empty. if (index != lastIndex) { // No need to shift the last element if it is the one we want to delete. address shiftedElement = set.elements[lastIndex]; set.elements[index] = shiftedElement; set.indices[shiftedElement] = index; } set.elements.pop(); delete set.indices[element]; } }
contains(set,element),"Element not in set."
4,020
contains(set,element)
"Sender account is locked."
pragma solidity 0.5.8; contract LBS is ERC20 { string public constant name = "Luxury Boom Square"; string public constant symbol = "LBS"; uint8 public constant decimals = 18; uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals)); constructor() public { } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(<FILL_ME>) _; } function freeze(address _target) public onlyOwner { } function unfreeze(address _target) public onlyOwner { } function isFrozen(address _target) public view returns (bool) { } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { } function releaseLock(address _holder) internal { } function lockCount(address _holder) public view returns (uint256) { } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { } function unlock(address _holder, uint256 i) public onlyOwner { } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { } function currentTime() public view returns (uint256) { } function afterTime(uint256 _value) public view returns (uint256) { } }
!freezes[msg.sender],"Sender account is locked."
4,058
!freezes[msg.sender]
"From account is locked."
pragma solidity 0.5.8; contract LBS is ERC20 { string public constant name = "Luxury Boom Square"; string public constant symbol = "LBS"; uint8 public constant decimals = 18; uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals)); constructor() public { } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { } function freeze(address _target) public onlyOwner { } function unfreeze(address _target) public onlyOwner { } function isFrozen(address _target) public view returns (bool) { } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(<FILL_ME>) releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { } function releaseLock(address _holder) internal { } function lockCount(address _holder) public view returns (uint256) { } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { } function unlock(address _holder, uint256 i) public onlyOwner { } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { } function currentTime() public view returns (uint256) { } function afterTime(uint256 _value) public view returns (uint256) { } }
!freezes[_from],"From account is locked."
4,058
!freezes[_from]
"Balance is too small."
pragma solidity 0.5.8; contract LBS is ERC20 { string public constant name = "Luxury Boom Square"; string public constant symbol = "LBS"; uint8 public constant decimals = 18; uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals)); constructor() public { } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { } function freeze(address _target) public onlyOwner { } function unfreeze(address _target) public onlyOwner { } function isFrozen(address _target) public view returns (bool) { } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { } function releaseLock(address _holder) internal { } function lockCount(address _holder) public view returns (uint256) { } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(<FILL_ME>) _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { } function unlock(address _holder, uint256 i) public onlyOwner { } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { } function currentTime() public view returns (uint256) { } function afterTime(uint256 _value) public view returns (uint256) { } }
super.balanceOf(_holder)>=_amount,"Balance is too small."
4,058
super.balanceOf(_holder)>=_amount
null
pragma solidity ^0.4.24; /* import "./oraclizeAPI_0.5.sol"; */ import "./Owned.sol"; import "./BurnableToken.sol"; import "./KYCVerification.sol"; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract UTRAToken is Owned, BurnableToken { string public name = "SurePAY Utility, Transaction, Reward and Access Token."; string public symbol = "UTRA"; uint8 public decimals = 5; uint256 public initialSupply = 8100000000 * (10 ** uint256(decimals)); uint256 public totalSupply = 8100000000 * (10 ** uint256(decimals)); uint256 public externalAuthorizePurchase = 0; mapping (address => bool) public frozenAccount; mapping(address => uint8) authorizedCaller; mapping (address => bool) public lockingEnabled; bool public kycEnabled = true; KYCVerification public kycVerification; event KYCMandateUpdate(bool _kycEnabled); event KYCContractAddressUpdate(KYCVerification _kycAddress); event LockFunds(address _buyer,bool _status); modifier onlyAuthCaller(){ require(<FILL_ME>) _; } /* check locking status of user address. */ modifier lockingVerified(address _guy) { } modifier kycVerified(address _guy) { } modifier frozenVerified(address _guy) { } function updateKycContractAddress(KYCVerification _kycAddress) public onlyOwner returns(bool) { } function updateKycMandate(bool _kycEnabled) public onlyAuthCaller returns(bool) { } function forceUpdateLockStatus(address _holder,bool _lock) public onlyAuthCaller returns(bool) { } /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Events */ event AuthorizedCaller(address caller); event DeAuthorizedCaller(address caller); /* Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { } /* authorize caller */ function authorizeCaller(address _caller) public onlyOwner returns(bool) { } /* deauthorize caller */ function deAuthorizeCaller(address _caller) public onlyOwner returns(bool) { } function () payable public { } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { } /// @notice Create `mintedAmount` tokens and send it to `target` /// @param target Address to receive the tokens /// @param mintedAmount the amount of tokens it will receive function mintToken(address target, uint256 mintedAmount) onlyOwner public { } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { } function purchaseToken(address _receiver, uint _tokens) onlyAuthCaller public { } /** * @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 kycVerified(msg.sender) frozenVerified(msg.sender) lockingVerified(msg.sender) returns (bool) { } /* Please make sure before calling this function from UI, Sender has sufficient balance for All transfers */ function multiTransfer(address[] _to,uint[] _value) public kycVerified(msg.sender) frozenVerified(msg.sender) lockingVerified(msg.sender) returns (bool) { } /* Lock user address */ function lockUserAddress() public returns(bool){ } /* Unlock User Address */ function unlockUserAddress() public returns(bool){ } }
authorizedCaller[msg.sender]==1||msg.sender==owner
4,195
authorizedCaller[msg.sender]==1||msg.sender==owner
null
pragma solidity ^0.4.24; /* import "./oraclizeAPI_0.5.sol"; */ import "./Owned.sol"; import "./BurnableToken.sol"; import "./KYCVerification.sol"; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract UTRAToken is Owned, BurnableToken { string public name = "SurePAY Utility, Transaction, Reward and Access Token."; string public symbol = "UTRA"; uint8 public decimals = 5; uint256 public initialSupply = 8100000000 * (10 ** uint256(decimals)); uint256 public totalSupply = 8100000000 * (10 ** uint256(decimals)); uint256 public externalAuthorizePurchase = 0; mapping (address => bool) public frozenAccount; mapping(address => uint8) authorizedCaller; mapping (address => bool) public lockingEnabled; bool public kycEnabled = true; KYCVerification public kycVerification; event KYCMandateUpdate(bool _kycEnabled); event KYCContractAddressUpdate(KYCVerification _kycAddress); event LockFunds(address _buyer,bool _status); modifier onlyAuthCaller(){ } /* check locking status of user address. */ modifier lockingVerified(address _guy) { } modifier kycVerified(address _guy) { } modifier frozenVerified(address _guy) { } function updateKycContractAddress(KYCVerification _kycAddress) public onlyOwner returns(bool) { } function updateKycMandate(bool _kycEnabled) public onlyAuthCaller returns(bool) { } function forceUpdateLockStatus(address _holder,bool _lock) public onlyAuthCaller returns(bool) { } /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Events */ event AuthorizedCaller(address caller); event DeAuthorizedCaller(address caller); /* Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { } /* authorize caller */ function authorizeCaller(address _caller) public onlyOwner returns(bool) { } /* deauthorize caller */ function deAuthorizeCaller(address _caller) public onlyOwner returns(bool) { } function () payable public { } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require(<FILL_ME>) // Check if the sender has enough require (balances[_to].add(_value) > balances[_to]); // Check for overflow balances[_from] = balances[_from].sub(_value); // Subtract from the sender balances[_to] = balances[_to].add(_value); // Add the same to the recipient emit Transfer(_from, _to, _value); } /// @notice Create `mintedAmount` tokens and send it to `target` /// @param target Address to receive the tokens /// @param mintedAmount the amount of tokens it will receive function mintToken(address target, uint256 mintedAmount) onlyOwner public { } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { } function purchaseToken(address _receiver, uint _tokens) onlyAuthCaller public { } /** * @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 kycVerified(msg.sender) frozenVerified(msg.sender) lockingVerified(msg.sender) returns (bool) { } /* Please make sure before calling this function from UI, Sender has sufficient balance for All transfers */ function multiTransfer(address[] _to,uint[] _value) public kycVerified(msg.sender) frozenVerified(msg.sender) lockingVerified(msg.sender) returns (bool) { } /* Lock user address */ function lockUserAddress() public returns(bool){ } /* Unlock User Address */ function unlockUserAddress() public returns(bool){ } }
balances[_from]>_value
4,195
balances[_from]>_value
null
pragma solidity ^0.4.24; /* import "./oraclizeAPI_0.5.sol"; */ import "./Owned.sol"; import "./BurnableToken.sol"; import "./KYCVerification.sol"; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract UTRAToken is Owned, BurnableToken { string public name = "SurePAY Utility, Transaction, Reward and Access Token."; string public symbol = "UTRA"; uint8 public decimals = 5; uint256 public initialSupply = 8100000000 * (10 ** uint256(decimals)); uint256 public totalSupply = 8100000000 * (10 ** uint256(decimals)); uint256 public externalAuthorizePurchase = 0; mapping (address => bool) public frozenAccount; mapping(address => uint8) authorizedCaller; mapping (address => bool) public lockingEnabled; bool public kycEnabled = true; KYCVerification public kycVerification; event KYCMandateUpdate(bool _kycEnabled); event KYCContractAddressUpdate(KYCVerification _kycAddress); event LockFunds(address _buyer,bool _status); modifier onlyAuthCaller(){ } /* check locking status of user address. */ modifier lockingVerified(address _guy) { } modifier kycVerified(address _guy) { } modifier frozenVerified(address _guy) { } function updateKycContractAddress(KYCVerification _kycAddress) public onlyOwner returns(bool) { } function updateKycMandate(bool _kycEnabled) public onlyAuthCaller returns(bool) { } function forceUpdateLockStatus(address _holder,bool _lock) public onlyAuthCaller returns(bool) { } /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Events */ event AuthorizedCaller(address caller); event DeAuthorizedCaller(address caller); /* Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { } /* authorize caller */ function authorizeCaller(address _caller) public onlyOwner returns(bool) { } /* deauthorize caller */ function deAuthorizeCaller(address _caller) public onlyOwner returns(bool) { } function () payable public { } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balances[_from] > _value); // Check if the sender has enough require(<FILL_ME>) // Check for overflow balances[_from] = balances[_from].sub(_value); // Subtract from the sender balances[_to] = balances[_to].add(_value); // Add the same to the recipient emit Transfer(_from, _to, _value); } /// @notice Create `mintedAmount` tokens and send it to `target` /// @param target Address to receive the tokens /// @param mintedAmount the amount of tokens it will receive function mintToken(address target, uint256 mintedAmount) onlyOwner public { } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { } function purchaseToken(address _receiver, uint _tokens) onlyAuthCaller public { } /** * @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 kycVerified(msg.sender) frozenVerified(msg.sender) lockingVerified(msg.sender) returns (bool) { } /* Please make sure before calling this function from UI, Sender has sufficient balance for All transfers */ function multiTransfer(address[] _to,uint[] _value) public kycVerified(msg.sender) frozenVerified(msg.sender) lockingVerified(msg.sender) returns (bool) { } /* Lock user address */ function lockUserAddress() public returns(bool){ } /* Unlock User Address */ function unlockUserAddress() public returns(bool){ } }
balances[_to].add(_value)>balances[_to]
4,195
balances[_to].add(_value)>balances[_to]
"Only-operator"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./interfaces/IConvexDeposit.sol"; import "./interfaces/IConvexWithdraw.sol"; import "./interfaces/ICurvePool.sol"; import "./interfaces/IUniswapV2Router02.sol"; import "./interfaces/ITangoFactory.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/ISecretBridge.sol"; contract Constant { address public constant uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public constant sushiRouter = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address public constant wETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; uint256 public constant deadline = 0xf000000000000000000000000000000000000000000000000000000000000000; address public constant ust = 0xa47c8bf37f92aBed4A126BDA807A7b7498661acD; address public constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address public constant dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address public constant usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address public constant tango = 0x182F4c4C97cd1c24E1Df8FC4c053E5C47bf53Bef; address public constant crv = 0xD533a949740bb3306d119CC777fa900bA034cd52; address public constant cvx = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B; address public constant sefi = 0x773258b03c730F84aF10dFcB1BfAa7487558B8Ac; address public constant curvePool = 0xB0a0716841F2Fc03fbA72A891B8Bb13584F52F2d; address public constant curveLpToken = 0x94e131324b6054c0D789b190b2dAC504e4361b53; address public constant convexDeposit = 0xF403C135812408BFbE8713b5A23a04b3D48AAE31; address public constant convexWithDrawAndClaim = 0xd4Be1911F8a0df178d6e7fF5cE39919c273E2B7B; uint256 public constant pidUST = 21; } contract SecretStrategyUST is ITangoFactory, Constant, Ownable { using SafeERC20 for IERC20; uint256 public secretUST; uint256 public reserveUST; uint256 public minReserve; uint256 public stakedBalance; uint256 public depositFee; uint256 public rewardFee; uint256 public totalDepositFee; uint256 public totalRewardFee; uint256 public totalUSTDeposited; address public router; bytes public receiver; mapping(address => bool) isOperator; modifier onlyRouter() { } modifier onlyOperator() { require(<FILL_ME>) _; } event Invest(address _user, uint256 _amount); event Withdraw(address _user, uint256 _amount); event Balance(uint256 _secretUST, uint256 _reserveUST); constructor(address _router, uint256 _minReserve) Ownable() { } function adminSetFee(uint256 _depositFee, uint256 _rewardFee) external onlyOwner() { } function adminSetMinReversed(uint256 _minReserve) external onlyOwner() { } function adminSetRewardRecipient(bytes memory _receiver) external onlyOwner() { } function adminWhiteListOperator(address _operator, bool _whitelist) external onlyOwner() { } function adminCollectFee(address _to) external onlyOwner() { } function adminFillReserve(uint256 _amount) external onlyOwner() { } function adminWithdrawToken(address _token, address _to, uint256 _amount) external onlyOwner() { } function adminUnstakeAndWithdraw(address _to, uint256 _amount) external onlyOwner() { } /** * @dev swap token at UniswapV2Router with path fromToken - WETH - toToken * @param _fromToken is source token * @param _toToken is des token * @param _swapAmount is amount of source token to swap * @return _amountOut is the amount of _toToken */ function _uniswapSwapToken( address _router, address _fromToken, address _toToken, uint256 _swapAmount ) private returns (uint256 _amountOut) { } /** * @dev add liquidity to Curve at UST poool * @param _curvePool is curve liqudity pool address * @param _param is [ust, dai, usdc, usdt] * @return amount of lp token */ function _curveAddLiquidity(address _curvePool, uint256[4] memory _param) private returns(uint256) { } /** * @dev add liquidity to Curve at UST poool * @param _curvePool is curve liqudity pool address * @param _curveLpBalance is amount lp token * @return amount of lp token */ function _curveRemoveLiquidity(address _curvePool, uint256 _curveLpBalance) private returns(uint256) { } function calculateLpAmount(address _curvePool, uint256 _ustAmount) private returns (uint256){ } function secretInvest(address _user, address _token, uint256 _amount) external override onlyRouter() { } function withrawFromPool(uint256 _amount) private returns(uint256) { } function operatorClaimRewards() external onlyOperator() { } function operatorRebalanceReserve() external onlyOperator() { } function secretWithdraw(address _user, uint256 _amount) external override onlyRouter() { } function operatorClaimRewardsToSCRT(address _secretBridge) external override onlyOperator() { } function operatorInvest() external onlyOperator() { } function _stake(address _pool, uint256 _pid, uint256 _stakeAmount) private { } function _withdraw(address _pool, uint256 _amount) private { } function getStakingInfor() public view returns(uint256, uint256) { } receive() external payable { } }
isOperator[msg.sender],"Only-operator"
4,217
isOperator[msg.sender]
"Something-went-wrong"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./interfaces/IConvexDeposit.sol"; import "./interfaces/IConvexWithdraw.sol"; import "./interfaces/ICurvePool.sol"; import "./interfaces/IUniswapV2Router02.sol"; import "./interfaces/ITangoFactory.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/ISecretBridge.sol"; contract Constant { address public constant uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public constant sushiRouter = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address public constant wETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; uint256 public constant deadline = 0xf000000000000000000000000000000000000000000000000000000000000000; address public constant ust = 0xa47c8bf37f92aBed4A126BDA807A7b7498661acD; address public constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address public constant dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address public constant usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address public constant tango = 0x182F4c4C97cd1c24E1Df8FC4c053E5C47bf53Bef; address public constant crv = 0xD533a949740bb3306d119CC777fa900bA034cd52; address public constant cvx = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B; address public constant sefi = 0x773258b03c730F84aF10dFcB1BfAa7487558B8Ac; address public constant curvePool = 0xB0a0716841F2Fc03fbA72A891B8Bb13584F52F2d; address public constant curveLpToken = 0x94e131324b6054c0D789b190b2dAC504e4361b53; address public constant convexDeposit = 0xF403C135812408BFbE8713b5A23a04b3D48AAE31; address public constant convexWithDrawAndClaim = 0xd4Be1911F8a0df178d6e7fF5cE39919c273E2B7B; uint256 public constant pidUST = 21; } contract SecretStrategyUST is ITangoFactory, Constant, Ownable { using SafeERC20 for IERC20; uint256 public secretUST; uint256 public reserveUST; uint256 public minReserve; uint256 public stakedBalance; uint256 public depositFee; uint256 public rewardFee; uint256 public totalDepositFee; uint256 public totalRewardFee; uint256 public totalUSTDeposited; address public router; bytes public receiver; mapping(address => bool) isOperator; modifier onlyRouter() { } modifier onlyOperator() { } event Invest(address _user, uint256 _amount); event Withdraw(address _user, uint256 _amount); event Balance(uint256 _secretUST, uint256 _reserveUST); constructor(address _router, uint256 _minReserve) Ownable() { } function adminSetFee(uint256 _depositFee, uint256 _rewardFee) external onlyOwner() { } function adminSetMinReversed(uint256 _minReserve) external onlyOwner() { } function adminSetRewardRecipient(bytes memory _receiver) external onlyOwner() { } function adminWhiteListOperator(address _operator, bool _whitelist) external onlyOwner() { } function adminCollectFee(address _to) external onlyOwner() { } function adminFillReserve(uint256 _amount) external onlyOwner() { } function adminWithdrawToken(address _token, address _to, uint256 _amount) external onlyOwner() { } function adminUnstakeAndWithdraw(address _to, uint256 _amount) external onlyOwner() { } /** * @dev swap token at UniswapV2Router with path fromToken - WETH - toToken * @param _fromToken is source token * @param _toToken is des token * @param _swapAmount is amount of source token to swap * @return _amountOut is the amount of _toToken */ function _uniswapSwapToken( address _router, address _fromToken, address _toToken, uint256 _swapAmount ) private returns (uint256 _amountOut) { } /** * @dev add liquidity to Curve at UST poool * @param _curvePool is curve liqudity pool address * @param _param is [ust, dai, usdc, usdt] * @return amount of lp token */ function _curveAddLiquidity(address _curvePool, uint256[4] memory _param) private returns(uint256) { } /** * @dev add liquidity to Curve at UST poool * @param _curvePool is curve liqudity pool address * @param _curveLpBalance is amount lp token * @return amount of lp token */ function _curveRemoveLiquidity(address _curvePool, uint256 _curveLpBalance) private returns(uint256) { } function calculateLpAmount(address _curvePool, uint256 _ustAmount) private returns (uint256){ } function secretInvest(address _user, address _token, uint256 _amount) external override onlyRouter() { } function withrawFromPool(uint256 _amount) private returns(uint256) { } function operatorClaimRewards() external onlyOperator() { } function operatorRebalanceReserve() external onlyOperator() { require(reserveUST < minReserve, "No-need-rebalance-now"); uint256 _amount = minReserve - reserveUST; reserveUST = reserveUST + withrawFromPool(_amount); require(<FILL_ME>) } function secretWithdraw(address _user, uint256 _amount) external override onlyRouter() { } function operatorClaimRewardsToSCRT(address _secretBridge) external override onlyOperator() { } function operatorInvest() external onlyOperator() { } function _stake(address _pool, uint256 _pid, uint256 _stakeAmount) private { } function _withdraw(address _pool, uint256 _amount) private { } function getStakingInfor() public view returns(uint256, uint256) { } receive() external payable { } }
IERC20(ust).balanceOf(address(this))>=reserveUST,"Something-went-wrong"
4,217
IERC20(ust).balanceOf(address(this))>=reserveUST
'ds-math-add-overflow'
/* * Capital DEX * * Copyright ©️ 2020 Curio AG (Company Number FL-0002.594.728-9) * Incorporated and registered in Liechtenstein. * * Copyright ©️ 2020 Curio Capital AG (Company Number CHE-211.446.654) * Incorporated and registered in Zug, Switzerland. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Source https://github.com/Uniswap/uniswap-v2-core * Subject to the GPL-3.0 license. */ // SPDX-License-Identifier: GPL-3.0 pragma solidity =0.6.12; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMathUniswap { function add(uint x, uint y) internal pure returns (uint z) { require(<FILL_ME>) } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } uint constant WAD = 10 ** 18; //rounds to zero if x*y < WAD / 2 function wmul(uint x, uint y) internal pure returns (uint z) { } }
(z=x+y)>=x,'ds-math-add-overflow'
4,282
(z=x+y)>=x
'ds-math-sub-underflow'
/* * Capital DEX * * Copyright ©️ 2020 Curio AG (Company Number FL-0002.594.728-9) * Incorporated and registered in Liechtenstein. * * Copyright ©️ 2020 Curio Capital AG (Company Number CHE-211.446.654) * Incorporated and registered in Zug, Switzerland. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Source https://github.com/Uniswap/uniswap-v2-core * Subject to the GPL-3.0 license. */ // SPDX-License-Identifier: GPL-3.0 pragma solidity =0.6.12; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMathUniswap { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { require(<FILL_ME>) } function mul(uint x, uint y) internal pure returns (uint z) { } uint constant WAD = 10 ** 18; //rounds to zero if x*y < WAD / 2 function wmul(uint x, uint y) internal pure returns (uint z) { } }
(z=x-y)<=x,'ds-math-sub-underflow'
4,282
(z=x-y)<=x
null
pragma solidity ^0.4.18; /** ---------------------------------------------------------------------------------------------- * Power_Token by Power Limited. */ 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 ERC20 { uint256 public totalSupply; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); function allowance(address owner, address spender) public view returns (uint256); function approve(address spender, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { } modifier onlyOwner() { } function transferOwnership(address newOwner) public onlyOwner { } } interface TokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 is ERC20, Ownable{ // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it using SafeMath for uint256; // Balances mapping (address => uint256) balances; // Allowances mapping (address => mapping (address => uint256)) allowances; // ----- Events ----- event Burn(address indexed from, uint256 value); function TokenERC20(uint256 _initialSupply, string _tokenName, string _tokenSymbol, uint8 _decimals) public { } modifier onlyPayloadSize(uint size) { } function balanceOf(address _owner) public view returns(uint256) { } function allowance(address _owner, address _spender) public view returns (uint256) { } function _transfer(address _from, address _to, uint _value) internal returns(bool) { } function transfer(address _to, uint256 _value) public returns(bool) { } function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { } function approve(address _spender, uint256 _value) public returns(bool) { require(<FILL_ME>) allowances[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns(bool) { } function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) public returns (bool) { } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns(bool) { } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns(bool) { } /** * approve should be called when allowances[_spender] == 0. To increment * allowances value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } contract PowerToken is TokenERC20 { function PowerToken() TokenERC20(1000000000, "LuJia Token", "QZB", 18) public { } }
(_value==0)||(allowances[msg.sender][_spender]==0)
4,304
(_value==0)||(allowances[msg.sender][_spender]==0)
null
pragma solidity ^0.4.18; /** ---------------------------------------------------------------------------------------------- * Power_Token by Power Limited. */ 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 ERC20 { uint256 public totalSupply; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); function allowance(address owner, address spender) public view returns (uint256); function approve(address spender, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { } modifier onlyOwner() { } function transferOwnership(address newOwner) public onlyOwner { } } interface TokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 is ERC20, Ownable{ // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it using SafeMath for uint256; // Balances mapping (address => uint256) balances; // Allowances mapping (address => mapping (address => uint256)) allowances; // ----- Events ----- event Burn(address indexed from, uint256 value); function TokenERC20(uint256 _initialSupply, string _tokenName, string _tokenSymbol, uint8 _decimals) public { } modifier onlyPayloadSize(uint size) { } function balanceOf(address _owner) public view returns(uint256) { } function allowance(address _owner, address _spender) public view returns (uint256) { } function _transfer(address _from, address _to, uint _value) internal returns(bool) { } function transfer(address _to, uint256 _value) public returns(bool) { } function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { } function approve(address _spender, uint256 _value) public returns(bool) { } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns(bool) { } function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) public returns (bool) { for (uint256 i = 0; i < _addresses.length; i++) { require(<FILL_ME>) require(_amounts[i] <= balances[msg.sender]); require(_amounts[i] > 0); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_amounts[i]); balances[_addresses[i]] = balances[_addresses[i]].add(_amounts[i]); Transfer(msg.sender, _addresses[i], _amounts[i]); } return true; } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns(bool) { } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns(bool) { } /** * approve should be called when allowances[_spender] == 0. To increment * allowances value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } contract PowerToken is TokenERC20 { function PowerToken() TokenERC20(1000000000, "LuJia Token", "QZB", 18) public { } }
_addresses[i]!=address(0)
4,304
_addresses[i]!=address(0)
null
pragma solidity ^0.4.18; /** ---------------------------------------------------------------------------------------------- * Power_Token by Power Limited. */ 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 ERC20 { uint256 public totalSupply; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); function allowance(address owner, address spender) public view returns (uint256); function approve(address spender, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { } modifier onlyOwner() { } function transferOwnership(address newOwner) public onlyOwner { } } interface TokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 is ERC20, Ownable{ // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it using SafeMath for uint256; // Balances mapping (address => uint256) balances; // Allowances mapping (address => mapping (address => uint256)) allowances; // ----- Events ----- event Burn(address indexed from, uint256 value); function TokenERC20(uint256 _initialSupply, string _tokenName, string _tokenSymbol, uint8 _decimals) public { } modifier onlyPayloadSize(uint size) { } function balanceOf(address _owner) public view returns(uint256) { } function allowance(address _owner, address _spender) public view returns (uint256) { } function _transfer(address _from, address _to, uint _value) internal returns(bool) { } function transfer(address _to, uint256 _value) public returns(bool) { } function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { } function approve(address _spender, uint256 _value) public returns(bool) { } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns(bool) { } function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) public returns (bool) { for (uint256 i = 0; i < _addresses.length; i++) { require(_addresses[i] != address(0)); require(<FILL_ME>) require(_amounts[i] > 0); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_amounts[i]); balances[_addresses[i]] = balances[_addresses[i]].add(_amounts[i]); Transfer(msg.sender, _addresses[i], _amounts[i]); } return true; } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns(bool) { } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns(bool) { } /** * approve should be called when allowances[_spender] == 0. To increment * allowances value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } contract PowerToken is TokenERC20 { function PowerToken() TokenERC20(1000000000, "LuJia Token", "QZB", 18) public { } }
_amounts[i]<=balances[msg.sender]
4,304
_amounts[i]<=balances[msg.sender]
null
pragma solidity ^0.4.18; /** ---------------------------------------------------------------------------------------------- * Power_Token by Power Limited. */ 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 ERC20 { uint256 public totalSupply; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); function allowance(address owner, address spender) public view returns (uint256); function approve(address spender, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { } modifier onlyOwner() { } function transferOwnership(address newOwner) public onlyOwner { } } interface TokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 is ERC20, Ownable{ // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it using SafeMath for uint256; // Balances mapping (address => uint256) balances; // Allowances mapping (address => mapping (address => uint256)) allowances; // ----- Events ----- event Burn(address indexed from, uint256 value); function TokenERC20(uint256 _initialSupply, string _tokenName, string _tokenSymbol, uint8 _decimals) public { } modifier onlyPayloadSize(uint size) { } function balanceOf(address _owner) public view returns(uint256) { } function allowance(address _owner, address _spender) public view returns (uint256) { } function _transfer(address _from, address _to, uint _value) internal returns(bool) { } function transfer(address _to, uint256 _value) public returns(bool) { } function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { } function approve(address _spender, uint256 _value) public returns(bool) { } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns(bool) { } function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) public returns (bool) { } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns(bool) { } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns(bool) { } /** * approve should be called when allowances[_spender] == 0. To increment * allowances value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { // Check for overflows require(<FILL_ME>) allowances[msg.sender][_spender] =allowances[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowances[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } contract PowerToken is TokenERC20 { function PowerToken() TokenERC20(1000000000, "LuJia Token", "QZB", 18) public { } }
allowances[msg.sender][_spender].add(_addedValue)>allowances[msg.sender][_spender]
4,304
allowances[msg.sender][_spender].add(_addedValue)>allowances[msg.sender][_spender]
"ERC721: transfer of token that is not own"
pragma solidity ^0.6.0; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name, string memory symbol) public { } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { } /** * @dev See {IERC721Metadata-name}. */ function name() public view override returns (string memory) { } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view override returns (string memory) { } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view returns (string memory) { } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view override returns (bool) { } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view returns (bool) { } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(<FILL_ME>) require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { } function _approve(address to, uint256 tokenId) private { } /** * @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 { } }
ownerOf(tokenId)==from,"ERC721: transfer of token that is not own"
4,351
ownerOf(tokenId)==from
'token.transfer has failed'
pragma solidity ^0.4.24; // Developed by Phenom.Team <info@phenom.team> /** * @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 ERC20 { uint public totalSupply; mapping(address => uint) balances; mapping(address => mapping (address => uint)) allowed; function balanceOf(address _owner) view returns (uint); function transfer(address _to, uint _value) returns (bool); function transferFrom(address _from, address _to, uint _value) returns (bool); function approve(address _spender, uint _value) returns (bool); function allowance(address _owner, address _spender) view returns (uint); event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); } contract Ownable { address public owner; constructor() public { } modifier onlyOwner() { } } contract BaseTokenVesting is Ownable() { using SafeMath for uint; address public beneficiary; ERC20 public token; bool public vestingHasStarted; uint public start; uint public cliff; uint public vestingPeriod; uint public released; event Released(uint _amount); constructor( address _benificiary, uint _cliff, uint _vestingPeriod, address _token ) internal { } function startVesting() public onlyOwner { } function sendTokens(address _to, uint _amount) public onlyOwner { require(vestingHasStarted == false, 'send tokens only if vesting has not been started'); require(<FILL_ME>) } function release() public; function releasableAmount() public view returns (uint _amount); function vestedAmount() public view returns (uint _amount); } contract TokenVestingWithConstantPercent is BaseTokenVesting { uint public periodPercent; constructor( address _benificiary, uint _cliff, uint _vestingPeriod, address _tokenAddress, uint _periodPercent ) BaseTokenVesting(_benificiary, _cliff, _vestingPeriod, _tokenAddress) public { } function release() public { } function releasableAmount() public view returns (uint _amount) { } function vestedAmount() public view returns (uint _amount) { } }
token.transfer(_to,_amount),'token.transfer has failed'
4,378
token.transfer(_to,_amount)
'revert on transfer failure'
pragma solidity ^0.4.24; // Developed by Phenom.Team <info@phenom.team> /** * @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 ERC20 { uint public totalSupply; mapping(address => uint) balances; mapping(address => mapping (address => uint)) allowed; function balanceOf(address _owner) view returns (uint); function transfer(address _to, uint _value) returns (bool); function transferFrom(address _from, address _to, uint _value) returns (bool); function approve(address _spender, uint _value) returns (bool); function allowance(address _owner, address _spender) view returns (uint); event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); } contract Ownable { address public owner; constructor() public { } modifier onlyOwner() { } } contract BaseTokenVesting is Ownable() { using SafeMath for uint; address public beneficiary; ERC20 public token; bool public vestingHasStarted; uint public start; uint public cliff; uint public vestingPeriod; uint public released; event Released(uint _amount); constructor( address _benificiary, uint _cliff, uint _vestingPeriod, address _token ) internal { } function startVesting() public onlyOwner { } function sendTokens(address _to, uint _amount) public onlyOwner { } function release() public; function releasableAmount() public view returns (uint _amount); function vestedAmount() public view returns (uint _amount); } contract TokenVestingWithConstantPercent is BaseTokenVesting { uint public periodPercent; constructor( address _benificiary, uint _cliff, uint _vestingPeriod, address _tokenAddress, uint _periodPercent ) BaseTokenVesting(_benificiary, _cliff, _vestingPeriod, _tokenAddress) public { } function release() public { require(vestingHasStarted, 'vesting has not started'); uint unreleased = releasableAmount(); require(unreleased > 0, 'released amount has to be greter than zero'); require(<FILL_ME>) released = released.add(unreleased); emit Released(unreleased); } function releasableAmount() public view returns (uint _amount) { } function vestedAmount() public view returns (uint _amount) { } }
token.transfer(beneficiary,unreleased),'revert on transfer failure'
4,378
token.transfer(beneficiary,unreleased)
"TransferFrom failed, make sure you approved token transfer"
/* Copyright (C) 2020 PlotX.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ */ pragma solidity 0.5.7; contract Staking { using SafeMath for uint256; /** * @dev Structure to store Interest details. * It contains total amount of tokens staked and globalYield. */ struct InterestData { uint256 globalTotalStaked; uint256 globalYieldPerToken; uint256 lastUpdated; mapping(address => Staker) stakers; } /** * @dev Structure to store staking details. * It contains amount of tokens staked and withdrawn interest. */ struct Staker { uint256 totalStaked; uint256 withdrawnToDate; uint256 stakeBuyinRate; } // Token address ERC20 private stakeToken; // Reward token ERC20 private rewardToken; // Interest and staker data InterestData public interestData; uint public stakingStartTime; uint public totalReward; // unclaimed reward will be trasfered to this account address public vaultAddress; // 10^18 uint256 private constant DECIMAL1e18 = 10**18; //Total time (in sec) over which reward will be distributed uint256 public stakingPeriod; /** * @dev Emitted when `staker` stake `value` tokens. */ event Staked(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` withdraws their stake `value` tokens. */ event StakeWithdrawn(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` collects interest `_value`. */ event InterestCollected( address indexed staker, uint256 _value, uint256 _globalYieldPerToken ); /** * @dev Constructor * @param _stakeToken The address of stake Token * @param _rewardToken The address of reward Token * @param _stakingPeriod valid staking time after staking starts * @param _totalRewardToBeDistributed total amount to be distributed as reward */ constructor( address _stakeToken, address _rewardToken, uint256 _stakingPeriod, uint256 _totalRewardToBeDistributed, uint256 _stakingStart, address _vaultAdd ) public { } /** * @dev Allows a staker to deposit Tokens. Notice that `approve` is * needed to be executed before the execution of this method. * @param _amount The amount of tokens to stake */ function stake(uint256 _amount) external { require(_amount > 0, "You need to stake a positive token amount"); require(<FILL_ME>) require(now.sub(stakingStartTime) <= stakingPeriod, "Can not stake after staking period passed"); uint newlyInterestGenerated = now.sub(interestData.lastUpdated).mul(totalReward).div(stakingPeriod); interestData.lastUpdated = now; updateGlobalYieldPerToken(newlyInterestGenerated); updateStakeData(msg.sender, _amount); emit Staked(msg.sender, _amount, interestData.globalYieldPerToken); } /** * @dev Updates InterestData and Staker data while staking. * must call update globalYieldPerToken before this operation * @param _staker Staker's address * @param _stake Amount of stake * */ function updateStakeData( address _staker, uint256 _stake ) internal { } /** * @dev Calculates and updates the yield rate in which the staker has entered * a staker may stake multiple times, so we calculate his cumulative rate his earning will be calculated based on GlobalYield and StakeBuyinRate * Formula: * StakeBuyinRate = [StakeBuyinRate(P) + (GlobalYield(P) x Stake)] * * @param _stakerData Staker's Data * @param _globalYieldPerToken Total yielding amount per token * @param _stake Amount staked * */ function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake ) internal { } /** * @dev Withdraws the sender staked Token. */ function withdrawStakeAndInterest(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while withdrawing stake. * * @param _staker Staker address * @param _amount Amount of stake to withdraw * */ function updateStakeAndInterestData( address _staker, uint256 _amount ) internal { } /** * @dev Withdraws the sender Earned interest. */ function withdrawInterest() public { } function updateGlobalYield() public { } function getYieldData(address _staker) public view returns(uint256, uint256) { } function _timeSinceLastUpdate() internal returns(uint256) { } /** * @dev Calculates Interest for staker for their stake. * * Formula: * EarnedInterest = MAX[TotalStaked x GlobalYield - (StakeBuyinRate + WithdrawnToDate), 0] * * @param _staker Staker's address * * @return The amount of tokens credit for the staker. */ function calculateInterest(address _staker) public view returns (uint256) { } /** * @dev Calculates and updates new accrued amount per token since last update. * * Formula: * GlobalYield = GlobalYield(P) + newlyGeneratedInterest/GlobalTotalStake. * * @param _interestGenerated Interest token earned since last update. * */ function updateGlobalYieldPerToken( uint256 _interestGenerated ) internal { } function getStakerData(address _staker) public view returns(uint256, uint256) { } /** * @dev returns stats data. * @param _staker Address of staker. * @return Total staked. * @return Total reward to be distributed. * @return estimated reward for user at end of staking period if no one stakes from current time. * @return Unlocked reward based on elapsed time. * @return Accrued reward for user till now. */ function getStatsData(address _staker) external view returns(uint, uint, uint, uint, uint) { } }
stakeToken.transferFrom(msg.sender,address(this),_amount),"TransferFrom failed, make sure you approved token transfer"
4,393
stakeToken.transferFrom(msg.sender,address(this),_amount)
"Can not stake after staking period passed"
/* Copyright (C) 2020 PlotX.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ */ pragma solidity 0.5.7; contract Staking { using SafeMath for uint256; /** * @dev Structure to store Interest details. * It contains total amount of tokens staked and globalYield. */ struct InterestData { uint256 globalTotalStaked; uint256 globalYieldPerToken; uint256 lastUpdated; mapping(address => Staker) stakers; } /** * @dev Structure to store staking details. * It contains amount of tokens staked and withdrawn interest. */ struct Staker { uint256 totalStaked; uint256 withdrawnToDate; uint256 stakeBuyinRate; } // Token address ERC20 private stakeToken; // Reward token ERC20 private rewardToken; // Interest and staker data InterestData public interestData; uint public stakingStartTime; uint public totalReward; // unclaimed reward will be trasfered to this account address public vaultAddress; // 10^18 uint256 private constant DECIMAL1e18 = 10**18; //Total time (in sec) over which reward will be distributed uint256 public stakingPeriod; /** * @dev Emitted when `staker` stake `value` tokens. */ event Staked(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` withdraws their stake `value` tokens. */ event StakeWithdrawn(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` collects interest `_value`. */ event InterestCollected( address indexed staker, uint256 _value, uint256 _globalYieldPerToken ); /** * @dev Constructor * @param _stakeToken The address of stake Token * @param _rewardToken The address of reward Token * @param _stakingPeriod valid staking time after staking starts * @param _totalRewardToBeDistributed total amount to be distributed as reward */ constructor( address _stakeToken, address _rewardToken, uint256 _stakingPeriod, uint256 _totalRewardToBeDistributed, uint256 _stakingStart, address _vaultAdd ) public { } /** * @dev Allows a staker to deposit Tokens. Notice that `approve` is * needed to be executed before the execution of this method. * @param _amount The amount of tokens to stake */ function stake(uint256 _amount) external { require(_amount > 0, "You need to stake a positive token amount"); require( stakeToken.transferFrom(msg.sender, address(this), _amount), "TransferFrom failed, make sure you approved token transfer" ); require(<FILL_ME>) uint newlyInterestGenerated = now.sub(interestData.lastUpdated).mul(totalReward).div(stakingPeriod); interestData.lastUpdated = now; updateGlobalYieldPerToken(newlyInterestGenerated); updateStakeData(msg.sender, _amount); emit Staked(msg.sender, _amount, interestData.globalYieldPerToken); } /** * @dev Updates InterestData and Staker data while staking. * must call update globalYieldPerToken before this operation * @param _staker Staker's address * @param _stake Amount of stake * */ function updateStakeData( address _staker, uint256 _stake ) internal { } /** * @dev Calculates and updates the yield rate in which the staker has entered * a staker may stake multiple times, so we calculate his cumulative rate his earning will be calculated based on GlobalYield and StakeBuyinRate * Formula: * StakeBuyinRate = [StakeBuyinRate(P) + (GlobalYield(P) x Stake)] * * @param _stakerData Staker's Data * @param _globalYieldPerToken Total yielding amount per token * @param _stake Amount staked * */ function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake ) internal { } /** * @dev Withdraws the sender staked Token. */ function withdrawStakeAndInterest(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while withdrawing stake. * * @param _staker Staker address * @param _amount Amount of stake to withdraw * */ function updateStakeAndInterestData( address _staker, uint256 _amount ) internal { } /** * @dev Withdraws the sender Earned interest. */ function withdrawInterest() public { } function updateGlobalYield() public { } function getYieldData(address _staker) public view returns(uint256, uint256) { } function _timeSinceLastUpdate() internal returns(uint256) { } /** * @dev Calculates Interest for staker for their stake. * * Formula: * EarnedInterest = MAX[TotalStaked x GlobalYield - (StakeBuyinRate + WithdrawnToDate), 0] * * @param _staker Staker's address * * @return The amount of tokens credit for the staker. */ function calculateInterest(address _staker) public view returns (uint256) { } /** * @dev Calculates and updates new accrued amount per token since last update. * * Formula: * GlobalYield = GlobalYield(P) + newlyGeneratedInterest/GlobalTotalStake. * * @param _interestGenerated Interest token earned since last update. * */ function updateGlobalYieldPerToken( uint256 _interestGenerated ) internal { } function getStakerData(address _staker) public view returns(uint256, uint256) { } /** * @dev returns stats data. * @param _staker Address of staker. * @return Total staked. * @return Total reward to be distributed. * @return estimated reward for user at end of staking period if no one stakes from current time. * @return Unlocked reward based on elapsed time. * @return Accrued reward for user till now. */ function getStatsData(address _staker) external view returns(uint, uint, uint, uint, uint) { } }
now.sub(stakingStartTime)<=stakingPeriod,"Can not stake after staking period passed"
4,393
now.sub(stakingStartTime)<=stakingPeriod
"withdraw transfer failed"
/* Copyright (C) 2020 PlotX.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ */ pragma solidity 0.5.7; contract Staking { using SafeMath for uint256; /** * @dev Structure to store Interest details. * It contains total amount of tokens staked and globalYield. */ struct InterestData { uint256 globalTotalStaked; uint256 globalYieldPerToken; uint256 lastUpdated; mapping(address => Staker) stakers; } /** * @dev Structure to store staking details. * It contains amount of tokens staked and withdrawn interest. */ struct Staker { uint256 totalStaked; uint256 withdrawnToDate; uint256 stakeBuyinRate; } // Token address ERC20 private stakeToken; // Reward token ERC20 private rewardToken; // Interest and staker data InterestData public interestData; uint public stakingStartTime; uint public totalReward; // unclaimed reward will be trasfered to this account address public vaultAddress; // 10^18 uint256 private constant DECIMAL1e18 = 10**18; //Total time (in sec) over which reward will be distributed uint256 public stakingPeriod; /** * @dev Emitted when `staker` stake `value` tokens. */ event Staked(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` withdraws their stake `value` tokens. */ event StakeWithdrawn(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` collects interest `_value`. */ event InterestCollected( address indexed staker, uint256 _value, uint256 _globalYieldPerToken ); /** * @dev Constructor * @param _stakeToken The address of stake Token * @param _rewardToken The address of reward Token * @param _stakingPeriod valid staking time after staking starts * @param _totalRewardToBeDistributed total amount to be distributed as reward */ constructor( address _stakeToken, address _rewardToken, uint256 _stakingPeriod, uint256 _totalRewardToBeDistributed, uint256 _stakingStart, address _vaultAdd ) public { } /** * @dev Allows a staker to deposit Tokens. Notice that `approve` is * needed to be executed before the execution of this method. * @param _amount The amount of tokens to stake */ function stake(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while staking. * must call update globalYieldPerToken before this operation * @param _staker Staker's address * @param _stake Amount of stake * */ function updateStakeData( address _staker, uint256 _stake ) internal { } /** * @dev Calculates and updates the yield rate in which the staker has entered * a staker may stake multiple times, so we calculate his cumulative rate his earning will be calculated based on GlobalYield and StakeBuyinRate * Formula: * StakeBuyinRate = [StakeBuyinRate(P) + (GlobalYield(P) x Stake)] * * @param _stakerData Staker's Data * @param _globalYieldPerToken Total yielding amount per token * @param _stake Amount staked * */ function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake ) internal { } /** * @dev Withdraws the sender staked Token. */ function withdrawStakeAndInterest(uint256 _amount) external { Staker storage staker = interestData.stakers[msg.sender]; require(_amount > 0, "Should withdraw positive amount"); require(staker.totalStaked >= _amount, "Not enough token staked"); withdrawInterest(); updateStakeAndInterestData(msg.sender, _amount); require(<FILL_ME>) emit StakeWithdrawn(msg.sender, _amount, interestData.globalYieldPerToken); } /** * @dev Updates InterestData and Staker data while withdrawing stake. * * @param _staker Staker address * @param _amount Amount of stake to withdraw * */ function updateStakeAndInterestData( address _staker, uint256 _amount ) internal { } /** * @dev Withdraws the sender Earned interest. */ function withdrawInterest() public { } function updateGlobalYield() public { } function getYieldData(address _staker) public view returns(uint256, uint256) { } function _timeSinceLastUpdate() internal returns(uint256) { } /** * @dev Calculates Interest for staker for their stake. * * Formula: * EarnedInterest = MAX[TotalStaked x GlobalYield - (StakeBuyinRate + WithdrawnToDate), 0] * * @param _staker Staker's address * * @return The amount of tokens credit for the staker. */ function calculateInterest(address _staker) public view returns (uint256) { } /** * @dev Calculates and updates new accrued amount per token since last update. * * Formula: * GlobalYield = GlobalYield(P) + newlyGeneratedInterest/GlobalTotalStake. * * @param _interestGenerated Interest token earned since last update. * */ function updateGlobalYieldPerToken( uint256 _interestGenerated ) internal { } function getStakerData(address _staker) public view returns(uint256, uint256) { } /** * @dev returns stats data. * @param _staker Address of staker. * @return Total staked. * @return Total reward to be distributed. * @return estimated reward for user at end of staking period if no one stakes from current time. * @return Unlocked reward based on elapsed time. * @return Accrued reward for user till now. */ function getStatsData(address _staker) external view returns(uint, uint, uint, uint, uint) { } }
stakeToken.transfer(msg.sender,_amount),"withdraw transfer failed"
4,393
stakeToken.transfer(msg.sender,_amount)
"Withdraw interest transfer failed"
/* Copyright (C) 2020 PlotX.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ */ pragma solidity 0.5.7; contract Staking { using SafeMath for uint256; /** * @dev Structure to store Interest details. * It contains total amount of tokens staked and globalYield. */ struct InterestData { uint256 globalTotalStaked; uint256 globalYieldPerToken; uint256 lastUpdated; mapping(address => Staker) stakers; } /** * @dev Structure to store staking details. * It contains amount of tokens staked and withdrawn interest. */ struct Staker { uint256 totalStaked; uint256 withdrawnToDate; uint256 stakeBuyinRate; } // Token address ERC20 private stakeToken; // Reward token ERC20 private rewardToken; // Interest and staker data InterestData public interestData; uint public stakingStartTime; uint public totalReward; // unclaimed reward will be trasfered to this account address public vaultAddress; // 10^18 uint256 private constant DECIMAL1e18 = 10**18; //Total time (in sec) over which reward will be distributed uint256 public stakingPeriod; /** * @dev Emitted when `staker` stake `value` tokens. */ event Staked(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` withdraws their stake `value` tokens. */ event StakeWithdrawn(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` collects interest `_value`. */ event InterestCollected( address indexed staker, uint256 _value, uint256 _globalYieldPerToken ); /** * @dev Constructor * @param _stakeToken The address of stake Token * @param _rewardToken The address of reward Token * @param _stakingPeriod valid staking time after staking starts * @param _totalRewardToBeDistributed total amount to be distributed as reward */ constructor( address _stakeToken, address _rewardToken, uint256 _stakingPeriod, uint256 _totalRewardToBeDistributed, uint256 _stakingStart, address _vaultAdd ) public { } /** * @dev Allows a staker to deposit Tokens. Notice that `approve` is * needed to be executed before the execution of this method. * @param _amount The amount of tokens to stake */ function stake(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while staking. * must call update globalYieldPerToken before this operation * @param _staker Staker's address * @param _stake Amount of stake * */ function updateStakeData( address _staker, uint256 _stake ) internal { } /** * @dev Calculates and updates the yield rate in which the staker has entered * a staker may stake multiple times, so we calculate his cumulative rate his earning will be calculated based on GlobalYield and StakeBuyinRate * Formula: * StakeBuyinRate = [StakeBuyinRate(P) + (GlobalYield(P) x Stake)] * * @param _stakerData Staker's Data * @param _globalYieldPerToken Total yielding amount per token * @param _stake Amount staked * */ function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake ) internal { } /** * @dev Withdraws the sender staked Token. */ function withdrawStakeAndInterest(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while withdrawing stake. * * @param _staker Staker address * @param _amount Amount of stake to withdraw * */ function updateStakeAndInterestData( address _staker, uint256 _amount ) internal { } /** * @dev Withdraws the sender Earned interest. */ function withdrawInterest() public { uint timeSinceLastUpdate = _timeSinceLastUpdate(); uint newlyInterestGenerated = timeSinceLastUpdate.mul(totalReward).div(stakingPeriod); updateGlobalYieldPerToken(newlyInterestGenerated); uint256 interest = calculateInterest(msg.sender); Staker storage stakerData = interestData.stakers[msg.sender]; stakerData.withdrawnToDate = stakerData.withdrawnToDate.add(interest); require(<FILL_ME>) emit InterestCollected(msg.sender, interest, interestData.globalYieldPerToken); } function updateGlobalYield() public { } function getYieldData(address _staker) public view returns(uint256, uint256) { } function _timeSinceLastUpdate() internal returns(uint256) { } /** * @dev Calculates Interest for staker for their stake. * * Formula: * EarnedInterest = MAX[TotalStaked x GlobalYield - (StakeBuyinRate + WithdrawnToDate), 0] * * @param _staker Staker's address * * @return The amount of tokens credit for the staker. */ function calculateInterest(address _staker) public view returns (uint256) { } /** * @dev Calculates and updates new accrued amount per token since last update. * * Formula: * GlobalYield = GlobalYield(P) + newlyGeneratedInterest/GlobalTotalStake. * * @param _interestGenerated Interest token earned since last update. * */ function updateGlobalYieldPerToken( uint256 _interestGenerated ) internal { } function getStakerData(address _staker) public view returns(uint256, uint256) { } /** * @dev returns stats data. * @param _staker Address of staker. * @return Total staked. * @return Total reward to be distributed. * @return estimated reward for user at end of staking period if no one stakes from current time. * @return Unlocked reward based on elapsed time. * @return Accrued reward for user till now. */ function getStatsData(address _staker) external view returns(uint, uint, uint, uint, uint) { } }
rewardToken.transfer(msg.sender,interest),"Withdraw interest transfer failed"
4,393
rewardToken.transfer(msg.sender,interest)
"Transfer failed while trasfering to vault"
/* Copyright (C) 2020 PlotX.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ */ pragma solidity 0.5.7; contract Staking { using SafeMath for uint256; /** * @dev Structure to store Interest details. * It contains total amount of tokens staked and globalYield. */ struct InterestData { uint256 globalTotalStaked; uint256 globalYieldPerToken; uint256 lastUpdated; mapping(address => Staker) stakers; } /** * @dev Structure to store staking details. * It contains amount of tokens staked and withdrawn interest. */ struct Staker { uint256 totalStaked; uint256 withdrawnToDate; uint256 stakeBuyinRate; } // Token address ERC20 private stakeToken; // Reward token ERC20 private rewardToken; // Interest and staker data InterestData public interestData; uint public stakingStartTime; uint public totalReward; // unclaimed reward will be trasfered to this account address public vaultAddress; // 10^18 uint256 private constant DECIMAL1e18 = 10**18; //Total time (in sec) over which reward will be distributed uint256 public stakingPeriod; /** * @dev Emitted when `staker` stake `value` tokens. */ event Staked(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` withdraws their stake `value` tokens. */ event StakeWithdrawn(address indexed staker, uint256 value, uint256 _globalYieldPerToken); /** * @dev Emitted when `staker` collects interest `_value`. */ event InterestCollected( address indexed staker, uint256 _value, uint256 _globalYieldPerToken ); /** * @dev Constructor * @param _stakeToken The address of stake Token * @param _rewardToken The address of reward Token * @param _stakingPeriod valid staking time after staking starts * @param _totalRewardToBeDistributed total amount to be distributed as reward */ constructor( address _stakeToken, address _rewardToken, uint256 _stakingPeriod, uint256 _totalRewardToBeDistributed, uint256 _stakingStart, address _vaultAdd ) public { } /** * @dev Allows a staker to deposit Tokens. Notice that `approve` is * needed to be executed before the execution of this method. * @param _amount The amount of tokens to stake */ function stake(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while staking. * must call update globalYieldPerToken before this operation * @param _staker Staker's address * @param _stake Amount of stake * */ function updateStakeData( address _staker, uint256 _stake ) internal { } /** * @dev Calculates and updates the yield rate in which the staker has entered * a staker may stake multiple times, so we calculate his cumulative rate his earning will be calculated based on GlobalYield and StakeBuyinRate * Formula: * StakeBuyinRate = [StakeBuyinRate(P) + (GlobalYield(P) x Stake)] * * @param _stakerData Staker's Data * @param _globalYieldPerToken Total yielding amount per token * @param _stake Amount staked * */ function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake ) internal { } /** * @dev Withdraws the sender staked Token. */ function withdrawStakeAndInterest(uint256 _amount) external { } /** * @dev Updates InterestData and Staker data while withdrawing stake. * * @param _staker Staker address * @param _amount Amount of stake to withdraw * */ function updateStakeAndInterestData( address _staker, uint256 _amount ) internal { } /** * @dev Withdraws the sender Earned interest. */ function withdrawInterest() public { } function updateGlobalYield() public { } function getYieldData(address _staker) public view returns(uint256, uint256) { } function _timeSinceLastUpdate() internal returns(uint256) { } /** * @dev Calculates Interest for staker for their stake. * * Formula: * EarnedInterest = MAX[TotalStaked x GlobalYield - (StakeBuyinRate + WithdrawnToDate), 0] * * @param _staker Staker's address * * @return The amount of tokens credit for the staker. */ function calculateInterest(address _staker) public view returns (uint256) { } /** * @dev Calculates and updates new accrued amount per token since last update. * * Formula: * GlobalYield = GlobalYield(P) + newlyGeneratedInterest/GlobalTotalStake. * * @param _interestGenerated Interest token earned since last update. * */ function updateGlobalYieldPerToken( uint256 _interestGenerated ) internal { if (interestData.globalTotalStaked == 0) { require(<FILL_ME>) return; } interestData.globalYieldPerToken = interestData.globalYieldPerToken.add( _interestGenerated .mul(DECIMAL1e18) .div(interestData.globalTotalStaked) ); } function getStakerData(address _staker) public view returns(uint256, uint256) { } /** * @dev returns stats data. * @param _staker Address of staker. * @return Total staked. * @return Total reward to be distributed. * @return estimated reward for user at end of staking period if no one stakes from current time. * @return Unlocked reward based on elapsed time. * @return Accrued reward for user till now. */ function getStatsData(address _staker) external view returns(uint, uint, uint, uint, uint) { } }
rewardToken.transfer(vaultAddress,_interestGenerated),"Transfer failed while trasfering to vault"
4,393
rewardToken.transfer(vaultAddress,_interestGenerated)
"Excluded addresses cannot call this function"
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { } function _msgData() internal view virtual returns (bytes memory) { } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library 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) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } library Address { function isContract(address account) internal view returns (bool) { } function sendValue(address payable recipient, uint256 amount) internal { } function functionCall(address target, bytes memory data) internal returns (bytes memory) { } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { } function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { } function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { } function owner() public view returns (address) { } modifier onlyOwner() { } function renounceOwnership() public virtual onlyOwner { } function transferOwnership(address newOwner) public virtual onlyOwner { } } contract SUPERFLECT is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1250 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _tBurnTotal; string private _name = 't.me/superflect'; string private _symbol = 'SUPERFLECT'; uint8 private _decimals = 9; // Tax Fee - 15% // Burn Fee - 5% // Tx Limit - 100 uint256 private _taxFee = 15; uint256 private _burnFee = 5; uint256 private _maxTxAmount = 100e9; constructor () public { } function name() public view returns (string memory) { } function symbol() public view returns (string memory) { } function decimals() public view returns (uint8) { } 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 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 increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { } function isExcluded(address account) public view returns (bool) { } function totalFees() public view returns (uint256) { } function totalBurn() public view returns (uint256) { } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(<FILL_ME>) (uint256 rAmount,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { } function excludeAccount(address account) external onlyOwner() { } function includeAccount(address account) external onlyOwner() { } function _approve(address owner, address spender, uint256 amount) private { } function _transfer(address sender, address recipient, uint256 amount) private { } function _transferStandard(address sender, address recipient, uint256 tAmount) private { } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { } function _reflectFee(uint256 rFee, uint256 rBurn, uint256 tFee, uint256 tBurn) private { } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 burnFee) private pure returns (uint256, uint256, uint256) { } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tBurn, uint256 currentRate) private pure returns (uint256, uint256, uint256) { } function _getRate() private view returns(uint256) { } function _getCurrentSupply() private view returns(uint256, uint256) { } function _getTaxFee() private view returns(uint256) { } function _getMaxTxAmount() private view returns(uint256) { } function _setTaxFee(uint256 taxFee) external onlyOwner() { } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { } }
!_isExcluded[sender],"Excluded addresses cannot call this function"
4,533
!_isExcluded[sender]
"Account is already excluded"
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { } function _msgData() internal view virtual returns (bytes memory) { } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library 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) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } library Address { function isContract(address account) internal view returns (bool) { } function sendValue(address payable recipient, uint256 amount) internal { } function functionCall(address target, bytes memory data) internal returns (bytes memory) { } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { } function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { } function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { } function owner() public view returns (address) { } modifier onlyOwner() { } function renounceOwnership() public virtual onlyOwner { } function transferOwnership(address newOwner) public virtual onlyOwner { } } contract SUPERFLECT is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1250 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _tBurnTotal; string private _name = 't.me/superflect'; string private _symbol = 'SUPERFLECT'; uint8 private _decimals = 9; // Tax Fee - 15% // Burn Fee - 5% // Tx Limit - 100 uint256 private _taxFee = 15; uint256 private _burnFee = 5; uint256 private _maxTxAmount = 100e9; constructor () public { } function name() public view returns (string memory) { } function symbol() public view returns (string memory) { } function decimals() public view returns (uint8) { } 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 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 increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { } function isExcluded(address account) public view returns (bool) { } function totalFees() public view returns (uint256) { } function totalBurn() public view returns (uint256) { } function deliver(uint256 tAmount) public { } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { } function excludeAccount(address account) external onlyOwner() { require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(<FILL_ME>) if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(address account) external onlyOwner() { } function _approve(address owner, address spender, uint256 amount) private { } function _transfer(address sender, address recipient, uint256 amount) private { } function _transferStandard(address sender, address recipient, uint256 tAmount) private { } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { } function _reflectFee(uint256 rFee, uint256 rBurn, uint256 tFee, uint256 tBurn) private { } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 burnFee) private pure returns (uint256, uint256, uint256) { } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tBurn, uint256 currentRate) private pure returns (uint256, uint256, uint256) { } function _getRate() private view returns(uint256) { } function _getCurrentSupply() private view returns(uint256, uint256) { } function _getTaxFee() private view returns(uint256) { } function _getMaxTxAmount() private view returns(uint256) { } function _setTaxFee(uint256 taxFee) external onlyOwner() { } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { } }
!_isExcluded[account],"Account is already excluded"
4,533
!_isExcluded[account]