@agoric/fast-usdc 0.2.0 → 0.2.1-upgrade-23-dev-bd79330.0.bd79330
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 +13 -11
- package/src/cli/bin.d.ts +3 -0
- package/src/cli/bin.d.ts.map +1 -0
- package/src/cli/bridge-action.d.ts +10 -0
- package/src/cli/bridge-action.d.ts.map +1 -0
- package/src/cli/bridge-action.js +5 -4
- package/src/cli/cli.d.ts +13 -0
- package/src/cli/cli.d.ts.map +1 -0
- package/src/cli/cli.js +4 -4
- package/src/cli/config-commands.d.ts +5 -0
- package/src/cli/config-commands.d.ts.map +1 -0
- package/src/cli/config.d.ts +22 -0
- package/src/cli/config.d.ts.map +1 -0
- package/src/cli/lp-commands.d.ts +12 -0
- package/src/cli/lp-commands.d.ts.map +1 -0
- package/src/cli/lp-commands.js +9 -3
- package/src/cli/operator-commands.d.ts +10 -0
- package/src/cli/operator-commands.d.ts.map +1 -0
- package/src/cli/transfer.d.ts +9 -0
- package/src/cli/transfer.d.ts.map +1 -0
- package/src/cli/transfer.js +5 -4
- package/src/cli/util/agoric.d.ts +3 -0
- package/src/cli/util/agoric.d.ts.map +1 -0
- package/src/cli/util/bank.d.ts +2 -0
- package/src/cli/util/bank.d.ts.map +1 -0
- package/src/cli/util/cctp.d.ts +5 -0
- package/src/cli/util/cctp.d.ts.map +1 -0
- package/src/cli/util/file.d.ts +12 -0
- package/src/cli/util/file.d.ts.map +1 -0
- package/src/cli/util/file.js +1 -1
- package/src/cli/util/noble.d.ts +11 -0
- package/src/cli/util/noble.d.ts.map +1 -0
- package/src/clientSupport.d.ts +51 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +8 -5
- package/src/constants.d.ts +35 -0
- package/src/constants.d.ts.map +1 -0
- package/src/main.d.ts +2 -0
- package/src/main.d.ts.map +1 -0
- package/src/operator-kit-interface.d.ts +19 -0
- package/src/operator-kit-interface.d.ts.map +1 -0
- package/src/pool-share-math.d.ts +73 -0
- package/src/pool-share-math.d.ts.map +1 -0
- package/src/type-guards.d.ts +113 -0
- package/src/type-guards.d.ts.map +1 -0
- package/src/types.d.ts +174 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.js +208 -0
- package/src/utils/fees.d.ts +64 -0
- package/src/utils/fees.d.ts.map +1 -0
- package/src/types.ts +0 -196
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export function makeNatAmountShape(brand: Brand<"nat">, min?: NatValue): {
|
|
2
|
+
brand: Brand<"nat">;
|
|
3
|
+
value: import("@endo/patterns").Matcher;
|
|
4
|
+
};
|
|
5
|
+
export function makeProposalShapes({ PoolShares, USDC }: Record<"PoolShares" | "USDC", Brand<"nat">>): {
|
|
6
|
+
deposit: (import("@endo/pass-style").CopyRecordInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
7
|
+
"Symbol(validatedType)"?: {
|
|
8
|
+
give: {
|
|
9
|
+
USDC: Amount<"nat">;
|
|
10
|
+
};
|
|
11
|
+
want: {
|
|
12
|
+
PoolShare: Amount<"nat">;
|
|
13
|
+
};
|
|
14
|
+
} | undefined;
|
|
15
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
16
|
+
"Symbol(validatedType)"?: {
|
|
17
|
+
give: {
|
|
18
|
+
USDC: Amount<"nat">;
|
|
19
|
+
};
|
|
20
|
+
want: {
|
|
21
|
+
PoolShare: Amount<"nat">;
|
|
22
|
+
};
|
|
23
|
+
} | undefined;
|
|
24
|
+
});
|
|
25
|
+
withdraw: (import("@endo/pass-style").CopyRecordInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
26
|
+
"Symbol(validatedType)"?: {
|
|
27
|
+
give: {
|
|
28
|
+
PoolShare: Amount<"nat">;
|
|
29
|
+
};
|
|
30
|
+
want: {
|
|
31
|
+
USDC: Amount<"nat">;
|
|
32
|
+
};
|
|
33
|
+
} | undefined;
|
|
34
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
35
|
+
"Symbol(validatedType)"?: {
|
|
36
|
+
give: {
|
|
37
|
+
PoolShare: Amount<"nat">;
|
|
38
|
+
};
|
|
39
|
+
want: {
|
|
40
|
+
USDC: Amount<"nat">;
|
|
41
|
+
};
|
|
42
|
+
} | undefined;
|
|
43
|
+
});
|
|
44
|
+
withdrawFees: (import("@endo/pass-style").CopyRecordInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
45
|
+
"Symbol(validatedType)"?: {
|
|
46
|
+
want: {
|
|
47
|
+
USDC: Amount<"nat">;
|
|
48
|
+
};
|
|
49
|
+
} | undefined;
|
|
50
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
51
|
+
"Symbol(validatedType)"?: {
|
|
52
|
+
want: {
|
|
53
|
+
USDC: Amount<"nat">;
|
|
54
|
+
};
|
|
55
|
+
} | undefined;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
/** @type {TypedPattern<FastUsdcTerms>} */
|
|
59
|
+
export const FastUSDCTermsShape: TypedPattern<FastUsdcTerms>;
|
|
60
|
+
/** @type {TypedPattern<EvmAddress>} */
|
|
61
|
+
export const EvmAddressShape: TypedPattern<EvmAddress>;
|
|
62
|
+
/** @type {TypedPattern<EvmHash>} */
|
|
63
|
+
export const EvmHashShape: TypedPattern<EvmHash>;
|
|
64
|
+
/** @type {TypedPattern<RiskAssessment>} */
|
|
65
|
+
export const RiskAssessmentShape: TypedPattern<RiskAssessment>;
|
|
66
|
+
/** @type {TypedPattern<CctpTxEvidence>} */
|
|
67
|
+
export const CctpTxEvidenceShape: TypedPattern<CctpTxEvidence>;
|
|
68
|
+
/** @type {TypedPattern<EvidenceWithRisk>} */
|
|
69
|
+
export const EvidenceWithRiskShape: TypedPattern<EvidenceWithRisk>;
|
|
70
|
+
/** @type {TypedPattern<PendingTx>} */
|
|
71
|
+
export const PendingTxShape: TypedPattern<PendingTx>;
|
|
72
|
+
/** @type {TypedPattern<AddressHook>} */
|
|
73
|
+
export const AddressHookShape: TypedPattern<AddressHook>;
|
|
74
|
+
/** @type {TypedPattern<FeeConfig['destinationOverrides']>} */
|
|
75
|
+
export const DestinationOverridesShape: TypedPattern<FeeConfig["destinationOverrides"]>;
|
|
76
|
+
/** @type {TypedPattern<FeeConfig>} */
|
|
77
|
+
export const FeeConfigShape: TypedPattern<FeeConfig>;
|
|
78
|
+
/** @type {TypedPattern<PoolMetrics>} */
|
|
79
|
+
export const PoolMetricsShape: TypedPattern<PoolMetrics>;
|
|
80
|
+
/** @type {TypedPattern<ChainPolicy>} */
|
|
81
|
+
export const ChainPolicyShape: TypedPattern<ChainPolicy>;
|
|
82
|
+
/**
|
|
83
|
+
* @type {TypedPattern<FeedPolicy>}
|
|
84
|
+
*
|
|
85
|
+
* must be CopyData; no Brands or other Remotables
|
|
86
|
+
*/
|
|
87
|
+
export const FeedPolicyShape: TypedPattern<FeedPolicy>;
|
|
88
|
+
/**
|
|
89
|
+
* The version of CosmosChainInfoShape that matches the `valueShape` used in FUSDC's ChainHub's `chainInfos` mapStore.
|
|
90
|
+
* @type {TypedPattern<CosmosChainInfo>}
|
|
91
|
+
*/
|
|
92
|
+
export const CosmosChainInfoShapeV1: TypedPattern<CosmosChainInfo>;
|
|
93
|
+
/** @type {TypedPattern<FastUSDCConfig>} */
|
|
94
|
+
export const FastUSDCConfigShape: TypedPattern<FastUSDCConfig>;
|
|
95
|
+
import type { Brand } from '@agoric/ertp';
|
|
96
|
+
import type { NatValue } from '@agoric/ertp';
|
|
97
|
+
import type { Amount } from '@agoric/ertp';
|
|
98
|
+
import type { FastUsdcTerms } from './types.js';
|
|
99
|
+
import type { TypedPattern } from '@agoric/internal';
|
|
100
|
+
import type { EvmAddress } from './types.js';
|
|
101
|
+
import type { EvmHash } from './types.js';
|
|
102
|
+
import type { RiskAssessment } from './types.js';
|
|
103
|
+
import type { CctpTxEvidence } from './types.js';
|
|
104
|
+
import type { EvidenceWithRisk } from './types.js';
|
|
105
|
+
import type { PendingTx } from './types.js';
|
|
106
|
+
import type { AddressHook } from './types.js';
|
|
107
|
+
import type { FeeConfig } from './types.js';
|
|
108
|
+
import type { PoolMetrics } from './types.js';
|
|
109
|
+
import type { ChainPolicy } from './types.js';
|
|
110
|
+
import type { FeedPolicy } from './types.js';
|
|
111
|
+
import type { CosmosChainInfo } from '@agoric/orchestration';
|
|
112
|
+
import type { FastUSDCConfig } from './types.js';
|
|
113
|
+
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["type-guards.js"],"names":[],"mappings":"AAoBO,0CAHI,MAAM,KAAK,CAAC,QACZ,QAAQ;;;EAGmC;AAG/C,yDADK,MAAM,CAAC,YAAY,GAAG,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBtD;AAED,0CAA0C;AAC1C,iCADW,aAAa,aAAa,CAAC,CAGnC;AAEH,uCAAuC;AACvC,8BADW,aAAa,UAAU,CAAC,CAIhC;AAGH,oCAAoC;AACpC,2BADW,aAAa,OAAO,CAAC,CAG7B;AAGH,2CAA2C;AAC3C,kCADW,aAAa,cAAc,CAAC,CAMrC;AAGF,2CAA2C;AAC3C,kCADW,aAAa,cAAc,CAAC,CAgBrC;AAGF,6CAA6C;AAC7C,oCADW,aAAa,gBAAgB,CAAC,CAIvC;AAGF,sCAAsC;AAEtC,6BAFW,aAAa,SAAS,CAAC,CAKhC;AAGF,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CAIlC;AAKF,8DAA8D;AAC9D,wCADW,aAAa,SAAS,CAAC,sBAAsB,CAAC,CAAC,CAYxD;AAEF,sCAAsC;AACtC,6BADW,aAAa,SAAS,CAAC,CAYhC;AAEF,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CAQlC;AAGF,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CAelC;AAGF;;;;GAIG;AACH,8BAJU,aAAa,UAAU,CAAC,CAWhC;AAGF;;;GAGG;AACH,qCAFU,aAAa,eAAe,CAAC,CAcrC;AAEF,2CAA2C;AAC3C,kCADW,aAAa,cAAc,CAAC,CAQpC;2BAzMgD,cAAc;8BAAd,cAAc;4BAAd,cAAc;mCAI+H,YAAY;kCAH7K,kBAAkB;gCAG+I,YAAY;6BAAZ,YAAY;oCAAZ,YAAY;oCAAZ,YAAY;sCAAZ,YAAY;+BAAZ,YAAY;iCAAZ,YAAY;+BAAZ,YAAY;iCAAZ,YAAY;iCAAZ,YAAY;gCAAZ,YAAY;qCAFhG,uBAAuB;oCAE6D,YAAY"}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { Amount } from '@agoric/ertp';
|
|
2
|
+
import type { AccountId, BaseChainInfo, Bech32Address, CaipChainId, CosmosChainAddress, CosmosChainInfo, Denom, DenomDetail, KnownNamespace } from '@agoric/orchestration';
|
|
3
|
+
import type { IBCChannelID } from '@agoric/vats';
|
|
4
|
+
import type { CopyRecord } from '@endo/pass-style';
|
|
5
|
+
import type { PendingTxStatus, TxStatus } from './constants.js';
|
|
6
|
+
import type { RepayAmountKWR } from './utils/fees.js';
|
|
7
|
+
type Ratio = {
|
|
8
|
+
numerator: Amount<'nat'>;
|
|
9
|
+
denominator: Amount<'nat'>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Block hash is calculated using the keccak256 algorithm that always results
|
|
13
|
+
* in 32 bytes (64 hex characters prepended by 0x) no matter the input length.
|
|
14
|
+
*/
|
|
15
|
+
export type EvmHash = `0x${string}`;
|
|
16
|
+
/**
|
|
17
|
+
* An address is always the last 20 bytes (40 hex charaters prepended by 0x) of
|
|
18
|
+
* the public key hash.
|
|
19
|
+
*/
|
|
20
|
+
export type EvmAddress = `0x${string & {
|
|
21
|
+
length: 40;
|
|
22
|
+
}}`;
|
|
23
|
+
export type NobleAddress = `noble1${string}`;
|
|
24
|
+
export type EvmChainID = number;
|
|
25
|
+
export type EvmChainName = string;
|
|
26
|
+
export interface RiskAssessment {
|
|
27
|
+
risksIdentified?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface CctpTxEvidence {
|
|
30
|
+
/** from Noble RPC */
|
|
31
|
+
aux: {
|
|
32
|
+
forwardingChannel: IBCChannelID;
|
|
33
|
+
recipientAddress: CosmosChainAddress['value'] | AccountId;
|
|
34
|
+
};
|
|
35
|
+
/** on the source chain (e.g. L1 Ethereum and L2s Arbitrum, Base) */
|
|
36
|
+
blockHash: EvmHash;
|
|
37
|
+
/** height of blockHash on the source chain */
|
|
38
|
+
blockNumber: bigint;
|
|
39
|
+
/**
|
|
40
|
+
* Seconds since Unix epoch. Not all CCTP source chains update time the same
|
|
41
|
+
* way but they all use Unix epoch and thus are approximately equal. (Within
|
|
42
|
+
* minutes apart.)
|
|
43
|
+
*/
|
|
44
|
+
blockTimestamp: bigint;
|
|
45
|
+
/**
|
|
46
|
+
* [Domain of values](https://chainid.network/) per [EIP-155](https://eips.ethereum.org/EIPS/eip-155)
|
|
47
|
+
* (We don't have [CCTP `domain`](https://developers.circle.com/stablecoins/supported-domains) )
|
|
48
|
+
*/
|
|
49
|
+
chainId: number;
|
|
50
|
+
/** data covered by signature (aka txHash) */
|
|
51
|
+
tx: {
|
|
52
|
+
amount: bigint;
|
|
53
|
+
forwardingAddress: NobleAddress;
|
|
54
|
+
sender: EvmAddress;
|
|
55
|
+
};
|
|
56
|
+
txHash: EvmHash;
|
|
57
|
+
}
|
|
58
|
+
export interface EvidenceWithRisk extends CopyRecord {
|
|
59
|
+
evidence: CctpTxEvidence;
|
|
60
|
+
risk: RiskAssessment;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 'evidence' only available when it's first observed and not in subsequent
|
|
64
|
+
* updates.
|
|
65
|
+
*/
|
|
66
|
+
export interface TransactionRecord extends CopyRecord {
|
|
67
|
+
evidence?: CctpTxEvidence;
|
|
68
|
+
split?: RepayAmountKWR;
|
|
69
|
+
risksIdentified?: string[];
|
|
70
|
+
status: TxStatus;
|
|
71
|
+
}
|
|
72
|
+
/** the record in vstorage at the path of the contract's node */
|
|
73
|
+
export interface ContractRecord extends CopyRecord {
|
|
74
|
+
nobleICA?: CosmosChainAddress['value'];
|
|
75
|
+
poolAccount: CosmosChainAddress['value'];
|
|
76
|
+
settlementAccount: CosmosChainAddress['value'];
|
|
77
|
+
}
|
|
78
|
+
export type LogFn = (...args: unknown[]) => void;
|
|
79
|
+
export interface PendingTx extends CctpTxEvidence {
|
|
80
|
+
status: PendingTxStatus;
|
|
81
|
+
}
|
|
82
|
+
export type FeeConfig = {
|
|
83
|
+
/** flat fee charged for every advance, eligible for LP disbursement */
|
|
84
|
+
flat: Amount<'nat'>;
|
|
85
|
+
/** proportion of advance kept as a fee, eligible for LP disbursement */
|
|
86
|
+
variableRate: Ratio;
|
|
87
|
+
/** proportion of `flat` and `variableRate` fees that goes to the contract (remaining goes to LPs) */
|
|
88
|
+
contractRate: Ratio;
|
|
89
|
+
/**
|
|
90
|
+
* if present, a fee required to relay (e.g. CCTP to EVM/Solana). Not
|
|
91
|
+
* considered for LP disbursement - goes to `contractSeat`.
|
|
92
|
+
*/
|
|
93
|
+
relay?: Amount<'nat'>;
|
|
94
|
+
/** Optional destination-specific overrides. If present, must supersede base values. */
|
|
95
|
+
destinationOverrides?: Record<CaipChainId, Partial<Omit<FeeConfig, 'destinationOverrides'>>>;
|
|
96
|
+
};
|
|
97
|
+
export interface PoolStats {
|
|
98
|
+
totalBorrows: Amount<'nat'>;
|
|
99
|
+
totalContractFees: Amount<'nat'>;
|
|
100
|
+
totalPoolFees: Amount<'nat'>;
|
|
101
|
+
totalRepays: Amount<'nat'>;
|
|
102
|
+
}
|
|
103
|
+
export interface PoolMetrics extends PoolStats {
|
|
104
|
+
encumberedBalance: Amount<'nat'>;
|
|
105
|
+
shareWorth: Ratio;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Published vstorage values under the `fastUsdc.` hierarchy.
|
|
109
|
+
*/
|
|
110
|
+
export type FastUsdcPublishedPathTypes = {
|
|
111
|
+
fastUsdc: ContractRecord;
|
|
112
|
+
'fastUsdc.feeConfig': FeeConfig;
|
|
113
|
+
'fastUsdc.poolMetrics': PoolMetrics;
|
|
114
|
+
} & {
|
|
115
|
+
[K in `fastUsdc.txns.${string}`]: TransactionRecord;
|
|
116
|
+
};
|
|
117
|
+
export interface ChainPolicy {
|
|
118
|
+
/** `msg.sender` of DepositAndBurn to TokenMessenger must be an attenuated wrapper contract that does not contain `replaceDepositForBurn` */
|
|
119
|
+
attenuatedCttpBridgeAddresses: EvmHash[];
|
|
120
|
+
/** @see {@link https://developers.circle.com/stablecoins/evm-smart-contracts} */
|
|
121
|
+
cctpTokenMessengerAddress: EvmHash;
|
|
122
|
+
/** e.g., `1` for ETH mainnet 42161 for Arbitrum One. @see {@link https://chainlist.org/} */
|
|
123
|
+
chainId: EvmChainID;
|
|
124
|
+
/** the number of block confirmations to observe before reporting */
|
|
125
|
+
confirmations: number;
|
|
126
|
+
rateLimits: {
|
|
127
|
+
/** do not advance more than this amount for an individual transaction */
|
|
128
|
+
tx: bigint;
|
|
129
|
+
/** do not advance more than this amount per block window */
|
|
130
|
+
blockWindow: bigint;
|
|
131
|
+
/** the number of blocks to consider for `blockWindow` */
|
|
132
|
+
blockWindowSize: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export type FeedPolicy = {
|
|
136
|
+
nobleDomainId: number;
|
|
137
|
+
nobleAgoricChannelId: string;
|
|
138
|
+
chainPolicies: Record<EvmChainName, ChainPolicy>;
|
|
139
|
+
eventFilter?: string;
|
|
140
|
+
} & CopyRecord;
|
|
141
|
+
export type FastUsdcTerms = {
|
|
142
|
+
usdcDenom: Denom;
|
|
143
|
+
};
|
|
144
|
+
export type FastUSDCConfig = {
|
|
145
|
+
terms: FastUsdcTerms;
|
|
146
|
+
oracles: Record<string, string>;
|
|
147
|
+
feeConfig: FeeConfig;
|
|
148
|
+
feedPolicy: FeedPolicy;
|
|
149
|
+
noNoble: boolean;
|
|
150
|
+
chainInfo: Record<string, ChainHubChainInfo>;
|
|
151
|
+
assetInfo: [Denom, DenomDetail & {
|
|
152
|
+
brandKey?: string;
|
|
153
|
+
}][];
|
|
154
|
+
} & CopyRecord;
|
|
155
|
+
/** decoded address hook parameters */
|
|
156
|
+
export type AddressHook = {
|
|
157
|
+
baseAddress: string;
|
|
158
|
+
query: {
|
|
159
|
+
/** end user destination address */
|
|
160
|
+
EUD: Bech32Address;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* The shape of ChainInfo ChainHub is expecting for FUSDC.
|
|
165
|
+
*
|
|
166
|
+
* Note: this diverges from `CosmosChainInfo` and `BaseChainInfo` in that:
|
|
167
|
+
* - BaseChainInfo includes chainId for backwards compatibility with `CosmosChainInfoShapeV1`
|
|
168
|
+
*/
|
|
169
|
+
export type ChainHubChainInfo<N extends KnownNamespace = KnownNamespace> = N extends 'cosmos' ? CosmosChainInfo : BaseChainInfoWithChainId<N>;
|
|
170
|
+
interface BaseChainInfoWithChainId<N extends KnownNamespace = KnownNamespace> extends BaseChainInfo<N> {
|
|
171
|
+
chainId: string;
|
|
172
|
+
}
|
|
173
|
+
export type * from './constants.js';
|
|
174
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,KAAK,EACL,WAAW,EACX,cAAc,EACf,MAAM,uB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AAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CAC3D,GAAG,UAAU,CAAC;AAEf,sCAAsC;AACtC,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QACL,mCAAmC;QACnC,GAAG,EAAE,aAAa,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IACrE,CAAC,SAAS,QAAQ,GAAG,eAAe,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC;AAErE,UAAU,wBAAwB,CAChC,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,aAAa,CAAC,CAAC,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mBAAmB,gBAAgB,CAAC"}
|
package/src/types.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// XXX duped with Zoe contractSupport ambient types
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Block hash is calculated using the keccak256 algorithm that always results
|
|
26
|
+
* in 32 bytes (64 hex characters prepended by 0x) no matter the input length.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An address is always the last 20 bytes (40 hex charaters prepended by 0x) of
|
|
31
|
+
* the public key hash.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 'evidence' only available when it's first observed and not in subsequent
|
|
80
|
+
* updates.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/** the record in vstorage at the path of the contract's node */
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Published vstorage values under the `fastUsdc.` hierarchy.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
/** decoded address hook parameters */
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The shape of ChainInfo ChainHub is expecting for FUSDC.
|
|
195
|
+
*
|
|
196
|
+
* Note: this diverges from `CosmosChainInfo` and `BaseChainInfo` in that:
|
|
197
|
+
* - BaseChainInfo includes chainId for backwards compatibility with `CosmosChainInfoShapeV1`
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export function makeFeeTools(feeConfig: FeeConfig): {
|
|
2
|
+
/**
|
|
3
|
+
* Calculate the base fee to charge for the advance (variable + flat).
|
|
4
|
+
* Will be shared between the pool and the contract based on
|
|
5
|
+
* {@link FeeConfig.contractRate}.
|
|
6
|
+
*
|
|
7
|
+
* @param {Amount<'nat'>} requested
|
|
8
|
+
* @param {AccountId} destination
|
|
9
|
+
* @returns {Amount<'nat'>}
|
|
10
|
+
*/
|
|
11
|
+
calculateBaseFee(requested: Amount<"nat">, destination: AccountId): Amount<"nat">;
|
|
12
|
+
/**
|
|
13
|
+
* Calculate the optional relay fee charged for certain destinations.
|
|
14
|
+
* Only disbursed to contract seat.
|
|
15
|
+
*
|
|
16
|
+
* @param {AccountId} destination
|
|
17
|
+
* @returns {Amount<'nat'>}
|
|
18
|
+
*/
|
|
19
|
+
calculateRelayFee(destination: AccountId): Amount<"nat">;
|
|
20
|
+
/**
|
|
21
|
+
* Calculate the total fee to charge for the advance.
|
|
22
|
+
*
|
|
23
|
+
* @param {Amount<'nat'>} requested
|
|
24
|
+
* @param {AccountId} destination
|
|
25
|
+
* @throws {Error} if requested does not exceed fees
|
|
26
|
+
*/
|
|
27
|
+
calculateAdvanceFee(requested: Amount<"nat">, destination: AccountId): import("@agoric/ertp").NatAmount;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate the net amount to advance after withholding fees.
|
|
30
|
+
*
|
|
31
|
+
* @param {Amount<'nat'>} requested
|
|
32
|
+
* @param {AccountId} destination
|
|
33
|
+
* @throws {Error} if requested does not exceed fees
|
|
34
|
+
*/
|
|
35
|
+
calculateAdvance(requested: Amount<"nat">, destination: AccountId): import("@agoric/ertp").NatAmount;
|
|
36
|
+
/**
|
|
37
|
+
* Calculate the split of fees between pool and contract.
|
|
38
|
+
*
|
|
39
|
+
* The `ContractFee` includes base fees plus the relay fee.
|
|
40
|
+
*
|
|
41
|
+
* @param {Amount<'nat'>} requested
|
|
42
|
+
* @param {AccountId} destination
|
|
43
|
+
* @returns {RepayAmountKWR} an {@link AmountKeywordRecord}
|
|
44
|
+
* @throws {Error} if requested does not exceed fees
|
|
45
|
+
*/
|
|
46
|
+
calculateSplit(requested: Amount<"nat">, destination: AccountId): RepayAmountKWR;
|
|
47
|
+
};
|
|
48
|
+
export type RepayAmountKWR = {
|
|
49
|
+
Principal: Amount<"nat">;
|
|
50
|
+
PoolFee: Amount<"nat">;
|
|
51
|
+
ContractFee: Amount<"nat">;
|
|
52
|
+
RelayFee: Amount<"nat">;
|
|
53
|
+
};
|
|
54
|
+
export type RepayPaymentKWR = {
|
|
55
|
+
Principal: Payment<"nat">;
|
|
56
|
+
PoolFee: Payment<"nat">;
|
|
57
|
+
ContractFee: Payment<"nat">;
|
|
58
|
+
RelayFee: Payment<"nat">;
|
|
59
|
+
};
|
|
60
|
+
import type { FeeConfig } from '../types.js';
|
|
61
|
+
import type { Amount } from '@agoric/ertp';
|
|
62
|
+
import type { AccountId } from '@agoric/orchestration';
|
|
63
|
+
import type { Payment } from '@agoric/ertp';
|
|
64
|
+
//# sourceMappingURL=fees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["fees.js"],"names":[],"mappings":"AAsDO,wCAFI,SAAS;IAOhB;;;;;;;;OAQG;gCAHQ,OAAO,KAAK,CAAC,eACb,SAAS,GACP,OAAO,KAAK,CAAC;IAW1B;;;;;;OAMG;mCAFQ,SAAS,GACP,OAAO,KAAK,CAAC;IAM1B;;;;;;OAMG;mCAHQ,OAAO,KAAK,CAAC,eACb,SAAS;IAUpB;;;;;;OAMG;gCAHQ,OAAO,KAAK,CAAC,eACb,SAAS;IAOpB;;;;;;;;;OASG;8BAJQ,OAAO,KAAK,CAAC,eACb,SAAS,GACP,cAAc;EAsB9B;6BA9HY;IACT,SAAS,EAAE,OAAO,KAAK,CAAC,CAAC;IACzB,OAAO,EAAE,OAAO,KAAK,CAAC,CAAC;IACvB,WAAW,EAAE,OAAO,KAAK,CAAC,CAAC;IAC3B,QAAQ,EAAE,OAAO,KAAK,CAAC,CAAC;CACxB;8BAIS;IACT,SAAS,EAAE,QAAQ,KAAK,CAAC,CAAC;IAC1B,OAAO,EAAE,QAAQ,KAAK,CAAC,CAAC;IACxB,WAAW,EAAE,QAAQ,KAAK,CAAC,CAAC;IAC5B,QAAQ,EAAE,QAAQ,KAAK,CAAC,CAAC;CACzB;+BAlBwB,aAAa;4BAFP,cAAc;+BACpB,uBAAuB;6BADjB,cAAc"}
|