Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.monolith.market/llms.txt

Use this file to discover all available pages before exploring further.

Coin Contract

The Coin contract implements an ERC20 stablecoin with additional functionality for the Monolith protocol. Contract implementation

Constructor

constructor(
    address _minter,
    string memory name,
    string memory symbol
)
Initializes the stablecoin with a designated minter address, token name, and symbol. Parameters:
  • _minter: Address authorized to mint new tokens (Lender.sol)
  • name: ERC20 token name (e.g., “USD Coin”)
  • symbol: ERC20 token symbol (e.g., “USDC”)

User-Facing Functions

mint

function mint(address to, uint256 amount) external
Creates new tokens and assigns them to the specified address. Can only be called by the minter (Lender.sol). Parameters:
  • to: Address to receive the minted tokens
  • amount: Amount of tokens to mint (in wei, 18 decimals)
Requirements:
  • msg.sender must be the minter address (Lender.sol).
Events Emitted:
  • Transfer(address(0), to, amount)

burn

function burn(uint256 amount) external
Destroys tokens from the caller’s balance, reducing the total supply. Parameters:
  • amount: Amount of tokens to burn from caller’s balance
Requirements:
  • Caller must have sufficient balance (balanceOf(msg.sender) >= amount)
Events Emitted:
  • Transfer(msg.sender, address(0), amount)

transfer

function transfer(address to, uint256 amount) external returns (bool)
Standard ERC20 transfer function. Moves tokens from caller’s balance to another address. Parameters:
  • to: Recipient address
  • amount: Amount of tokens to transfer
Returns:
  • bool: Always returns true on successful transfer
Requirements:
  • Caller must have sufficient balance
Events Emitted:
  • Transfer(msg.sender, to, amount)

transferFrom

function transferFrom(address from, address to, uint256 amount) external returns (bool)
Standard ERC20 transferFrom function. Moves tokens from one address to another using allowance mechanism. Parameters:
  • from: Address to transfer tokens from
  • to: Recipient address
  • amount: Amount of tokens to transfer
Returns:
  • bool: Always returns true on successful transfer
Requirements:
  • from must have sufficient balance
  • Caller must have sufficient allowance from from
Events Emitted:
  • Transfer(from, to, amount)

approve

function approve(address spender, uint256 amount) external returns (bool)
Standard ERC20 approve function. Allows spender to transfer up to amount tokens from caller’s balance. Parameters:
  • spender: Address authorized to spend tokens
  • amount: Maximum amount spender can transfer
Returns:
  • bool: Always returns true on successful approval
Events Emitted:
  • Approval(msg.sender, spender, amount)

View Functions

balanceOf

function balanceOf(address account) external view returns (uint256)
Returns the token balance of the specified address. Parameters:
  • account: Address to query balance for
Returns:
  • uint256: Token balance in wei

allowance

function allowance(address owner, address spender) external view returns (uint256)
Returns the remaining allowance that spender can spend on behalf of owner. Parameters:
  • owner: Address that granted the allowance
  • spender: Address authorized to spend
Returns:
  • uint256: Remaining allowance amount

totalSupply

function totalSupply() external view returns (uint256)
Returns the total supply of tokens in circulation. Returns:
  • uint256: Total token supply in wei

name

function name() external view returns (string memory)
Returns the name of the token. Returns:
  • string: Token name

symbol

function symbol() external view returns (string memory)
Returns the symbol of the token. Returns:
  • string: Token symbol

decimals

function decimals() external view returns (uint8)
Returns the number of decimals used for token amounts. Returns:
  • uint8: Number of decimals (18 for this token)

minter

function minter() external view returns (address)
Returns the address authorized to mint new tokens (Lender.sol). Returns:
  • address: Minter address

Events

Transfer

event Transfer(address indexed from, address indexed to, uint256 amount)
Emitted when tokens are transferred, minted, or burned. Parameters:
  • from: Sender address (address(0) for mints)
  • to: Recipient address (address(0) for burns)
  • amount: Amount of tokens transferred

Approval

event Approval(address indexed owner, address indexed spender, uint256 amount)
Emitted when allowance is set or changed. Parameters:
  • owner: Address granting the allowance
  • spender: Address receiving the allowance
  • amount: New allowance amount