Skip to content

Commit 62aca85

Browse files
committed
chore(orca.contract.js): removed retriable wrapper
chore(orca.flows.js): removed transfer retriable from createAndFund orchestration handler chore(contract): fixed linting issues from changes
1 parent 5a7bc63 commit 62aca85

File tree

2 files changed

+9
-110
lines changed

2 files changed

+9
-110
lines changed

contract/src/orca.contract.js

Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { AmountShape } from '@agoric/ertp';
22
import { makeTracer } from '@agoric/internal';
33
import { withOrchestration } from '@agoric/orchestration/src/utils/start-helper.js';
4-
import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js';
54
import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
6-
import { Fail } from '@endo/errors';
7-
import { E } from '@endo/far';
85
import { M } from '@endo/patterns';
96
import * as flows from './orca.flows.js';
107

@@ -73,110 +70,14 @@ const contract = async (
7370
zcf,
7471
privateArgs,
7572
zone,
76-
{ orchestrateAll, vowTools, zoeTools },
73+
{ orchestrateAll, zoeTools },
7774
) => {
7875
trace('inside start function: v1.1.95');
7976
trace('privateArgs', privateArgs);
8077

81-
const wrapper = () => {
82-
const transfer = vowTools.retriable(
83-
zone,
84-
'transfer',
85-
/**
86-
* @type {Transfer}
87-
*/
88-
async (
89-
srcSeat,
90-
localAccount,
91-
remoteAccount,
92-
give,
93-
amt,
94-
localAddress,
95-
remoteAddress,
96-
) => {
97-
!srcSeat.hasExited() || Fail`The seat cannot have exited.`;
98-
const { zcfSeat: tempSeat, userSeat: userSeatP } =
99-
zcf.makeEmptySeatKit();
100-
trace('tempSeat:', tempSeat);
101-
const userSeat = await userSeatP;
102-
trace('userSeat:', userSeat);
103-
trace('storageNode', privateArgs.storageNode);
104-
atomicTransfer(zcf, srcSeat, tempSeat, give);
105-
tempSeat.exit();
106-
107-
const pmt = await E(userSeat).getPayout('Deposit');
108-
trace('pmt:', pmt);
109-
trace('amt:', amt);
110-
111-
// NOTE: with watch
112-
// const promises = Object.entries(give).map(async ([kw, _amount]) => {
113-
// trace("kw::", kw)
114-
// trace("_amount", _amount)
115-
// trace("amt", amt)
116-
// });
117-
// const watcher = zone.exo(
118-
// `watcher-transfer-${localAddress.value}-to-${remoteAddress.value}`, // Error: key (a string) has already been used in this zone and incarnation -- perhaps use timestamp or offerid as well?
119-
// M.interface('watcher for transfer', {
120-
// onFulfilled: M.call(M.any()).optional(M.any()).returns(VowShape),
121-
// }
122-
// ),
123-
// {
124-
// /**
125-
// * @param {any} _result
126-
// * @param {bigint} value
127-
// */
128-
// onFulfilled(
129-
// _result,
130-
// value
131-
// ) {
132-
// trace("inside onFulfilled:", value)
133-
// return watch(localAccount.transfer(
134-
// {
135-
// denom: "ubld",
136-
// value: value/2n,
137-
// },
138-
// remoteAddress
139-
// ))
140-
// },
141-
// },
142-
// );
143-
// trace("about to watch transfer, watcher v0.16")
144-
// trace("watcher", watcher)
145-
// watch(
146-
// E(localAccount).deposit(pmt),
147-
// watcher,
148-
// BigInt(amt.value),
149-
// );
150-
// await Promise.all(promises);
151-
152-
// NOTE: without watcher
153-
await E(localAccount).deposit(pmt);
154-
await localAccount.transfer(
155-
{
156-
denom: 'ubld',
157-
value: amt.value / 2n,
158-
},
159-
remoteAddress,
160-
);
161-
162-
// const localAccountBalance = await localAccount.getBalance(amt.brand)
163-
// const remoteAccountbalance = await remoteAccount.getBalance(amt.brand)
164-
// trace("localaccount balance: ", localAccountBalance);
165-
// trace("remoteaccount balance: ", remoteAccountbalance);
166-
},
167-
);
168-
return harden({
169-
transfer,
170-
});
171-
};
172-
173-
const wrap = wrapper();
174-
trace('wrapper.transfer', wrapper);
175-
17678
// @ts-expect-error XXX ZCFSeat not Passable
17779
const { makeAccount, makeCreateAndFund } = orchestrateAll(flows, {
17880
localTransfer: zoeTools.localTransfer,
179-
transfer: wrap.transfer,
18081
// write: E(storageNode).write),
18182
// makeChildNode: E(storageNode).makeChildNode,
18283
// setValue: E(storageNode).setValue,

contract/src/orca.flows.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ harden(makeAccount);
4444
*
4545
* @param {Orchestrator} orch
4646
* @param {object} ctx
47-
* @param {Transfer} ctx.transfer
47+
* @param {ZoeTools['localTransfer']} ctx.localTransfer
4848
* @param {StorageNode['setValue']} ctx.setValue
4949
* @param {ZCFSeat} seat
5050
* @param {{ chainName: string }} offerArgs
5151
*/
5252
export const makeCreateAndFund = async (
5353
orch,
5454
{
55-
transfer,
55+
localTransfer,
5656
// write,
5757
// makeChildNode,
5858
setValue,
@@ -100,14 +100,12 @@ export const makeCreateAndFund = async (
100100
trace('remoteAddress', remoteAddress);
101101
trace('fund new orch account');
102102
trace('seat', seat);
103-
trace('transfer', transfer);
104-
await transfer(
105-
seat,
106-
localAccount,
107-
remoteAccount,
108-
give,
109-
amt,
110-
localAddress,
103+
await localTransfer(seat, localAccount, give);
104+
await localAccount.transfer(
105+
{
106+
denom: 'ubld',
107+
value: amt.value / 2n,
108+
},
111109
remoteAddress,
112110
);
113111
seat.exit();

0 commit comments

Comments
 (0)