Skip to content

Implement generate_debt #91

@0x-r4bbit

Description

@0x-r4bbit

generate_debt(amount) in stablecoin/src/:

  • Assert the position account is already initialized
  • Accrue any outstanding stability fees on the position first
  • Check that minting amount stablecoins keeps the collateralization ratio above the minimum (requires price feed and redemption price)
  • Issue a chained Mint call to the token program to mint amount stablecoins to the user's stablecoin holding account
  • Increase Position.debt_amount, initialize the per-position stability fee accumulator index

Also extend open_position with an optional debt_amount parameter: if non-zero, run the same collateralization check and mint after depositing collateral.

Depends on: feedback controller / redemption price, stability fees and price feed

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions