Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xEbAE6212581025030eC6165A95E0Ec550DbB6020
Balance 0 ETH
Nonce 1
Code Size 5899 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

5899 bytes
0x608060405234801561000f575f80fd5b50600436106101d1575f3560e01c80639754a7d8116100fe578063b4f2e8b81161009e578063ef8f192a1161006e578063ef8f192a146103d8578063f2fde38b146103f7578063f43b78ff1461040a578063f4514fa31461041e575f80fd5b8063b4f2e8b814610373578063c189205814610386578063d1b8051f146103a1578063e1017332146103b4575f80fd5b8063aaefb3c3116100d9578063aaefb3c31461032a578063b2118a8d14610332578063b291239f14610345578063b401810a14610360575f80fd5b80639754a7d814610307578063a38eb6221461030f578063a7c6016014610317575f80fd5b806346904840116101745780636edeeb8d116101445780636edeeb8d146102d3578063715018a6146102e65780637b1b1de6146102ee5780638da5cb5b146102f7575f80fd5b806346904840146102895780634c6a78c41461029c5780634f9f8357146102c357806361543801146102cb575f80fd5b80632425228e116101af5780632425228e1461020f5780632bf2762f1461022e5780632f48ab7d1461024157806345549ad414610280575f80fd5b8063017f6fae146101d55780630fa87615146101f15780631481794e146101fa575b5f80fd5b6101de60025481565b6040519081526020015b60405180910390f35b6101de60065481565b61020d610208366004611453565b610427565b005b6101de61021d36600461147b565b60086020525f908152604090205481565b61020d61023c36600461147b565b6104f1565b6102687f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b6040516001600160a01b0390911681526020016101e8565b6101de60055481565b600354610268906001600160a01b031681565b6102687f00000000000000000000000071fc7a476dc5fbba0189deddb33374e8cc38b48681565b61020d61056f565b6101de6105ba565b6101de6102e136600461147b565b6105c8565b61020d610a08565b6101de60015481565b5f546001600160a01b0316610268565b61020d610a1b565b61020d610a66565b6101de61032536600461147b565b610ab1565b61020d610eeb565b61020d610340366004611492565b610f30565b6102687371fc7a476dc5fbba0189deddb33374e8cc38b48681565b61020d61036e3660046114cb565b61104b565b61020d6103813660046114f4565b6110e5565b61026873dac17f958d2ee523a2206206994597c13d831ec781565b61020d6103af366004611453565b6111a5565b6003546103c890600160a81b900460ff1681565b60405190151581526020016101e8565b6101de6103e636600461147b565b60076020525f908152604090205481565b61020d61040536600461151e565b611262565b6003546103c890600160a01b900460ff1681565b6101de60045481565b61042f61129f565b6001600160a01b0382166104765760405162461bcd60e51b81526020600482015260096024820152683d32b9379030b2323960b91b60448201526064015b60405180910390fd5b6104aa6001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec71683836112cb565b604080516001600160a01b0384168152602081018390527fb478926c8c08735485a152b83a8579215621d5ad0aa92795fbc030c66ba6df8091015b60405180910390a15050565b6104f961129f565b5f81116105315760405162461bcd60e51b815260206004820152600660248201526507072696365360d41b604482015260640161046d565b600180549082905560408051828152602081018490527f945c1c4e99aa89f648fbfe3df471b916f719e16d960fcec0737d4d56bd69683891016104e5565b61057761129f565b6003805460ff60a81b191690556040513381527ffe8e8212f500595bc1a7ddd3e375abe499b17173648ed86876dbea37581e0592906020015b60405180910390a1565b5f6105c361132f565b905090565b6003545f90600160a81b900460ff16156106125760405162461bcd60e51b815260206004820152600b60248201526a1cd95b1b081c185d5cd95960aa1b604482015260640161046d565b5f821161064f5760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015260640161046d565b5f600154116106905760405162461bcd60e51b815260206004820152600d60248201526c1c1c9a58d9481b9bdd081cd95d609a1b604482015260640161046d565b5f7371fc7a476dc5fbba0189deddb33374e8cc38b4866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106e1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610705919061153e565b90505f61071382600a611654565b6001546107209086611662565b61072a9190611679565b90505f81116107675760405162461bcd60e51b81526020600482015260096024820152681d1bdbc81cdb585b1b60ba1b604482015260640161046d565b5f612710600254836107799190611662565b6107839190611679565b905061078f8183611698565b93505f61079a61132f565b5f81815260086020526040812054919250906107b79087906116ab565b90506006545f14806107cb57506006548111155b6108175760405162461bcd60e51b815260206004820152601860248201527f706572696f642073656c6c206361702065786365656465640000000000000000604482015260640161046d565b61084c6001600160a01b037f00000000000000000000000071fc7a476dc5fbba0189deddb33374e8cc38b4861633308a61133e565b6040516370a0823160e01b815230600482015286907f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316906370a0823190602401602060405180830381865afa1580156108b0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108d491906116be565b10156109165760405162461bcd60e51b81526020600482015260116024820152701a5b9cdd59999a58da595b9d081554d115607a1b604482015260640161046d565b5f8311801561092f57506003546001600160a01b031615155b1561096e5760035461096e906001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781169116856112cb565b6109a26001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec71633886112cb565b5f8281526008602090815260409182902083905581518981529081018690529081018490526060810187905233907f490fdc1c23c0f3a84bf80a0384eaadcb9188c9ef71b9430da391a0e4c4c39bf6906080015b60405180910390a25050505050919050565b610a1061129f565b610a195f61137d565b565b610a2361129f565b6003805460ff60a81b1916600160a81b1790556040513381527fbd4854f7d7cd59d7634d7a1aa9ae344fbcb8ba2b2fddf86de9a7a455db5f5f37906020016105b0565b610a6e61129f565b6003805460ff60a01b1916600160a01b1790556040513381527f45169df37d8b437c44cc42c052c2cbf92a2dca5ef49ec02cfb0bd83fd9da2aff906020016105b0565b6003545f90600160a01b900460ff1615610afa5760405162461bcd60e51b815260206004820152600a602482015269189d5e481c185d5cd95960b21b604482015260640161046d565b5f8211610b375760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015260640161046d565b5f60015411610b785760405162461bcd60e51b815260206004820152600d60248201526c1c1c9a58d9481b9bdd081cd95d609a1b604482015260640161046d565b5f610b8161132f565b5f8181526007602052604081205491925090610b9e9085906116ab565b90506005545f1480610bb257506005548111155b610bfe5760405162461bcd60e51b815260206004820152601760248201527f706572696f642062757920636170206578636565646564000000000000000000604482015260640161046d565b610c336001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec71633308761133e565b5f61271060025486610c459190611662565b610c4f9190611679565b90505f610c5c8287611698565b90505f7371fc7a476dc5fbba0189deddb33374e8cc38b4866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610caf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cd3919061153e565b600154909150610ce482600a611654565b610cee9084611662565b610cf89190611679565b95505f8611610d3c5760405162461bcd60e51b815260206004820152601060248201526f185b5bdd5b9d081d1bdbc81cdb585b1b60821b604482015260640161046d565b6040516370a0823160e01b815230600482015286907f00000000000000000000000071fc7a476dc5fbba0189deddb33374e8cc38b4866001600160a01b0316906370a0823190602401602060405180830381865afa158015610da0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dc491906116be565b1015610e075760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e7420415a4e583160701b604482015260640161046d565b5f83118015610e2057506003546001600160a01b031615155b15610e5f57600354610e5f906001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781169116856112cb565b610e936001600160a01b037f00000000000000000000000071fc7a476dc5fbba0189deddb33374e8cc38b4861633886112cb565b5f8581526007602090815260409182902086905581518981529081018590529081018390526060810187905233907f5f5252e81556cf80e49da97ac40f17af2fb3b00e318b675ae93089f555bfa380906080016109f6565b610ef361129f565b6003805460ff60a01b191690556040513381527f1fca686fe8b90694d638f449d38b5d59c6c23de9d9d7f92c0bef7e2930d208e7906020016105b0565b610f3861129f565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316836001600160a01b031614158015610fac57507f00000000000000000000000071fc7a476dc5fbba0189deddb33374e8cc38b4866001600160a01b0316836001600160a01b031614155b610fe65760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015260640161046d565b610ffa6001600160a01b03841683836112cb565b604080516001600160a01b038086168252841660208201529081018290527f9b793652de97f04c5168920587bad4b1c6345295a8f5ad31c59ff946a26f91d2906060015b60405180910390a1505050565b61105361129f565b610e108310156110985760405162461bcd60e51b815260206004820152601060248201526f1c195c9a5bd9081d1bdbc81cdb585b1b60821b604482015260640161046d565b60048390556005829055600681905560408051848152602081018490529081018290527fd1f36181d3ebe98115b599698392570844425fd4c194b65e2faac16b6ed417f79060600161103e565b6110ed61129f565b61271082111561112a5760405162461bcd60e51b81526020600482015260086024820152676665653e3130302560c01b604482015260640161046d565b6002805460038054928590556001600160a01b031983166001600160a01b0385811691821790925560408051848152602081018890529290941693820184905260608201529091907f92f522032eedce04e448df1d2fbdab83ea83b8d92ef27709bfec2ea9fd45b51a9060800160405180910390a150505050565b6111ad61129f565b6001600160a01b0382166111ef5760405162461bcd60e51b81526020600482015260096024820152683d32b9379030b2323960b91b604482015260640161046d565b6112236001600160a01b037f00000000000000000000000071fc7a476dc5fbba0189deddb33374e8cc38b4861683836112cb565b604080516001600160a01b0384168152602081018390527fc9b875ec05e1a6908f4df5f838ae291a3725aa50056c727da61580a2737daef591016104e5565b61126a61129f565b6001600160a01b03811661129357604051631e4fbdf760e01b81525f600482015260240161046d565b61129c8161137d565b50565b5f546001600160a01b03163314610a195760405163118cdaa760e01b815233600482015260240161046d565b6040516001600160a01b0383811660248301526044820183905261132a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506113cc565b505050565b5f600454426105c39190611679565b6040516001600160a01b0384811660248301528381166044830152606482018390526113779186918216906323b872dd906084016112f8565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f8060205f8451602086015f885af1806113eb576040513d5f823e3d81fd5b50505f513d9150811561140257806001141561140f565b6001600160a01b0384163b155b1561137757604051635274afe760e01b81526001600160a01b038516600482015260240161046d565b80356001600160a01b038116811461144e575f80fd5b919050565b5f8060408385031215611464575f80fd5b61146d83611438565b946020939093013593505050565b5f6020828403121561148b575f80fd5b5035919050565b5f805f606084860312156114a4575f80fd5b6114ad84611438565b92506114bb60208501611438565b9150604084013590509250925092565b5f805f606084860312156114dd575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215611505575f80fd5b8235915061151560208401611438565b90509250929050565b5f6020828403121561152e575f80fd5b61153782611438565b9392505050565b5f6020828403121561154e575f80fd5b815160ff81168114611537575f80fd5b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156115ac57815f19048211156115925761159261155e565b8085161561159f57918102915b93841c9390800290611577565b509250929050565b5f826115c25750600161164e565b816115ce57505f61164e565b81600181146115e457600281146115ee5761160a565b600191505061164e565b60ff8411156115ff576115ff61155e565b50506001821b61164e565b5060208310610133831016604e8410600b841016171561162d575081810a61164e565b6116378383611572565b805f190482111561164a5761164a61155e565b0290505b92915050565b5f61153760ff8416836115b4565b808202811582820484141761164e5761164e61155e565b5f8261169357634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561164e5761164e61155e565b8082018082111561164e5761164e61155e565b5f602082840312156116ce575f80fd5b505191905056fea26469706673582212207a3db74b0b53737057ac71f3586eebda67a325f121844875070c2f6fd1d7b37064736f6c63430008140033

Verified Source Code Full Match

Compiler: v0.8.20+commit.a1b79de6 EVM: shanghai Optimization: Yes (200 runs)
AZNX1BUY.sol 205 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/*
  AZNX1SaleWithUSDT (Official Deployment Version)
  -----------------------------------------------
  ✅ Works with OpenZeppelin 5.x (Ownable requires initialOwner)
  ✅ USDT-only buy/sell
  ✅ Configurable price, fee, and caps
  ✅ Uses SafeERC20 for both USDT and AZNX1
  ✅ Fully production-ready for Azaance (AZNX1)
*/

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

interface IERC20Decimals {
    function decimals() external view returns (uint8);
}

contract AZNX1SaleWithUSDT is Ownable {
    using SafeERC20 for IERC20;

    // === TOKEN ADDRESSES ===
    // USDT (Ethereum mainnet)
    address public constant USDT_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
    IERC20 public immutable usdt = IERC20(USDT_ADDRESS);

    // Azaance Token (AZNX1)
    address public constant AZNX1_ADDRESS = 0x71Fc7a476Dc5FbBA0189DEDdb33374e8cc38b486;
    IERC20 public immutable aznx1 = IERC20(AZNX1_ADDRESS);

    // === PRICE & FEES ===
    uint256 public pricePerToken; // in USDT smallest units (6 decimals)
    uint256 public feeBP;         // basis points (e.g. 100 = 1%)
    address public feeRecipient;

    // === PAUSING ===
    bool public buyPaused;
    bool public sellPaused;

    // === PERIOD LIMITS ===
    uint256 public periodSeconds;
    uint256 public periodBuyCap;
    uint256 public periodSellCap;

    mapping(uint256 => uint256) public periodUsdtBought;
    mapping(uint256 => uint256) public periodUsdtPaidOut;

    // === EVENTS ===
    event Purchased(address indexed buyer, uint256 usdtTotal, uint256 fee, uint256 netUsdt, uint256 tokensSent);
    event Sold(address indexed seller, uint256 tokensIn, uint256 usdtGross, uint256 fee, uint256 usdtPaid);
    event PriceUpdated(uint256 oldPrice, uint256 newPrice);
    event FeeUpdated(uint256 oldFeeBP, uint256 newFeeBP, address oldRecipient, address newRecipient);
    event BuyPaused(address by);
    event BuyUnpaused(address by);
    event SellPaused(address by);
    event SellUnpaused(address by);
    event PeriodConfigUpdated(uint256 periodSeconds, uint256 periodBuyCap, uint256 periodSellCap);
    event WithdrawUSDT(address to, uint256 amount);
    event WithdrawAZNX1(address to, uint256 amount);
    event RescueERC20(address token, address to, uint256 amount);

    constructor(
        address _owner,
        uint256 _pricePerToken,
        uint256 _feeBP,
        address _feeRecipient,
        uint256 _periodSeconds,
        uint256 _periodBuyCap,
        uint256 _periodSellCap
    ) Ownable(_owner) {
        require(_owner != address(0), "owner zero");
        require(_feeBP <= 10000, "fee>100%");
        require(_pricePerToken > 0, "price0");
        require(_periodSeconds >= 1 hours, "period too small");

        pricePerToken = _pricePerToken;
        feeBP = _feeBP;
        feeRecipient = _feeRecipient;
        periodSeconds = _periodSeconds;
        periodBuyCap = _periodBuyCap;
        periodSellCap = _periodSellCap;

        buyPaused = false;
        sellPaused = false;
    }

    function _currentPeriodIndex() internal view returns (uint256) {
        return block.timestamp / periodSeconds;
    }

    // === BUY AZNX1 ===
    function buyWithUSDT(uint256 totalUsdtAmount) external returns (uint256 tokensOut) {
        require(!buyPaused, "buy paused");
        require(totalUsdtAmount > 0, "zero amount");
        require(pricePerToken > 0, "price not set");

        uint256 idx = _currentPeriodIndex();
        uint256 newTotal = periodUsdtBought[idx] + totalUsdtAmount;
        require(periodBuyCap == 0 || newTotal <= periodBuyCap, "period buy cap exceeded");

        usdt.safeTransferFrom(msg.sender, address(this), totalUsdtAmount);

        uint256 fee = (totalUsdtAmount * feeBP) / 10000;
        uint256 net = totalUsdtAmount - fee;

        uint8 tokenDecimals = IERC20Decimals(AZNX1_ADDRESS).decimals();
        tokensOut = (net * (10 ** tokenDecimals)) / pricePerToken;
        require(tokensOut > 0, "amount too small");
        require(aznx1.balanceOf(address(this)) >= tokensOut, "insufficient AZNX1");

        if (fee > 0 && feeRecipient != address(0)) {
            usdt.safeTransfer(feeRecipient, fee);
        }

        aznx1.safeTransfer(msg.sender, tokensOut);
        periodUsdtBought[idx] = newTotal;

        emit Purchased(msg.sender, totalUsdtAmount, fee, net, tokensOut);
    }

    // === SELL AZNX1 ===
    function sellAZNX1(uint256 tokenAmount) external returns (uint256 netPayout) {
        require(!sellPaused, "sell paused");
        require(tokenAmount > 0, "zero amount");
        require(pricePerToken > 0, "price not set");

        uint8 tokenDecimals = IERC20Decimals(AZNX1_ADDRESS).decimals();
        uint256 usdtGross = (tokenAmount * pricePerToken) / (10 ** tokenDecimals);
        require(usdtGross > 0, "too small");

        uint256 fee = (usdtGross * feeBP) / 10000;
        netPayout = usdtGross - fee;

        uint256 idx = _currentPeriodIndex();
        uint256 newPaid = periodUsdtPaidOut[idx] + netPayout;
        require(periodSellCap == 0 || newPaid <= periodSellCap, "period sell cap exceeded");

        aznx1.safeTransferFrom(msg.sender, address(this), tokenAmount);
        require(usdt.balanceOf(address(this)) >= netPayout, "insufficient USDT");

        if (fee > 0 && feeRecipient != address(0)) {
            usdt.safeTransfer(feeRecipient, fee);
        }

        usdt.safeTransfer(msg.sender, netPayout);
        periodUsdtPaidOut[idx] = newPaid;

        emit Sold(msg.sender, tokenAmount, usdtGross, fee, netPayout);
    }

    // === ADMIN FUNCTIONS ===
    function setPricePerToken(uint256 _pricePerToken) external onlyOwner {
        require(_pricePerToken > 0, "price0");
        uint256 old = pricePerToken;
        pricePerToken = _pricePerToken;
        emit PriceUpdated(old, _pricePerToken);
    }

    function setFee(uint256 _feeBP, address _feeRecipient) external onlyOwner {
        require(_feeBP <= 10000, "fee>100%");
        uint256 oldFee = feeBP;
        address oldRecipient = feeRecipient;
        feeBP = _feeBP;
        feeRecipient = _feeRecipient;
        emit FeeUpdated(oldFee, _feeBP, oldRecipient, _feeRecipient);
    }

    function pauseBuy() external onlyOwner { buyPaused = true; emit BuyPaused(msg.sender); }
    function unpauseBuy() external onlyOwner { buyPaused = false; emit BuyUnpaused(msg.sender); }
    function pauseSell() external onlyOwner { sellPaused = true; emit SellPaused(msg.sender); }
    function unpauseSell() external onlyOwner { sellPaused = false; emit SellUnpaused(msg.sender); }

    function setPeriodConfig(uint256 _periodSeconds, uint256 _periodBuyCap, uint256 _periodSellCap) external onlyOwner {
        require(_periodSeconds >= 1 hours, "period too small");
        periodSeconds = _periodSeconds;
        periodBuyCap = _periodBuyCap;
        periodSellCap = _periodSellCap;
        emit PeriodConfigUpdated(_periodSeconds, _periodBuyCap, _periodSellCap);
    }

    function withdrawUSDT(address to, uint256 amount) external onlyOwner {
        require(to != address(0), "zero addr");
        usdt.safeTransfer(to, amount);
        emit WithdrawUSDT(to, amount);
    }

    function withdrawAZNX1(address to, uint256 amount) external onlyOwner {
        require(to != address(0), "zero addr");
        aznx1.safeTransfer(to, amount);
        emit WithdrawAZNX1(to, amount);
    }

    function rescueERC20(address tokenAddr, address to, uint256 amount) external onlyOwner {
        require(tokenAddr != address(usdt) && tokenAddr != address(aznx1), "not allowed");
        IERC20(tokenAddr).safeTransfer(to, amount);
        emit RescueERC20(tokenAddr, to, amount);
    }

    // === VIEW ===
    function currentPeriodIndex() external view returns (uint256) {
        return _currentPeriodIndex();
    }
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
SafeERC20.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}
IERC1363.sol 86 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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 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) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Read Contract

AZNX1_ADDRESS 0xb291239f → address
USDT_ADDRESS 0xc1892058 → address
aznx1 0x4c6a78c4 → address
buyPaused 0xf43b78ff → bool
currentPeriodIndex 0x61543801 → uint256
feeBP 0x017f6fae → uint256
feeRecipient 0x46904840 → address
owner 0x8da5cb5b → address
periodBuyCap 0x45549ad4 → uint256
periodSeconds 0xf4514fa3 → uint256
periodSellCap 0x0fa87615 → uint256
periodUsdtBought 0xef8f192a → uint256
periodUsdtPaidOut 0x2425228e → uint256
pricePerToken 0x7b1b1de6 → uint256
sellPaused 0xe1017332 → bool
usdt 0x2f48ab7d → address

Write Contract 14 functions

These functions modify contract state and require a wallet transaction to execute.

buyWithUSDT 0xa7c60160
uint256 totalUsdtAmount
returns: uint256
pauseBuy 0xa38eb622
No parameters
pauseSell 0x9754a7d8
No parameters
renounceOwnership 0x715018a6
No parameters
rescueERC20 0xb2118a8d
address tokenAddr
address to
uint256 amount
sellAZNX1 0x6edeeb8d
uint256 tokenAmount
returns: uint256
setFee 0xb4f2e8b8
uint256 _feeBP
address _feeRecipient
setPeriodConfig 0xb401810a
uint256 _periodSeconds
uint256 _periodBuyCap
uint256 _periodSellCap
setPricePerToken 0x2bf2762f
uint256 _pricePerToken
transferOwnership 0xf2fde38b
address newOwner
unpauseBuy 0xaaefb3c3
No parameters
unpauseSell 0x4f9f8357
No parameters
withdrawAZNX1 0xd1b8051f
address to
uint256 amount
withdrawUSDT 0x1481794e
address to
uint256 amount

Token Balances (1)

View Transfers →
USDT 1.298

Recent Transactions

No transactions found for this address