Isle Protocol

Github Actions Coverage Foundry

This repository contains the core smart contracts for the Isle Protocol. In-depth documentation is available at docs.isle.finance

Getting Started

  1. If you are on VS Code, install Nomicfoundation/hardhat-solidity or JuanBlanco/solidity (select one for solidity) and Tamasfe/even-better-toml as extensions. (Learn more)

  2. Install Forge and pnpm

  3. Install npm packages

    pnpm install
  4. Install foundry libraries

    forge install

Architecture

Isle Protocol is a designed where each pool will be a set of contracts

  • PoolAddressesProvider
  • LoanManager
  • WithdrawalManager
  • PoolConfigurator
  • Pool

That is to say, each pool will have its own set of contracts so as to maximize customisability for pool admins. Please see the following diagrams to have a better view of the design and flow.

Usage

This is a list of the most frequently needed commands.

Build

Build the contracts:

$ forge build

Clean

Delete the build artifacts and cache directories:

$ forge clean

Compile

Compile the contracts:

$ forge build

Coverage

Get a test coverage report:

$ forge coverage

Get a .lcov coverage report

$ forge coverage --report lcov

Deploy

Deploy to Anvil:

$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545

Gas snapshot

$ forge snapshot

Gas report

$ pnpm gas-report

Format

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm lint

Test

Run the tests:

$ forge test

Scripts

View balance of address

cast balance --rpc-url "sepolia" -e $ADDRESS

Send ETH to another address

cast send $ADDRESS --rpc-url "sepolia" --value 0.1ether --private-key $PRIV_KEY

Run deploy scripts

forge script scripts/DeployERC20Mint.s.sol --rpc-url "$RPC_URL" --sender "$SENDER" --broadcast --sig "run()" --verify -vvvv
forge script scripts/DeployCore.s.sol --rpc-url "$RPC_URL" --sender "$SENDER" --broadcast --sig "run(address)" --verify -vvvv "$ADDRESS"
forge script scripts/Init.s.sol --rpc-url "$RPC_URL" --sender "$SENDER" --broadcast --sig "run(address,address)" --verify -vvvv "$RECEIVABLE" "$PAP"

Run Anvil with specified Mnemonic

anvil -m "$MNEMONIC"

Get crurrent gas price in gwei

cast to-unit $(cast gas-price) gwei

Deployment Addresses

Sepolia (2023.10.19)

  • IsleUSD: 0xD7719799520b89A6b934A4402388e9EDdFD85387
  • Receivable: 0x497918fD3227835184Af0D8fCc106E5e70BBc881
  • Deployer: 0xBbC9928618b05356841a8565C72E4493D12ad163
  • IsleGlobals: 0xd5175C76F5a129De4F53b0DF5c878706E31910a1
  • PoolAddressesProvider: 0x454Bc3c86aB284F2Aa7A746733B23B46866FbeDB
  • WithdrawalManager: 0x7F5abDad0A9ee5Fbdf0B07F4Cf007F88783f14E5
  • LoanManager: 0x1a16F4f4805197DF48Cc898f97601CE97B13d4a4
  • PoolConfigurator: 0x389dE947656Fd0E2C806254Ad3fD9Ae4Ef297cDE
Implementation
  • Receivable: 0x103d37376F312C0D3FA4021351dC87811E0464B2
  • IsleGlobals: 0x359f8Cfc8EadB4acB591211B73F5968b9900dB06
  • WithdrawalManager: 0x9EDe7Fa06de4CcF3be5e26e27120eb608D001Ed8
  • LoanManager: 0x5a0a72f2c0a28161d33e7bd56191ab2ed1a629e3
  • PoolConfigurator: 0x4137b1072c18F50D8D5f883043712727efa7B038

Plume

Implementation

Verify contracts

forge verify-contract \
    --chain-id 11155111 \
    --num-of-optimizations 1000 \
    --watch \
    ${Address} \
    contracts/Receivable.sol:Receivable

With constructor

See Foundry Book

forge verify-contract \
    --chain-id 11155111 \
    --num-of-optimizations 1000 \
    --watch \
    --constructor-args $(cast abi-encode "constructor(address)" ${ARG}) \
    ${Address} \
    contracts/WithdrawalManager.sol:WithdrawalManager

With library

forge verify-contract \
    --chain-id 11155111 \
    --num-of-optimizations 1000 \
    --watch \
    --constructor-args $(cast abi-encode "constructor(address)" ${ARG}) \
    --libraries contracts/libraries/${Library}.sol:${Library}:${Address} \
    ${Address} \
    contracts/PoolConfigurator.sol:PoolConfigurator