Address Contract Partially Verified
Address
0xfe1506a3C85b1090E390bD8f453E7fa1Cf754865
Balance
0 ETH
Nonce
1
Code Size
2355 bytes
Creator
0x14473Eb0...c5cB at tx 0x305b2038...cbfcd1
Indexed Transactions
0
Contract Bytecode
2355 bytes
0x6080604052600436106100c15760003560e01c80636a61e5fc1161007f5780638da5cb5b116100595780638da5cb5b146101dd5780639d76ea58146101ff578063e4dae5fe14610214578063ff186b2e14610229576100c1565b80636a61e5fc1461017b578063742fe0d41461019b5780637ff9b596146101c8576100c1565b80629f9262146100c657806326a4e8d2146100e8578063274cc594146101085780633ccfd60b1461011057806350baa62214610125578063614223db14610145575b600080fd5b3480156100d257600080fd5b506100e66100e136600461076f565b61023e565b005b3480156100f457600080fd5b506100e6610103366004610721565b6102b1565b6100e66102fd565b34801561011c57600080fd5b506100e6610329565b34801561013157600080fd5b506100e661014036600461076f565b610390565b34801561015157600080fd5b50610165610160366004610721565b610508565b60405161017291906108d0565b60405180910390f35b34801561018757600080fd5b506100e661019636600461076f565b61051a565b3480156101a757600080fd5b506101bb6101b6366004610721565b610579565b60405161017291906107f0565b3480156101d457600080fd5b50610165610596565b3480156101e957600080fd5b506101f261059c565b604051610172919061079f565b34801561020b57600080fd5b506101f26105ab565b34801561022057600080fd5b506100e66105ba565b34801561023557600080fd5b50610165610669565b6000546001600160a01b031633146102715760405162461bcd60e51b8152600401610268906107fb565b60405180910390fd5b60018190556040517f9193344cc8802d31c4aa2815214e792efa5a9fa7daa8e102ab2ad3576e74b51b906102a69083906108d0565b60405180910390a150565b6000546001600160a01b031633146102db5760405162461bcd60e51b8152600401610268906107fb565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600154341461031e5760405162461bcd60e51b81526004016102689061086b565b6103273361066f565b565b6000546001600160a01b031633146103535760405162461bcd60e51b8152600401610268906107fb565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f1935050505015801561038d573d6000803e3d6000fd5b50565b6000546001600160a01b031633146103ba5760405162461bcd60e51b8152600401610268906107fb565b6003546040516370a0823160e01b81526001600160a01b039091169060009082906370a08231906103ef90309060040161079f565b60206040518083038186803b15801561040757600080fd5b505afa15801561041b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043f9190610787565b9050828110156104615760405162461bcd60e51b815260040161026890610899565b60005460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb92610495929091169087906004016107d7565b602060405180830381600087803b1580156104af57600080fd5b505af11580156104c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e7919061074f565b6105035760405162461bcd60e51b81526004016102689061083c565b505050565b60046020526000908152604090205481565b6000546001600160a01b031633146105445760405162461bcd60e51b8152600401610268906107fb565b60028190556040517f6b361c807733cc94a3b7bda39c1c94dcc0511e91aa47b0f7f918068e93976890906102a69083906108d0565b6001600160a01b0316600090815260046020526040902054421090565b60025481565b6000546001600160a01b031681565b6003546001600160a01b031681565b6003546002546040516323b872dd60e01b81526001600160a01b039092169182916323b872dd916105f29133913091906004016107b3565b602060405180830381600087803b15801561060c57600080fd5b505af1158015610620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610644919061074f565b6106605760405162461bcd60e51b81526004016102689061083c565b61038d3361066f565b60015481565b600061067e4262278d006108d9565b6001600160a01b0383166000908152600460205260409020549091504210156106ca576001600160a01b0382166000908152600460205260409020546106c79062278d006108d9565b90505b6001600160a01b03821660008181526004602052604090819020839055517faac641193722e260ce312e714156cdc3510a4892fdb1b50ea84cb29a03418004906107159084906108d0565b60405180910390a25050565b600060208284031215610732578081fd5b81356001600160a01b0381168114610748578182fd5b9392505050565b600060208284031215610760578081fd5b81518015158114610748578182fd5b600060208284031215610780578081fd5b5035919050565b600060208284031215610798578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b60208082526021908201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6040820152603760f91b606082015260800190565b602080825260159082015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b602080825260149082015273125b98dbdc9c9958dd0811551208185b5bdd5b9d60621b604082015260600190565b6020808252601a908201527f496e73756666696369656e7420746f6b656e2062616c616e6365000000000000604082015260600190565b90815260200190565b600082198211156108f857634e487b7160e01b81526011600452602481fd5b50019056fea264697066735822122066547d1044807bc671ce202a22fb5e2f70701792c69de40466efa5bdb277b4e064736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: Yes (200 runs)
MOXAIPremiumMembership.sol 79 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
contract MOXAIPremiumMembership {
address public owner;
uint256 public ethPrice;
uint256 public tokenPrice;
address public tokenAddress;
mapping(address => uint256) public premiumExpiry;
event PremiumPurchased(address indexed user, uint256 expiryDate);
event EthPriceUpdated(uint256 newPrice);
event TokenPriceUpdated(uint256 newPrice);
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this function");
_;
}
constructor() {
owner = msg.sender;
}
function buyPremiumWithETH() external payable {
require(msg.value == ethPrice, "Incorrect ETH amount");
_extendPremium(msg.sender);
}
function buyPremiumWithMoxaiToken() external {
IERC20 token = IERC20(tokenAddress);
require(token.transferFrom(msg.sender, address(this), tokenPrice), "Token transfer failed");
_extendPremium(msg.sender);
}
function _extendPremium(address user) internal {
uint256 newExpiry = block.timestamp + 30 days;
if (premiumExpiry[user] > block.timestamp) {
newExpiry = premiumExpiry[user] + 30 days;
}
premiumExpiry[user] = newExpiry;
emit PremiumPurchased(user, newExpiry);
}
function isPremium(address user) external view returns (bool) {
return premiumExpiry[user] > block.timestamp;
}
function withdraw() external onlyOwner {
payable(owner).transfer(address(this).balance);
}
function withdrawToken(uint256 amount) external onlyOwner {
IERC20 token = IERC20(tokenAddress);
uint256 contractBalance = token.balanceOf(address(this));
require(contractBalance >= amount, "Insufficient token balance");
require(token.transfer(owner, amount), "Token transfer failed");
}
function setEthPrice(uint256 _ethPrice) external onlyOwner {
ethPrice = _ethPrice;
emit EthPriceUpdated(_ethPrice);
}
function setTokenPrice(uint256 _tokenPrice) external onlyOwner {
tokenPrice = _tokenPrice;
emit TokenPriceUpdated(_tokenPrice);
}
function setTokenAddress(address _tokenAddress) external onlyOwner {
tokenAddress = _tokenAddress;
}
}
Read Contract
ethPrice 0xff186b2e → uint256
isPremium 0x742fe0d4 → bool
owner 0x8da5cb5b → address
premiumExpiry 0x614223db → uint256
tokenAddress 0x9d76ea58 → address
tokenPrice 0x7ff9b596 → uint256
Write Contract 7 functions
These functions modify contract state and require a wallet transaction to execute.
buyPremiumWithETH 0x274cc594
No parameters
buyPremiumWithMoxaiToken 0xe4dae5fe
No parameters
setEthPrice 0x009f9262
uint256 _ethPrice
setTokenAddress 0x26a4e8d2
address _tokenAddress
setTokenPrice 0x6a61e5fc
uint256 _tokenPrice
withdraw 0x3ccfd60b
No parameters
withdrawToken 0x50baa622
uint256 amount
Recent Transactions
No transactions found for this address