Skip to content

Commit

Permalink
fixup! feat: use orchFns.autoStake as target for receiveUpcall
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Sep 11, 2024
1 parent 5a56e8b commit 5b8b568
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/orchestration/src/examples/auto-stake-it.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
InvitationShape,
} from '@agoric/zoe/src/typeGuards.js';
import { makeTracer } from '@agoric/internal';
import { M, mustMatch } from '@endo/patterns';
import { M } from '@endo/patterns';
import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
import { preparePortfolioHolder } from '../exos/portfolio-holder-kit.js';
import { withOrchestration } from '../utils/start-helper.js';
Expand All @@ -18,7 +18,6 @@ const trace = makeTracer('AutoStakeIt');
* @import {IBCChannelID, VTransferIBCEvent} from '@agoric/vats';
* @import {TargetApp} from '@agoric/vats/src/bridge-target.js';
* @import {ChainAddress, CosmosValidatorAddress, Denom} from '@agoric/orchestration';
* @import {TypedPattern} from '@agoric/internal';
* @import {CosmosOrchestrationAccount} from '../exos/cosmos-orchestration-account.js';
* @import {LocalOrchestrationAccount} from '../exos/local-orchestration-account.js';
* @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js';
Expand All @@ -39,7 +38,6 @@ const trace = makeTracer('AutoStakeIt');
* }} StakingTapState
*/

/** @type {TypedPattern<StakingTapState>} */
const StakingTapStateShape = harden({
stakingAccount: M.remotable('CosmosOrchestrationAccount'),
localAccount: M.remotable('LocalOrchestrationAccount'),
Expand Down Expand Up @@ -86,10 +84,7 @@ const contract = async (
receiveUpcall: M.call(M.record()).returns(M.undefined()),
}),
/** @param {StakingTapState} initialState */
initialState => {
mustMatch(initialState, StakingTapStateShape); // TODO use opts.stateShape
return harden(initialState);
},
initialState => harden(initialState),
{
/**
* Transfers from localAccount to stakingAccount, then delegates from the
Expand All @@ -105,6 +100,9 @@ const contract = async (
orchFns.autoStake(localAccount, stakingAccount, config, event);
},
},
{
stateShape: StakingTapStateShape,
},
);

const orchFns = orchestrateAll(flows, {
Expand Down

0 comments on commit 5b8b568

Please sign in to comment.