Structuring States & Intents
In BalloonDogs’ SDK, an Intent defines how an asset or position changes across different blockchains. Intents are built from two main components: the From state (the current condition of the asset) and the To state (the desired condition after the transaction).
State Definition
A State represents the position of an asset and is categorized into types.
Parameters:
Each State object includes key parameters such as:
address: The contract address associated with the asset, loan, or staking protocol (e.g., Aave, Lido)
asset: The token address associated with the transaction
amount: The number of tokens or assets involved. It can be optional depending on the context (e.g., staking)
chainId: The ID of the blockchain network where the asset resides (e.g., Ethereum, BNB Chain)
Examples
Declaring an Asset
Declaring a Loan
Declaring a Stake
Defining an Intent
An Intent defines a transaction or operation that transforms a From state into a To state.
1. From (Source State)
The From section defines the specific portion of the user’s current assets or position that will be used in the intent. This allocation can include a variety of DeFi positions, such as swapping a portion of tokens, unstaking a part of an asset, or moving some NFTs.
This is an example for declaring a From of type "Token":
2. To (Desired State)
The To state specifies the desired outcome after executing the intent.
For example, you can declare the token you want to hold at the end of the execution or specify where you want your assets to be deposited or staked.
In this example, 500 USDT is moved from the BNB Chain to be staked on Ethereum via Lido.
Last updated