Skip to main content
PulseScanner.io

Address

0x4b15df5a489173e4e4ced1027ebe7fdaa4fd5a24
Current Holdings
$0.00
TXs sent
not counted
First Active
2025-10-23
block 24,833,854
Last Active
327 days ago
block 24,834,807
Funded By
not identified

Net worth historyi

No net-worth snapshots recorded yet
exact matchGigaVideo1155solc 0.8.23+commit.f704f362runtime exact · creation exact
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

// OpenZeppelin v5.0.2
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/token/ERC1155/ERC1155.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/token/ERC20/IERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/utils/ReentrancyGuard.sol"; // <-- perbaikan path
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/utils/Pausable.sol";

contract GigaVideo1155 is ERC1155, Ownable, ReentrancyGuard, Pausable {
    uint256 public constant TOKEN_ID = 1;

    IERC20  public immutable paymentToken;   // $GIGACOCK
    address public treasury;
    uint256 public pricePerMint;             // 18 desimal
    uint256 public maxSupply;
    uint256 public totalMinted;

    bool public uriLocked;

    event Minted(address indexed minter, uint256 qty, uint256 paid);
    event PriceUpdated(uint256 oldPrice, uint256 newPrice);
    event TreasuryUpdated(address oldTreasury, address newTreasury);
    event UriLocked(string currentURI);

    constructor(
        address _gigaToken,
        address _treasury,
        uint256 _price,
        uint256 _maxSupply,
        string memory _uri
    ) ERC1155(_uri) Ownable(msg.sender) {
        require(_gigaToken != address(0) && _treasury != address(0), "zero addr");
        require(_maxSupply > 0, "bad supply");

        paymentToken = IERC20(_gigaToken);
        treasury     = _treasury;
        pricePerMint = _price;
        maxSupply    = _maxSupply;
    }

    function mint(uint256 qty) external nonReentrant whenNotPaused {
        require(qty > 0, "qty=0");
        require(totalMinted + qty <= maxSupply, "sold out");

        uint256 cost = pricePerMint * qty;
        require(paymentToken.allowance(msg.sender, address(this)) >= cost, "approve first");
        require(paymentToken.transferFrom(msg.sender, treasury, cost), "pay fail");

        totalMinted += qty;
        _mint(msg.sender, TOKEN_ID, qty, "");
        emit Minted(msg.sender, qty, cost);
    }

    // Admin
    function setPrice(uint256 newPrice) external onlyOwner {
        emit PriceUpdated(pricePerMint, newPrice);
        pricePerMint = newPrice;
    }

    function setTreasury(address newTreasury) external onlyOwner {
        require(newTreasury != address(0), "zero addr");
        emit TreasuryUpdated(treasury, newTreasury);
        treasury = newTreasury;
    }

    function setURI(string calldata newuri) external onlyOwner {
        require(!uriLocked, "URI locked");
        _setURI(newuri);
    }

    function lockURI() external onlyOwner {
        require(!uriLocked, "already locked");
        uriLocked = true;
        emit UriLocked(uri(TOKEN_ID)); // ERC1155.uri() butuh tokenId
    }

    function pause() external onlyOwner { _pause(); }
    function unpause() external onlyOwner { _unpause(); }

    function rescueERC20(address token, uint256 amount) external onlyOwner {
        require(token != address(paymentToken), "no rescue paymentToken");
        IERC20(token).transfer(msg.sender, amount);
    }
}