-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { prepareAsyncFlowTools } from '@agoric/async-flow'; | ||
import { prepareVowTools } from '@agoric/vow'; | ||
import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js'; | ||
import { makeDurableZone } from '@agoric/zone/durable.js'; | ||
import { prepareLocalChainAccountKit } from '../exos/local-chain-account-kit.js'; | ||
import { makeOrchestrationFacade } from '../facade.js'; | ||
import { makeChainHub } from './chainHub.js'; | ||
|
||
/** | ||
* @import {PromiseKit} from '@endo/promise-kit' | ||
* @import {LocalChain} from '@agoric/vats/src/localchain.js'; | ||
* @import {TimerService, TimerBrand} from '@agoric/time'; | ||
* @import {Baggage} from '@agoric/vat-data'; | ||
* @import {NameHub} from '@agoric/vats'; | ||
* @import {Remote} from '@agoric/vow'; | ||
* @import {OrchestrationService} from '../service.js'; | ||
*/ | ||
|
||
/** | ||
* @typedef {{ | ||
* localchain: Remote<LocalChain>; | ||
* orchestrationService: Remote<OrchestrationService>; | ||
* storageNode: Remote<StorageNode>; | ||
* timerService: Remote<TimerService>; | ||
* agoricNames: Remote<NameHub>; | ||
* }} OrchestrationPowers | ||
*/ | ||
|
||
/** | ||
* Helper that a contract start function can use to set up the objects needed | ||
* for orchestration. | ||
* | ||
* @param {ZCF} zcf | ||
* @param {Baggage} baggage | ||
* @param {OrchestrationPowers} remotePowers | ||
* @param {Marshaller} marshaller | ||
*/ | ||
export const provideOrchestration = ( | ||
zcf, | ||
baggage, | ||
remotePowers, | ||
marshaller, | ||
) => { | ||
const zone = makeDurableZone(baggage); | ||
|
||
const chainHub = makeChainHub(remotePowers.agoricNames); | ||
|
||
const { makeRecorderKit } = prepareRecorderKitMakers(baggage, marshaller); | ||
const makeLocalChainAccountKit = prepareLocalChainAccountKit( | ||
zone, | ||
makeRecorderKit, | ||
zcf, | ||
remotePowers.timerService, | ||
chainHub, | ||
); | ||
|
||
const vowTools = prepareVowTools(zone.subZone('vows')); | ||
const asyncFlowTools = prepareAsyncFlowTools(zone.subZone('asyncFlow'), { | ||
vowTools, | ||
}); | ||
|
||
const facade = makeOrchestrationFacade({ | ||
zcf, | ||
zone, | ||
chainHub, | ||
makeLocalChainAccountKit, | ||
asyncFlowTools, | ||
...remotePowers, | ||
}); | ||
return { ...facade, chainHub, zone }; | ||
}; | ||
harden(provideOrchestration); |