Skip to content

category-labs/monad-std

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monad Standard Library • CI status

Monad Standard Library (monad-std) is a collection of Monad-specific interfaces and testing helpers for Foundry.

It provides Solidity interfaces that track Monad runtime behavior and lightweight base contracts for ergonomic test usage.

Install

forge install category-labs/monad-std

Contracts

IMonadStaking

src/interfaces/IMonadStaking.sol defines the public interface for the staking precompile at 0x1000.

IReserveBalance

src/interfaces/IReserveBalance.sol defines the public interface for the reserve balance precompile at 0x1001 (MIP-4).

MonadVm

src/MonadVm.sol defines Monad Foundry cheatcodes exposed by Monad's VM interface.

MonadStdConstants

src/MonadStdConstants.sol exposes canonical Monad addresses and typed handles:

  • MONAD_VM_ADDRESS
  • STAKING_ADDRESS
  • RESERVE_BALANCE_ADDRESS
  • MONAD_VM
  • STAKING
  • RESERVE_BALANCE

MonadBase and MonadTest

src/Base.sol and src/MonadTest.sol provide forge-std-style ergonomics for tests:

  • monadVm alias for MONAD_VM
  • staking alias for STAKING
  • reserveBalance alias for RESERVE_BALANCE
  • MonadTest as a convenience aggregate base

Example Usage

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.13 <0.9.0;

import {MonadTest} from "monad-std/MonadTest.sol";

contract ExampleTest is MonadTest {
    function testUseMonadVm() public {
        monadVm.setEpoch(42, false);
        monadVm.setProposer(7);
        monadVm.epochBoundary(43);
    }

    function testUseStakingInterface() public {
        staking.getEpoch();
        uint64 proposerValId = staking.getProposerValId();
        staking.getValidator(proposerValId);
        staking.getConsensusValidatorSet(0);
    }
}

Solidity Version Support

The current Solidity support range is:

  • >=0.8.13 <0.9.0

Development

forge fmt --check
forge build --sizes
forge test -vvv

Contributing

See the contributing guide.

Getting Help

  • Open an issue for bugs or feature requests.

License

Monad Standard Library is licensed under MIT.

About

A collection of helpful contracts and libraries for use with Monad for Foundry

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages