Skip to content

Commit

Permalink
feat: record fee split in transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Dec 17, 2024
1 parent e3f49be commit 8846972
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/fast-usdc/src/exos/settler.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const prepareSettler = (
repayer.repay(settlingSeat, split);

// update status manager, marking tx `SETTLED`
statusManager.disbursed(txHash);
statusManager.disbursed(txHash, split);
},
/**
* @param {EvmHash} txHash
Expand Down
13 changes: 10 additions & 3 deletions packages/fast-usdc/src/exos/status-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { makeTracer } from '@agoric/internal';
import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js';
import { AmountKeywordRecordShape } from '@agoric/zoe/src/typeGuards.js';
import { Fail, makeError, q } from '@endo/errors';
import { E } from '@endo/eventual-send';
import { M } from '@endo/patterns';
Expand Down Expand Up @@ -209,7 +210,9 @@ export const prepareStatusManager = (
M.undefined(),
),
),
disbursed: M.call(EvmHashShape).returns(M.undefined()),
disbursed: M.call(EvmHashShape, AmountKeywordRecordShape).returns(
M.undefined(),
),
forwarded: M.call(M.opt(EvmHashShape), M.string(), M.nat()).returns(
M.undefined(),
),
Expand Down Expand Up @@ -310,9 +313,13 @@ export const prepareStatusManager = (
* Mark a transaction as `DISBURSED`
*
* @param {EvmHash} txHash
* @param {import('./liquidity-pool.js').RepayAmountKWR} split
*/
disbursed(txHash) {
void publishTxnRecord(txHash, harden({ status: TxStatus.Disbursed }));
disbursed(txHash, split) {
void publishTxnRecord(
txHash,
harden({ split, status: TxStatus.Disbursed }),
);
},

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/fast-usdc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { Amount } from '@agoric/ertp';
import type { CopyRecord, Passable } from '@endo/pass-style';
import type { PendingTxStatus, TxStatus } from './constants.js';
import type { FastUsdcTerms } from './fast-usdc.contract.js';
import type { RepayAmountKWR } from './exos/liquidity-pool.js';

export type EvmHash = `0x${string}`;
export type EvmAddress = `0x${string & { length: 40 }}`;
Expand Down Expand Up @@ -40,6 +41,7 @@ export interface CctpTxEvidence {
*/
export interface TransactionRecord extends CopyRecord {
evidence?: CctpTxEvidence;
split?: RepayAmountKWR;
status: TxStatus;
}

Expand Down

0 comments on commit 8846972

Please sign in to comment.