Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 631 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Buy Bag | 13588557 | 972 days ago | IN | 3.6 ETH | 0.0080667 | ||||
Buy Bag | 13581997 | 973 days ago | IN | 10 ETH | 0.00734144 | ||||
Buy Bag | 13576003 | 974 days ago | IN | 3 ETH | 0.00464289 | ||||
Buy Bag | 13548905 | 978 days ago | IN | 5.3 ETH | 0.00649693 | ||||
Buy Bag | 13374498 | 1005 days ago | IN | 0.3 ETH | 0.00882381 | ||||
Buy Bag | 13365352 | 1007 days ago | IN | 0.5 ETH | 0.00625114 | ||||
Buy Bag | 13359271 | 1008 days ago | IN | 0.1 ETH | 0.00450796 | ||||
Buy Bag | 13359083 | 1008 days ago | IN | 0.2 ETH | 0.00506869 | ||||
Buy Bag | 13353903 | 1009 days ago | IN | 0.5 ETH | 0.00689376 | ||||
Buy Bag | 13353687 | 1009 days ago | IN | 0.1 ETH | 0.0111 | ||||
Buy Bag | 13316781 | 1014 days ago | IN | 0.1 ETH | 0.00318369 | ||||
Buy Bag | 13279328 | 1020 days ago | IN | 0.2 ETH | 0.00506161 | ||||
Buy Bag | 13276130 | 1021 days ago | IN | 0.1 ETH | 0.00375581 | ||||
Buy Bag | 13270096 | 1022 days ago | IN | 0.1 ETH | 0.00540029 | ||||
Buy Bag | 13261224 | 1023 days ago | IN | 0.2 ETH | 0.00301049 | ||||
Buy Bag | 13258821 | 1023 days ago | IN | 0.2 ETH | 0.00549642 | ||||
Buy Bag | 13258675 | 1023 days ago | IN | 0.2 ETH | 0.00603407 | ||||
Buy Bag | 13258394 | 1023 days ago | IN | 0.1 ETH | 0.00440702 | ||||
Buy Bag | 13256546 | 1024 days ago | IN | 0.1 ETH | 0.00285666 | ||||
Buy Bag | 13238875 | 1026 days ago | IN | 0.3 ETH | 0.006436 | ||||
Buy Bag | 13238731 | 1026 days ago | IN | 0.3 ETH | 0.00994905 | ||||
Buy Bag | 13235840 | 1027 days ago | IN | 0.2 ETH | 0.00286474 | ||||
Buy Bag | 13223488 | 1029 days ago | IN | 0.1 ETH | 0.00230781 | ||||
Buy Bag | 13223450 | 1029 days ago | IN | 0.1 ETH | 0.00276285 | ||||
Buy Bag | 13215308 | 1030 days ago | IN | 0.3 ETH | 0.00304371 |
Loading...
Loading
Contract Name:
BagSale
Compiler Version
v0.7.4+commit.3f05b770
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-05-31 */ // SPDX-License-Identifier: MIT pragma solidity 0.7.4; // Part: OpenZeppelin/[email protected]/Context /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // Part: OpenZeppelin/[email protected]/IERC20 /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // Part: OpenZeppelin/[email protected]/SafeMath /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // Part: OpenZeppelin/[email protected]/ERC20 /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @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`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * 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 view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @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 address. * - `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 sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // Part: OpenZeppelin/[email protected]/Ownable /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // Part: Bags contract Bags is ERC20, Ownable { using SafeMath for uint256; uint256 immutable public MAX_BAGS; constructor(uint256 _maxBags) ERC20("Degen$ Farm Bags", "BAGZ") { MAX_BAGS = _maxBags; } function mint(address to, uint256 amount) external onlyOwner { require(totalSupply() <= MAX_BAGS.sub(amount), "MAX bags amount exceed!"); _mint(to, amount); } function burn(address to, uint256 amount) external onlyOwner { _burn(to, amount); } /** * @dev Owner can claim any tokens that transfered * to this contract address */ function reclaimToken(ERC20 token) external onlyOwner { require(address(token) != address(0)); uint256 balance = token.balanceOf(address(this)); token.transfer(owner(), balance); } /** * @dev This function implement proxy for before transfer hook form OpenZeppelin ERC20. * * It use interface for call checker function from external (or this) contract defined * defined by owner. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { require(to != address(this), "This contract not accept tokens" ); } /** * @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`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * 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 view override returns (uint8) { return 0; } } // File: BagSale.sol contract BagSale is Ownable { using SafeMath for uint256; Bags immutable bagsContract; uint256 public bagPrice = 1e17; uint256 public weiRaised; event BagBought(address indexed _buyer, uint256 _boughtPrice, uint256 amount); /** * @dev Set some initial params for sale. * * Requirements: * * - `_erc20` Bags ERC20 contract address. */ constructor(Bags _erc20) { bagsContract = _erc20; } /** * @dev Call this Function for buy bag for ether * */ function buyBag() external payable { require(msg.value >= bagPrice, "Need more ether!"); uint256 mintAmount = msg.value.mul(10**bagsContract.decimals()).div(bagPrice); bagsContract.mint(msg.sender, mintAmount); weiRaised = weiRaised.add(msg.value); emit BagBought(msg.sender, bagPrice, mintAmount); } /** * @dev Just withdraw ether to owner */ function withdraw() external onlyOwner { msg.sender.transfer(address(this).balance); } /** * @dev Returns amount of bags that available for sale yet */ function bagsAvailable() external view returns (uint256) { return bagsContract.MAX_BAGS().sub(bagsContract.totalSupply()); } /** * @dev Returns price for next bag in current moment */ function nextBagPrice() external view returns (uint256) { return _nextPrice(1); } /** * @dev Function returns tuple with next price according to the bonding * curve (1) and left amount of BAGs token (2) * * @return (uint256, uint256) */ function howMuch() external view returns (uint256, uint256) { return (_nextPrice(1), bagsContract.MAX_BAGS().sub(bagsContract.totalSupply())); } /** * @dev Returns price after `_bagsCount` will bought *. * @param _bagsCount - bags that will bought. */ function _nextPrice(uint256 _bagsCount) internal view returns (uint256) { //Because last_price expressed in wei we dont need mul(1e18) //but still need div(1e4) - see comment above near A and B declaration //uint256 _price = last_price.mul(A**_bagsCount).div(10**(4*_bagsCount)); return bagPrice; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract Bags","name":"_erc20","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"_boughtPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BagBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"bagPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bagsAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyBag","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"howMuch","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextBagPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weiRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405267016345785d8a000060015534801561001c57600080fd5b50604051610aa7380380610aa78339818101604052602081101561003f57600080fd5b5051600061004b6100aa565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060601b6001600160601b0319166080526100ae565b3390565b60805160601c6109c86100df6000398061021952806102b3528061052b52806105c8528061076952506109c86000f3fe6080604052600436106100915760003560e01c80638da5cb5b116100595780638da5cb5b14610106578063942b58a814610137578063f170047714610165578063f2fde38b1461017a578063f9e2c9e2146101ad57610091565b8063369bad25146100965780633ccfd60b146100a05780634042b66f146100b5578063584fb155146100dc578063715018a6146100f1575b600080fd5b61009e6101c2565b005b3480156100ac57600080fd5b5061009e610392565b3480156100c157600080fd5b506100ca610435565b60408051918252519081900360200190f35b3480156100e857600080fd5b506100ca61043b565b3480156100fd57600080fd5b5061009e61044c565b34801561011257600080fd5b5061011b61050a565b604080516001600160a01b039092168252519081900360200190f35b34801561014357600080fd5b5061014c610519565b6040805192835260208301919091528051918290030190f35b34801561017157600080fd5b506100ca610648565b34801561018657600080fd5b5061009e6004803603602081101561019d57600080fd5b50356001600160a01b031661064e565b3480156101b957600080fd5b506100ca610762565b60015434101561020c576040805162461bcd60e51b815260206004820152601060248201526f4e656564206d6f72652065746865722160801b604482015290519081900360640190fd5b60006102af6001546102a97f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561027057600080fd5b505afa158015610284573d6000803e3d6000fd5b505050506040513d602081101561029a57600080fd5b5051349060ff16600a0a6107c0565b90610822565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340c10f1933836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561032857600080fd5b505af115801561033c573d6000803e3d6000fd5b505060025461034e9250905034610889565b6002556001546040805191825260208201839052805133927f5a7af92484a258118bf610e9a07479af587d48b2fa460bd69cd27cb286fdeb6792908290030190a250565b61039a6108e3565b6001600160a01b03166103ab61050a565b6001600160a01b031614610406576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610432573d6000803e3d6000fd5b50565b60025481565b600061044760016108e7565b905090565b6104546108e3565b6001600160a01b031661046561050a565b6001600160a01b0316146104c0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60008061052660016108e7565b6106407f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561058257600080fd5b505afa158015610596573d6000803e3d6000fd5b505050506040513d60208110156105ac57600080fd5b505160408051635af9afaf60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691635af9afaf916004808301926020929190829003018186803b15801561060e57600080fd5b505afa158015610622573d6000803e3d6000fd5b505050506040513d602081101561063857600080fd5b5051906108ee565b915091509091565b60015481565b6106566108e3565b6001600160a01b031661066761050a565b6001600160a01b0316146106c2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107075760405162461bcd60e51b815260040180806020018281038252602681526020018061094c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006104477f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561058257600080fd5b6000826107cf5750600061081c565b828202828482816107dc57fe5b04146108195760405162461bcd60e51b81526004018080602001828103825260218152602001806109726021913960400191505060405180910390fd5b90505b92915050565b6000808211610878576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161088157fe5b049392505050565b600082820183811015610819576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b5060015490565b600082821115610945576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212206c9c7c7c08e431dd7dc63840b6402fa410a1b461b583fdb7c097a63f812700df64736f6c63430007040033000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b8
Deployed Bytecode
0x6080604052600436106100915760003560e01c80638da5cb5b116100595780638da5cb5b14610106578063942b58a814610137578063f170047714610165578063f2fde38b1461017a578063f9e2c9e2146101ad57610091565b8063369bad25146100965780633ccfd60b146100a05780634042b66f146100b5578063584fb155146100dc578063715018a6146100f1575b600080fd5b61009e6101c2565b005b3480156100ac57600080fd5b5061009e610392565b3480156100c157600080fd5b506100ca610435565b60408051918252519081900360200190f35b3480156100e857600080fd5b506100ca61043b565b3480156100fd57600080fd5b5061009e61044c565b34801561011257600080fd5b5061011b61050a565b604080516001600160a01b039092168252519081900360200190f35b34801561014357600080fd5b5061014c610519565b6040805192835260208301919091528051918290030190f35b34801561017157600080fd5b506100ca610648565b34801561018657600080fd5b5061009e6004803603602081101561019d57600080fd5b50356001600160a01b031661064e565b3480156101b957600080fd5b506100ca610762565b60015434101561020c576040805162461bcd60e51b815260206004820152601060248201526f4e656564206d6f72652065746865722160801b604482015290519081900360640190fd5b60006102af6001546102a97f000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b86001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561027057600080fd5b505afa158015610284573d6000803e3d6000fd5b505050506040513d602081101561029a57600080fd5b5051349060ff16600a0a6107c0565b90610822565b90507f000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b86001600160a01b03166340c10f1933836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561032857600080fd5b505af115801561033c573d6000803e3d6000fd5b505060025461034e9250905034610889565b6002556001546040805191825260208201839052805133927f5a7af92484a258118bf610e9a07479af587d48b2fa460bd69cd27cb286fdeb6792908290030190a250565b61039a6108e3565b6001600160a01b03166103ab61050a565b6001600160a01b031614610406576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610432573d6000803e3d6000fd5b50565b60025481565b600061044760016108e7565b905090565b6104546108e3565b6001600160a01b031661046561050a565b6001600160a01b0316146104c0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60008061052660016108e7565b6106407f000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b86001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561058257600080fd5b505afa158015610596573d6000803e3d6000fd5b505050506040513d60208110156105ac57600080fd5b505160408051635af9afaf60e01b815290516001600160a01b037f000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b81691635af9afaf916004808301926020929190829003018186803b15801561060e57600080fd5b505afa158015610622573d6000803e3d6000fd5b505050506040513d602081101561063857600080fd5b5051906108ee565b915091509091565b60015481565b6106566108e3565b6001600160a01b031661066761050a565b6001600160a01b0316146106c2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107075760405162461bcd60e51b815260040180806020018281038252602681526020018061094c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006104477f000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b86001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561058257600080fd5b6000826107cf5750600061081c565b828202828482816107dc57fe5b04146108195760405162461bcd60e51b81526004018080602001828103825260218152602001806109726021913960400191505060405180910390fd5b90505b92915050565b6000808211610878576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161088157fe5b049392505050565b600082820183811015610819576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b5060015490565b600082821115610945576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212206c9c7c7c08e431dd7dc63840b6402fa410a1b461b583fdb7c097a63f812700df64736f6c63430007040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b8
-----Decoded View---------------
Arg [0] : _erc20 (address): 0xBABA0d970e735c7E48bba07C1164c4e0449AE9b8
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000baba0d970e735c7e48bba07c1164c4e0449ae9b8
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.