Enable exponent update (#750)

This commit is contained in:
guibescos 2023-04-06 13:34:55 -05:00 committed by GitHub
parent 4502c6dcf9
commit 3842c9460b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -391,6 +391,23 @@ const General = () => {
.instruction()
)
}
if (
JSON.stringify(prev.priceAccounts[0].expo) !==
JSON.stringify(newChanges.priceAccounts[0].expo)
) {
// create update exponent instruction
instructions.push(
await pythProgramClient.methods
.initPrice(newChanges.priceAccounts[0].expo, 1)
.accounts({
fundingAccount,
priceAccount: new PublicKey(prev.priceAccounts[0].address),
})
.instruction()
)
}
// check if minPub has changed
if (
prev.priceAccounts[0].minPub !== newChanges.priceAccounts[0].minPub