testnet
GitHub

Event: Mint

event Mint(address indexed minter, address indexed recipient, uint256 amount)

Emitted by the OKRW precompile upon a successful call to the mint function. This event provides a verifiable, on-chain record of all OKRW minting activity originating from the EVM. Indexers and client applications can subscribe to this event to track the OKRW supply and distribution.

Parameters

Name Type Required Description
minter address - The authorized address that initiated the minting call.
recipient address - The address that received the newly minted tokens.
amount uint256 - The amount of OKRW that was minted.

Returns

Type:

Examples

Listening for Mint Events with Ethers.js

This script demonstrates how to subscribe to the `Mint` event in real-time using a WebSocket provider, allowing a backend service or frontend to react immediately to new token creation.

const { ethers } = require("ethers");

const okrwPrecompileAddress = "0x1000000000000000000000000000000000000001";
const okrwAbi = [
    "event Mint(address indexed minter, address indexed recipient, uint256 amount)"
];

// Assume 'provider' is a connected ethers.Provider
const okrwContract = new ethers.Contract(okrwPrecompileAddress, okrwAbi, provider);

console.log("Listening for new OKRW mints...");

okrwContract.on("Mint", (minter, recipient, amount, event) => {
    console.log("--- New Mint Detected ---");
    console.log(`  Minter: ${minter}`);
    console.log(`  Recipient: ${recipient}`);
    console.log(`  Amount: ${ethers.formatEther(amount)} OKRW`);
    console.log(`  Transaction: ${event.log.transactionHash}`);
});
ESC
Type to search