@0xintuition/contracts-v2
v1.0.0-alpha.0
Published
Intuition Protocol V2 smart contracts, ABIs, and bytecode
Readme
Intuition V2 Smart Contracts
The Intuition V2 smart contracts for the Intuition protocol, built using Foundry.
Installation
The contracts, ABIs, and creation bytecode are published to npm as
@0xintuition/contracts-v2:
npm install @0xintuition/contracts-v2
# or
bun add @0xintuition/contracts-v2Using the ABIs and bytecode (TypeScript / JavaScript)
The ABIs are exported as const, so they work out of the box with viem's type inference, and equally with ethers:
import { MultiVaultAbi, TrustBondingAbi } from "@0xintuition/contracts-v2/abis";
import { MultiVaultBytecode } from "@0xintuition/contracts-v2/bytecodes";
// or everything from the package root:
import { MultiVaultAbi, MultiVaultBytecode } from "@0xintuition/contracts-v2";
const vault = getContract({ address, abi: MultiVaultAbi, client });Both ESM and CommonJS are supported, with full TypeScript declarations.
Using the Solidity sources
The .sol sources are shipped under src/, and all Solidity dependencies (OpenZeppelin v5 and v4, solady, PRB Math,
account-abstraction) are installed automatically as npm dependencies, so you can import and inherit the contracts
directly:
import { MultiVault } from "@0xintuition/contracts-v2/src/protocol/MultiVault.sol";
import { IMultiVault } from "@0xintuition/contracts-v2/src/interfaces/IMultiVault.sol";Every import path in the sources matches the npm layout of its dependency, so:
Hardhat resolves everything through node_modules with no extra configuration.
Foundry users need remappings pointing each prefix into node_modules (e.g. in remappings.txt):
@0xintuition/contracts-v2/=node_modules/@0xintuition/contracts-v2/
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
@openzeppelin-v4/contracts-upgradeable/=node_modules/@openzeppelin-v4/contracts-upgradeable/
solady/=node_modules/solady/
@prb/math/=node_modules/@prb/math/
@account-abstraction/contracts/=node_modules/@account-abstraction/contracts/(The @openzeppelin-v4 remapping is only needed if you compile the legacy Trust/TrustToken contracts.)
The contracts are compiled with Solidity 0.8.29, optimizer enabled at 10,000 runs, EVM version cancun.
What's Inside
- Forge: compile, test, fuzz, format, and deploy smart contracts
- [Bun]: Foundry defaults to git submodules, but this template also uses Node.js packages for managing dependencies
- Forge Std: collection of helpful contracts and utilities for testing
- Prettier: code formatter for non-Solidity files
- Solhint: linter for Solidity code
Deploy Smart Contracts on Intuition Testnet
- Execute script/base/BaseEmissionsControllerDeploy.s.sol
- Update the
BASE_SEPOLIA_BASE_EMISSIONS_CONTROLLERin .env
- Update the
- Execute script/intuition/MultiVaultMigrationModeDeploy.s.sol
- Update the
INTUITION_SEPOLIA_MULTIVAULT_MIGRATION_MODE_IMPLEMENTATIONin .env
- Update the
- Execute script/intuition/IntuitionDeployAndSetup.s.sol
- Update the
INTUITION_SEPOLIA_MULTI_VAULT_MIGRATION_MODE_PROXYin .env - Update the
INTUITION_SEPOLIA_SATELLITE_EMISSIONS_CONTROLLERin .env
- Update the
- Execute script/base/BaseEmissionsControllerSetup.s.sol
Upgrade MultiVaultMigrationMode to MultiVault contract post-migration
- Make sure to set
INTUITION_SEPOLIA_PROXY_ADMINin .env - Execute MultiVaultMigrationModeUpgrade.s.sol
Testing
forge test --match-path 'tests/unit/CoreEmissionsController/*.sol'
Usage
This is a list of the most frequently needed commands.
Build
Build the contracts:
$ forge buildClean
Delete the build artifacts and cache directories:
$ forge cleanCompile
Compile the contracts:
$ forge buildCoverage
Get a test coverage report:
$ forge coverageDeploy
Deploy to Anvil:
$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545For this script to work, you need to have a MNEMONIC environment variable set to a valid
BIP39 mnemonic.
For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.
Format
Format the contracts:
$ forge fmtGas Usage
Get a gas report:
$ forge test --gas-reportLint
Lint the contracts:
$ bun run lintTest
Run the tests:
$ forge testTest Coverage
Generate test coverage and output result to the terminal:
$ bun run test:coverageTest Coverage Report
Generate test coverage with lcov report (you'll have to open the ./coverage/index.html file in your browser, to do so
simply copy paste the path):
$ bun run test:coverage:report[!NOTE]
This command requires you to have
lcovinstalled on your machine. On macOS, you can install it with Homebrew:brew install lcov.
Claude Slash Commands (Shared)
This repo includes team-shared Claude slash commands in .claude/commands.
Use /help in Claude Code to see them, then run:
/audit-solidity [codebase-path] [spec-document-optional]/audit-context [codebase-path] [--focus <module>]/audit-entry-points [directory-path]/audit-static-analysis [codebase-path]/audit-spec-compliance <spec-document> [codebase-path]/audit-variants [vulnerability-description]
Generated reports are written to audits/automated-reports/.
License
This project is licensed under BUSL-1.1
Utility Scripts
Trust V2 Reinitialize Call Data
Generates the encoded calldata for the reinitialize() function for the TRUST token upgrade.
npx tsx script/upgrades/generate-trust-v2-upgrade-calldata.ts <ADMIN_ADDRESS> <BASE_EMISSIONS_CONTROLLER_ADDRESS>Trust Proxy V2 Upgrade
Generates the encoded calldata for the Trust ProxyAdmin.upgradeAndCall() execution.
npx tsx script/upgrades/generate-trust-proxy-upgrade-and-call-calldata.ts "0x6cd905dF2Ed214b22e0d48FF17CD4200C1C6d8A3" <IMPLEMENTATION_ADDRESS> <REINITIALIZE_CALLDATA_OR_0x>Timelock Update Delay
Prepares the TimelockController schedule parameters for updating the minimum delay within the TimelockController
contract.
npx tsx script/upgrades/generate-timelock-update-delay-calldata.ts <RPC_URL> <NEW_DELAY_IN_SECONDS>Example:
npx tsx script/upgrades/generate-timelock-update-delay-calldata.ts "https://mainnet.base.org" 259200Timelock Upgrade and Call
Builds the TimelockController schedule parameters for a ProxyAdmin.upgradeAndCall() execution.
npx tsx script/upgrades/generate-timelock-upgrade-and-call-calldata.ts <RPC_URL> <PROXY_ADDRESS> <IMPLEMENTATION_ADDRESS> <REINITIALIZE_CALLDATA_OR_0x>Example:
npx tsx script/upgrades/generate-timelock-upgrade-and-call-calldata.ts "https://mainnet.base.org" "0x000000000000000000000000000000000000dEaD" "0x000000000000000000000000000000000000dEaD" "0x"Deployed Contracts
Mainnet
Base Mainnet
| Contract Name | Address | ProxyAdmin | | --------------------------- | ------------------------------------------ | ------------------------------------------ | | Trust | 0x6cd905dF2Ed214b22e0d48FF17CD4200C1C6d8A3 | 0x857552ab95E6cC389b977d5fEf971DEde8683e8e | | Upgrades TimelockController | 0x1E442BbB08c98100b18fa830a88E8A57b5dF9157 | / | | BaseEmissionsController | 0x7745bDEe668501E5eeF7e9605C746f9cDfb60667 | 0x58dCdf3b6F5D03835CF6556EdC798bfd690B251a | | EmissionsAutomationAdapter | 0xb1ce9Ac324B5C3928736Ec33b5Fd741cb04a2F2d | / |
Intuition Mainnet
| Contract Name | Address | ProxyAdmin | | ----------------------------- | ------------------------------------------ | ------------------------------------------ | | WrappedTrust | 0x81cFb09cb44f7184Ad934C09F82000701A4bF672 | / | | Upgrades TimelockController | 0x321e5d4b20158648dFd1f360A79CAFc97190bAd1 | / | | Parameters TimelockController | 0x71b0F1ABebC2DaA0b7B5C3f9b72FAa1cd9F35FEA | / | | MultiVault | 0x6E35cF57A41fA15eA0EaE9C33e751b01A784Fe7e | 0x1999faD6477e4fa9aA0FF20DaafC32F7B90005C8 | | AtomWalletFactory | 0x33827373a7D1c7C78a01094071C2f6CE74253B9B | 0x68667f67986650B8C86A87612c556dc0dC07F9a7 | | AtomWalletBeacon | 0xC23cD55CF924b3FE4b97deAA0EAF222a5082A1FF | / | | AtomWarden | 0x98C9BCecf318d0D1409Bf81Ea3551b629fAEC165 | 0xf548dbDd7a18Ee9d91106b3b6967770b504aeE2A | | SatelliteEmissionsController | 0x73B8819f9b157BE42172E3866fB0Ba0d5fA0A5c6 | 0xdF60D18E86F3454309aD7734055843F7ee5f30a3 | | TrustBonding | 0x635bBD1367B66E7B16a21D6E5A63C812fFC00617 | 0xF10FEE90B3C633c4fCd49aA557Ec7d51E5AEef62 | | BondingCurveRegistry | 0xd0E488Fb32130232527eedEB72f8cE2BFC0F9930 | 0x678c7D3d759611b554A1293295007f2b202C2302 | | LinearCurve | 0xc3eFD5471dc63d74639725f381f9686e3F264366 | 0x6365D6eD0caf54d6290D866d56C043d3fCDc3B8c | | OffsetProgressiveCurve | 0x23afF95153aa88D28B9B97Ba97629E05D5fD335d | 0xe58B117aDfB0a141dC1CC22b98297294F6E2c5E7 | | Multicall3 | 0xcA11bde05977b3631167028862bE2a173976CA11 | / | | EntryPoint | 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108 | / | | SafeSingletonFactory | 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 | / |
Testnet
Base Sepolia
| Contract Name | Address | ProxyAdmin | | --------------------------- | ------------------------------------------ | ------------------------------------------ | | TestTrust | 0xA54b4E6e356b963Ee00d1C947f478d9194a1a210 | / | | Upgrades TimelockController | 0x9099BC9fd63B01F94528B60CEEB336C679eb6d52 | / | | BaseEmissionsController | 0xC14773Aae24aA60CB8F261995405C28f6D742DCf | 0x0b954b1CbAAf8972845BC5D31a8B748f0F8849fc |
Intuition Testnet
| Contract Name | Address | ProxyAdmin | | ----------------------------- | ------------------------------------------ | ------------------------------------------ | | WrappedTrust | 0xDE80b6EE63f7D809427CA350e30093F436A0fe35 | / | | Upgrades TimelockController | 0x59B7EaB1cFA47F8E61606aDf79a6b7B5bBF1aF26 | / | | Parameters TimelockController | 0xcCB113bfFf493d80F32Fb799Dca23686a04302A7 | / | | MultiVault | 0x2Ece8D4dEdcB9918A398528f3fa4688b1d2CAB91 | 0x840d79645824C43227573305BBFCd162504BBB6e | | AtomWalletFactory | 0xa4e96c6dB8Dd3314c64bF9d0E845A4905a8705d4 | 0x83e13aD14714236b5d9eca851FE6561Cfc9220c9 | | AtomWalletBeacon | 0x4B0aC884843576dBA0B0fda925f202aB8b546E33 | / | | AtomWarden | 0x040B7760EFDEd7e933CFf419224b57DFB9Eb4488 | 0xabBf8147d33e76251383A81c81189077C505B51A | | SatelliteEmissionsController | 0xD3be4d1E56866b98f30Ae6C326F14EF9c6ffBBDF | 0x5ec513714f57f7b984875719Bd8Ef00d05487524 | | TrustBonding | 0x75dD32b522c89566265eA32ecb50b4Fc4d00ADc7 | 0x214D3833114e25262bb8e4E9B5A99F062bFb93D4 | | BondingCurveRegistry | 0x2AFC4949Dd3664219AA2c20133771658E93892A1 | 0x0C5AeAba37b1E92064f0af684D65476d24F52a9A | | LinearCurve | 0x6df5eecd9B14E31C98A027b8634876E4805F71B0 | 0x34D65193EE2e1449FE6CB8eca1EE046FcC21669e | | OffsetProgressiveCurve | 0xE65EcaAF5964aC0d94459A66A59A8B9eBCE42CbB | 0x6A65336598d4783d0673DD238418248909C71F26 | | Multicall3 | 0xcA11bde05977b3631167028862bE2a173976CA11 | / | | EntryPoint | 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108 | / |
