fix(stablecoin): annotate stablecoin instruction accounts

This commit is contained in:
Ricardo Guilherme Schmidt 2026-06-29 13:56:04 -03:00
parent 621889e52c
commit e247365f30
No known key found for this signature in database
GPG Key ID: 1396EA17DE132FFE
2 changed files with 35 additions and 20 deletions

View File

@ -8,38 +8,38 @@
{ {
"name": "admin", "name": "admin",
"writable": false, "writable": false,
"signer": false, "signer": true,
"init": false "init": false
}, },
{ {
"name": "protocol_parameters", "name": "protocol_parameters",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": true
}, },
{ {
"name": "stability_fee_accumulator", "name": "stability_fee_accumulator",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": true
}, },
{ {
"name": "redemption_price_state", "name": "redemption_price_state",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": true
}, },
{ {
"name": "stablecoin_definition", "name": "stablecoin_definition",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": true
}, },
{ {
"name": "stablecoin_master_holding", "name": "stablecoin_master_holding",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": true
}, },
{ {
"name": "collateral_definition", "name": "collateral_definition",
@ -105,7 +105,7 @@
{ {
"name": "caller", "name": "caller",
"writable": false, "writable": false,
"signer": false, "signer": true,
"init": false "init": false
}, },
{ {
@ -116,7 +116,7 @@
}, },
{ {
"name": "stability_fee_accumulator", "name": "stability_fee_accumulator",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": false
}, },
@ -135,18 +135,18 @@
{ {
"name": "admin", "name": "admin",
"writable": false, "writable": false,
"signer": false, "signer": true,
"init": false "init": false
}, },
{ {
"name": "protocol_parameters", "name": "protocol_parameters",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": false
}, },
{ {
"name": "stability_fee_accumulator", "name": "stability_fee_accumulator",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": false
}, },
@ -227,24 +227,24 @@
{ {
"name": "owner", "name": "owner",
"writable": false, "writable": false,
"signer": false, "signer": true,
"init": false "init": false
}, },
{ {
"name": "position", "name": "position",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": false
}, },
{ {
"name": "stablecoin_definition", "name": "stablecoin_definition",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": false
}, },
{ {
"name": "user_stablecoin_holding", "name": "user_stablecoin_holding",
"writable": false, "writable": true,
"signer": false, "signer": false,
"init": false "init": false
}, },

View File

@ -20,11 +20,17 @@ mod stablecoin {
#[instruction] #[instruction]
pub fn initialize_program( pub fn initialize_program(
ctx: ProgramContext, ctx: ProgramContext,
#[account(signer)]
admin: AccountWithMetadata, admin: AccountWithMetadata,
#[account(init)]
protocol_parameters: AccountWithMetadata, protocol_parameters: AccountWithMetadata,
#[account(init)]
stability_fee_accumulator: AccountWithMetadata, stability_fee_accumulator: AccountWithMetadata,
#[account(init)]
redemption_price_state: AccountWithMetadata, redemption_price_state: AccountWithMetadata,
#[account(init)]
stablecoin_definition: AccountWithMetadata, stablecoin_definition: AccountWithMetadata,
#[account(init)]
stablecoin_master_holding: AccountWithMetadata, stablecoin_master_holding: AccountWithMetadata,
collateral_definition: AccountWithMetadata, collateral_definition: AccountWithMetadata,
market_price_oracle: AccountWithMetadata, market_price_oracle: AccountWithMetadata,
@ -70,8 +76,10 @@ mod stablecoin {
#[instruction] #[instruction]
pub fn accrue_stability_fee( pub fn accrue_stability_fee(
ctx: ProgramContext, ctx: ProgramContext,
#[account(signer)]
caller: AccountWithMetadata, caller: AccountWithMetadata,
protocol_parameters: AccountWithMetadata, protocol_parameters: AccountWithMetadata,
#[account(mut)]
stability_fee_accumulator: AccountWithMetadata, stability_fee_accumulator: AccountWithMetadata,
clock: AccountWithMetadata, clock: AccountWithMetadata,
) -> SpelResult { ) -> SpelResult {
@ -93,8 +101,11 @@ mod stablecoin {
#[instruction] #[instruction]
pub fn set_stability_fee_per_millisecond( pub fn set_stability_fee_per_millisecond(
ctx: ProgramContext, ctx: ProgramContext,
#[account(signer)]
admin: AccountWithMetadata, admin: AccountWithMetadata,
#[account(mut)]
protocol_parameters: AccountWithMetadata, protocol_parameters: AccountWithMetadata,
#[account(mut)]
stability_fee_accumulator: AccountWithMetadata, stability_fee_accumulator: AccountWithMetadata,
clock: AccountWithMetadata, clock: AccountWithMetadata,
new_rate: u128, new_rate: u128,
@ -162,9 +173,13 @@ mod stablecoin {
#[instruction] #[instruction]
pub fn generate_debt( pub fn generate_debt(
ctx: ProgramContext, ctx: ProgramContext,
#[account(signer)]
owner: AccountWithMetadata, owner: AccountWithMetadata,
#[account(mut)]
position: AccountWithMetadata, position: AccountWithMetadata,
#[account(mut)]
stablecoin_definition: AccountWithMetadata, stablecoin_definition: AccountWithMetadata,
#[account(mut)]
user_stablecoin_holding: AccountWithMetadata, user_stablecoin_holding: AccountWithMetadata,
stability_fee_accumulator: AccountWithMetadata, stability_fee_accumulator: AccountWithMetadata,
redemption_price_state: AccountWithMetadata, redemption_price_state: AccountWithMetadata,