AssetDelta

Documentation for eth_defi.tx.AssetDelta Python class.

class AssetDelta[source]

Spend/incoming asset information.

Some transaction builders, like Enzyme vaults, need to have the incoming/outgoing asset information associated with the transaction. This is because internally Enzyme needs to move assets to the adapter contract from the vault contract to perform the transaction.

We use this data structure to describe what assets the transaction touches.

See eth_defi.enzyme.vault_transaction_builder for more information.

Attributes summary

asset

The ERC-20 token for this delta.

raw_amount

Changed amount.

Methods summary

__init__(asset, raw_amount)

as_json_friendly_dict()

Get the asset delta representation as JSON'nable dict.

is_incoming()

This delta describes incoming assets.

is_spending()

This delta describes assets that we spend in the transaction.

asset: Union[eth_typing.evm.HexAddress, str]

The ERC-20 token for this delta.

raw_amount: int

Changed amount.

Negative for tokens that are going to be used for purchases in this tx, positive for incoming.

Much include any slippage tolerance for trades.

is_incoming()[source]

This delta describes incoming assets.

Return type

bool

is_spending()[source]

This delta describes assets that we spend in the transaction.

Return type

bool

as_json_friendly_dict()[source]

Get the asset delta representation as JSON’nable dict.

We need to convert large Python ints to strings.

__init__(asset, raw_amount)
Parameters
  • asset (Union[eth_typing.evm.HexAddress, str]) –

  • raw_amount (int) –

Return type

None