@agoric/orchestration 0.1.1-dev-0889e20.0 → 0.1.1-dev-81ac381.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 +16 -16
- package/src/cosmos-api.d.ts +12 -0
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +15 -0
- package/src/examples/auto-stake-it-tap-kit.d.ts +49 -0
- package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -0
- package/src/examples/auto-stake-it-tap-kit.js +157 -0
- package/src/examples/auto-stake-it.contract.d.ts +45 -0
- package/src/examples/auto-stake-it.contract.d.ts.map +1 -0
- package/src/examples/auto-stake-it.contract.js +188 -0
- package/src/examples/basic-flows.contract.d.ts +14 -5
- package/src/examples/basic-flows.contract.d.ts.map +1 -1
- package/src/examples/basic-flows.contract.js +74 -12
- package/src/examples/sendAnywhere.contract.d.ts +3 -9
- package/src/examples/sendAnywhere.contract.d.ts.map +1 -1
- package/src/examples/sendAnywhere.contract.js +3 -35
- package/src/examples/stakeBld.contract.d.ts +21 -0
- package/src/examples/stakeBld.contract.d.ts.map +1 -1
- package/src/exos/chain-hub-admin.d.ts +21 -0
- package/src/exos/chain-hub-admin.d.ts.map +1 -0
- package/src/exos/chain-hub-admin.js +56 -0
- package/src/exos/local-chain-facade.d.ts +42 -0
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.d.ts +22 -0
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +10 -3
- package/src/exos/portfolio-holder-kit.d.ts +64 -0
- package/src/exos/portfolio-holder-kit.d.ts.map +1 -0
- package/src/exos/portfolio-holder-kit.js +174 -0
- package/src/proposals/start-stakeBld.d.ts +21 -0
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/utils/time.d.ts +1 -0
- package/src/utils/time.d.ts.map +1 -1
- package/src/utils/time.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-81ac381.0+81ac381",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/network": "0.1.1-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
45
|
-
"@agoric/vats": "0.15.2-dev-
|
|
46
|
-
"@agoric/vow": "0.1.1-dev-
|
|
47
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
48
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/async-flow": "0.1.1-dev-81ac381.0+81ac381",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-81ac381.0+81ac381",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-81ac381.0+81ac381",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-81ac381.0+81ac381",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-81ac381.0+81ac381",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-81ac381.0+81ac381",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-81ac381.0+81ac381",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-81ac381.0+81ac381",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-81ac381.0+81ac381",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-81ac381.0+81ac381",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-81ac381.0+81ac381",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-81ac381.0+81ac381",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-81ac381.0+81ac381",
|
|
49
49
|
"@endo/base64": "^1.0.5",
|
|
50
50
|
"@endo/errors": "^1.2.2",
|
|
51
51
|
"@endo/far": "^1.1.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "github:paulmillr/noble-hashes#ae060da"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-81ac381.0+81ac381",
|
|
58
58
|
"@chain-registry/client": "^1.47.4",
|
|
59
59
|
"@cosmjs/amino": "^0.32.3",
|
|
60
60
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typeCoverage": {
|
|
95
95
|
"atLeast": 98.09
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "81ac38153db929618831ac19f57c019769d3cbef"
|
|
98
98
|
}
|
package/src/cosmos-api.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/
|
|
|
7
7
|
import type { Brand, Purse, Payment, Amount } from '@agoric/ertp/src/types.js';
|
|
8
8
|
import type { Port } from '@agoric/network';
|
|
9
9
|
import type { IBCChannelID, IBCConnectionID } from '@agoric/vats';
|
|
10
|
+
import type { TargetApp, TargetRegistration } from '@agoric/vats/src/bridge-target.js';
|
|
10
11
|
import type { LocalIbcAddress, RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
11
12
|
import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
|
|
12
13
|
/** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
|
|
@@ -160,6 +161,17 @@ export type LocalAccountMethods = {
|
|
|
160
161
|
deposit: (payment: Payment<'nat'>) => Promise<void>;
|
|
161
162
|
/** withdraw a Payment from the account */
|
|
162
163
|
withdraw: (amount: Amount<'nat'>) => Promise<Payment<'nat'>>;
|
|
164
|
+
/**
|
|
165
|
+
* Register a handler that receives an event each time ICS-20 transfers are
|
|
166
|
+
* sent or received by the underlying account. Each account may be associated
|
|
167
|
+
* with at most one handler at a given time.
|
|
168
|
+
* Does not grant the handler the ability to intercept a transfer. For a
|
|
169
|
+
* blocking handler, aka 'IBC Hooks', leverage `registerActiveTap` from
|
|
170
|
+
* `transferMiddleware` directly.
|
|
171
|
+
*
|
|
172
|
+
* @param tap
|
|
173
|
+
*/
|
|
174
|
+
monitorTransfers: (tap: TargetApp) => Promise<TargetRegistration>;
|
|
163
175
|
};
|
|
164
176
|
export type IBCMsgTransferOptions = {
|
|
165
177
|
timeoutHeight?: MsgTransfer['timeoutHeight'];
|
package/src/cosmos-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-api.d.ts","sourceRoot":"","sources":["cosmos-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,KAAK,EACV,KAAK,IAAI,eAAe,EACxB,KAAK,EACN,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC7G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AClB,GACG,UAAU,GACV,EAAE,CAAC,GACL,GAAG,SAAS;IACZ,aAAa,EAAE,EAAE,CAAC;CACnB,GACG,qBAAqB,GACrB,EAAE,CAAC"}
|
package/src/cosmos-api.ts
CHANGED
|
@@ -14,6 +14,10 @@ import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/
|
|
|
14
14
|
import type { Brand, Purse, Payment, Amount } from '@agoric/ertp/src/types.js';
|
|
15
15
|
import type { Port } from '@agoric/network';
|
|
16
16
|
import type { IBCChannelID, IBCConnectionID } from '@agoric/vats';
|
|
17
|
+
import type {
|
|
18
|
+
TargetApp,
|
|
19
|
+
TargetRegistration,
|
|
20
|
+
} from '@agoric/vats/src/bridge-target.js';
|
|
17
21
|
import type {
|
|
18
22
|
LocalIbcAddress,
|
|
19
23
|
RemoteIbcAddress,
|
|
@@ -208,6 +212,17 @@ export type LocalAccountMethods = {
|
|
|
208
212
|
deposit: (payment: Payment<'nat'>) => Promise<void>;
|
|
209
213
|
/** withdraw a Payment from the account */
|
|
210
214
|
withdraw: (amount: Amount<'nat'>) => Promise<Payment<'nat'>>;
|
|
215
|
+
/**
|
|
216
|
+
* Register a handler that receives an event each time ICS-20 transfers are
|
|
217
|
+
* sent or received by the underlying account. Each account may be associated
|
|
218
|
+
* with at most one handler at a given time.
|
|
219
|
+
* Does not grant the handler the ability to intercept a transfer. For a
|
|
220
|
+
* blocking handler, aka 'IBC Hooks', leverage `registerActiveTap` from
|
|
221
|
+
* `transferMiddleware` directly.
|
|
222
|
+
*
|
|
223
|
+
* @param tap
|
|
224
|
+
*/
|
|
225
|
+
monitorTransfers: (tap: TargetApp) => Promise<TargetRegistration>;
|
|
211
226
|
};
|
|
212
227
|
|
|
213
228
|
export type IBCMsgTransferOptions = {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function prepareStakingTap(zone: Zone, vowTools: VowTools): (...args: Parameters<ReturnType<typeof prepareStakingTapKit>>) => ReturnType<ReturnType<typeof prepareStakingTapKit>>["tap"];
|
|
2
|
+
export type StakingTapState = {
|
|
3
|
+
stakingAccount: ERef<OrchestrationAccount<any> & StakingAccountActions>;
|
|
4
|
+
localAccount: ERef<OrchestrationAccount<{
|
|
5
|
+
chainId: "agoric";
|
|
6
|
+
}>>;
|
|
7
|
+
validator: CosmosValidatorAddress;
|
|
8
|
+
localChainAddress: ChainAddress;
|
|
9
|
+
remoteChainAddress: ChainAddress;
|
|
10
|
+
sourceChannel: IBCChannelID;
|
|
11
|
+
remoteDenom: Denom;
|
|
12
|
+
localDenom: Denom;
|
|
13
|
+
};
|
|
14
|
+
export type MakeStakingTap = ReturnType<typeof prepareStakingTap>;
|
|
15
|
+
export type StakingTap = ReturnType<MakeStakingTap>;
|
|
16
|
+
import type { Zone } from '@agoric/zone';
|
|
17
|
+
import type { VowTools } from '@agoric/vow';
|
|
18
|
+
/**
|
|
19
|
+
* @param {Zone} zone
|
|
20
|
+
* @param {VowTools} vowTools
|
|
21
|
+
*/
|
|
22
|
+
declare function prepareStakingTapKit(zone: Zone, { watch }: VowTools): (initialState: StakingTapState) => import("@endo/exo").GuardedKit<{
|
|
23
|
+
tap: {
|
|
24
|
+
/**
|
|
25
|
+
* Transfers from localAccount to stakingAccount, then delegates from
|
|
26
|
+
* the stakingAccount to `validator` if the expected token (remoteDenom)
|
|
27
|
+
* is received.
|
|
28
|
+
*
|
|
29
|
+
* @param {VTransferIBCEvent} event
|
|
30
|
+
*/
|
|
31
|
+
receiveUpcall(event: VTransferIBCEvent): import("@agoric/vow").Vow<void> | undefined;
|
|
32
|
+
};
|
|
33
|
+
transferWatcher: {
|
|
34
|
+
/**
|
|
35
|
+
* @param {void} _result
|
|
36
|
+
* @param {bigint} value the qty of uatom to delegate
|
|
37
|
+
*/
|
|
38
|
+
onFulfilled(_result: void, value: bigint): import("@agoric/vow").Vow<void>;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
import type { OrchestrationAccount } from '@agoric/orchestration';
|
|
42
|
+
import type { StakingAccountActions } from '@agoric/orchestration';
|
|
43
|
+
import type { CosmosValidatorAddress } from '@agoric/orchestration';
|
|
44
|
+
import type { ChainAddress } from '@agoric/orchestration';
|
|
45
|
+
import type { IBCChannelID } from '@agoric/vats';
|
|
46
|
+
import type { Denom } from '@agoric/orchestration';
|
|
47
|
+
import type { VTransferIBCEvent } from '@agoric/vats';
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=auto-stake-it-tap-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-stake-it-tap-kit.d.ts","sourceRoot":"","sources":["auto-stake-it-tap-kit.js"],"names":[],"mappings":"AAsJO,wCANI,IAAI,YACJ,QAAQ,GACN,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,KACzD,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAKjE;8BArIY;IACZ,cAAkB,EAAE,IAAI,CAAC,qBAAqB,GAAG,CAAC,GAAG,qBAAqB,CAAC,CAAC;IAC5E,YAAgB,EAAE,IAAI,CAAC,qBAAqB;QAAE,OAAO,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC,CAAC;IACpE,SAAa,EAAE,sBAAsB,CAAC;IACtC,iBAAqB,EAAE,YAAY,CAAC;IACpC,kBAAsB,EAAE,YAAY,CAAC;IACrC,aAAiB,EAAE,YAAY,CAAC;IAChC,WAAe,EAAE,KAAK,CAAC;IACvB,UAAc,EAAE,KAAK,CAAC;CACnB;6BA8HU,UAAU,CAAC,OAAO,iBAAiB,CAAC;yBACpC,UAAU,CAAC,cAAc,CAAC;0BAhJjB,cAAc;8BADV,aAAa;AAkCxC;;;GAGG;AACH,4CAHW,IAAI,aACJ,QAAQ;;QAwBX;;;;;;WAMG;6BADQ,iBAAiB;;;QAwC5B;;;WAGG;6BAFQ,IAAI,SACJ,MAAM;;GAcxB;0CAtH0G,uBAAuB;2CAAvB,uBAAuB;4CAAvB,uBAAuB;kCAAvB,uBAAuB;kCAJhF,cAAc;2BAI2C,uBAAuB;uCAJhF,cAAc"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { M, mustMatch } from '@endo/patterns';
|
|
2
|
+
import { E } from '@endo/far';
|
|
3
|
+
import { VowShape } from '@agoric/vow';
|
|
4
|
+
import { makeTracer } from '@agoric/internal';
|
|
5
|
+
import { atob } from '@endo/base64';
|
|
6
|
+
import { ChainAddressShape } from '../typeGuards.js';
|
|
7
|
+
|
|
8
|
+
const trace = makeTracer('AutoStakeItTap');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @import {IBCChannelID, VTransferIBCEvent} from '@agoric/vats';
|
|
12
|
+
* @import {VowTools} from '@agoric/vow';
|
|
13
|
+
* @import {Zone} from '@agoric/zone';
|
|
14
|
+
* @import {TargetApp} from '@agoric/vats/src/bridge-target.js';
|
|
15
|
+
* @import {ChainAddress, CosmosValidatorAddress, Denom, OrchestrationAccount, StakingAccountActions} from '@agoric/orchestration';
|
|
16
|
+
* @import {FungibleTokenPacketData} from '@agoric/cosmic-proto/ibc/applications/transfer/v2/packet.js';
|
|
17
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {{
|
|
22
|
+
* stakingAccount: ERef<OrchestrationAccount<any> & StakingAccountActions>;
|
|
23
|
+
* localAccount: ERef<OrchestrationAccount<{ chainId: 'agoric' }>>;
|
|
24
|
+
* validator: CosmosValidatorAddress;
|
|
25
|
+
* localChainAddress: ChainAddress;
|
|
26
|
+
* remoteChainAddress: ChainAddress;
|
|
27
|
+
* sourceChannel: IBCChannelID;
|
|
28
|
+
* remoteDenom: Denom;
|
|
29
|
+
* localDenom: Denom;
|
|
30
|
+
* }} StakingTapState
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** @type {TypedPattern<StakingTapState>} */
|
|
34
|
+
const StakingTapStateShape = {
|
|
35
|
+
stakingAccount: M.remotable('CosmosOrchestrationAccount'),
|
|
36
|
+
localAccount: M.remotable('LocalOrchestrationAccount'),
|
|
37
|
+
validator: ChainAddressShape,
|
|
38
|
+
localChainAddress: ChainAddressShape,
|
|
39
|
+
remoteChainAddress: ChainAddressShape,
|
|
40
|
+
sourceChannel: M.string(),
|
|
41
|
+
remoteDenom: M.string(),
|
|
42
|
+
localDenom: M.string(),
|
|
43
|
+
};
|
|
44
|
+
harden(StakingTapStateShape);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {Zone} zone
|
|
48
|
+
* @param {VowTools} vowTools
|
|
49
|
+
*/
|
|
50
|
+
const prepareStakingTapKit = (zone, { watch }) => {
|
|
51
|
+
return zone.exoClassKit(
|
|
52
|
+
'StakingTapKit',
|
|
53
|
+
{
|
|
54
|
+
tap: M.interface('AutoStakeItTap', {
|
|
55
|
+
receiveUpcall: M.call(M.record()).returns(
|
|
56
|
+
M.or(VowShape, M.undefined()),
|
|
57
|
+
),
|
|
58
|
+
}),
|
|
59
|
+
transferWatcher: M.interface('TransferWatcher', {
|
|
60
|
+
onFulfilled: M.call(M.undefined())
|
|
61
|
+
.optional(M.bigint())
|
|
62
|
+
.returns(VowShape),
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
/** @param {StakingTapState} initialState */
|
|
66
|
+
initialState => {
|
|
67
|
+
mustMatch(initialState, StakingTapStateShape);
|
|
68
|
+
return harden(initialState);
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
tap: {
|
|
72
|
+
/**
|
|
73
|
+
* Transfers from localAccount to stakingAccount, then delegates from
|
|
74
|
+
* the stakingAccount to `validator` if the expected token (remoteDenom)
|
|
75
|
+
* is received.
|
|
76
|
+
*
|
|
77
|
+
* @param {VTransferIBCEvent} event
|
|
78
|
+
*/
|
|
79
|
+
receiveUpcall(event) {
|
|
80
|
+
trace('receiveUpcall', event);
|
|
81
|
+
|
|
82
|
+
// ignore packets from unknown channels
|
|
83
|
+
if (event.packet.source_channel !== this.state.sourceChannel) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const tx = /** @type {FungibleTokenPacketData} */ (
|
|
88
|
+
JSON.parse(atob(event.packet.data))
|
|
89
|
+
);
|
|
90
|
+
trace('receiveUpcall packet data', tx);
|
|
91
|
+
|
|
92
|
+
const { remoteDenom, localChainAddress } = this.state;
|
|
93
|
+
// ignore outgoing transfers
|
|
94
|
+
if (tx.receiver !== localChainAddress.value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// only interested in transfers of `remoteDenom`
|
|
98
|
+
if (tx.denom !== remoteDenom) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const { localAccount, localDenom, remoteChainAddress } = this.state;
|
|
103
|
+
return watch(
|
|
104
|
+
E(localAccount).transfer(
|
|
105
|
+
{
|
|
106
|
+
denom: localDenom,
|
|
107
|
+
value: BigInt(tx.amount),
|
|
108
|
+
},
|
|
109
|
+
remoteChainAddress,
|
|
110
|
+
),
|
|
111
|
+
this.facets.transferWatcher,
|
|
112
|
+
BigInt(tx.amount),
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
transferWatcher: {
|
|
117
|
+
/**
|
|
118
|
+
* @param {void} _result
|
|
119
|
+
* @param {bigint} value the qty of uatom to delegate
|
|
120
|
+
*/
|
|
121
|
+
onFulfilled(_result, value) {
|
|
122
|
+
const { stakingAccount, validator, remoteDenom } = this.state;
|
|
123
|
+
return watch(
|
|
124
|
+
E(stakingAccount).delegate(validator, {
|
|
125
|
+
denom: remoteDenom,
|
|
126
|
+
value,
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Provides a {@link TargetApp} that reacts to an incoming IBC transfer by:
|
|
137
|
+
*
|
|
138
|
+
* 1. transferring the funds to the staking account specified at initialization
|
|
139
|
+
* 2. delegating the funds to the validator specified at initialization
|
|
140
|
+
*
|
|
141
|
+
* XXX consider a facet with a method for changing the validator
|
|
142
|
+
*
|
|
143
|
+
* XXX consider logic for multiple stakingAccounts + denoms
|
|
144
|
+
*
|
|
145
|
+
* @param {Zone} zone
|
|
146
|
+
* @param {VowTools} vowTools
|
|
147
|
+
* @returns {(
|
|
148
|
+
* ...args: Parameters<ReturnType<typeof prepareStakingTapKit>>
|
|
149
|
+
* ) => ReturnType<ReturnType<typeof prepareStakingTapKit>>['tap']}
|
|
150
|
+
*/
|
|
151
|
+
export const prepareStakingTap = (zone, vowTools) => {
|
|
152
|
+
const makeKit = prepareStakingTapKit(zone, vowTools);
|
|
153
|
+
return (...args) => makeKit(...args).tap;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/** @typedef {ReturnType<typeof prepareStakingTap>} MakeStakingTap */
|
|
157
|
+
/** @typedef {ReturnType<MakeStakingTap>} StakingTap */
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: OrchestrationPowers & {
|
|
2
|
+
marshaller: Marshaller;
|
|
3
|
+
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
4
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
5
|
+
makeAccountsInvitation(): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/vow").Vow<{
|
|
6
|
+
publicSubscribers: {
|
|
7
|
+
[k: string]: ResolvedPublicTopic<unknown>;
|
|
8
|
+
};
|
|
9
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
10
|
+
MakeInvitation<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
|
|
11
|
+
}>;
|
|
12
|
+
}>>, {
|
|
13
|
+
chainName: string;
|
|
14
|
+
validator: CosmosValidatorAddress;
|
|
15
|
+
localDenom: Denom;
|
|
16
|
+
}>>;
|
|
17
|
+
}>;
|
|
18
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
19
|
+
initChain(chainName: string, chainInfo: Readonly<{
|
|
20
|
+
chainId: string;
|
|
21
|
+
connections?: Record<string, import("@agoric/orchestration").IBCConnectionInfo>;
|
|
22
|
+
icqEnabled?: boolean;
|
|
23
|
+
stakingTokens?: Readonly<Array<{
|
|
24
|
+
denom: string;
|
|
25
|
+
}>>;
|
|
26
|
+
}>, connectionInfo: import("@agoric/orchestration").IBCConnectionInfo): Promise<void>;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
export type OrchestrationPowers = {
|
|
30
|
+
localchain: Remote<LocalChain>;
|
|
31
|
+
orchestrationService: Remote<CosmosInterchainService>;
|
|
32
|
+
storageNode: Remote<StorageNode>;
|
|
33
|
+
timerService: Remote<TimerService>;
|
|
34
|
+
agoricNames: Remote<NameHub>;
|
|
35
|
+
};
|
|
36
|
+
export type AutoStakeItSF = typeof start;
|
|
37
|
+
import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
38
|
+
import type { CosmosValidatorAddress } from '@agoric/orchestration';
|
|
39
|
+
import type { Denom } from '@agoric/orchestration';
|
|
40
|
+
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
41
|
+
import type { Remote } from '@agoric/vow';
|
|
42
|
+
import type { CosmosInterchainService } from '@agoric/orchestration';
|
|
43
|
+
import type { TimerService } from '@agoric/time';
|
|
44
|
+
import type { NameHub } from '@agoric/vats';
|
|
45
|
+
//# sourceMappingURL=auto-stake-it.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-stake-it.contract.d.ts","sourceRoot":"","sources":["auto-stake-it.contract.js"],"names":[],"mappings":"AAyLA;gBAhDiB,UAAU;;;;;;;;;;;uBA5FX,MAAM;uBACN,sBAAsB;wBACrB,KAAK;;;;;;;;;;;;;GA0I2B;kCA9JpC;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;4BA0JU,OAAO,KAAK;yCA9KY,2CAA2C;4CAMmD,uBAAuB;2BAAvB,uBAAuB;gCAL9H,gCAAgC;4BAEpC,aAAa;6CAG8F,uBAAuB;kCAP5H,cAAc;6BAGnB,cAAc"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EmptyProposalShape,
|
|
3
|
+
InvitationShape,
|
|
4
|
+
} from '@agoric/zoe/src/typeGuards.js';
|
|
5
|
+
import { Fail } from '@endo/errors';
|
|
6
|
+
import { M } from '@endo/patterns';
|
|
7
|
+
import { withOrchestration } from '../utils/start-helper.js';
|
|
8
|
+
import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
|
|
9
|
+
import { prepareStakingTap } from './auto-stake-it-tap-kit.js';
|
|
10
|
+
import { preparePortfolioHolder } from '../exos/portfolio-holder-kit.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @import {TimerService} from '@agoric/time';
|
|
14
|
+
* @import {ResolvedPublicTopic} from '@agoric/zoe/src/contractSupport/topics.js';
|
|
15
|
+
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
16
|
+
* @import {NameHub} from '@agoric/vats';
|
|
17
|
+
* @import {Remote} from '@agoric/vow';
|
|
18
|
+
* @import {Zone} from '@agoric/zone';
|
|
19
|
+
* @import {GuestInterface} from '@agoric/async-flow';
|
|
20
|
+
* @import {CosmosValidatorAddress, Orchestrator, CosmosInterchainService, Denom, OrchestrationAccount, StakingAccountActions} from '@agoric/orchestration';
|
|
21
|
+
* @import {MakeStakingTap} from './auto-stake-it-tap-kit.js';
|
|
22
|
+
* @import {MakePortfolioHolder} from '../exos/portfolio-holder-kit.js';
|
|
23
|
+
* @import {ChainHub} from '../exos/chain-hub.js';
|
|
24
|
+
* @import {OrchestrationTools} from '../utils/start-helper.js';
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {{
|
|
29
|
+
* localchain: Remote<LocalChain>;
|
|
30
|
+
* orchestrationService: Remote<CosmosInterchainService>;
|
|
31
|
+
* storageNode: Remote<StorageNode>;
|
|
32
|
+
* timerService: Remote<TimerService>;
|
|
33
|
+
* agoricNames: Remote<NameHub>;
|
|
34
|
+
* }} OrchestrationPowers
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {Orchestrator} orch
|
|
39
|
+
* @param {{
|
|
40
|
+
* makeStakingTap: MakeStakingTap;
|
|
41
|
+
* makePortfolioHolder: MakePortfolioHolder;
|
|
42
|
+
* chainHub: GuestInterface<ChainHub>;
|
|
43
|
+
* }} ctx
|
|
44
|
+
* @param {ZCFSeat} seat
|
|
45
|
+
* @param {{
|
|
46
|
+
* chainName: string;
|
|
47
|
+
* validator: CosmosValidatorAddress;
|
|
48
|
+
* localDenom: Denom;
|
|
49
|
+
* }} offerArgs
|
|
50
|
+
*/
|
|
51
|
+
const makeAccountsHandler = async (
|
|
52
|
+
orch,
|
|
53
|
+
{ makeStakingTap, makePortfolioHolder, chainHub },
|
|
54
|
+
seat,
|
|
55
|
+
{
|
|
56
|
+
chainName,
|
|
57
|
+
validator,
|
|
58
|
+
// TODO localDenom is user supplied, until #9211
|
|
59
|
+
localDenom,
|
|
60
|
+
},
|
|
61
|
+
) => {
|
|
62
|
+
seat.exit(); // no funds exchanged
|
|
63
|
+
const [agoric, remoteChain] = await Promise.all([
|
|
64
|
+
orch.getChain('agoric'),
|
|
65
|
+
orch.getChain(chainName),
|
|
66
|
+
]);
|
|
67
|
+
const { chainId, stakingTokens } = await remoteChain.getChainInfo();
|
|
68
|
+
const remoteDenom = stakingTokens[0].denom;
|
|
69
|
+
remoteDenom ||
|
|
70
|
+
Fail`${chainId || chainName} does not have stakingTokens in config`;
|
|
71
|
+
if (chainId !== validator.chainId) {
|
|
72
|
+
Fail`validator chainId ${validator.chainId} does not match remote chainId ${chainId}`;
|
|
73
|
+
}
|
|
74
|
+
const [localAccount, stakingAccount] = await Promise.all([
|
|
75
|
+
agoric.makeAccount(),
|
|
76
|
+
/** @type {Promise<OrchestrationAccount<any> & StakingAccountActions>} */ (
|
|
77
|
+
remoteChain.makeAccount()
|
|
78
|
+
),
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
const [localChainAddress, remoteChainAddress] = await Promise.all([
|
|
82
|
+
localAccount.getAddress(),
|
|
83
|
+
stakingAccount.getAddress(),
|
|
84
|
+
]);
|
|
85
|
+
const agoricChainId = (await agoric.getChainInfo()).chainId;
|
|
86
|
+
const { transferChannel } = await chainHub.getConnectionInfo(
|
|
87
|
+
agoricChainId,
|
|
88
|
+
chainId,
|
|
89
|
+
);
|
|
90
|
+
assert(transferChannel.counterPartyChannelId, 'unable to find sourceChannel');
|
|
91
|
+
|
|
92
|
+
// Every time the `localAccount` receives `remoteDenom` over IBC, delegate it.
|
|
93
|
+
const tap = makeStakingTap({
|
|
94
|
+
localAccount,
|
|
95
|
+
stakingAccount,
|
|
96
|
+
validator,
|
|
97
|
+
localChainAddress,
|
|
98
|
+
remoteChainAddress,
|
|
99
|
+
sourceChannel: transferChannel.counterPartyChannelId,
|
|
100
|
+
remoteDenom,
|
|
101
|
+
localDenom,
|
|
102
|
+
});
|
|
103
|
+
// XXX consider storing appRegistration, so we can .revoke() or .updateTargetApp()
|
|
104
|
+
// @ts-expect-error tap.receiveUpcall: 'Vow<void> | undefined' not assignable to 'Promise<any>'
|
|
105
|
+
await localAccount.monitorTransfers(tap);
|
|
106
|
+
|
|
107
|
+
const accountEntries = harden(
|
|
108
|
+
/** @type {[string, OrchestrationAccount<any>][]} */ ([
|
|
109
|
+
['agoric', localAccount],
|
|
110
|
+
[chainName, stakingAccount],
|
|
111
|
+
]),
|
|
112
|
+
);
|
|
113
|
+
const publicTopicEntries = harden(
|
|
114
|
+
/** @type {[string, ResolvedPublicTopic<unknown>][]} */ (
|
|
115
|
+
await Promise.all(
|
|
116
|
+
accountEntries.map(async ([name, account]) => {
|
|
117
|
+
const { account: topicRecord } = await account.getPublicTopics();
|
|
118
|
+
return [name, topicRecord];
|
|
119
|
+
}),
|
|
120
|
+
)
|
|
121
|
+
),
|
|
122
|
+
);
|
|
123
|
+
const portfolioHolder = makePortfolioHolder(
|
|
124
|
+
accountEntries,
|
|
125
|
+
publicTopicEntries,
|
|
126
|
+
);
|
|
127
|
+
return portfolioHolder.asContinuingOffer();
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* AutoStakeIt allows users to to create an auto-forwarding address that
|
|
132
|
+
* transfers and stakes tokens on a remote chain when received.
|
|
133
|
+
*
|
|
134
|
+
* To be wrapped with `withOrchestration`.
|
|
135
|
+
*
|
|
136
|
+
* @param {ZCF} zcf
|
|
137
|
+
* @param {OrchestrationPowers & {
|
|
138
|
+
* marshaller: Marshaller;
|
|
139
|
+
* }} _privateArgs
|
|
140
|
+
* @param {Zone} zone
|
|
141
|
+
* @param {OrchestrationTools} tools
|
|
142
|
+
*/
|
|
143
|
+
const contract = async (
|
|
144
|
+
zcf,
|
|
145
|
+
_privateArgs,
|
|
146
|
+
zone,
|
|
147
|
+
{ chainHub, orchestrate, vowTools },
|
|
148
|
+
) => {
|
|
149
|
+
const makeStakingTap = prepareStakingTap(
|
|
150
|
+
zone.subZone('stakingTap'),
|
|
151
|
+
vowTools,
|
|
152
|
+
);
|
|
153
|
+
const makePortfolioHolder = preparePortfolioHolder(
|
|
154
|
+
zone.subZone('portfolio'),
|
|
155
|
+
vowTools,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const makeAccounts = orchestrate(
|
|
159
|
+
'makeAccounts',
|
|
160
|
+
{ makeStakingTap, makePortfolioHolder, chainHub },
|
|
161
|
+
makeAccountsHandler,
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const publicFacet = zone.exo(
|
|
165
|
+
'AutoStakeIt Public Facet',
|
|
166
|
+
M.interface('AutoStakeIt Public Facet', {
|
|
167
|
+
makeAccountsInvitation: M.callWhen().returns(InvitationShape),
|
|
168
|
+
}),
|
|
169
|
+
{
|
|
170
|
+
makeAccountsInvitation() {
|
|
171
|
+
return zcf.makeInvitation(
|
|
172
|
+
makeAccounts,
|
|
173
|
+
'Make Accounts',
|
|
174
|
+
undefined,
|
|
175
|
+
EmptyProposalShape,
|
|
176
|
+
);
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const creatorFacet = prepareChainHubAdmin(zone, chainHub);
|
|
182
|
+
|
|
183
|
+
return { publicFacet, creatorFacet };
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const start = withOrchestration(contract);
|
|
187
|
+
|
|
188
|
+
/** @typedef {typeof start} AutoStakeItSF */
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: OrchestrationPowers & {
|
|
2
2
|
marshaller: Marshaller;
|
|
3
|
-
}, baggage: Baggage)
|
|
3
|
+
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
4
4
|
publicFacet: import("@endo/exo").Guarded<{
|
|
5
|
-
makeOrchAccountInvitation(): Promise<Invitation<Vow<import("../utils/zoe-tools.js").ResolvedContinuingOfferResult>, {
|
|
5
|
+
makeOrchAccountInvitation(): Promise<Invitation<import("@agoric/vow").Vow<import("../utils/zoe-tools.js").ResolvedContinuingOfferResult>, {
|
|
6
6
|
chainName: string;
|
|
7
7
|
}>>;
|
|
8
|
+
makePortfolioAccountInvitation(): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/vow").Vow<{
|
|
9
|
+
publicSubscribers: {
|
|
10
|
+
[k: string]: ResolvedPublicTopic<unknown>;
|
|
11
|
+
};
|
|
12
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
13
|
+
MakeInvitation<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
|
|
14
|
+
}>;
|
|
15
|
+
}>>, {
|
|
16
|
+
chainNames: string[];
|
|
17
|
+
}>>;
|
|
8
18
|
}>;
|
|
9
19
|
}>;
|
|
10
20
|
export type BasicFlowsSF = typeof start;
|
|
11
21
|
import type { OrchestrationPowers } from '../utils/start-helper.js';
|
|
12
|
-
import type {
|
|
13
|
-
import type { Vow } from '@agoric/vow';
|
|
22
|
+
import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
14
23
|
//# sourceMappingURL=basic-flows.contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-flows.contract.d.ts","sourceRoot":"","sources":["basic-flows.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basic-flows.contract.d.ts","sourceRoot":"","sources":["basic-flows.contract.js"],"names":[],"mappings":"AAmIA;gBAhDiB,UAAU;;;;uBA1DH,MAAM;;;;;;;;;;wBAmBL,MAAM,EAAE;;;GAuFgB;2BAEnC,OAAO,KAAK;yCAxHY,0BAA0B;yCAD1B,2CAA2C"}
|