Skip to main content

The IPOR Fusion SDK for Python

Project description

IPOR Fusion Python SDK

IPOR Fusion Python SDK

ipor_fusion is the official Python SDK for IPOR Fusion Plasma Vaults — typed abstractions for DeFi protocol interactions on EVM chains through a fuse adapter pattern.

Maintained by IPOR Labs AG.

Workflow CI CD Release
Social Chat on Discord X (formerly Twitter) URL IPOR Official Broadcast
Code PyPI version GitHub License Python Version Code style: black DeepWiki

Quickstart

Install

pip install ipor-fusion

Connect and execute

from ipor_fusion import Web3Context, PlasmaVault, AaveV3SupplyFuse
from web3 import Web3

# 1. Create a Web3 context with your provider and private key
ctx = Web3Context.from_url(
    url="https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY",
    private_key="0x...",
)

# 2. Wrap the PlasmaVault contract
vault = PlasmaVault(ctx, Web3.to_checksum_address("0xVAULT_ADDRESS"))

# 3. Build a fuse action (e.g. supply USDC to Aave V3)
fuse = AaveV3SupplyFuse(Web3.to_checksum_address("0xFUSE_ADDRESS"))
action = fuse.supply(
    asset=Web3.to_checksum_address("0xUSDC_ADDRESS"),
    amount=1_000_000,  # 1 USDC (6 decimals)
)

# 4. Execute on-chain
receipt = vault.execute([action])

Architecture

The SDK uses a fuse adapter pattern:

  • Fuses encode protocol-specific calls into FuseAction objects (pure calldata, no state)
  • PlasmaVault batches and executes FuseAction sequences on-chain via execute()
  • Web3Context manages provider connections, signing, and transaction dispatch
Fuse.method()  -->  FuseAction  -->  PlasmaVault.execute([actions])  -->  on-chain tx

Core modules (ipor_fusion.core)

Module Purpose
Web3Context Provider connection, signing, tx dispatch
PlasmaVault ERC-4626 vault — execute, deposit, withdraw
AccessManager Role-based access control
RewardsManager Claim and vest rewards
WithdrawManager Time-windowed withdrawal requests
PriceOracleMiddleware Asset price feeds

Supported protocols (ipor_fusion.fuses)

Protocol Fuses
Aave V3 AaveV3SupplyFuse, AaveV3BorrowFuse
Morpho MorphoSupplyFuse, MorphoCollateralFuse, MorphoBorrowFuse, MorphoFlashLoanFuse, MorphoClaimFuse
Uniswap V3 UniswapV3SwapFuse, UniswapV3NewPositionFuse, UniswapV3ModifyPositionFuse, UniswapV3CollectFuse
Ramses V2 RamsesV2NewPositionFuse, RamsesV2ModifyPositionFuse, RamsesV2CollectFuse, RamsesClaimFuse
Compound V3 CompoundV3SupplyFuse
Gearbox V3 GearboxSupplyFuse, GearboxStakeFuse
ERC-4626 ERC4626SupplyFuse
Fluid Instadapp FluidInstadappSupplyFuse, FluidInstadappStakingFuse
Universal UniversalTokenSwapperFuse

Supported networks

  • Ethereum mainnet
  • Arbitrum One
  • Base

Development

poetry install                                              # Install dependencies
poetry run pytest tests/test_fuse_encoding.py -n auto -v    # Unit tests (fast, no Docker)
poetry run pytest -v -s                                     # All tests (needs Docker + .env)
poetry run black ./                                         # Format
poetry run pylint --rcfile=pylintrc.toml --verbose --recursive=y .  # Lint
poetry run mypy .                                           # Type check

Integration tests require Docker (Anvil) and provider URLs in .env:

cp .env.example .env
# Edit .env with ARBITRUM_PROVIDER_URL, ETHEREUM_PROVIDER_URL, BASE_PROVIDER_URL

Examples

For full usage patterns, see the example repository: ipor-fusion-alpha-example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipor_fusion-2.0.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipor_fusion-2.0.0-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file ipor_fusion-2.0.0.tar.gz.

File metadata

  • Download URL: ipor_fusion-2.0.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.13

File hashes

Hashes for ipor_fusion-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f42c699eeedf224f47198dac499b0708ae215ea73af9dc75b6377cf66389764d
MD5 a2b57fb7298b8ed8eaf3683afb02eec0
BLAKE2b-256 7edca04a4b14ad4af5fb227fe000b73052b3d0e7da0bdf08a405d99dd8546253

See more details on using hashes here.

File details

Details for the file ipor_fusion-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ipor_fusion-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.13

File hashes

Hashes for ipor_fusion-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8103077cc705ccdf84b7ccdf0e80885fbd8295900f8af0b1778fd945ca6517e
MD5 9834ced4ba8b32ba98bdfc8957961abb
BLAKE2b-256 df382fed0c990c877fc08dfe66148e6cd8c795e476a5e043524b43f3ac59b2c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page