Address
- Address
- 0xc1435918908e0dd10795ae50f4b11d48e034e3b6
- Type
- contract
- Balance
- 0 tMIDX (0 wei)
- Nonce
- 1
- Code size
- 2,501 bytes
Contract
Source code ✓ verified
- Contract
- MockStablecoin
- Compiler
- solc 0.8.36+commit.8a079791
- Optimizer
- enabled, 200 runs
- Verified
- 2026-09-21 17:41:00 UTC
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/// @title MockStablecoin
/// @notice Minimal, self-contained ERC-20 for the MIDX **testnet only**. It mimics the shape of a
/// fiat-backed stablecoin (name / symbol / decimals) so integrations can test against
/// USDC / EURC / JPYC / MXNB-shaped tokens.
///
/// This is NOT a real stablecoin: it is unbacked and freely mintable by the owner. Do not
/// deploy to mainnet. The same source is deployed once per currency with different constructor
/// arguments; the deployer becomes the owner and receives the initial supply.
contract MockStablecoin {
// --- ERC-20 metadata ---
string public name;
string public symbol;
uint8 public immutable decimals;
// --- ERC-20 state ---
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
// --- ownership (mint control) ---
address public owner;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() {
require(msg.sender == owner, "not owner");
_;
}
/// @param _name Token name, e.g. "USD Coin".
/// @param _symbol Token symbol, e.g. "USDC".
/// @param _decimals Decimal precision (USDC/EURC/MXNB = 6, JPYC = 18).
/// @param _initialHolder Address credited with the initial supply (the tMIDX wallet).
/// @param _initialSupply Initial amount in base units (whole * 10**decimals).
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
address _initialHolder,
uint256 _initialSupply
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
if (_initialSupply > 0) {
_mint(_initialHolder, _initialSupply);
}
}
// --- ERC-20 ---
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max) {
require(allowed >= value, "insufficient allowance");
allowance[from][msg.sender] = allowed - value;
}
_transfer(from, to, value);
return true;
}
// --- mint / burn (testnet convenience) ---
/// @notice Owner-only mint, to top up test balances.
function mint(address to, uint256 amount) external onlyOwner {
_mint(to, amount);
}
/// @notice Burn from the caller's own balance.
function burn(uint256 amount) external {
uint256 bal = balanceOf[msg.sender];
require(bal >= amount, "insufficient balance");
unchecked { balanceOf[msg.sender] = bal - amount; }
totalSupply -= amount;
emit Transfer(msg.sender, address(0), amount);
}
/// @notice Hand ownership (mint rights) to another address.
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "zero owner");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
// --- internal ---
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "transfer to zero");
uint256 bal = balanceOf[from];
require(bal >= value, "insufficient balance");
unchecked { balanceOf[from] = bal - value; }
balanceOf[to] += value;
emit Transfer(from, to, value);
}
function _mint(address to, uint256 amount) internal {
require(to != address(0), "mint to zero");
totalSupply += amount;
balanceOf[to] += amount;
emit Transfer(address(0), to, amount);
}
}
ABI
[
{
"type": "constructor",
"inputs": [
{
"name": "_name",
"type": "string",
"internalType": "string"
},
{
"name": "_symbol",
"type": "string",
"internalType": "string"
},
{
"name": "_decimals",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "_initialHolder",
"type": "address",
"internalType": "address"
},
{
"name": "_initialSupply",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "nonpayable"
},
{
"name": "Approval",
"type": "event",
"inputs": [
{
"name": "owner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "spender",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"name": "OwnershipTransferred",
"type": "event",
"inputs": [
{
"name": "previousOwner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newOwner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "Transfer",
"type": "event",
"inputs": [
{
"name": "from",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "to",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"name": "allowance",
"type": "function",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
},
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "approve",
"type": "function",
"inputs": [
{
"name": "spender",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"name": "balanceOf",
"type": "function",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "burn",
"type": "function",
"inputs": [
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "decimals",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"name": "mint",
"type": "function",
"inputs": [
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "name",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "view"
},
{
"name": "owner",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "symbol",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "view"
},
{
"name": "totalSupply",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "transfer",
"type": "function",
"inputs": [
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"name": "transferFrom",
"type": "function",
"inputs": [
{
"name": "from",
"type": "address",
"internalType": "address"
},
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"name": "transferOwnership",
"type": "function",
"inputs": [
{
"name": "newOwner",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
}
]Transactions
None found in the last 250 blocks.
Temporary placeholder infrastructure for chain registration.
Not a production network - state may be reset without notice.