lez-programs/artifacts/twap_oracle-idl.json
r4bbit c9fbb626ea refactor(twap_oracle): match instruction function order to Instruction enum
`idl-gen` emits IDL instructions in source order, and `spel` uses each
instruction's IDL position as its serde variant index. When the
`#[instruction]` function order diverges from the `twap_oracle_core::Instruction`
enum order, spel addresses the wrong instruction.

Move `update_current_tick` ahead of the TWAP-computation instruction so the
function order in twap_oracle.rs lines up with the enum variant order, and
regenerate artifacts/twap_oracle-idl.json to match.

No behavioral change — the instruction bodies are unchanged, only reordered.
2026-06-30 15:13:47 +02:00

310 lines
6.1 KiB
JSON

{
"version": "0.1.0",
"name": "twap_oracle",
"instructions": [
{
"name": "create_price_observations",
"accounts": [
{
"name": "price_observations",
"writable": true,
"signer": false,
"init": true
},
{
"name": "price_source",
"writable": false,
"signer": true,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": [
{
"name": "initial_tick",
"type": "i32"
},
{
"name": "window_duration",
"type": "u64"
}
]
},
{
"name": "create_oracle_price_account",
"accounts": [
{
"name": "oracle_price_account",
"writable": true,
"signer": false,
"init": true
},
{
"name": "price_source",
"writable": false,
"signer": true,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": [
{
"name": "base_asset",
"type": "account_id"
},
{
"name": "quote_asset",
"type": "account_id"
},
{
"name": "initial_price",
"type": "u128"
},
{
"name": "window_duration",
"type": "u64"
}
]
},
{
"name": "create_current_tick_account",
"accounts": [
{
"name": "current_tick_account",
"writable": true,
"signer": false,
"init": true
},
{
"name": "price_source",
"writable": false,
"signer": true,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": [
{
"name": "initial_price",
"type": "u128"
}
]
},
{
"name": "update_current_tick",
"accounts": [
{
"name": "current_tick_account",
"writable": true,
"signer": false,
"init": false
},
{
"name": "price_source",
"writable": false,
"signer": true,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": [
{
"name": "price",
"type": "u128"
}
]
},
{
"name": "publish_price",
"accounts": [
{
"name": "price_observations",
"writable": false,
"signer": false,
"init": false
},
{
"name": "oracle_price_account",
"writable": true,
"signer": false,
"init": false
},
{
"name": "current_tick_account",
"writable": false,
"signer": false,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": [
{
"name": "price_source_id",
"type": "account_id"
},
{
"name": "window_duration",
"type": "u64"
}
]
},
{
"name": "record_tick",
"accounts": [
{
"name": "price_observations",
"writable": true,
"signer": false,
"init": false
},
{
"name": "current_tick_account",
"writable": false,
"signer": false,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": [
{
"name": "price_source_id",
"type": "account_id"
},
{
"name": "window_duration",
"type": "u64"
}
]
}
],
"accounts": [
{
"name": "PriceObservations",
"type": {
"kind": "struct",
"fields": [
{
"name": "price_source_id",
"type": "account_id"
},
{
"name": "write_index",
"type": "u32"
},
{
"name": "total_entries",
"type": "u64"
},
{
"name": "last_recorded_tick",
"type": "i32"
},
{
"name": "entries",
"type": {
"vec": {
"defined": "ObservationEntry"
}
}
}
]
}
},
{
"name": "OraclePriceAccount",
"type": {
"kind": "struct",
"fields": [
{
"name": "base_asset",
"type": "account_id"
},
{
"name": "quote_asset",
"type": "account_id"
},
{
"name": "price",
"type": "u128"
},
{
"name": "timestamp",
"type": "u64"
},
{
"name": "source_id",
"type": "account_id"
},
{
"name": "confidence_interval",
"type": "u128"
}
]
}
},
{
"name": "CurrentTickAccount",
"type": {
"kind": "struct",
"fields": [
{
"name": "tick",
"type": "i32"
},
{
"name": "last_updated",
"type": "u64"
}
]
}
}
],
"types": [
{
"name": "ObservationEntry",
"kind": "struct",
"fields": [
{
"name": "timestamp",
"type": "u64"
},
{
"name": "tick_cumulative",
"type": "i64"
}
]
}
],
"instruction_type": "twap_oracle_core::Instruction"
}