diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx
index 25ef7c09..2f885c1f 100644
--- a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx
+++ b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx
@@ -197,6 +197,13 @@ const General = () => {
changes[symbol].new = { ...fileDataParsed[symbol] }
}
})
+ // check if any existing symbols are not in uploaded json
+ Object.keys(data).forEach((symbol) => {
+ if (!fileDataParsed[symbol]) {
+ changes[symbol] = { prev: {} }
+ changes[symbol].prev = { ...data[symbol] }
+ }
+ })
setDataChanges(changes)
openModal()
}
@@ -342,6 +349,30 @@ const General = () => {
.instruction()
)
}
+ } else if (!newChanges) {
+ // if new is undefined, it means that the symbol is deleted
+ // create delete price account instruction
+ instructions.push(
+ await pythProgramClient.methods
+ .delPrice()
+ .accounts({
+ fundingAccount,
+ productAccount: new PublicKey(prev.address),
+ priceAccount: new PublicKey(prev.priceAccounts[0].address),
+ })
+ .instruction()
+ )
+ // create delete product account instruction
+ instructions.push(
+ await pythProgramClient.methods
+ .delProduct()
+ .accounts({
+ fundingAccount,
+ mappingAccount: rawConfig.mappingAccounts[0].address,
+ productAccount: new PublicKey(prev.address),
+ })
+ .instruction()
+ )
} else {
// check if metadata has changed
if (
@@ -433,14 +464,13 @@ const General = () => {
}
const MetadataChangesRows = ({ changes }: { changes: any }) => {
- const addNewPriceFeed =
- changes.prev === undefined && changes.new !== undefined
+ const addPriceFeed = changes.prev === undefined && changes.new !== undefined
return (
<>
{Object.keys(changes.new).map(
(metadataKey) =>
- (addNewPriceFeed ||
+ (addPriceFeed ||
changes.prev[metadataKey] !== changes.new[metadataKey]) && (
@@ -451,7 +481,7 @@ const General = () => {
|
- {!addNewPriceFeed ? (
+ {!addPriceFeed ? (
<>
{changes.prev[metadataKey]}
{' '}
@@ -467,14 +497,13 @@ const General = () => {
}
const PriceAccountsChangesRows = ({ changes }: { changes: any }) => {
- const addNewPriceFeed =
- changes.prev === undefined && changes.new !== undefined
+ const addPriceFeed = changes.prev === undefined && changes.new !== undefined
return (
<>
{changes.new.map((priceAccount: any, index: number) =>
Object.keys(priceAccount).map((priceAccountKey) =>
priceAccountKey === 'publishers' ? (
- addNewPriceFeed ? (
+ addPriceFeed ? (
{
)
)
) : (
- (addNewPriceFeed ||
+ (addPriceFeed ||
changes.prev[index][priceAccountKey] !==
priceAccount[priceAccountKey]) && (
@@ -505,7 +534,7 @@ const General = () => {
.join(' ')}
- {!addNewPriceFeed ? (
+ {!addPriceFeed ? (
<>
{changes.prev[index][priceAccountKey]}
@@ -523,14 +552,13 @@ const General = () => {
}
const PublisherKeysChangesRows = ({ changes }: { changes: any }) => {
- const addNewPriceFeed =
- changes.prev === undefined && changes.new !== undefined
- const publisherKeysToAdd = addNewPriceFeed
+ const addPriceFeed = changes.prev === undefined && changes.new !== undefined
+ const publisherKeysToAdd = addPriceFeed
? changes.new
: changes.new.filter(
(newPublisher: string) => !changes.prev.includes(newPublisher)
)
- const publisherKeysToRemove = addNewPriceFeed
+ const publisherKeysToRemove = addPriceFeed
? []
: changes.prev.filter(
(prevPublisher: string) => !changes.new.includes(prevPublisher)
@@ -580,6 +608,19 @@ const General = () => {
)
}
+ const OldPriceFeedsRows = ({ priceFeedData }: { priceFeedData: any }) => {
+ return (
+ <>
+ |
+ Symbol |
+
+ {priceFeedData.metadata.symbol}
+ |
+
+ >
+ )
+ }
+
const ModalContent = ({ changes }: { changes: any }) => {
return (
<>
@@ -588,14 +629,18 @@ const General = () => {
{/* compare changes.prev and changes.new and display the fields that are different */}
{Object.keys(changes).map((key) => {
const { prev, new: newChanges } = changes[key]
- const addNewPriceFeed =
+ const addPriceFeed =
prev === undefined && newChanges !== undefined
- const diff = addNewPriceFeed
- ? []
- : Object.keys(prev).filter(
- (k) =>
- JSON.stringify(prev[k]) !== JSON.stringify(newChanges[k])
- )
+ const deletePriceFeed =
+ prev !== undefined && newChanges === undefined
+ const diff =
+ addPriceFeed || deletePriceFeed
+ ? []
+ : Object.keys(prev).filter(
+ (k) =>
+ JSON.stringify(prev[k]) !==
+ JSON.stringify(newChanges[k])
+ )
return (
@@ -603,11 +648,17 @@ const General = () => {
className="base16 py-4 pl-6 pr-2 font-bold lg:pl-6"
colSpan={2}
>
- {addNewPriceFeed ? 'Add New Price Feed' : key}
+ {addPriceFeed
+ ? 'Add New Price Feed'
+ : deletePriceFeed
+ ? 'Delete Old Price Feed'
+ : key}
- {addNewPriceFeed ? (
+ {addPriceFeed ? (
+ ) : deletePriceFeed ? (
+
) : (
diff.map((k) =>
k === 'metadata' ? (
diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx
index 50e88025..524863ee 100644
--- a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx
+++ b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx
@@ -402,7 +402,7 @@ const Proposal = ({
) : proposalStatus === 'executeReady' ? (
- |