A comprehensive testing library for Ethereum smart contracts, featuring pre-configured setups for Uniswap V2/V3 testing environments.
- Pre-configured Uniswap V2 and V3 testing environments
- Mock ERC20 tokens and WETH implementations
- Base testing utilities for common testing scenarios
- Foundry-compatible testing framework
yarn add @kei.fi/testing-lib
Inherit from the base test contracts to access testing utilities:
import {BaseTest} from "@kei.fi/testing-lib/BaseTest.sol";
contract MyTest is BaseTest {
function testSomething() public {
// Your test code here
}
}
For Uniswap-specific testing, use the pre-configured environments:
import {UniswapTest} from "@kei.fi/testing-lib/UniswapTest.sol";
contract MyUniswapTest is UniswapTest {
function testUniswapInteraction() public {
// Access pre-deployed Uniswap contracts
// uniswapV2Factory, uniswapV2Router02, uniswapV3Factory, etc.
}
}
-
Base Testing
- BaseTest.sol: Core testing utilities
- TokensTest.sol: Mock ERC20 token implementations
- WETHTest.sol: WETH9 mock implementation
-
Uniswap Integration
- UniswapV2Test.sol: Uniswap V2 testing environment
- UniswapV3Test.sol: Uniswap V3 testing environment
- Pre-deployed pools and routers
-
Deployment Scripts
- BaseDeployScript.sol: Base deployment utilities
- Configurable deployment environments
- Foundry
- Node.js
- Yarn
- Clone the repository
- Install dependencies:
yarn install
- Run tests:
forge test
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.