Skip to content

Commit

Permalink
refactor: rename seats in liquidityPool
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Feb 27, 2025
1 parent 6602a58 commit 90db359
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/fast-usdc/src/exos/liquidity-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ export const prepareLiquidityPoolKit = (zone, zcf, USDC, tools) => {
},

depositHandler: {
/** @param {ZCFSeat} lp */
async handle(lp) {
/** @param {ZCFSeat} lpSeat */
async handle(lpSeat) {
const { shareWorth, shareMint, poolSeat, encumberedBalance } =
this.state;
const { external } = this.facets;

/** @type {USDCProposalShapes['deposit']} */
// @ts-expect-error ensured by proposalShape
const proposal = lp.getProposal();
const proposal = lpSeat.getProposal();
checkPoolBalance(
poolSeat.getCurrentAllocation(),
shareWorth,
Expand All @@ -279,23 +279,23 @@ export const prepareLiquidityPoolKit = (zone, zcf, USDC, tools) => {
const post = depositCalc(shareWorth, proposal);

// COMMIT POINT
const mint = shareMint.mintGains(post.payouts);
const sharePayoutSeat = shareMint.mintGains(post.payouts);
try {
this.state.shareWorth = post.shareWorth;
zcf.atomicRearrange(
harden([
// zoe guarantees lp has proposal.give allocated
[lp, poolSeat, proposal.give],
// mintGains() above establishes that mint has post.payouts
[mint, lp, post.payouts],
// zoe guarantees lpSeat has proposal.give allocated
[lpSeat, poolSeat, proposal.give],
// mintGains() above establishes that sharePayoutSeat has post.payouts
[sharePayoutSeat, lpSeat, post.payouts],
]),
);
} catch (cause) {
// UNTIL #10684: ability to terminate an incarnation w/o terminating the contract
throw new Error('🚨 cannot commit deposit', { cause });
} finally {
lp.exit();
mint.exit();
lpSeat.exit();
sharePayoutSeat.exit();
}
external.publishPoolMetrics();
},
Expand Down

0 comments on commit 90db359

Please sign in to comment.