Skip to content

Extension of forge-std with additional Mento utilities

Notifications You must be signed in to change notification settings

mento-protocol/mento-std

Repository files navigation

Mento Standard Solidity Library (mento-std)

Extensions for forge-std and added utilities that are shared between mento-core and mento-deployments, and potentially other Mento Solidity repositories.

Array

Provides helpers to build dynamic arrays of finite length by the use of overloaded functions. The Array.sol file is generated by this script, which can be called by running:

pnpm gen:array-helpers

The configuration is stored in the script file:

const TARGETS = {
  uints: {
    type: "uint256"
  },
  addresses: {
    type: 'address'
  },
  bytes4s: {
    type: 'bytes4'
  },
  bytes32s: {
    type: 'bytes32'
  }
} as const;
const MAX_SIZE = 8;

CeloChains

CeloChains is an extension of the StdChains contract in forge-std. It adds the celo specific chains to the registered chains in StdChains, and adds a couple of convenience methods.

ContractsLookup

The contract implements the logic to lookup contract addresses that can be derived from:

  1. A dependencies.json file.
  2. Contract creations recorded in broadcast scripts, that are explicitly loaded by calling load.
  3. The Celo registry.
  4. The GovernanceFactory contract, if it can be found in (1) or (2).

Usage:

import {Script} from "mento-std/Script.sol"

contract SomeScript is Script {
  function setUp() {
    load("DeploySomething", "latest");
  }
  
  function doSufff() {
    address something = lookup("Something");
  }
}

CeloPrecompiles

Minimum precompiles helper which only treats the TRANSFER precompile, it seams like after the L2 move this will be the only one left, and it's the only one we have ever cared about at mento.

Script

Base Script contract that composes from base forge-std modules and extends them with the local modules.

Test

Base Test contract that composes from base forge-std modules and extends them with the local modules.

About

Extension of forge-std with additional Mento utilities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published