Fix store saving/loading procedure (#1244)
yaml file names were based on contract types but they were using the old format entropy contracts were not serialized
This commit is contained in:
parent
6917c84b0e
commit
17ea0c19e0
|
@ -13,7 +13,7 @@ import {
|
|||
EvmPriceFeedContract,
|
||||
SuiPriceFeedContract,
|
||||
} from "./contracts";
|
||||
import { PriceFeedContract } from "./base";
|
||||
import { PriceFeedContract, Storable } from "./base";
|
||||
import { parse, stringify } from "yaml";
|
||||
import { readdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
||||
import { Vault } from "./governance";
|
||||
|
@ -30,7 +30,7 @@ export class Store {
|
|||
this.loadAllVaults();
|
||||
}
|
||||
|
||||
static serialize(obj: PriceFeedContract | Chain | Vault) {
|
||||
static serialize(obj: Storable) {
|
||||
return stringify([obj.toJson()]);
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,10 @@ export class Store {
|
|||
}
|
||||
|
||||
saveAllContracts() {
|
||||
const contractsByType: Record<string, PriceFeedContract[]> = {};
|
||||
for (const contract of Object.values(this.contracts)) {
|
||||
const contractsByType: Record<string, Storable[]> = {};
|
||||
const contracts: Storable[] = Object.values(this.contracts);
|
||||
contracts.push(...Object.values(this.entropy_contracts));
|
||||
for (const contract of contracts) {
|
||||
if (!contractsByType[contract.getType()]) {
|
||||
contractsByType[contract.getType()] = [];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
- chain: base_goerli
|
||||
address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
|
||||
type: EvmPriceFeedContract
|
|
@ -250,6 +250,3 @@
|
|||
- chain: filecoin
|
||||
address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
|
||||
type: EvmPriceFeedContract
|
||||
- chain: base_goerli
|
||||
address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
|
||||
type: EvmEntropyContract
|
Loading…
Reference in New Issue