Skip to content

Commit

Permalink
Update: pyth lazer stable coin
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKhalili committed Feb 7, 2025
1 parent 00800b8 commit 1f63f7d
Show file tree
Hide file tree
Showing 4 changed files with 317 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/driftpy/accounts/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ async def get_oracle_price_data_and_slot(
elif is_variant(oracle_source, "PythLazer1M"):
oracle_price_data = decode_pyth_lazer_price_info(oracle_raw)
data_and_slot = DataAndSlot(data=oracle_price_data, slot=slot)
elif is_variant(oracle_source, "PythLazerStableCoin"):
oracle_price_data = decode_pyth_lazer_price_info(oracle_raw)
data_and_slot = DataAndSlot(data=oracle_price_data, slot=slot)

if data_and_slot:
return data_and_slot
Expand Down
301 changes: 298 additions & 3 deletions src/driftpy/idl/drift.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.107.0",
"version": "2.109.0",
"name": "drift",
"instructions": [
{
Expand Down Expand Up @@ -188,6 +188,89 @@
}
]
},
{
"name": "initializeFuelOverflow",
"accounts": [
{
"name": "fuelOverflow",
"isMut": true,
"isSigner": false
},
{
"name": "userStats",
"isMut": true,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": false
},
{
"name": "payer",
"isMut": true,
"isSigner": true
},
{
"name": "rent",
"isMut": false,
"isSigner": false
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false
}
],
"args": []
},
{
"name": "sweepFuel",
"accounts": [
{
"name": "fuelOverflow",
"isMut": true,
"isSigner": false
},
{
"name": "userStats",
"isMut": true,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": false
}
],
"args": []
},
{
"name": "resetFuelSeason",
"accounts": [
{
"name": "userStats",
"isMut": true,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": false
},
{
"name": "state",
"isMut": false,
"isSigner": false
},
{
"name": "admin",
"isMut": false,
"isSigner": true
}
],
"args": []
},
{
"name": "initializeReferrerName",
"accounts": [
Expand Down Expand Up @@ -8405,9 +8488,14 @@
{
"name": "padding1",
"type": {
"array": ["u8", 2]
"array": ["u8", 1]
}
},
{
"name": "fuelOverflowStatus",
"docs": ["whether the user has a FuelOverflow account"],
"type": "u8"
},
{
"name": "fuelInsurance",
"docs": ["accumulated fuel for token amounts of insurance"],
Expand Down Expand Up @@ -8486,6 +8574,57 @@
}
]
}
},
{
"name": "FuelOverflow",
"type": {
"kind": "struct",
"fields": [
{
"name": "authority",
"docs": ["The authority of this overflow account"],
"type": "publicKey"
},
{
"name": "fuelInsurance",
"type": "u128"
},
{
"name": "fuelDeposits",
"type": "u128"
},
{
"name": "fuelBorrows",
"type": "u128"
},
{
"name": "fuelPositions",
"type": "u128"
},
{
"name": "fuelTaker",
"type": "u128"
},
{
"name": "fuelMaker",
"type": "u128"
},
{
"name": "lastFuelSweepTs",
"type": "u32"
},
{
"name": "lastResetTs",
"type": "u32"
},
{
"name": "padding",
"type": {
"array": ["u128", 6]
}
}
]
}
}
],
"types": [
Expand Down Expand Up @@ -10535,10 +10674,17 @@
"docs": ["How many slots the auction lasts"],
"type": "u8"
},
{
"name": "postedSlotTail",
"docs": [
"Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
],
"type": "u8"
},
{
"name": "padding",
"type": {
"array": ["u8", 3]
"array": ["u8", 2]
}
}
]
Expand Down Expand Up @@ -11106,6 +11252,9 @@
},
{
"name": "PythLazer1M"
},
{
"name": "PythLazerStableCoin"
}
]
}
Expand Down Expand Up @@ -11581,6 +11730,17 @@
]
}
},
{
"name": "FuelOverflowStatus",
"type": {
"kind": "enum",
"variants": [
{
"name": "Exists"
}
]
}
},
{
"name": "SignatureVerificationError",
"type": {
Expand Down Expand Up @@ -12732,6 +12892,131 @@
"index": false
}
]
},
{
"name": "FuelSweepRecord",
"fields": [
{
"name": "ts",
"type": "i64",
"index": false
},
{
"name": "authority",
"type": "publicKey",
"index": false
},
{
"name": "userStatsFuelInsurance",
"type": "u32",
"index": false
},
{
"name": "userStatsFuelDeposits",
"type": "u32",
"index": false
},
{
"name": "userStatsFuelBorrows",
"type": "u32",
"index": false
},
{
"name": "userStatsFuelPositions",
"type": "u32",
"index": false
},
{
"name": "userStatsFuelTaker",
"type": "u32",
"index": false
},
{
"name": "userStatsFuelMaker",
"type": "u32",
"index": false
},
{
"name": "fuelOverflowFuelInsurance",
"type": "u128",
"index": false
},
{
"name": "fuelOverflowFuelDeposits",
"type": "u128",
"index": false
},
{
"name": "fuelOverflowFuelBorrows",
"type": "u128",
"index": false
},
{
"name": "fuelOverflowFuelPositions",
"type": "u128",
"index": false
},
{
"name": "fuelOverflowFuelTaker",
"type": "u128",
"index": false
},
{
"name": "fuelOverflowFuelMaker",
"type": "u128",
"index": false
}
]
},
{
"name": "FuelSeasonRecord",
"fields": [
{
"name": "ts",
"type": "i64",
"index": false
},
{
"name": "authority",
"type": "publicKey",
"index": false
},
{
"name": "fuelInsurance",
"type": "u128",
"index": false
},
{
"name": "fuelDeposits",
"type": "u128",
"index": false
},
{
"name": "fuelBorrows",
"type": "u128",
"index": false
},
{
"name": "fuelPositions",
"type": "u128",
"index": false
},
{
"name": "fuelTaker",
"type": "u128",
"index": false
},
{
"name": "fuelMaker",
"type": "u128",
"index": false
},
{
"name": "fuelTotal",
"type": "u128",
"index": false
}
]
}
],
"errors": [
Expand Down Expand Up @@ -14284,6 +14569,16 @@
"code": 6309,
"name": "SwiftUserContextUserMismatch",
"msg": "User in swift message does not match user in ix context"
},
{
"code": 6310,
"name": "UserFuelOverflowThresholdNotMet",
"msg": "User fuel overflow threshold not met"
},
{
"code": 6311,
"name": "FuelOverflowAccountNotFound",
"msg": "FuelOverflow account not found"
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 1f63f7d

Please sign in to comment.