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 protectionWithdrawParams— Validated withdrawal parametersPoolInfo— Read-only pool state snapshotTransactionResult— On-chain transaction receipt with parsed logsGasConfig— 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plp_contract-2.0.1.tar.gz.
File metadata
- Download URL: plp_contract-2.0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cda9cbead5c4ecb2dccde1be910669c5d756f1eb386a564bec2b11a17e8f31ad
|
|
| MD5 |
0b5ea7aff8e096b230eff6415fdf23d4
|
|
| BLAKE2b-256 |
3693d90e860c7e4409dcd9f74eda629eb9e7a9633e488f48ce5d650d71f53670
|
File details
Details for the file plp_contract-2.0.1-py3-none-any.whl.
File metadata
- Download URL: plp_contract-2.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a10786eb0e07d7644969ce7ff8473bdee06034bbbf6db66e0ec7ab86fb3332
|
|
| MD5 |
0ee63f93908085df689985eb15aad544
|
|
| BLAKE2b-256 |
aebc1fff66c407fddfd86c62162b6675ae7fabbb2f7871de0981e9e49f312b50
|