@agoric/inter-protocol 0.16.2-upgrade-14-dev-0169c7e.0 → 0.16.2-upgrade-16-dev-8879538.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +41 -34
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +84 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +135 -103
- package/src/auction/auctioneer.d.ts +83 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +63 -49
- package/src/auction/offerBook.d.ts +45 -0
- package/src/auction/offerBook.d.ts.map +1 -0
- package/src/auction/offerBook.js +13 -12
- package/src/auction/params.d.ts +149 -0
- package/src/auction/params.d.ts.map +1 -0
- package/src/auction/params.js +10 -9
- package/src/auction/scheduleMath.d.ts +5 -0
- package/src/auction/scheduleMath.d.ts.map +1 -0
- package/src/auction/scheduleMath.js +17 -15
- package/src/auction/scheduler.d.ts +49 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +51 -43
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +9 -7
- package/src/auction/util.d.ts +32 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +6 -4
- package/src/clientSupport.d.ts +167 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +97 -40
- package/src/collectFees.d.ts +2 -0
- package/src/collectFees.d.ts.map +1 -0
- package/src/contractSupport.d.ts +28 -0
- package/src/contractSupport.d.ts.map +1 -0
- package/src/contractSupport.js +14 -12
- package/src/econCommitteeCharter.d.ts +39 -0
- package/src/econCommitteeCharter.d.ts.map +1 -0
- package/src/econCommitteeCharter.js +21 -20
- package/src/feeDistributor.d.ts +224 -0
- package/src/feeDistributor.d.ts.map +1 -0
- package/src/feeDistributor.js +37 -33
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +1 -0
- package/src/interest-math.d.ts +3 -0
- package/src/interest-math.d.ts.map +1 -0
- package/src/interest.d.ts +28 -0
- package/src/interest.d.ts.map +1 -0
- package/src/interest.js +21 -16
- package/src/price/README.md +13 -0
- package/src/price/fluxAggregatorContract.d.ts +70 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +62 -55
- package/src/price/fluxAggregatorKit.d.ts +103 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +50 -37
- package/src/price/priceOracleKit.d.ts +38 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +11 -13
- package/src/price/roundsManager.d.ts +238 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +77 -82
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.d.ts +69 -0
- package/src/proposals/add-auction.d.ts.map +1 -0
- package/src/proposals/add-auction.js +181 -0
- package/src/proposals/addAssetToVault.d.ts +160 -0
- package/src/proposals/addAssetToVault.d.ts.map +1 -0
- package/src/proposals/addAssetToVault.js +172 -38
- package/src/proposals/committee-proposal.d.ts +113 -0
- package/src/proposals/committee-proposal.d.ts.map +1 -0
- package/src/proposals/committee-proposal.js +25 -31
- package/src/proposals/core-proposal.d.ts +149 -0
- package/src/proposals/core-proposal.d.ts.map +1 -0
- package/src/proposals/core-proposal.js +9 -11
- package/src/proposals/econ-behaviors.d.ts +1169 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +66 -45
- package/src/proposals/price-feed-proposal.d.ts +84 -0
- package/src/proposals/price-feed-proposal.d.ts.map +1 -0
- package/src/proposals/price-feed-proposal.js +108 -51
- package/src/proposals/startEconCommittee.d.ts +34 -0
- package/src/proposals/startEconCommittee.d.ts.map +1 -0
- package/src/proposals/startEconCommittee.js +2 -2
- package/src/proposals/startPSM.d.ts +59 -0
- package/src/proposals/startPSM.d.ts.map +1 -0
- package/src/proposals/startPSM.js +38 -27
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
- package/src/proposals/upgrade-vaults.d.ts +35 -0
- package/src/proposals/upgrade-vaults.d.ts.map +1 -0
- package/src/proposals/upgrade-vaults.js +202 -0
- package/src/proposals/utils.d.ts +17 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +34 -7
- package/src/provisionPool.d.ts +167 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +122 -0
- package/src/provisionPoolKit.d.ts +770 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +463 -0
- package/src/psm/psm.d.ts +122 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +73 -69
- package/src/psm/types-ambient.d.ts +2 -0
- package/src/psm/types-ambient.d.ts.map +1 -0
- package/src/psm/types-ambient.js +3 -0
- package/src/reserve/assetReserve.d.ts +47 -0
- package/src/reserve/assetReserve.d.ts.map +1 -0
- package/src/reserve/assetReserve.js +28 -19
- package/src/reserve/assetReserveKit.d.ts +74 -0
- package/src/reserve/assetReserveKit.d.ts.map +1 -0
- package/src/reserve/assetReserveKit.js +18 -24
- package/src/reserve/params.d.ts +10 -0
- package/src/reserve/params.d.ts.map +1 -0
- package/src/tokens.d.ts +3 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +5 -0
- package/src/vaultFactory/burn.d.ts +2 -0
- package/src/vaultFactory/burn.d.ts.map +1 -0
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +163 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +36 -22
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +10 -9
- package/src/vaultFactory/orderedVaultStore.d.ts +360 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +145 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +992 -0
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
- package/src/vaultFactory/prioritizedVaults.js +4 -4
- package/src/vaultFactory/proceeds.d.ts +35 -0
- package/src/vaultFactory/proceeds.d.ts.map +1 -0
- package/src/vaultFactory/proceeds.js +26 -18
- package/src/vaultFactory/storeUtils.d.ts +25 -0
- package/src/vaultFactory/storeUtils.d.ts.map +1 -0
- package/src/vaultFactory/storeUtils.js +10 -12
- package/src/vaultFactory/types-ambient.d.ts +234 -0
- package/src/vaultFactory/types-ambient.d.ts.map +1 -0
- package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
- package/src/vaultFactory/vault.d.ts +402 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +99 -93
- package/src/vaultFactory/vaultDirector.d.ts +388 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +61 -50
- package/src/vaultFactory/vaultFactory.d.ts +277 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +49 -32
- package/src/vaultFactory/vaultHolder.d.ts +270 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +10 -14
- package/src/vaultFactory/vaultKit.d.ts +102 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +819 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +248 -151
- package/CHANGELOG.md +0 -1066
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -113
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -200
- package/scripts/invite-committee-core.js +0 -42
- package/scripts/manual-price-feed.js +0 -117
- package/scripts/price-feed-core.js +0 -104
- package/scripts/start-local-chain.sh +0 -84
- package/src/psm/types.js +0 -3
- package/src/typeGuards.js +0 -13
- package/src/vaultFactory/type-imports.js +0 -4
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/** @type {ContractMeta} */
|
|
2
|
+
export const meta: ContractMeta;
|
|
3
|
+
export function makeContractFeeCollector(zoe: ERef<ZoeService>, creatorFacet: ERef<CollectibleContractFacet>): {
|
|
4
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
5
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
6
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
7
|
+
}>;
|
|
8
|
+
export function startDistributing(schedulePayments: () => Promise<unknown>, timerService: globalThis.ERef<TimerService>, collectionInterval?: RelativeTime | undefined): void;
|
|
9
|
+
export function makeShareConfig(destinations?: Record<string, globalThis.ERef<FeeDestination>> | undefined, keywordShares?: Record<string, bigint> | undefined): {
|
|
10
|
+
shares: {
|
|
11
|
+
share: bigint;
|
|
12
|
+
destination: globalThis.ERef<FeeDestination>;
|
|
13
|
+
}[];
|
|
14
|
+
totalShares: bigint;
|
|
15
|
+
};
|
|
16
|
+
export function sharePayment(payment: Payment<"nat">, issuer: ERef<Issuer<"nat">>, { shares, totalShares }: ShareConfig): Promise<void>;
|
|
17
|
+
export function makeFeeDistributor(feeIssuer: ERef<Issuer<"nat">>, terms: {
|
|
18
|
+
keywordShares: Record<Keyword, NatValue>;
|
|
19
|
+
timerService: globalThis.ERef<TimerService>;
|
|
20
|
+
collectionInterval: RelativeTime;
|
|
21
|
+
}): {
|
|
22
|
+
creatorFacet: {
|
|
23
|
+
makeContractFeeCollector: (zoe: ERef<ZoeService>, creatorFacet: ERef<CollectibleContractFacet>) => {
|
|
24
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
25
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
26
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Start distributing fees from this collector.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} debugName
|
|
32
|
+
* @param {ERef<FeeCollector>} collectorP
|
|
33
|
+
*/
|
|
34
|
+
startPeriodicCollection: (debugName: string, collectorP: ERef<FeeCollector>) => Promise<PeriodicFeeCollector>;
|
|
35
|
+
/**
|
|
36
|
+
* @param {import('@endo/far').EOnly<
|
|
37
|
+
* import('@agoric/ertp/src/types.js').DepositFacet
|
|
38
|
+
* >} depositFacet
|
|
39
|
+
*/
|
|
40
|
+
makeDepositFacetDestination: (depositFacet: import("@endo/far").EOnly<import("@agoric/ertp/src/types.js").DepositFacet>) => {
|
|
41
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
42
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
43
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a destination that generates invitations and makes Zoe offers.
|
|
47
|
+
*
|
|
48
|
+
* @param {ERef<ZoeService>} zoe
|
|
49
|
+
* @param {string} keyword
|
|
50
|
+
* @param {unknown} target
|
|
51
|
+
* @param {PropertyKey} makeInvitationMethod
|
|
52
|
+
* @param {unknown[]} [args]
|
|
53
|
+
*/
|
|
54
|
+
makeOfferDestination: (zoe: ERef<ZoeService>, keyword: string, target: unknown, makeInvitationMethod: PropertyKey, args?: unknown[] | undefined) => {
|
|
55
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
56
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
57
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
58
|
+
}>;
|
|
59
|
+
/** @param {Record<Keyword, ERef<FeeDestination>>} newDestinations */
|
|
60
|
+
setDestinations: (newDestinations: Record<Keyword, ERef<FeeDestination>>) => Promise<void>;
|
|
61
|
+
/** @param {Record<Keyword, bigint>} newShares */
|
|
62
|
+
setKeywordShares: (newShares: Record<Keyword, bigint>) => void;
|
|
63
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
64
|
+
makeContractFeeCollector: (zoe: ERef<ZoeService>, creatorFacet: ERef<CollectibleContractFacet>) => {
|
|
65
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
66
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
67
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Start distributing fees from this collector.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} debugName
|
|
73
|
+
* @param {ERef<FeeCollector>} collectorP
|
|
74
|
+
*/
|
|
75
|
+
startPeriodicCollection: (debugName: string, collectorP: ERef<FeeCollector>) => Promise<PeriodicFeeCollector>;
|
|
76
|
+
/**
|
|
77
|
+
* @param {import('@endo/far').EOnly<
|
|
78
|
+
* import('@agoric/ertp/src/types.js').DepositFacet
|
|
79
|
+
* >} depositFacet
|
|
80
|
+
*/
|
|
81
|
+
makeDepositFacetDestination: (depositFacet: import("@endo/far").EOnly<import("@agoric/ertp/src/types.js").DepositFacet>) => {
|
|
82
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
83
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
84
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a destination that generates invitations and makes Zoe offers.
|
|
88
|
+
*
|
|
89
|
+
* @param {ERef<ZoeService>} zoe
|
|
90
|
+
* @param {string} keyword
|
|
91
|
+
* @param {unknown} target
|
|
92
|
+
* @param {PropertyKey} makeInvitationMethod
|
|
93
|
+
* @param {unknown[]} [args]
|
|
94
|
+
*/
|
|
95
|
+
makeOfferDestination: (zoe: ERef<ZoeService>, keyword: string, target: unknown, makeInvitationMethod: PropertyKey, args?: unknown[] | undefined) => {
|
|
96
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
97
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
98
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
99
|
+
}>;
|
|
100
|
+
/** @param {Record<Keyword, ERef<FeeDestination>>} newDestinations */
|
|
101
|
+
setDestinations: (newDestinations: Record<Keyword, ERef<FeeDestination>>) => Promise<void>;
|
|
102
|
+
/** @param {Record<Keyword, bigint>} newShares */
|
|
103
|
+
setKeywordShares: (newShares: Record<Keyword, bigint>) => void;
|
|
104
|
+
}>;
|
|
105
|
+
publicFacet: {
|
|
106
|
+
distributeFees: (payment: Payment<"nat">) => Promise<void>;
|
|
107
|
+
getKeywordShares: () => Record<string, bigint>;
|
|
108
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
109
|
+
distributeFees: (payment: Payment<"nat">) => Promise<void>;
|
|
110
|
+
getKeywordShares: () => Record<string, bigint>;
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
export function start(zcf: ZCF<Parameters<typeof makeFeeDistributor>[1]>): Promise<{
|
|
114
|
+
creatorFacet: {
|
|
115
|
+
makeContractFeeCollector: (zoe: ERef<ZoeService>, creatorFacet: ERef<CollectibleContractFacet>) => {
|
|
116
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
117
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
118
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
119
|
+
}>;
|
|
120
|
+
/**
|
|
121
|
+
* Start distributing fees from this collector.
|
|
122
|
+
*
|
|
123
|
+
* @param {string} debugName
|
|
124
|
+
* @param {ERef<FeeCollector>} collectorP
|
|
125
|
+
*/
|
|
126
|
+
startPeriodicCollection: (debugName: string, collectorP: ERef<FeeCollector>) => Promise<PeriodicFeeCollector>;
|
|
127
|
+
/**
|
|
128
|
+
* @param {import('@endo/far').EOnly<
|
|
129
|
+
* import('@agoric/ertp/src/types.js').DepositFacet
|
|
130
|
+
* >} depositFacet
|
|
131
|
+
*/
|
|
132
|
+
makeDepositFacetDestination: (depositFacet: import("@endo/far").EOnly<import("@agoric/ertp/src/types.js").DepositFacet>) => {
|
|
133
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
134
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
135
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Create a destination that generates invitations and makes Zoe offers.
|
|
139
|
+
*
|
|
140
|
+
* @param {ERef<ZoeService>} zoe
|
|
141
|
+
* @param {string} keyword
|
|
142
|
+
* @param {unknown} target
|
|
143
|
+
* @param {PropertyKey} makeInvitationMethod
|
|
144
|
+
* @param {unknown[]} [args]
|
|
145
|
+
*/
|
|
146
|
+
makeOfferDestination: (zoe: ERef<ZoeService>, keyword: string, target: unknown, makeInvitationMethod: PropertyKey, args?: unknown[] | undefined) => {
|
|
147
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
148
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
149
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
150
|
+
}>;
|
|
151
|
+
/** @param {Record<Keyword, ERef<FeeDestination>>} newDestinations */
|
|
152
|
+
setDestinations: (newDestinations: Record<Keyword, ERef<FeeDestination>>) => Promise<void>;
|
|
153
|
+
/** @param {Record<Keyword, bigint>} newShares */
|
|
154
|
+
setKeywordShares: (newShares: Record<Keyword, bigint>) => void;
|
|
155
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
156
|
+
makeContractFeeCollector: (zoe: ERef<ZoeService>, creatorFacet: ERef<CollectibleContractFacet>) => {
|
|
157
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
158
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
159
|
+
collectFees: () => Promise<globalThis.Payment<any>>;
|
|
160
|
+
}>;
|
|
161
|
+
/**
|
|
162
|
+
* Start distributing fees from this collector.
|
|
163
|
+
*
|
|
164
|
+
* @param {string} debugName
|
|
165
|
+
* @param {ERef<FeeCollector>} collectorP
|
|
166
|
+
*/
|
|
167
|
+
startPeriodicCollection: (debugName: string, collectorP: ERef<FeeCollector>) => Promise<PeriodicFeeCollector>;
|
|
168
|
+
/**
|
|
169
|
+
* @param {import('@endo/far').EOnly<
|
|
170
|
+
* import('@agoric/ertp/src/types.js').DepositFacet
|
|
171
|
+
* >} depositFacet
|
|
172
|
+
*/
|
|
173
|
+
makeDepositFacetDestination: (depositFacet: import("@endo/far").EOnly<import("@agoric/ertp/src/types.js").DepositFacet>) => {
|
|
174
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
175
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
176
|
+
pushPayment: (payment: any, _issuer: any) => Promise<globalThis.Amount>;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* Create a destination that generates invitations and makes Zoe offers.
|
|
180
|
+
*
|
|
181
|
+
* @param {ERef<ZoeService>} zoe
|
|
182
|
+
* @param {string} keyword
|
|
183
|
+
* @param {unknown} target
|
|
184
|
+
* @param {PropertyKey} makeInvitationMethod
|
|
185
|
+
* @param {unknown[]} [args]
|
|
186
|
+
*/
|
|
187
|
+
makeOfferDestination: (zoe: ERef<ZoeService>, keyword: string, target: unknown, makeInvitationMethod: PropertyKey, args?: unknown[] | undefined) => {
|
|
188
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
189
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
190
|
+
pushPayment: (payment: any, issuer: any) => Promise<any>;
|
|
191
|
+
}>;
|
|
192
|
+
/** @param {Record<Keyword, ERef<FeeDestination>>} newDestinations */
|
|
193
|
+
setDestinations: (newDestinations: Record<Keyword, ERef<FeeDestination>>) => Promise<void>;
|
|
194
|
+
/** @param {Record<Keyword, bigint>} newShares */
|
|
195
|
+
setKeywordShares: (newShares: Record<Keyword, bigint>) => void;
|
|
196
|
+
}>;
|
|
197
|
+
publicFacet: {
|
|
198
|
+
distributeFees: (payment: Payment<"nat">) => Promise<void>;
|
|
199
|
+
getKeywordShares: () => Record<string, bigint>;
|
|
200
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
201
|
+
distributeFees: (payment: Payment<"nat">) => Promise<void>;
|
|
202
|
+
getKeywordShares: () => Record<string, bigint>;
|
|
203
|
+
}>;
|
|
204
|
+
}>;
|
|
205
|
+
export type FeeCollector = {
|
|
206
|
+
collectFees: () => ERef<Payment<"nat">>;
|
|
207
|
+
};
|
|
208
|
+
export type PeriodicFeeCollector = {
|
|
209
|
+
getCollector: () => FeeCollector;
|
|
210
|
+
collectAndDistributeNow: () => Promise<void>;
|
|
211
|
+
stop: () => void;
|
|
212
|
+
};
|
|
213
|
+
export type CollectibleContractFacet = {
|
|
214
|
+
makeCollectFeesInvitation: () => Promise<Invitation<string, never>>;
|
|
215
|
+
};
|
|
216
|
+
export type FeeDestination = {
|
|
217
|
+
pushPayment: (payment: Payment, issuer: ERef<Issuer>) => Promise<Amount>;
|
|
218
|
+
};
|
|
219
|
+
export type ShareConfig = ReturnType<typeof makeShareConfig>;
|
|
220
|
+
export type FeeDistributorCreatorFacet = ReturnType<typeof makeFeeDistributor>["creatorFacet"];
|
|
221
|
+
export type FeeDistributorPublicFacet = ReturnType<typeof makeFeeDistributor>["publicFacet"];
|
|
222
|
+
import type { TimerService } from '@agoric/time';
|
|
223
|
+
import type { RelativeTime } from '@agoric/time';
|
|
224
|
+
//# sourceMappingURL=feeDistributor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeDistributor.d.ts","sourceRoot":"","sources":["feeDistributor.js"],"names":[],"mappings":"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"}
|
package/src/feeDistributor.js
CHANGED
|
@@ -9,23 +9,23 @@ import { KeywordShape } from '@agoric/zoe/src/typeGuards.js';
|
|
|
9
9
|
|
|
10
10
|
const KeywordSharesShape = M.recordOf(KeywordShape, M.nat());
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
12
|
+
/** @type {ContractMeta} */
|
|
13
|
+
export const meta = {
|
|
14
|
+
customTermsShape: {
|
|
15
|
+
keywordShares: KeywordSharesShape,
|
|
16
|
+
timerService: M.eref(M.remotable('TimerService')),
|
|
17
|
+
collectionInterval: RelativeTimeShape,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
harden(meta);
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
23
|
+
* @import {RelativeTime} from '@agoric/time'
|
|
24
|
+
* @import {TimerService} from '@agoric/time'
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* @typedef {object} FeeCollector
|
|
28
|
-
*
|
|
29
29
|
* @property {() => ERef<Payment<'nat'>>} collectFees
|
|
30
30
|
*/
|
|
31
31
|
|
|
@@ -65,10 +65,12 @@ export const makeContractFeeCollector = (zoe, creatorFacet) => {
|
|
|
65
65
|
* for fees that have been collected to date and send that payment to the
|
|
66
66
|
* depositFacet.
|
|
67
67
|
*
|
|
68
|
-
* @param {() => Promise<unknown>} schedulePayments - distribute to the
|
|
69
|
-
*
|
|
68
|
+
* @param {() => Promise<unknown>} schedulePayments - distribute to the
|
|
69
|
+
* destinations
|
|
70
|
+
* @param {ERef<TimerService>} timerService - timer that is used to schedule
|
|
71
|
+
* collections
|
|
70
72
|
* @param {RelativeTime} [collectionInterval] - how often to collect fees in the
|
|
71
|
-
*
|
|
73
|
+
* `timerService` unit
|
|
72
74
|
*/
|
|
73
75
|
export const startDistributing = (
|
|
74
76
|
schedulePayments,
|
|
@@ -99,8 +101,9 @@ export const startDistributing = (
|
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
/**
|
|
102
|
-
* @typedef {{
|
|
103
|
-
*
|
|
104
|
+
* @typedef {{
|
|
105
|
+
* pushPayment: (payment: Payment, issuer: ERef<Issuer>) => Promise<Amount>;
|
|
106
|
+
* }} FeeDestination
|
|
104
107
|
* @param {Record<Keyword, ERef<FeeDestination>>} [destinations]
|
|
105
108
|
* @param {Record<Keyword, NatValue>} [keywordShares]
|
|
106
109
|
*/
|
|
@@ -161,17 +164,16 @@ export const sharePayment = async (
|
|
|
161
164
|
.filter(([_, amt]) => !AmountMath.isEmpty(amt));
|
|
162
165
|
|
|
163
166
|
/**
|
|
164
|
-
* If the `sharedPayment[i]` payments that are sent to the fee
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* be undeposited.
|
|
167
|
+
* If the `sharedPayment[i]` payments that are sent to the fee `destination`
|
|
168
|
+
* with `pushPayment` never arrive, or never get deposited (or otherwise used
|
|
169
|
+
* up), then they remain in the recovery set of the `recoveryPurse`. The
|
|
170
|
+
* purpose of this, and of recovery sets in general, is to be able, in
|
|
171
|
+
* emergencies, to recover the assets of payments in flight that seem to be
|
|
172
|
+
* stuck. This is much like cancelling a check that may still be undeposited.
|
|
171
173
|
*
|
|
172
174
|
* TODO: However, for this to be possible, the `recoveryPurse` holding that
|
|
173
|
-
* recovery set must remain accessible to someone that should legitimately
|
|
174
|
-
*
|
|
175
|
+
* recovery set must remain accessible to someone that should legitimately be
|
|
176
|
+
* able to recover those payments. But this `recoveryPurse` is currently
|
|
175
177
|
* dropped on the floor instead.
|
|
176
178
|
*/
|
|
177
179
|
const recoveryPurse = E(issuer).makeEmptyPurse();
|
|
@@ -193,7 +195,11 @@ export const sharePayment = async (
|
|
|
193
195
|
|
|
194
196
|
/**
|
|
195
197
|
* @param {ERef<Issuer<'nat'>>} feeIssuer
|
|
196
|
-
* @param {{
|
|
198
|
+
* @param {{
|
|
199
|
+
* keywordShares: Record<Keyword, NatValue>;
|
|
200
|
+
* timerService: ERef<TimerService>;
|
|
201
|
+
* collectionInterval: RelativeTime;
|
|
202
|
+
* }} terms
|
|
197
203
|
*/
|
|
198
204
|
export const makeFeeDistributor = (feeIssuer, terms) => {
|
|
199
205
|
const { timerService, collectionInterval } = terms;
|
|
@@ -262,7 +268,9 @@ export const makeFeeDistributor = (feeIssuer, terms) => {
|
|
|
262
268
|
},
|
|
263
269
|
|
|
264
270
|
/**
|
|
265
|
-
* @param {import('@endo/far').EOnly<
|
|
271
|
+
* @param {import('@endo/far').EOnly<
|
|
272
|
+
* import('@agoric/ertp/src/types.js').DepositFacet
|
|
273
|
+
* >} depositFacet
|
|
266
274
|
*/
|
|
267
275
|
makeDepositFacetDestination: depositFacet => {
|
|
268
276
|
return Far(`DepositFacetDestination`, {
|
|
@@ -315,9 +323,7 @@ export const makeFeeDistributor = (feeIssuer, terms) => {
|
|
|
315
323
|
});
|
|
316
324
|
},
|
|
317
325
|
|
|
318
|
-
/**
|
|
319
|
-
* @param {Record<Keyword, ERef<FeeDestination>>} newDestinations
|
|
320
|
-
*/
|
|
326
|
+
/** @param {Record<Keyword, ERef<FeeDestination>>} newDestinations */
|
|
321
327
|
setDestinations: async newDestinations => {
|
|
322
328
|
destinations = newDestinations;
|
|
323
329
|
shareConfig = makeShareConfig(destinations, keywordShares);
|
|
@@ -344,9 +350,7 @@ export const makeFeeDistributor = (feeIssuer, terms) => {
|
|
|
344
350
|
/** @typedef {ReturnType<typeof makeFeeDistributor>['creatorFacet']} FeeDistributorCreatorFacet */
|
|
345
351
|
/** @typedef {ReturnType<typeof makeFeeDistributor>['publicFacet']} FeeDistributorPublicFacet */
|
|
346
352
|
|
|
347
|
-
/**
|
|
348
|
-
* @param {ZCF<Parameters<typeof makeFeeDistributor>[1]>} zcf
|
|
349
|
-
*/
|
|
353
|
+
/** @param {ZCF<Parameters<typeof makeFeeDistributor>[1]>} zcf */
|
|
350
354
|
export const start = async zcf => {
|
|
351
355
|
const feeIssuer = E(zcf.getZoeService()).getFeeIssuer();
|
|
352
356
|
return makeFeeDistributor(feeIssuer, zcf.getTerms());
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
|
package/src/index.js
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export function calculateCurrentDebt(debtSnapshot: Amount<"nat">, interestSnapshot: Ratio, currentCompoundedInterest: Ratio): Amount<"nat">;
|
|
2
|
+
export function reverseInterest(debt: Amount<"nat">, interestApplied: Ratio): Amount<"nat">;
|
|
3
|
+
//# sourceMappingURL=interest-math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interest-math.d.ts","sourceRoot":"","sources":["interest-math.js"],"names":[],"mappings":"AAgCO,mDALI,MAAM,CAAC,KAAK,CAAC,oBACb,KAAK,6BACL,KAAK,GACH,MAAM,CAAC,KAAK,CAAC,CAiBzB;AAOM,sCAJI,MAAM,CAAC,KAAK,CAAC,mBACb,KAAK,GACH,MAAM,CAAC,KAAK,CAAC,CAIzB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Timestamp} from '@agoric/time'
|
|
3
|
+
* @import {RelativeTime} from '@agoric/time'
|
|
4
|
+
*/
|
|
5
|
+
export const SECONDS_PER_YEAR: bigint;
|
|
6
|
+
export function makeInterestCalculator(annualRate: Ratio, chargingPeriod: RelativeTime, recordingPeriod: RelativeTime): CalculatorKit;
|
|
7
|
+
export function calculateCompoundedInterest(priorCompoundedInterest: Ratio, priorDebt: NatValue, newDebt: NatValue): Ratio;
|
|
8
|
+
export function chargeInterest(powers: {
|
|
9
|
+
mint: ZCFMint<"nat">;
|
|
10
|
+
mintAndTransferWithFee: MintAndTransfer;
|
|
11
|
+
poolIncrementSeat: ZCFSeat;
|
|
12
|
+
seatAllocationKeyword: Keyword;
|
|
13
|
+
}, params: {
|
|
14
|
+
interestRate: Ratio;
|
|
15
|
+
chargingPeriod: RelativeTime;
|
|
16
|
+
recordingPeriod: RelativeTime;
|
|
17
|
+
}, prior: {
|
|
18
|
+
latestInterestUpdate: Timestamp;
|
|
19
|
+
compoundedInterest: Ratio;
|
|
20
|
+
totalDebt: Amount<"nat">;
|
|
21
|
+
}, accruedUntil: Timestamp): {
|
|
22
|
+
compoundedInterest: Ratio;
|
|
23
|
+
latestInterestUpdate: Timestamp;
|
|
24
|
+
totalDebt: Amount<"nat">;
|
|
25
|
+
};
|
|
26
|
+
import type { RelativeTime } from '@agoric/time';
|
|
27
|
+
import type { Timestamp } from '@agoric/time';
|
|
28
|
+
//# sourceMappingURL=interest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interest.d.ts","sourceRoot":"","sources":["interest.js"],"names":[],"mappings":"AAYA;;;GAGG;AAEH,sCAAuD;AAchD,mDALI,KAAK,gEAGH,aAAa,CA+EzB;AASM,qEAJI,KAAK,aACL,QAAQ,WACR,QAAQ,SAalB;AAyCM,uCAvBI;IACV,IAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACzB,sBAA0B,EAAE,eAAe,CAAC;IAC5C,iBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAyB,EAAE,OAAO,CAAC;CAChC;kBAEe,KAAK;;;;;wBAMC,KAAK;eACd,MAAM,CAAC,KAAK,CAAC;;wBAIJ,KAAK;;eAEd,MAAM,CAAC,KAAK,CAAC;EA+D5B;kCAvN8B,cAAc;+BADjB,cAAc"}
|
package/src/interest.js
CHANGED
|
@@ -11,8 +11,8 @@ import { Fail } from '@agoric/assert';
|
|
|
11
11
|
import { TimeMath } from '@agoric/time';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
14
|
+
* @import {Timestamp} from '@agoric/time'
|
|
15
|
+
* @import {RelativeTime} from '@agoric/time'
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
export const SECONDS_PER_YEAR = 60n * 60n * 24n * 365n;
|
|
@@ -20,9 +20,7 @@ const BASIS_POINTS = 10000;
|
|
|
20
20
|
// single digit APR is less than a basis point per day.
|
|
21
21
|
const LARGE_DENOMINATOR = BASIS_POINTS * BASIS_POINTS;
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Number chosen from 6 digits for a basis point, doubled for multiplication.
|
|
25
|
-
*/
|
|
23
|
+
/** Number chosen from 6 digits for a basis point, doubled for multiplication. */
|
|
26
24
|
const COMPOUNDED_INTEREST_DENOMINATOR = 10n ** 20n;
|
|
27
25
|
|
|
28
26
|
/**
|
|
@@ -147,20 +145,27 @@ const validatedBrand = (mint, debt) => {
|
|
|
147
145
|
* Charge interest accrued between `latestInterestUpdate` and `accruedUntil`.
|
|
148
146
|
*
|
|
149
147
|
* @param {{
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
148
|
+
* mint: ZCFMint<'nat'>;
|
|
149
|
+
* mintAndTransferWithFee: MintAndTransfer;
|
|
150
|
+
* poolIncrementSeat: ZCFSeat;
|
|
151
|
+
* seatAllocationKeyword: Keyword;
|
|
152
|
+
* }} powers
|
|
154
153
|
* @param {{
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
154
|
+
* interestRate: Ratio;
|
|
155
|
+
* chargingPeriod: RelativeTime;
|
|
156
|
+
* recordingPeriod: RelativeTime;
|
|
157
|
+
* }} params
|
|
158
158
|
* @param {{
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
159
|
+
* latestInterestUpdate: Timestamp;
|
|
160
|
+
* compoundedInterest: Ratio;
|
|
161
|
+
* totalDebt: Amount<'nat'>;
|
|
162
|
+
* }} prior
|
|
162
163
|
* @param {Timestamp} accruedUntil
|
|
163
|
-
* @returns {{
|
|
164
|
+
* @returns {{
|
|
165
|
+
* compoundedInterest: Ratio;
|
|
166
|
+
* latestInterestUpdate: Timestamp;
|
|
167
|
+
* totalDebt: Amount<'nat'>;
|
|
168
|
+
* }}
|
|
164
169
|
*/
|
|
165
170
|
export const chargeInterest = (powers, params, prior, accruedUntil) => {
|
|
166
171
|
const brand = validatedBrand(powers.mint, prior.totalDebt);
|
package/src/price/README.md
CHANGED
|
@@ -4,6 +4,19 @@ This directory contains the `fluxAggregatorKit.js` contract which takes prices a
|
|
|
4
4
|
input and outputs a best known price. There are multiple ways to get the price,
|
|
5
5
|
including a PriceAuthority interface.
|
|
6
6
|
|
|
7
|
+
## Design
|
|
8
|
+
|
|
9
|
+
The authorities are hierarchical. Many authorities can be registered in the priceAuthorityRegistry.
|
|
10
|
+
|
|
11
|
+
For oracles, there must be two: the negotiable brand and the _oracle_ brand (an inert one).
|
|
12
|
+
|
|
13
|
+
The intended flow is that:
|
|
14
|
+
1. a negotiable brand is created (e.g. ATOM)
|
|
15
|
+
2. a price provider says “i can give you quotes for that” and runs price-feed-proposal. That makes “oracleBrands” (which are inert and have a separate identity so that they don’t have the authority to say they’re the real quote for it).
|
|
16
|
+
3. Some higher authority (eg EC, Stakers) decides that should be the quote source for negotiable brand so it registers it under the real brand identity in the registry (with a new instance of a scaledPriceAuthority ).
|
|
17
|
+
|
|
18
|
+
In practice we do these all in one core proposal. And each vault manager is started with a limit on minting to the EC has another way to gate transactions.
|
|
19
|
+
|
|
7
20
|
## Usage
|
|
8
21
|
|
|
9
22
|
See the [Smart Wallet integration test](/packages/inter-protocol/test/smartWallet/test-oracle-integration.js) for how it's used.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Baggage} from '@agoric/vat-data'
|
|
3
|
+
* @import {TimerService} from '@agoric/time'
|
|
4
|
+
*/
|
|
5
|
+
/** @type {ContractMeta} */
|
|
6
|
+
export const meta: ContractMeta;
|
|
7
|
+
export function start(zcf: ZCF<import("./fluxAggregatorKit.js").ChainlinkConfig & {
|
|
8
|
+
timer: TimerService;
|
|
9
|
+
brandIn: Brand<"nat">;
|
|
10
|
+
brandOut: Brand<"nat">;
|
|
11
|
+
description: string;
|
|
12
|
+
unitAmountIn?: Amount<"nat">;
|
|
13
|
+
}>, privateArgs: {
|
|
14
|
+
highPrioritySendersManager?: import("@agoric/internal/src/priority-senders.js").PrioritySendersManager;
|
|
15
|
+
initialPoserInvitation: Invitation;
|
|
16
|
+
marshaller: ERef<Marshaller>;
|
|
17
|
+
namesByAddressAdmin: ERef<import("@agoric/vats").NameAdmin>;
|
|
18
|
+
storageNode: StorageNode;
|
|
19
|
+
}, baggage: Baggage): Promise<{
|
|
20
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
21
|
+
getParamMgrRetriever: () => {
|
|
22
|
+
get: () => import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
|
|
23
|
+
Electorate: "invitation";
|
|
24
|
+
}>;
|
|
25
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
26
|
+
get: () => import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
|
|
27
|
+
Electorate: "invitation";
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
30
|
+
getInvitation: (name: any) => Promise<Invitation<unknown, undefined>>;
|
|
31
|
+
getLimitedCreatorFacet: () => import("@endo/exo").Guarded<{
|
|
32
|
+
makeOracleInvitation(oracleId: string): Promise<Invitation<{
|
|
33
|
+
invitationMakers: {
|
|
34
|
+
PushPrice(result: import("./roundsManager.js").PriceRound): Promise<Invitation<void, undefined>>;
|
|
35
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
36
|
+
PushPrice(result: import("./roundsManager.js").PriceRound): Promise<Invitation<void, undefined>>;
|
|
37
|
+
}>;
|
|
38
|
+
oracle: import("@endo/exo").Guarded<{
|
|
39
|
+
pushPrice({ roundId: roundIdRaw, unitPrice: valueRaw, }: PriceDatum): Promise<void>;
|
|
40
|
+
getStatus(): import("./priceOracleKit.js").OracleStatus;
|
|
41
|
+
}>;
|
|
42
|
+
}, undefined>>;
|
|
43
|
+
removeOracle(oracleId: string): Promise<void>;
|
|
44
|
+
getRoundData: (roundIdRaw: any) => Promise<import("./roundsManager.js").RoundData>;
|
|
45
|
+
initOracle(oracleId: string): Promise<import("@endo/exo").GuardedKit<{
|
|
46
|
+
admin: {
|
|
47
|
+
disable(): void;
|
|
48
|
+
};
|
|
49
|
+
oracle: {
|
|
50
|
+
pushPrice({ roundId: roundIdRaw, unitPrice: valueRaw, }: PriceDatum): Promise<void>;
|
|
51
|
+
getStatus(): import("./priceOracleKit.js").OracleStatus;
|
|
52
|
+
};
|
|
53
|
+
}>>;
|
|
54
|
+
oracleRoundState(oracleId: string, queriedRoundId: bigint): Promise<import("./fluxAggregatorKit.js").RoundState>;
|
|
55
|
+
}>;
|
|
56
|
+
getGovernedApis: () => globalThis.GovernedApis;
|
|
57
|
+
getGovernedApiNames: () => string[];
|
|
58
|
+
setOfferFilter: (strings: any) => Promise<void>;
|
|
59
|
+
}>;
|
|
60
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
61
|
+
getPriceAuthority(): import("@agoric/zoe/tools/types.js").PriceAuthority;
|
|
62
|
+
getPublicTopics(): {
|
|
63
|
+
quotes: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("@agoric/zoe/tools/types.js").PriceDescription>;
|
|
64
|
+
latestRound: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./roundsManager.js").LatestRound>;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
}>;
|
|
68
|
+
import type { TimerService } from '@agoric/time';
|
|
69
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
70
|
+
//# sourceMappingURL=fluxAggregatorContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluxAggregatorContract.d.ts","sourceRoot":"","sources":["fluxAggregatorContract.js"],"names":[],"mappings":"AAcA;;;GAGG;AAEH,2BAA2B;AAC3B,mBADW,YAAY,CAmBrB;AA0BK;;aAfS,KAAK,CAAC,KAAK,CAAC;cACX,KAAK,CAAC,KAAK,CAAC;iBACT,MAAM;mBACJ,MAAM,CAAC,KAAK,CAAC;iBAGxB;IACV,0BAA8B,CAAC,EAAE,OAAO,0CAA0C,EAAE,sBAAsB,CAAC;IAC3G,sBAA0B,EAAE,UAAU,CAAC;IACvC,UAAc,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjC,mBAAuB,EAAE,IAAI,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,CAAC;IAChE,WAAe,EAAE,WAAW,CAAC;CAC1B;;;;;;;;;;;;;;;sCAwI45F,OAAO,oBAAoB,EAAE,UAAU;;mEAAV,UAAU;;;6EA5It8F,UAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0IR;kCAnL8B,cAAc;6BADnB,kBAAkB"}
|