Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

plp-contract

Python client library for PLP (Protocol Liquidity Pool) smart contract interactions. Provides typed, async-ready depositor and pool management clients built on web3.py.

Installation

pip install plp-contract

Quick Start

from plp_contract import SimpleDepositor, DepositParams

depositor = SimpleDepositor(
    rpc_url="https://eth.llamarpc.com",
    depositor_address="0x8cad6c2317233D38a3cf4601F4A441f316F77Db3",
    private_key="0x...",
    chain_id=1,
)

# Preview deposit
shares = depositor.preview_deposit(
    pool_address="0x...",
    amount_wei=10**18,
)
print(f"Expected shares: {shares}")

# Execute deposit
result = depositor.deposit(DepositParams(
    pool_address="0x...",
    amount_wei=10**18,
    min_shares=int(shares * 0.995),  # 0.5% slippage
))
print(f"TX: {result.tx_hash}")

Async Usage

import asyncio
from plp_contract import AsyncDepositor, DepositParams

async def main():
    async with AsyncDepositor(
        rpc_url="wss://eth.llamarpc.com",
        depositor_address="0x8cad6c2317233D38a3cf4601F4A441f316F77Db3",
        private_key="0x...",
        chain_id=1,
    ) as depositor:
        info = await depositor.get_pool_info("0x...")
        print(f"TVL: {info.tvl_eth:.2f} ETH")

        result = await depositor.deposit(DepositParams(
            pool_address="0x...",
            amount_wei=5 * 10**17,
        ))
        print(f"TX: {result.tx_hash}, gas: {result.gas_used}")

asyncio.run(main())

Pool Registry

Track and query multiple pools:

from web3 import Web3
from plp_contract import PoolRegistry

w3 = Web3(Web3.HTTPProvider("https://eth.llamarpc.com"))
registry = PoolRegistry(w3, depositor_address="0x8cad6c...")

registry.add("0xPool1...")
registry.add("0xPool2...")

for pool in registry.active():
    print(f"{pool.name}: TVL={pool.tvl_eth:.2f} ETH, price={pool.share_price:.6f}")

API Reference

SimpleDepositor / AsyncDepositor

Method Description
deposit(params) Deposit assets into a pool (handles approval)
withdraw(params) Withdraw by burning share tokens
withdraw_all(pool, ...) Withdraw entire share balance
get_pool_info(pool) Fetch on-chain pool state
preview_deposit(pool, amount) Estimate shares for deposit
preview_redeem(pool, shares) Estimate assets for redemption
balance_of(pool, account?) Query share token balance

Models

  • DepositParams — Validated deposit parameters with slippage protection
  • WithdrawParams — Validated withdrawal parameters
  • PoolInfo — Read-only pool state snapshot
  • TransactionResult — On-chain transaction receipt with parsed logs
  • GasConfig — EIP-1559 and legacy gas settings

Exceptions

Exception When
InsufficientBalanceError Balance below requested amount
SlippageExceededError Output below minimum threshold
PoolNotFoundError Pool address not registered
TransactionRevertedError On-chain revert
RPCError Provider communication failure
GasEstimationError Gas estimation fails

Supported Contracts

Contract Address Chain
ELP Depositor 0x8cad6c2317233D38a3cf4601F4A441f316F77Db3 Ethereum
Royco Vault 0x1F8B025D61Cd54E81B6e4f4fC1A8fc757bc50bcf Ethereum

Requirements

  • Python 3.9+
  • web3.py >= 6.0

License

MIT

Download files

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

Source Distribution

plp_contract-2.0.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

plp_contract-2.0.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file plp_contract-2.0.2.tar.gz.

File metadata

  • Download URL: plp_contract-2.0.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for plp_contract-2.0.2.tar.gz
Algorithm Hash digest
SHA256 8db9941c4d795cfb5b396f642ab13016f91b5d52e14c648d5d8a2974d39df3f2
MD5 50b7a7dcd8cbd05fc295e7419a6c000e
BLAKE2b-256 99195c5de6576e88ffee80dc44dbe2279e580dd43551ee38fea542312c0c6c30

See more details on using hashes here.

File details

Details for the file plp_contract-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: plp_contract-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for plp_contract-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d8f0220ffcbc2ec4906ecf7399c490278cd55152617790435c7cf29b7233363
MD5 0f8442797015312e5114dd3c66b59eed
BLAKE2b-256 45ad86be008318b3752353f048ca95a65f4e0ac535818fd517afb8ef4499c2d0

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