Skip to content

LedgerHQ/app-plugin-1inch

Repository files navigation

Badges

Code style check Compilation & tests

Ledger 1inch Plugin

This is a plugin for the Ethereum application which helps parsing and displaying relevant information when signing a 1inch transaction.

Prerequisite

Clone the plugin to a new folder.

git clone https://github.com/blooo-io/app-plugin-1inch.git

Then in the same folder clone two more repositories, which is the plugin-tools and app-ethereum.

git clone https://github.com/LedgerHQ/plugin-tools.git                          #plugin-tools
git clone --recurse-submodules https://github.com/LedgerHQ/app-ethereum.git     #app-ethereum

Documentation

Need more information about the interface, the architecture, or general stuff about ethereum plugins? You can find more about them in the ethereum-app documentation.

Smart Contracts

Smart contracts covered by this plugin are:

Network Version Smart Contract
Arbitrum V3 0x11111112542D85B3EF69AE05771c2dCCff4fAa26
Arbitrum V4 0x1111111254fb6c44bAC0beD2854e76F90643097d
Arbitrum V5 0x1111111254eeb25477b68fb85ed929f73a960582
Base V5 0x1111111254eeb25477b68fb85ed929f73a960582
Ethereum V3 0x11111112542D85B3EF69AE05771c2dCCff4fAa26
Ethereum V4 0x1111111254fb6c44bAC0beD2854e76F90643097d
Ethereum V5 0x1111111254eeb25477b68fb85ed929f73a960582
Fantom V4 0x1111111254fb6c44bAC0beD2854e76F90643097d
Fantom V5 0x1111111254eeb25477b68fb85ed929f73a960582
Optimism V3 0x11111112542D85B3EF69AE05771c2dCCff4fAa26
Optimism V4 0x1111111254fb6c44bAC0beD2854e76F90643097d
Optimism V5 0x1111111254eeb25477b68fb85ed929f73a960582
Polygon V3 0x11111112542D85B3EF69AE05771c2dCCff4fAa26
Polygon V4 0x1111111254fb6c44bAC0beD2854e76F90643097d
Polygon V5 0x1111111254eeb25477b68fb85ed929f73a960582
ZkSync V5 0x6e2b76966cbd9cf4cc2fa0d76d24d5241e0abc2f

Functions implemented:

Function Selector Displayed Parameters
Swap 0x7c025200
address desc.srcToken
address desc.dstToken
address desc.dstReceiver
uint256 desc.amount
uint256 desc.minReturnAmount
uint256 desc.flags
Swap (v5) 0x12aa3caf
address desc.srcToken
address desc.dstToken
address desc.dstReceiver
uint256 desc.amount
uint256 desc.minReturnAmount
uint256 desc.flags
Unoswap 0x2e95b6c8
address srcToken
uint256 amount
uint256 minReturn
Unoswap (v5) 0x0502b1c5
address srcToken
uint256 amount
uint256 minReturn
unoswapWithPermit 0xa1251d75
address srcToken
uint256 amount
uint256 minReturn
unoswapToWithPermit (v5) 0x3c15fd91
address recipient
address srcToken
uint256 amount
uint256 minReturn
uniswapV3Swap 0xe449022e
uint256 amount
uint256 minReturn
uniswapV3SwapTo 0xbc80f1a8
address recipient
uint256 amount
uint256 minReturn
uniswapV3SwapToWithPermit 0x2521b930
address recipient
address srcToken
uint256 amount
uint256 minReturn
clipperSwap 0xb0431182
address srcToken
address dstToken
uint256 amount
uint256 minReturn
clipperSwap (v5) 0x84bd6d29
address srcToken
address dstToken
uint256 inputAmount
uint256 outputAmount
clipperSwapToWithPermit 0xd6a92a5d
address recipient
address srcToken
address dstToken
uint256 amount
uint256 minReturn
clipperSwapToWithPermit (v5) 0xc805a666
address recipient
address srcToken
address dstToken
uint256 inputAmount
uint256 outputAmount
fillOrderRFQ 0xd0a3b665
address order.makerAsset
address order.takerAsset
address order.maker
uint256 order.makingAmount
uint256 order.takingAmount
fillOrderRFQ (v5) 0x3eca9c0a
address order.makerAsset
address order.takerAsset
address order.maker
uint256 order.makingAmount
uint256 order.takingAmount
fillOrderRFQToWithPermit 0x4cc4a27b
address order.makerAsset
address order.takerAsset
address order.maker
uint256 order.makingAmount
uint256 order.takingAmount
fillOrderRFQToWithPermit (v5) 0x70ccbd31
address order.makerAsset
address order.takerAsset
address order.maker
uint256 order.makingAmount
uint256 order.takingAmount

Build

Go to the plugin-tools folder and run the "./start" script.

cd plugin-tools  # go to plugin folder
./start.sh       # run the script start.sh

The script will build a docker image and attach a console. When the docker image is running go to the "app-plugin-1inch" folder and build the ".elf" files.

cd app-plugin-1inch/tests       # go to the tests folder in app-plugin-1inch
./build_local_test_elfs.sh      # run the script build_local_test_elfs.sh

Tests

To test the plugin go to the tests folder from the "app-plugin-1inch" and run the script "test"

cd app-plugin-1inch/tests       # go to the tests folder in app-plugin-1inch
yarn test                       # run the script test

Continuous Integration

The flow processed in GitHub Actions is the following: