|
1 | 1 | import { AmountShape } from '@agoric/ertp'; |
2 | 2 | import { makeTracer } from '@agoric/internal'; |
3 | 3 | import { withOrchestration } from '@agoric/orchestration/src/utils/start-helper.js'; |
4 | | -import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js'; |
5 | 4 | import { InvitationShape } from '@agoric/zoe/src/typeGuards.js'; |
6 | | -import { Fail } from '@endo/errors'; |
7 | | -import { E } from '@endo/far'; |
8 | 5 | import { M } from '@endo/patterns'; |
9 | 6 | import * as flows from './orca.flows.js'; |
10 | 7 |
|
@@ -73,110 +70,14 @@ const contract = async ( |
73 | 70 | zcf, |
74 | 71 | privateArgs, |
75 | 72 | zone, |
76 | | - { orchestrateAll, vowTools, zoeTools }, |
| 73 | + { orchestrateAll, zoeTools }, |
77 | 74 | ) => { |
78 | 75 | trace('inside start function: v1.1.95'); |
79 | 76 | trace('privateArgs', privateArgs); |
80 | 77 |
|
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 | | - |
176 | 78 | // @ts-expect-error XXX ZCFSeat not Passable |
177 | 79 | const { makeAccount, makeCreateAndFund } = orchestrateAll(flows, { |
178 | 80 | localTransfer: zoeTools.localTransfer, |
179 | | - transfer: wrap.transfer, |
180 | 81 | // write: E(storageNode).write), |
181 | 82 | // makeChildNode: E(storageNode).makeChildNode, |
182 | 83 | // setValue: E(storageNode).setValue, |
|
0 commit comments