Function jet_margin::jet_margin::adapter_invoke
source · [−]pub fn adapter_invoke<'info>(
ctx: Context<'_, '_, '_, 'info, AdapterInvoke<'info>>,
data: Vec<u8>
) -> Result<()>
Expand description
Perform an action by invoking other programs, allowing them to alter the balances of the token accounts belonging to this margin account.
This provides the margin account as a signer to any invoked instruction, and therefore grants the adapter authority over any tokens held by the margin account.
This validates the invoked program by expecting an adapter_metadata
account,
which must exist for the instruction to be considered valid. The configuration
for allowing adapter programs is controlled by protocol governance.
All extra accounts passed in are used as the input accounts when invoking the provided adapter porgram.
Parameters
data
- The instruction data to pass to the adapter program
Accounts
Name | Type | Description |
owner | signer | The authority that owns the margin account. |
margin_account | writable | The margin account to proxy an action for. |
adapter_program | read_only | The program to be invoked. |
adapter_metadata | read_only | The metadata about the proxy program. |
Events
Event Name | Description |
events::AdapterInvokeBegin | Marks the start of the adapter invocation (includes the margin account pubkey and the adapter program pubkey). |
events::PositionEvent (Note that each single event represents a different adapter position) | The PositionEvent marks the change in position. |
events::AdapterInvokeEnd | Marks the ending of the adapter invocation (includes no data except for the event itself being emitted). |