Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Credix] Minting/Redeeming/CollectProfit IXs #152

Merged
merged 24 commits into from
Jan 3, 2023

Conversation

crypto-vincent
Copy link

@crypto-vincent crypto-vincent commented Dec 12, 2022

Abstract

This PR adds integration with the onchain credix smart contract by minting UXD when depositing collateral in credix and burning UXD when withdrawing collateral from credix

New instructions set:

  • register_credix_lp_depository

    • init all necessary accounts
    • store important accounts address
    • init accounting storage
  • mint_with_credix_lp_depository

    • take user's USDC and put it in the credix LP
    • mint UXD and give it to user in exchange
  • redeem_from_credix_lp_depository

    • take user's UXD and burn it
    • withdraw USDC from credix LP and give it to user in exchange
  • collect_profit_of_credix_lp_depository

    • see if the credix LP owned assets surpass outstanding UXD liabilities
    • if yes, withdraw profits into UXD's authority collateral account
  • edit_credix_lp_depository

    • set and change configuration flags and accounting caps

PR Combo:

Generated transactions:

@crypto-vincent crypto-vincent self-assigned this Dec 12, 2022
@vercel
Copy link

vercel bot commented Dec 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
governance-ui ✅ Ready (Inspect) Visit Preview Jan 2, 2023 at 3:30AM (UTC)

@crypto-vincent crypto-vincent changed the title [InProgress] Credix Integration [Credix] Minting/Redeeming/CollectProfit IXs Dec 12, 2022
Copy link

@Orelsanpls Orelsanpls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance, look like it could work. To be tested on devnet.

Few nit, but we don't really mind as we are going to drop this repo soon enough

.min(0, 'Redeemable amount under management cap should be min 0'),
});

const RegisterCredixLpDepository = ({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name should be EditCredixLpDepository

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaned up 👌

}
error={formErrors['collateralName']}
>
<SelectOptionList list={getDepositoryMintSymbols(connection.cluster)} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credix is only USDC for now and most likely also in the future, you could simplify all form by removing Collateral selection

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed, I was thinking about this too, but devnet has a special collateral that is different from mercurial, i was unsure what to do as I didnt want to hardcode too much things

@crypto-vincent
Copy link
Author

crypto-vincent commented Dec 13, 2022

Was able to generate transactions proposals that looks good!

Copy link

@Orelsanpls Orelsanpls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crypto-vincent crypto-vincent merged commit 2d1ca22 into main Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants