Skip to content

Commit df46323

Browse files
committed
fix: reuse contracts for proxies
1 parent 92acaff commit df46323

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sdk/market/pricefeeds/PriceFeedsRegister.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ export class PriceFeedRegister
372372
}
373373

374374
#createUpdatableProxy(data: PartialPriceFeedTreeNode): IPriceFeedContract {
375-
return new Proxy(this.create(data), {
375+
// read, but do not write to feeds map
376+
const contract = this.#feeds.get(data.baseParams.addr) ?? this.create(data);
377+
return new Proxy(contract, {
376378
get(target, prop) {
377379
// when using this proxy, we will already have all the updatable dependencies, as returned from contracts
378380
// so this protects price feed instances from throwing errors due to being partially initialized

0 commit comments

Comments
 (0)