Functions
constructor
Paramaters
swap
Paramaters
RouteParam
@notice RouteParam is a struct that contains the parameters needed to execute a swap
SwapParams
@notice SwapParams is a struct that contains the parameters needed to execute a swap
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Starknet Smart Contracts
#[constructor]
fn constructor(ref self: ContractState, _owner: ContractAddress)
| name | type | Description |
|---|---|---|
| _owner | ContractAddress | The owner of the router contract |
#[external(v0)]
fn swap(ref self: ContractState, route: RouteParam, swap_parameters: Array<SwapParams>)
@notice RouteParam is a struct that contains the parameters needed to execute a swap
| name | type | description |
|---|---|---|
| token_in | ContractAddress | contract address of token to sell |
| token_out | ContractAddress | contract address of token to buy |
| amount_in | u256 | amount of token to sell |
| min_received | u256 | minimum received amount of user get |
| destination | ContractAddress | The receiver address for the output token |
@notice SwapParams is a struct that contains the parameters needed to execute a swap
| name | type | description |
|---|---|---|
| token_in | ContractAddress | contract address of token to sell |
| token_out | ContractAddress | contract address of token to buy |
| rate | u32 | rate * 10**4 gives 4 precision points |
| protocol_id | u32 | procotol id |
| extra_data | Array(felt252) | extra data fro route |
#[derive(Drop, starknet::Event)]
struct Swap {
sender: ContractAddress,
token_in: ContractAddress,
token_out: ContractAddress,
amount_in: u256,
amount_out: u256,
to: ContractAddress
}
| name | type | description |
|---|---|---|
| sender | ContractAddress | address that execute the swap |
| token_in | ContractAddress | contract address of token to sold |
| token_out | ContractAddress | contract address of token to bought |
| amount_in | u256 | amount of token to sold |
| amount_out | u256 | amount of token to bought |
| to | ContractAddress | The receiver address for the output token |