pub fn register_position(
    ctx: Context<'_, '_, '_, '_, RegisterPosition<'_>>
) -> Result<()>
Expand description

Register a position for deposits of tokens returned by adapter programs (e.g. margin-pool).

This will create a token account to hold the adapter provided tokens which represent a user’s deposit with that adapter.

This instruction may fail if the account has reached it’s maximum number of positions.

Accounts

NameTypeDescription
authoritysignerThe authority that can change the margin account.
payersignerThe address paying for rent.
margin_accountwritableThe margin account to register position type with.
position_token_mintread_onlyThe mint for the position token being registered.
metadataread_onlyThe metadata account that references the correct oracle for the token.
token_accountwritableThe token account to store hold the position assets in the custody of the margin account.
token_programread_onlyThe spl token program.
rentread_onlyThe rent sysvar. The rent to open the account.
system_programread_onlyThe system native program.

Events

Event NameDescription
events::PositionRegisteredMarks the registration of the position.