Smart Contract Python Bindings Reference

afp.bindings

Typed bindings around the smart contracts of the Autonomous Futures Protocol.

Classes:

  • AuctionConfig – Port of struct AuctionConfig on the IAuctioneer contract.
  • AuctionData – Port of struct AuctionData on the IAuctioneer contract.
  • BidData – Port of struct BidData on the IAuctioneer contract.
  • ClearingConfig – Port of struct ClearingConfig on the IClearing contract.
  • ClearingDiamond – ClearingDiamond contract binding.
  • Config – Port of struct Config on the IClearing contract.
  • Intent – Port of struct Intent on the IClearing contract.
  • IntentData – Port of struct IntentData on the IClearing contract.
  • LAAData – Port of struct LAAData on the IBankruptcy contract.
  • MarginAccount – MarginAccount contract binding.
  • MarginAccountRegistry – MarginAccountRegistry contract binding.
  • OracleProvider – OracleProvider contract binding.
  • OracleSpecification – Port of struct OracleSpecification on the IProductRegistry contract.
  • PositionData – Port of struct PositionData on the IMarginAccount contract.
  • PositionLossData – Port of struct PositionLossData on the IBankruptcy contract.
  • Product – Port of struct Product on the IProductRegistry contract.
  • ProductMetadata – Port of struct ProductMetadata on the IProductRegistry contract.
  • ProductRegistry – ProductRegistry contract binding.
  • ProductState – Port of enum ProductState on the ProductRegistry contract.
  • Settlement – Port of struct Settlement on the IMarginAccount contract.
  • Side – Port of enum Side on the ClearingFacet contract.
  • SystemViewer – SystemViewer contract binding.
  • Trade – Port of struct Trade on the IClearing contract.
  • TradingProtocol – TradingProtocol contract binding.
  • UserMarginAccountData – Port of struct UserMarginAccountData on the ISystemViewer contract.

afp.bindings.AuctionConfig

AuctionConfig(restoration_buffer, liquidation_duration)

Port of struct AuctionConfig on the IAuctioneer contract.

Attributes:

afp.bindings.AuctionConfig.liquidation_duration

liquidation_duration: int

afp.bindings.AuctionConfig.restoration_buffer

restoration_buffer: int

afp.bindings.AuctionData

AuctionData(start_block, mae_at_initiation, mmu_at_initiation, mae_now, mmu_now)

Port of struct AuctionData on the IAuctioneer contract.

Attributes:

afp.bindings.AuctionData.mae_at_initiation

mae_at_initiation: int

afp.bindings.AuctionData.mae_now

mae_now: int

afp.bindings.AuctionData.mmu_at_initiation

mmu_at_initiation: int

afp.bindings.AuctionData.mmu_now

mmu_now: int

afp.bindings.AuctionData.start_block

start_block: int

afp.bindings.BidData

BidData(product_id, price, quantity, side)

Port of struct BidData on the IAuctioneer contract.

Attributes:

afp.bindings.BidData.price

price: int

afp.bindings.BidData.product_id

product_id: hexbytes.HexBytes

afp.bindings.BidData.quantity

quantity: int

afp.bindings.BidData.side

side: Side

afp.bindings.ClearingConfig

ClearingConfig(clearing_fee_rate)

Port of struct ClearingConfig on the IClearing contract.

Attributes:

afp.bindings.ClearingConfig.clearing_fee_rate

clearing_fee_rate: int

afp.bindings.ClearingDiamond

ClearingDiamond(w3)

Bases: AuctioneerFacet, BankruptcyFacet, ClearingFacet, FinalSettlementFacet, MarkPriceTrackerFacet

ClearingDiamond contract binding.

Includes all functions inherited from various facets.

Parameters:

Functions:

  • auction_config – Binding for auctionConfig on the AuctioneerFacet contract.
  • auction_data – Binding for auctionData on the AuctioneerFacet contract.
  • bid_auction – Binding for bidAuction on the AuctioneerFacet contract.
  • can_terminate_auctions – Binding for canTerminateAuctions on the AuctioneerFacet contract.
  • clearing_fee_rate – Binding for clearingFeeRate on the ClearingFacet contract.
  • closeout_fee_rate – Binding for CLOSEOUT_FEE_RATE on the FinalSettlementFacet contract.
  • closeout_reward_rate – Binding for CLOSEOUT_REWARD_RATE on the FinalSettlementFacet contract.
  • config – Binding for config on the ClearingFacet contract.
  • estimate_fees – Binding for estimateFees on the ClearingFacet contract.
  • execute – Binding for execute on the ClearingFacet contract.
  • finalize_fsp – Binding for finalizeFsp on the FinalSettlementFacet contract.
  • finalize_initialization – Binding for finalizeInitialization on the ClearingFacet contract.
  • get_admin – Binding for getAdmin on the ClearingFacet contract.
  • get_fsp – Binding for getFsp on the FinalSettlementFacet contract.
  • get_margin_account_registry – Binding for getMarginAccountRegistry on the ClearingFacet contract.
  • get_product_registry – Binding for getProductRegistry on the ClearingFacet contract.
  • get_treasury – Binding for getTreasury on the ClearingFacet contract.
  • hash_intent – Binding for hashIntent on the ClearingFacet contract.
  • initialize – Binding for initialize on the ClearingFacet contract.
  • initiate_final_settlement – Binding for initiateFinalSettlement on the FinalSettlementFacet contract.
  • is_admin_active – Binding for isAdminActive on the ClearingFacet contract.
  • is_liquidatable – Binding for isLiquidatable on the AuctioneerFacet contract.
  • is_liquidating – Binding for isLiquidating on the AuctioneerFacet contract.
  • last_traded_timestamp – Binding for lastTradedTimestamp on the BankruptcyFacet contract.
  • mae_check_on_bid – Binding for maeCheckOnBid on the AuctioneerFacet contract.
  • max_mae_offered – Binding for maxMaeOffered on the AuctioneerFacet contract.
  • max_trading_fee_rate – Binding for MAX_TRADING_FEE_RATE on the ClearingFacet contract.
  • mutualize_losses – Binding for mutualizeLosses on the BankruptcyFacet contract.
  • open_interest – Binding for openInterest on the FinalSettlementFacet contract.
  • request_liquidation – Binding for requestLiquidation on the AuctioneerFacet contract.
  • set_active – Binding for setActive on the ClearingFacet contract.
  • set_admin – Binding for setAdmin on the ClearingFacet contract.
  • set_config – Binding for setConfig on the ClearingFacet contract.
  • terminate_auctions – Binding for terminateAuctions on the AuctioneerFacet contract.
  • unique_trader_count – Binding for uniqueTraderCount on the BankruptcyFacet contract.
  • validate_auctions – Binding for validateAuctions on the AuctioneerFacet contract.
  • validate_la_as – Binding for validateLAAs on the BankruptcyFacet contract.
  • valuation – Binding for valuation on the MarkPriceTrackerFacet contract.
  • valuation_after_trade – Binding for valuationAfterTrade on the MarkPriceTrackerFacet contract.
  • version – Binding for version on the ClearingFacet contract.

Attributes:

afp.bindings.ClearingDiamond.Auctioned

Auctioned: contract.ContractEvent

Binding for event Auctioned on the AuctioneerFacet contract.

afp.bindings.ClearingDiamond.LiquidationStarted

LiquidationStarted: contract.ContractEvent

Binding for event LiquidationStarted on the AuctioneerFacet contract.

afp.bindings.ClearingDiamond.LiquidationTerminated

LiquidationTerminated: contract.ContractEvent

Binding for event LiquidationTerminated on the AuctioneerFacet contract.

afp.bindings.ClearingDiamond.TradeExecuted

TradeExecuted: contract.ContractEvent

Binding for event TradeExecuted on the ClearingFacet contract.

afp.bindings.ClearingDiamond.auction_config

auction_config()

Binding for auctionConfig on the AuctioneerFacet contract.

Returns:

afp.bindings.ClearingDiamond.auction_data

auction_data(margin_account_id, collateral)

Binding for auctionData on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.bid_auction

bid_auction(margin_account_id, collateral_token, bids)

Binding for bidAuction on the AuctioneerFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.can_terminate_auctions

can_terminate_auctions(margin_account_id, collateral)

Binding for canTerminateAuctions on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.clearing_fee_rate

clearing_fee_rate()

Binding for clearingFeeRate on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.closeout_fee_rate

closeout_fee_rate()

Binding for CLOSEOUT_FEE_RATE on the FinalSettlementFacet contract.

Returns:

afp.bindings.ClearingDiamond.closeout_reward_rate

closeout_reward_rate()

Binding for CLOSEOUT_REWARD_RATE on the FinalSettlementFacet contract.

Returns:

afp.bindings.ClearingDiamond.config

config()

Binding for config on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.estimate_fees

estimate_fees(product_id, price, quantity, trading_fee_rate)

Binding for estimateFees on the ClearingFacet contract.

Parameters:

  • product_id (HexBytes) –
  • price (int) –
  • quantity (int) –
  • trading_fee_rate (int) –

Returns:

afp.bindings.ClearingDiamond.execute

execute(trade, fallback_on_failure)

Binding for execute on the ClearingFacet contract.

Parameters:

  • trade (Trade) –
  • fallback_on_failure (bool) –

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.finalize_fsp

finalize_fsp(product_id)

Binding for finalizeFsp on the FinalSettlementFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.finalize_initialization

finalize_initialization(margin_account_registry)

Binding for finalizeInitialization on the ClearingFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.get_admin

get_admin()

Binding for getAdmin on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.get_fsp

get_fsp(product_id)

Binding for getFsp on the FinalSettlementFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.get_margin_account_registry

get_margin_account_registry()

Binding for getMarginAccountRegistry on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.get_product_registry

get_product_registry()

Binding for getProductRegistry on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.get_treasury

get_treasury()

Binding for getTreasury on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.hash_intent

hash_intent(intent)

Binding for hashIntent on the ClearingFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.initialize

initialize(_product_registry, _treasury)

Binding for initialize on the ClearingFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.initiate_final_settlement

initiate_final_settlement(product_id, accounts)

Binding for initiateFinalSettlement on the FinalSettlementFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.is_admin_active

is_admin_active()

Binding for isAdminActive on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.is_liquidatable

is_liquidatable(margin_account_id, collateral_token)

Binding for isLiquidatable on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.is_liquidating

is_liquidating(margin_account_id, collateral_token)

Binding for isLiquidating on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.last_traded_timestamp

last_traded_timestamp(product_id, trader)

Binding for lastTradedTimestamp on the BankruptcyFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.mae_check_on_bid

mae_check_on_bid(liquidator_margin_account_id, liquidating_margin_account_id, collateral, bids)

Binding for maeCheckOnBid on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.max_mae_offered

max_mae_offered(margin_account_id, collateral, mmu_decreased)

Binding for maxMaeOffered on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.max_trading_fee_rate

max_trading_fee_rate()

Binding for MAX_TRADING_FEE_RATE on the ClearingFacet contract.

Returns:

afp.bindings.ClearingDiamond.mutualize_losses

mutualize_losses(bankrupt_account_id, collateral_token, product_ids, laas)

Binding for mutualizeLosses on the BankruptcyFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.open_interest

open_interest(product_id)

Binding for openInterest on the FinalSettlementFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.request_liquidation

request_liquidation(margin_account_id, collateral_token)

Binding for requestLiquidation on the AuctioneerFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.set_active

set_active(active)

Binding for setActive on the ClearingFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.set_admin

set_admin(new_admin)

Binding for setAdmin on the ClearingFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.set_config

set_config(_config)

Binding for setConfig on the ClearingFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.terminate_auctions

terminate_auctions(margin_account_id, collateral)

Binding for terminateAuctions on the AuctioneerFacet contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ClearingDiamond.unique_trader_count

unique_trader_count(product_id)

Binding for uniqueTraderCount on the BankruptcyFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.validate_auctions

validate_auctions(margin_account_id, collateral_token, bids)

Binding for validateAuctions on the AuctioneerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.validate_la_as

validate_la_as(margin_account, bankrupt_account, product_id, product_owners)

Binding for validateLAAs on the BankruptcyFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.valuation

valuation(product_id)

Binding for valuation on the MarkPriceTrackerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.valuation_after_trade

valuation_after_trade(product_id, price, quantity)

Binding for valuationAfterTrade on the MarkPriceTrackerFacet contract.

Parameters:

Returns:

afp.bindings.ClearingDiamond.version

version()

Binding for version on the ClearingFacet contract.

Returns:

afp.bindings.Config

Config(auction_config, clearing_config)

Port of struct Config on the IClearing contract.

Attributes:

afp.bindings.Config.auction_config

auction_config: AuctionConfig

afp.bindings.Config.clearing_config

clearing_config: ClearingConfig

afp.bindings.Intent

Intent(margin_account_id, intent_account_id, hash, data, signature)

Port of struct Intent on the IClearing contract.

Attributes:

afp.bindings.Intent.data

data: IntentData

afp.bindings.Intent.hash

hash: hexbytes.HexBytes

afp.bindings.Intent.intent_account_id

intent_account_id: eth_typing.ChecksumAddress

afp.bindings.Intent.margin_account_id

margin_account_id: eth_typing.ChecksumAddress

afp.bindings.Intent.signature

signature: hexbytes.HexBytes

afp.bindings.IntentData

IntentData(nonce, trading_protocol_id, product_id, limit_price, quantity, max_trading_fee_rate, good_until, side)

Port of struct IntentData on the IClearing contract.

Attributes:

afp.bindings.IntentData.good_until

good_until: int

afp.bindings.IntentData.limit_price

limit_price: int

afp.bindings.IntentData.max_trading_fee_rate

max_trading_fee_rate: int

afp.bindings.IntentData.nonce

nonce: int

afp.bindings.IntentData.product_id

product_id: hexbytes.HexBytes

afp.bindings.IntentData.quantity

quantity: int

afp.bindings.IntentData.side

side: Side

afp.bindings.IntentData.trading_protocol_id

trading_protocol_id: eth_typing.ChecksumAddress

afp.bindings.LAAData

LAAData(owner, quantity, last_traded_timestamp, position_age)

Port of struct LAAData on the IBankruptcy contract.

Attributes:

afp.bindings.LAAData.last_traded_timestamp

last_traded_timestamp: int

afp.bindings.LAAData.owner

owner: eth_typing.ChecksumAddress

afp.bindings.LAAData.position_age

position_age: int

afp.bindings.LAAData.quantity

quantity: int

afp.bindings.MarginAccount

MarginAccount(w3, address)

MarginAccount contract binding.

Parameters:

  • w3 (Web3) –
  • address (ChecksumAddress) – The address of a deployed MarginAccount contract.

Functions:

  • authorize – Binding for authorize on the MarginAccount contract.
  • authorized – Binding for authorized on the MarginAccount contract.
  • batch_mae_check – Binding for batchMaeCheck on the MarginAccount contract.
  • batch_settle – Binding for batchSettle on the MarginAccount contract.
  • capital – Binding for capital on the MarginAccount contract.
  • clearing – Binding for clearing on the MarginAccount contract.
  • collateral_asset – Binding for collateralAsset on the MarginAccount contract.
  • collateral_token – Binding for collateralToken on the MarginAccount contract.
  • collect_fee – Binding for collectFee on the MarginAccount contract.
  • deposit – Binding for deposit on the MarginAccount contract.
  • disperse_fees – Binding for disperseFees on the MarginAccount contract.
  • estimate_liquidation_price – Binding for estimateLiquidationPrice on the MarginAccount contract.
  • estimate_liquidation_price_for_position – Binding for estimateLiquidationPriceForPosition on the MarginAccount contract.
  • initialize – Binding for initialize on the MarginAccount contract.
  • mae – Binding for mae on the MarginAccount contract.
  • mae_and_mmu_after_batch_trade – Binding for maeAndMmuAfterBatchTrade on the MarginAccount contract.
  • mae_check – Binding for maeCheck on the MarginAccount contract.
  • mma – Binding for mma on the MarginAccount contract.
  • mmu – Binding for mmu on the MarginAccount contract.
  • pnl – Binding for pnl on the MarginAccount contract.
  • position_age – Binding for positionAge on the MarginAccount contract.
  • position_count – Binding for positionCount on the MarginAccount contract.
  • position_data – Binding for positionData on the MarginAccount contract.
  • position_pn_l – Binding for positionPnL on the MarginAccount contract.
  • position_quantity – Binding for positionQuantity on the MarginAccount contract.
  • positions – Binding for positions on the MarginAccount contract.
  • product_registry – Binding for productRegistry on the MarginAccount contract.
  • revoke_authorization – Binding for revokeAuthorization on the MarginAccount contract.
  • settle – Binding for settle on the MarginAccount contract.
  • valuation – Binding for valuation on the MarginAccount contract.
  • withdraw – Binding for withdraw on the MarginAccount contract.
  • withdrawable – Binding for withdrawable on the MarginAccount contract.

Attributes:

afp.bindings.MarginAccount.FeeCollected

FeeCollected: contract.ContractEvent

Binding for event FeeCollected on the MarginAccount contract.

afp.bindings.MarginAccount.FeeDispersed

FeeDispersed: contract.ContractEvent

Binding for event FeeDispersed on the MarginAccount contract.

afp.bindings.MarginAccount.Initialized

Initialized: contract.ContractEvent

Binding for event Initialized on the MarginAccount contract.

afp.bindings.MarginAccount.PositionUpdated

PositionUpdated: contract.ContractEvent

Binding for event PositionUpdated on the MarginAccount contract.

afp.bindings.MarginAccount.authorize

authorize(intent_account)

Binding for authorize on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.authorized

authorized(margin_account, intent_account)

Binding for authorized on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.batch_mae_check

batch_mae_check(margin_account, settlements, mark_price_if_settled)

Binding for batchMaeCheck on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.batch_settle

batch_settle(margin_account_id, settlements)

Binding for batchSettle on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.capital

capital(margin_account)

Binding for capital on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.clearing

clearing()

Binding for clearing on the MarginAccount contract.

Returns:

afp.bindings.MarginAccount.collateral_asset

collateral_asset()

Binding for collateralAsset on the MarginAccount contract.

Returns:

afp.bindings.MarginAccount.collateral_token

collateral_token()

Binding for collateralToken on the MarginAccount contract.

Returns:

afp.bindings.MarginAccount.collect_fee

collect_fee(margin_account, capital_amount)

Binding for collectFee on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.deposit

deposit(amount)

Binding for deposit on the MarginAccount contract.

Parameters:

  • amount (int) –

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.disperse_fees

disperse_fees(recipients, capital_amounts)

Binding for disperseFees on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.estimate_liquidation_price

estimate_liquidation_price(margin_account_id, product_id, price, quantity)

Binding for estimateLiquidationPrice on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.estimate_liquidation_price_for_position

estimate_liquidation_price_for_position(margin_account_id, position_id)

Binding for estimateLiquidationPriceForPosition on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.initialize

initialize(_collateral_token, _valuation, _product_registry, _clearing)

Binding for initialize on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.mae

mae(margin_account)

Binding for mae on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.mae_and_mmu_after_batch_trade

mae_and_mmu_after_batch_trade(margin_account, settlements, mark_price_if_settled)

Binding for maeAndMmuAfterBatchTrade on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.mae_check

mae_check(margin_account, settlement, mark_price_if_settled)

Binding for maeCheck on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.mma

mma(margin_account)

Binding for mma on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.mmu

mmu(margin_account)

Binding for mmu on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.pnl

pnl(margin_account)

Binding for pnl on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.position_age

position_age(margin_account_id, position_id)

Binding for positionAge on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.position_count

position_count(margin_account)

Binding for positionCount on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.position_data

position_data(margin_account, position_id)

Binding for positionData on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.position_pn_l

position_pn_l(margin_account, position_id)

Binding for positionPnL on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.position_quantity

position_quantity(margin_account, position_id)

Binding for positionQuantity on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.positions

positions(margin_account)

Binding for positions on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccount.product_registry

product_registry()

Binding for productRegistry on the MarginAccount contract.

Returns:

afp.bindings.MarginAccount.revoke_authorization

revoke_authorization(intent_account)

Binding for revokeAuthorization on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.settle

settle(margin_account, intent_account, settlement)

Binding for settle on the MarginAccount contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.valuation

valuation()

Binding for valuation on the MarginAccount contract.

Returns:

afp.bindings.MarginAccount.withdraw

withdraw(amount)

Binding for withdraw on the MarginAccount contract.

Parameters:

  • amount (int) –

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccount.withdrawable

withdrawable(margin_account)

Binding for withdrawable on the MarginAccount contract.

Parameters:

Returns:

afp.bindings.MarginAccountRegistry

MarginAccountRegistry(w3)

Bases: MarginAccountRegistry

MarginAccountRegistry contract binding.

Parameters:

Functions:

  • clearing – Binding for clearing on the MarginAccountRegistry contract.
  • get_admin – Binding for getAdmin on the MarginAccountRegistry contract.
  • get_margin_account – Binding for getMarginAccount on the MarginAccountRegistry contract.
  • initialize – Binding for initialize on the MarginAccountRegistry contract.
  • initialize_margin_account – Binding for initializeMarginAccount on the MarginAccountRegistry contract.
  • is_admin_active – Binding for isAdminActive on the MarginAccountRegistry contract.
  • margin_accounts – Binding for marginAccounts on the MarginAccountRegistry contract.
  • owner – Binding for owner on the MarginAccountRegistry contract.
  • product_registry – Binding for productRegistry on the MarginAccountRegistry contract.
  • proxiable_uuid – Binding for proxiableUUID on the MarginAccountRegistry contract.
  • renounce_ownership – Binding for renounceOwnership on the MarginAccountRegistry contract.
  • set_active – Binding for setActive on the MarginAccountRegistry contract.
  • set_admin – Binding for setAdmin on the MarginAccountRegistry contract.
  • transfer_ownership – Binding for transferOwnership on the MarginAccountRegistry contract.
  • upgrade_interface_version – Binding for UPGRADE_INTERFACE_VERSION on the MarginAccountRegistry contract.
  • upgrade_to_and_call – Binding for upgradeToAndCall on the MarginAccountRegistry contract.
  • valuation – Binding for valuation on the MarginAccountRegistry contract.

Attributes:

afp.bindings.MarginAccountRegistry.Initialized

Initialized: contract.ContractEvent

Binding for event Initialized on the MarginAccountRegistry contract.

afp.bindings.MarginAccountRegistry.MarginAccountCreated

MarginAccountCreated: contract.ContractEvent

Binding for event MarginAccountCreated on the MarginAccountRegistry contract.

afp.bindings.MarginAccountRegistry.OwnershipTransferred

OwnershipTransferred: contract.ContractEvent

Binding for event OwnershipTransferred on the MarginAccountRegistry contract.

afp.bindings.MarginAccountRegistry.Upgraded

Upgraded: contract.ContractEvent

Binding for event Upgraded on the MarginAccountRegistry contract.

afp.bindings.MarginAccountRegistry.clearing

clearing()

Binding for clearing on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.get_admin

get_admin()

Binding for getAdmin on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.get_margin_account

get_margin_account(collateral_asset)

Binding for getMarginAccount on the MarginAccountRegistry contract.

Parameters:

Returns:

afp.bindings.MarginAccountRegistry.initialize

initialize(_clearing, _valuation, _product_registry, beacon_)

Binding for initialize on the MarginAccountRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.initialize_margin_account

initialize_margin_account(collateral_asset)

Binding for initializeMarginAccount on the MarginAccountRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.is_admin_active

is_admin_active()

Binding for isAdminActive on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.margin_accounts

margin_accounts(key0)

Binding for marginAccounts on the MarginAccountRegistry contract.

Parameters:

Returns:

afp.bindings.MarginAccountRegistry.owner

owner()

Binding for owner on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.product_registry

product_registry()

Binding for productRegistry on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.proxiable_uuid

proxiable_uuid()

Binding for proxiableUUID on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.renounce_ownership

renounce_ownership()

Binding for renounceOwnership on the MarginAccountRegistry contract.

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.set_active

set_active(active)

Binding for setActive on the MarginAccountRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.set_admin

set_admin(new_admin)

Binding for setAdmin on the MarginAccountRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.transfer_ownership

transfer_ownership(new_owner)

Binding for transferOwnership on the MarginAccountRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.upgrade_interface_version

upgrade_interface_version()

Binding for UPGRADE_INTERFACE_VERSION on the MarginAccountRegistry contract.

Returns:

afp.bindings.MarginAccountRegistry.upgrade_to_and_call

upgrade_to_and_call(new_implementation, data)

Binding for upgradeToAndCall on the MarginAccountRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.MarginAccountRegistry.valuation

valuation()

Binding for valuation on the MarginAccountRegistry contract.

Returns:

afp.bindings.OracleProvider

OracleProvider(w3)

Bases: OracleProvider

OracleProvider contract binding.

Parameters:

Functions:

  • get_admin – Binding for getAdmin on the OracleProvider contract.
  • initialize – Binding for initialize on the OracleProvider contract.
  • is_admin_active – Binding for isAdminActive on the OracleProvider contract.
  • owner – Binding for owner on the OracleProvider contract.
  • product_registry – Binding for productRegistry on the OracleProvider contract.
  • proxiable_uuid – Binding for proxiableUUID on the OracleProvider contract.
  • renounce_ownership – Binding for renounceOwnership on the OracleProvider contract.
  • resolve – Binding for resolve on the OracleProvider contract.
  • set_active – Binding for setActive on the OracleProvider contract.
  • set_admin – Binding for setAdmin on the OracleProvider contract.
  • submit – Binding for submit on the OracleProvider contract.
  • transfer_ownership – Binding for transferOwnership on the OracleProvider contract.
  • upgrade_interface_version – Binding for UPGRADE_INTERFACE_VERSION on the OracleProvider contract.
  • upgrade_to_and_call – Binding for upgradeToAndCall on the OracleProvider contract.

Attributes:

afp.bindings.OracleProvider.Initialized

Initialized: contract.ContractEvent

Binding for event Initialized on the OracleProvider contract.

afp.bindings.OracleProvider.OwnershipTransferred

OwnershipTransferred: contract.ContractEvent

Binding for event OwnershipTransferred on the OracleProvider contract.

afp.bindings.OracleProvider.PriceSubmitted

PriceSubmitted: contract.ContractEvent

Binding for event PriceSubmitted on the OracleProvider contract.

afp.bindings.OracleProvider.Upgraded

Upgraded: contract.ContractEvent

Binding for event Upgraded on the OracleProvider contract.

afp.bindings.OracleProvider.get_admin

get_admin()

Binding for getAdmin on the OracleProvider contract.

Returns:

afp.bindings.OracleProvider.initialize

initialize(_product_registry)

Binding for initialize on the OracleProvider contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleProvider.is_admin_active

is_admin_active()

Binding for isAdminActive on the OracleProvider contract.

Returns:

afp.bindings.OracleProvider.owner

owner()

Binding for owner on the OracleProvider contract.

Returns:

afp.bindings.OracleProvider.product_registry

product_registry()

Binding for productRegistry on the OracleProvider contract.

Returns:

afp.bindings.OracleProvider.proxiable_uuid

proxiable_uuid()

Binding for proxiableUUID on the OracleProvider contract.

Returns:

afp.bindings.OracleProvider.renounce_ownership

renounce_ownership()

Binding for renounceOwnership on the OracleProvider contract.

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleProvider.resolve

resolve(product_id, key1)

Binding for resolve on the OracleProvider contract.

Parameters:

Returns:

afp.bindings.OracleProvider.set_active

set_active(active)

Binding for setActive on the OracleProvider contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleProvider.set_admin

set_admin(admin)

Binding for setAdmin on the OracleProvider contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleProvider.submit

submit(key, fsp)

Binding for submit on the OracleProvider contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleProvider.transfer_ownership

transfer_ownership(new_owner)

Binding for transferOwnership on the OracleProvider contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleProvider.upgrade_interface_version

upgrade_interface_version()

Binding for UPGRADE_INTERFACE_VERSION on the OracleProvider contract.

Returns:

afp.bindings.OracleProvider.upgrade_to_and_call

upgrade_to_and_call(new_implementation, data)

Binding for upgradeToAndCall on the OracleProvider contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.OracleSpecification

OracleSpecification(oracle_address, fsv_decimals, fsp_alpha, fsp_beta, fsv_calldata)

Port of struct OracleSpecification on the IProductRegistry contract.

Attributes:

afp.bindings.OracleSpecification.fsp_alpha

fsp_alpha: int

afp.bindings.OracleSpecification.fsp_beta

fsp_beta: int

afp.bindings.OracleSpecification.fsv_calldata

fsv_calldata: hexbytes.HexBytes

afp.bindings.OracleSpecification.fsv_decimals

fsv_decimals: int

afp.bindings.OracleSpecification.oracle_address

oracle_address: eth_typing.ChecksumAddress

afp.bindings.PositionData

PositionData(position_id, quantity, cost_basis, maintenance_margin, pnl)

Port of struct PositionData on the IMarginAccount contract.

Attributes:

afp.bindings.PositionData.cost_basis

cost_basis: int

afp.bindings.PositionData.maintenance_margin

maintenance_margin: int

afp.bindings.PositionData.pnl

pnl: int

afp.bindings.PositionData.position_id

position_id: hexbytes.HexBytes

afp.bindings.PositionData.quantity

quantity: int

afp.bindings.PositionLossData

PositionLossData(position_id, bankrupt_account_u_pn_l, bankrupt_account_quantity, mark_price, point_value, tick_size, laa_data)

Port of struct PositionLossData on the IBankruptcy contract.

Attributes:

afp.bindings.PositionLossData.bankrupt_account_quantity

bankrupt_account_quantity: int

afp.bindings.PositionLossData.bankrupt_account_u_pn_l

bankrupt_account_u_pn_l: int

afp.bindings.PositionLossData.laa_data

laa_data: typing.List[LAAData]

afp.bindings.PositionLossData.mark_price

mark_price: int

afp.bindings.PositionLossData.point_value

point_value: int

afp.bindings.PositionLossData.position_id

position_id: hexbytes.HexBytes

afp.bindings.PositionLossData.tick_size

tick_size: int

afp.bindings.Product

Product(metadata, oracle_spec, price_quotation, collateral_asset, start_time, earliest_fsp_submission_time, unit_value, initial_margin_requirement, maintenance_margin_requirement, offer_price_buffer, auction_bounty, tradeout_interval, tick_size, extended_metadata)

Port of struct Product on the IProductRegistry contract.

Attributes:

afp.bindings.Product.auction_bounty

auction_bounty: int

afp.bindings.Product.collateral_asset

collateral_asset: eth_typing.ChecksumAddress

afp.bindings.Product.earliest_fsp_submission_time

earliest_fsp_submission_time: int

afp.bindings.Product.extended_metadata

extended_metadata: str

afp.bindings.Product.initial_margin_requirement

initial_margin_requirement: int

afp.bindings.Product.maintenance_margin_requirement

maintenance_margin_requirement: int

afp.bindings.Product.metadata

metadata: ProductMetadata

afp.bindings.Product.offer_price_buffer

offer_price_buffer: int

afp.bindings.Product.oracle_spec

oracle_spec: OracleSpecification

afp.bindings.Product.price_quotation

price_quotation: str

afp.bindings.Product.start_time

start_time: int

afp.bindings.Product.tick_size

tick_size: int

afp.bindings.Product.tradeout_interval

tradeout_interval: int

afp.bindings.Product.unit_value

unit_value: int

afp.bindings.ProductMetadata

ProductMetadata(builder, symbol, description)

Port of struct ProductMetadata on the IProductRegistry contract.

Attributes:

afp.bindings.ProductMetadata.builder

builder: eth_typing.ChecksumAddress

afp.bindings.ProductMetadata.description

description: str

afp.bindings.ProductMetadata.symbol

symbol: str

afp.bindings.ProductRegistry

ProductRegistry(w3)

Bases: ProductRegistry

ProductRegistry contract binding.

Parameters:

Functions:

  • auction_bounty – Binding for auctionBounty on the ProductRegistry contract.
  • clearing – Binding for clearing on the ProductRegistry contract.
  • collateral_asset – Binding for collateralAsset on the ProductRegistry contract.
  • earliest_fsp_submission_time – Binding for earliestFSPSubmissionTime on the ProductRegistry contract.
  • id – Binding for id on the ProductRegistry contract.
  • imr – Binding for imr on the ProductRegistry contract.
  • initialize – Binding for initialize on the ProductRegistry contract.
  • mmr – Binding for mmr on the ProductRegistry contract.
  • offer_price_buffer – Binding for offerPriceBuffer on the ProductRegistry contract.
  • oracle_specification – Binding for oracleSpecification on the ProductRegistry contract.
  • owner – Binding for owner on the ProductRegistry contract.
  • point_value – Binding for pointValue on the ProductRegistry contract.
  • products – Binding for products on the ProductRegistry contract.
  • proxiable_uuid – Binding for proxiableUUID on the ProductRegistry contract.
  • register – Binding for register on the ProductRegistry contract.
  • renounce_ownership – Binding for renounceOwnership on the ProductRegistry contract.
  • set_clearing – Binding for setClearing on the ProductRegistry contract.
  • state – Binding for state on the ProductRegistry contract.
  • tick_size – Binding for tickSize on the ProductRegistry contract.
  • transfer_ownership – Binding for transferOwnership on the ProductRegistry contract.
  • upgrade_interface_version – Binding for UPGRADE_INTERFACE_VERSION on the ProductRegistry contract.
  • upgrade_to_and_call – Binding for upgradeToAndCall on the ProductRegistry contract.

Attributes:

afp.bindings.ProductRegistry.Initialized

Initialized: contract.ContractEvent

Binding for event Initialized on the ProductRegistry contract.

afp.bindings.ProductRegistry.OwnershipTransferred

OwnershipTransferred: contract.ContractEvent

Binding for event OwnershipTransferred on the ProductRegistry contract.

afp.bindings.ProductRegistry.ProductRegistered

ProductRegistered: contract.ContractEvent

Binding for event ProductRegistered on the ProductRegistry contract.

afp.bindings.ProductRegistry.Upgraded

Upgraded: contract.ContractEvent

Binding for event Upgraded on the ProductRegistry contract.

afp.bindings.ProductRegistry.auction_bounty

auction_bounty(product_id)

Binding for auctionBounty on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.clearing

clearing()

Binding for clearing on the ProductRegistry contract.

Returns:

afp.bindings.ProductRegistry.collateral_asset

collateral_asset(product_id)

Binding for collateralAsset on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.earliest_fsp_submission_time

earliest_fsp_submission_time(product_id)

Binding for earliestFSPSubmissionTime on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.id

id(product)

Binding for id on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.imr

imr(product_id)

Binding for imr on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.initialize

initialize()

Binding for initialize on the ProductRegistry contract.

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ProductRegistry.mmr

mmr(product_id)

Binding for mmr on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.offer_price_buffer

offer_price_buffer(product_id)

Binding for offerPriceBuffer on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.oracle_specification

oracle_specification(product_id)

Binding for oracleSpecification on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.owner

owner()

Binding for owner on the ProductRegistry contract.

Returns:

afp.bindings.ProductRegistry.point_value

point_value(product_id)

Binding for pointValue on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.products

products(product_id)

Binding for products on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.proxiable_uuid

proxiable_uuid()

Binding for proxiableUUID on the ProductRegistry contract.

Returns:

afp.bindings.ProductRegistry.register

register(product)

Binding for register on the ProductRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ProductRegistry.renounce_ownership

renounce_ownership()

Binding for renounceOwnership on the ProductRegistry contract.

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ProductRegistry.set_clearing

set_clearing(clearing_)

Binding for setClearing on the ProductRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ProductRegistry.state

state(product_id)

Binding for state on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.tick_size

tick_size(product_id)

Binding for tickSize on the ProductRegistry contract.

Parameters:

Returns:

afp.bindings.ProductRegistry.transfer_ownership

transfer_ownership(new_owner)

Binding for transferOwnership on the ProductRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ProductRegistry.upgrade_interface_version

upgrade_interface_version()

Binding for UPGRADE_INTERFACE_VERSION on the ProductRegistry contract.

Returns:

afp.bindings.ProductRegistry.upgrade_to_and_call

upgrade_to_and_call(new_implementation, data)

Binding for upgradeToAndCall on the ProductRegistry contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.ProductState

Bases: IntEnum

Port of enum ProductState on the ProductRegistry contract.

Attributes:

afp.bindings.ProductState.EXPIRED

EXPIRED = 5

afp.bindings.ProductState.FINAL_SETTLEMENT

FINAL_SETTLEMENT = 4

afp.bindings.ProductState.LIVE

LIVE = 2

afp.bindings.ProductState.NOT_EXIST

NOT_EXIST = 0

afp.bindings.ProductState.PENDING

PENDING = 1

afp.bindings.ProductState.TRADEOUT

TRADEOUT = 3

afp.bindings.Settlement

Settlement(position_id, quantity, price)

Port of struct Settlement on the IMarginAccount contract.

Attributes:

afp.bindings.Settlement.position_id

position_id: hexbytes.HexBytes

afp.bindings.Settlement.price

price: int

afp.bindings.Settlement.quantity

quantity: int

afp.bindings.Side

Bases: IntEnum

Port of enum Side on the ClearingFacet contract.

Attributes:

afp.bindings.Side.ASK

ASK = 1

afp.bindings.Side.BID

BID = 0

afp.bindings.SystemViewer

SystemViewer(w3)

Bases: SystemViewer

SystemViewer contract binding.

Parameters:

Functions:

Attributes:

afp.bindings.SystemViewer.Initialized

Initialized: contract.ContractEvent

Binding for event Initialized on the SystemViewer contract.

afp.bindings.SystemViewer.OwnershipTransferred

OwnershipTransferred: contract.ContractEvent

Binding for event OwnershipTransferred on the SystemViewer contract.

afp.bindings.SystemViewer.Upgraded

Upgraded: contract.ContractEvent

Binding for event Upgraded on the SystemViewer contract.

afp.bindings.SystemViewer.clearing

clearing()

Binding for clearing on the SystemViewer contract.

Returns:

afp.bindings.SystemViewer.initialize

initialize(_clearing, _product_registry, _margin_account_registry)

Binding for initialize on the SystemViewer contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.SystemViewer.mae_by_collateral_asset

mae_by_collateral_asset(collateral_asset, accounts)

Binding for maeByCollateralAsset on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.mae_by_collateral_assets

mae_by_collateral_assets(collateral_assets, accounts)

Binding for maeByCollateralAssets on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.mae_checks_by_collateral_asset

mae_checks_by_collateral_asset(collateral_asset, accounts, settlements)

Binding for maeChecksByCollateralAsset on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.margin_account_registry

margin_account_registry()

Binding for marginAccountRegistry on the SystemViewer contract.

Returns:

afp.bindings.SystemViewer.owner

owner()

Binding for owner on the SystemViewer contract.

Returns:

afp.bindings.SystemViewer.positions_by_collateral_asset

positions_by_collateral_asset(collateral_asset, accounts)

Binding for positionsByCollateralAsset on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.positions_by_collateral_assets

positions_by_collateral_assets(collateral_assets, accounts)

Binding for positionsByCollateralAssets on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.product_details

product_details(product_ids)

Binding for productDetails on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.product_registry

product_registry()

Binding for productRegistry on the SystemViewer contract.

Returns:

afp.bindings.SystemViewer.product_states

product_states(product_ids)

Binding for productStates on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.proxiable_uuid

proxiable_uuid()

Binding for proxiableUUID on the SystemViewer contract.

Returns:

afp.bindings.SystemViewer.renounce_ownership

renounce_ownership()

Binding for renounceOwnership on the SystemViewer contract.

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.SystemViewer.transfer_ownership

transfer_ownership(new_owner)

Binding for transferOwnership on the SystemViewer contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.SystemViewer.upgrade_interface_version

upgrade_interface_version()

Binding for UPGRADE_INTERFACE_VERSION on the SystemViewer contract.

Returns:

afp.bindings.SystemViewer.upgrade_to_and_call

upgrade_to_and_call(new_implementation, data)

Binding for upgradeToAndCall on the SystemViewer contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.SystemViewer.user_margin_data_by_collateral_asset

user_margin_data_by_collateral_asset(collateral_asset, accounts)

Binding for userMarginDataByCollateralAsset on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.user_margin_data_by_collateral_assets

user_margin_data_by_collateral_assets(collateral_assets, accounts)

Binding for userMarginDataByCollateralAssets on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.SystemViewer.valuations

valuations(product_ids)

Binding for valuations on the SystemViewer contract.

Parameters:

Returns:

afp.bindings.Trade

Trade(product_id, protocol_id, trade_id, price, timestamp, accounts, quantities, fee_rates, intents)

Port of struct Trade on the IClearing contract.

Attributes:

afp.bindings.Trade.accounts

accounts: typing.List[eth_typing.ChecksumAddress]

afp.bindings.Trade.fee_rates

fee_rates: typing.List[int]

afp.bindings.Trade.intents

intents: typing.List[Intent]

afp.bindings.Trade.price

price: int

afp.bindings.Trade.product_id

product_id: hexbytes.HexBytes

afp.bindings.Trade.protocol_id

protocol_id: eth_typing.ChecksumAddress

afp.bindings.Trade.quantities

quantities: typing.List[int]

afp.bindings.Trade.timestamp

timestamp: int

afp.bindings.Trade.trade_id

trade_id: int

afp.bindings.TradingProtocol

TradingProtocol(w3, address)

TradingProtocol contract binding.

Parameters:

  • w3 (Web3) –
  • address (ChecksumAddress) – The address of a deployed TradingProtocol contract.

Functions:

  • add_trade_submitter – Binding for addTradeSubmitter on the TradingProtocol contract.
  • change_owner – Binding for changeOwner on the TradingProtocol contract.
  • default_admin_role – Binding for DEFAULT_ADMIN_ROLE on the TradingProtocol contract.
  • deposit – Binding for deposit on the TradingProtocol contract.
  • execute – Binding for execute on the TradingProtocol contract.
  • execute_sequence – Binding for executeSequence on the TradingProtocol contract.
  • get_role_admin – Binding for getRoleAdmin on the TradingProtocol contract.
  • get_role_member – Binding for getRoleMember on the TradingProtocol contract.
  • get_role_member_count – Binding for getRoleMemberCount on the TradingProtocol contract.
  • get_role_members – Binding for getRoleMembers on the TradingProtocol contract.
  • grant_role – Binding for grantRole on the TradingProtocol contract.
  • has_role – Binding for hasRole on the TradingProtocol contract.
  • initialize – Binding for initialize on the TradingProtocol contract.
  • proxiable_uuid – Binding for proxiableUUID on the TradingProtocol contract.
  • remove_trade_submitter – Binding for removeTradeSubmitter on the TradingProtocol contract.
  • renounce_role – Binding for renounceRole on the TradingProtocol contract.
  • revoke_role – Binding for revokeRole on the TradingProtocol contract.
  • supports_interface – Binding for supportsInterface on the TradingProtocol contract.
  • trade_submitter_role – Binding for TRADE_SUBMITTER_ROLE on the TradingProtocol contract.
  • upgrade_interface_version – Binding for UPGRADE_INTERFACE_VERSION on the TradingProtocol contract.
  • upgrade_to_and_call – Binding for upgradeToAndCall on the TradingProtocol contract.
  • withdraw – Binding for withdraw on the TradingProtocol contract.

Attributes:

afp.bindings.TradingProtocol.Initialized

Initialized: contract.ContractEvent

Binding for event Initialized on the TradingProtocol contract.

afp.bindings.TradingProtocol.RoleAdminChanged

RoleAdminChanged: contract.ContractEvent

Binding for event RoleAdminChanged on the TradingProtocol contract.

afp.bindings.TradingProtocol.RoleGranted

RoleGranted: contract.ContractEvent

Binding for event RoleGranted on the TradingProtocol contract.

afp.bindings.TradingProtocol.RoleRevoked

RoleRevoked: contract.ContractEvent

Binding for event RoleRevoked on the TradingProtocol contract.

afp.bindings.TradingProtocol.SequenceExecuted

SequenceExecuted: contract.ContractEvent

Binding for event SequenceExecuted on the TradingProtocol contract.

afp.bindings.TradingProtocol.Upgraded

Upgraded: contract.ContractEvent

Binding for event Upgraded on the TradingProtocol contract.

afp.bindings.TradingProtocol.add_trade_submitter

add_trade_submitter(submitter)

Binding for addTradeSubmitter on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.change_owner

change_owner(new_owner)

Binding for changeOwner on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.default_admin_role

default_admin_role()

Binding for DEFAULT_ADMIN_ROLE on the TradingProtocol contract.

Returns:

afp.bindings.TradingProtocol.deposit

deposit(margin_account_contract, amount)

Binding for deposit on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.execute

execute(trade, fallback_on_failure)

Binding for execute on the TradingProtocol contract.

Parameters:

  • trade (Trade) –
  • fallback_on_failure (bool) –

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.execute_sequence

execute_sequence(trades, fallback_on_failure)

Binding for executeSequence on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.get_role_admin

get_role_admin(role)

Binding for getRoleAdmin on the TradingProtocol contract.

Parameters:

Returns:

afp.bindings.TradingProtocol.get_role_member

get_role_member(role, index)

Binding for getRoleMember on the TradingProtocol contract.

Parameters:

Returns:

afp.bindings.TradingProtocol.get_role_member_count

get_role_member_count(role)

Binding for getRoleMemberCount on the TradingProtocol contract.

Parameters:

Returns:

afp.bindings.TradingProtocol.get_role_members

get_role_members(role)

Binding for getRoleMembers on the TradingProtocol contract.

Parameters:

Returns:

afp.bindings.TradingProtocol.grant_role

grant_role(role, account)

Binding for grantRole on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.has_role

has_role(role, account)

Binding for hasRole on the TradingProtocol contract.

Parameters:

Returns:

afp.bindings.TradingProtocol.initialize

initialize(clearing_address)

Binding for initialize on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.proxiable_uuid

proxiable_uuid()

Binding for proxiableUUID on the TradingProtocol contract.

Returns:

afp.bindings.TradingProtocol.remove_trade_submitter

remove_trade_submitter(submitter)

Binding for removeTradeSubmitter on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.renounce_role

renounce_role(role, caller_confirmation)

Binding for renounceRole on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.revoke_role

revoke_role(role, account)

Binding for revokeRole on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.supports_interface

supports_interface(interface_id)

Binding for supportsInterface on the TradingProtocol contract.

Parameters:

Returns:

afp.bindings.TradingProtocol.trade_submitter_role

trade_submitter_role()

Binding for TRADE_SUBMITTER_ROLE on the TradingProtocol contract.

Returns:

afp.bindings.TradingProtocol.upgrade_interface_version

upgrade_interface_version()

Binding for UPGRADE_INTERFACE_VERSION on the TradingProtocol contract.

Returns:

afp.bindings.TradingProtocol.upgrade_to_and_call

upgrade_to_and_call(new_implementation, data)

Binding for upgradeToAndCall on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.TradingProtocol.withdraw

withdraw(margin_account_contract, amount)

Binding for withdraw on the TradingProtocol contract.

Parameters:

Returns:

  • ContractFunction – A contract function instance to be sent in a transaction.

afp.bindings.UserMarginAccountData

UserMarginAccountData(collateral_asset, margin_account_id, mae, mmu, positions)

Port of struct UserMarginAccountData on the ISystemViewer contract.

Attributes:

afp.bindings.UserMarginAccountData.collateral_asset

collateral_asset: eth_typing.ChecksumAddress

afp.bindings.UserMarginAccountData.mae

mae: int

afp.bindings.UserMarginAccountData.margin_account_id

margin_account_id: eth_typing.ChecksumAddress

afp.bindings.UserMarginAccountData.mmu

mmu: int

afp.bindings.UserMarginAccountData.positions

positions: typing.List[PositionData]