@juiceswapxyz/swap-router-contracts
v3.0.0
Published
🧃 Smart contracts for swapping on JuiceSwap V2 and V3 (Uniswap fork)
Readme
JuiceSwap Swap Router
Smart contracts for swapping on the JuiceSwap V3 protocol.
JuiceSwap is a fork of Uniswap V3 with custom modifications including a 50% maximum protocol fee cap (governance-controlled).
Installation
npm install @juiceswapxyz/swap-router-contractsor
yarn add @juiceswapxyz/swap-router-contractsLocal Deployment
To deploy this code to a local testnet, import bytecode from the npm package artifacts:
import {
abi as SWAP_ROUTER_ABI,
bytecode as SWAP_ROUTER_BYTECODE,
} from '@juiceswapxyz/swap-router-contracts/artifacts/contracts/SwapRouter02.sol/SwapRouter02.json'
// deploy the bytecodeThis ensures you are testing against the same bytecode deployed to mainnet and public testnets.
Using Solidity Interfaces
Import swap router contract interfaces into your Solidity smart contracts:
import '@juiceswapxyz/swap-router-contracts/contracts/interfaces/ISwapRouter02.sol';
contract MyContract {
ISwapRouter02 router;
function doSomethingWithSwapRouter() {
// router.exactInput(...);
}
}Development
Install Dependencies
yarn installCompile Contracts
yarn compileRun Tests
Some tests use Hardhat mainnet forking and require an archive node. Create a .env file in the workspace root:
ARCHIVE_RPC_URL='...'Or set the variable when running tests:
export ARCHIVE_RPC_URL='...' && yarn testLicense
GPL-2.0-or-later
