Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mento-protocol/mento-std
Extension of forge-std with additional Mento utilities
https://github.com/mento-protocol/mento-std
Last synced: 6 days ago
JSON representation
Extension of forge-std with additional Mento utilities
- Host: GitHub
- URL: https://github.com/mento-protocol/mento-std
- Owner: mento-protocol
- Created: 2024-08-17T16:02:58.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-26T08:28:42.000Z (5 months ago)
- Last Synced: 2024-11-09T01:22:40.492Z (2 months ago)
- Language: Solidity
- Size: 69.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Mento Standard Solidity Library (mento-std)
Extensions for [forge-std](https://github.com/foundry-rs/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](./src/Array.sol) file is generated by [this script](./bin/gen-array-helpers.ts), which can be called by running:```
pnpm gen:array-helpers
```The configuration is stored in the script file:
```typescript
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:
```solidity
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.