Skip to content

Commit de48a00

Browse files
LuqiPananilhelvaci
authored andcommitted
chore(orchestration): create scaffold for swap anything asyncFlow
1 parent db3403c commit de48a00

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @import {GuestInterface, GuestOf} from '@agoric/async-flow';
3+
* @import {Invitation, ZCF, ZCFSeat} from '@agoric/zoe';
4+
* @import {Brand} from '@agoric/ertp';
5+
* @import {Vow} from '@agoric/vow';
6+
* @import {LocalOrchestrationAccountKit} from '../exos/local-orchestration-account.js';
7+
* @import {ZoeTools} from '../utils/zoe-tools.js';
8+
* @import {Orchestrator, OrchestrationFlow, LocalAccountMethods, ChainHub, ChainInfo} from '../types.js';
9+
* @import {AccountIdArg} from '../orchestration-api.ts';
10+
*/
11+
12+
/**
13+
* @satisfies {OrchestrationFlow}
14+
* @param {Orchestrator} orch
15+
* @param {object} ctx
16+
* @param {GuestInterface<ChainHub>} ctx.chainHub
17+
* @param {Promise<GuestInterface<LocalOrchestrationAccountKit['holder']>>} ctx.sharedLocalAccountP
18+
* @param {Promise<
19+
* GuestInterface<
20+
* import('../exos/cosmos-orchestration-account.js').CosmosOrchestrationAccountKit['holder']
21+
* >
22+
* >} ctx.nobleAccountP
23+
* @param {GuestInterface<ZoeTools>} ctx.zoeTools
24+
* @param {GuestOf<(msg: string) => Vow<void>>} ctx.log
25+
* @param {Brand} ctx.USDC
26+
* @param {ZCFSeat} seat
27+
* @param {{
28+
* destAddr: AccountIdArg;
29+
* destDenom: Denom;
30+
* slippage: { slippageRatio: Ratio; windowSeconds: Nat };
31+
* onFailedDelivery: string;
32+
* nextMemo: string;
33+
* }} offerArgs
34+
*/
35+
36+
// Given USDC, swap to desired token with slippage
37+
// Ref: https://github.com/osmosis-labs/osmosis/tree/main/cosmwasm/contracts/crosschain-swaps#via-ibc
38+
export const swapIt = async (
39+
orch,
40+
{
41+
chainHub,
42+
sharedLocalAccountP,
43+
log,
44+
nobleAccountP,
45+
USDC,
46+
zoeTools: { localTransfer, withdrawToSeat },
47+
},
48+
seat,
49+
offerArgs,
50+
) => {};
51+
harden(swapIt);

0 commit comments

Comments
 (0)