Skip to content

Commit

Permalink
test(fast-usdc): support pfm transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Nov 29, 2024
1 parent 9f21c28 commit d89a727
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
31 changes: 21 additions & 10 deletions packages/fast-usdc/test/fast-usdc.contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,14 @@ const makeCustomer = (
const myMsg = local.find(lm => {
if (lm.type !== 'VLOCALCHAIN_EXECUTE_TX') return false;
const [ibcTransferMsg] = lm.messages;
// support advances to noble + other chains
const receiver =
ibcTransferMsg.receiver === 'pfm'
? JSON.parse(ibcTransferMsg.memo).forward.receiver
: ibcTransferMsg.receiver;
return (
ibcTransferMsg['@type'] ===
'/ibc.applications.transfer.v1.MsgTransfer' &&
ibcTransferMsg.receiver === EUD
'/ibc.applications.transfer.v1.MsgTransfer' && receiver === EUD
);
});
if (!myMsg) {
Expand All @@ -652,17 +656,24 @@ const makeCustomer = (
{ amount: String(toReceive.value), denom: uusdcOnAgoric },
'C4',
);

t.log(who, 'sees', ibcTransferMsg.token, 'sent to', EUD);
// TODO #10445 expect PFM memo
t.is(ibcTransferMsg.memo, '', 'TODO expecting PFM memo');

// TODO #10445 expect routing through noble, not osmosis
if (!EUD.startsWith('noble')) {
t.like(
JSON.parse(ibcTransferMsg.memo),
{
forward: {
receiver: EUD,
},
},
'PFM receiver is EUD',
);
} else {
t.like(ibcTransferMsg, { receiver: EUD });
}
t.is(
ibcTransferMsg.sourceChannel,
fetchedChainInfo.agoric.connections['osmosis-1'].transferChannel
fetchedChainInfo.agoric.connections['noble-1'].transferChannel
.channelId,
'TODO expecting routing through Noble',
'expect routing through Noble',
);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Generated by [AVA](https://avajs.dev).
bech32Prefix: 'agoric',
chainId: 'agoric-3',
icqEnabled: false,
pfmEnabled: true,
stakingTokens: [
{
denom: 'ubld',
Expand All @@ -53,11 +54,13 @@ Generated by [AVA](https://avajs.dev).
bech32Prefix: 'noble',
chainId: 'noble-1',
icqEnabled: false,
pfmEnabled: true,
},
osmosis: {
bech32Prefix: 'osmo',
chainId: 'osmosis-1',
icqEnabled: true,
pfmEnabled: true,
stakingTokens: [
{
denom: 'uosmo',
Expand Down
Binary file modified packages/fast-usdc/test/snapshots/fast-usdc.contract.test.ts.snap
Binary file not shown.
3 changes: 2 additions & 1 deletion packages/fast-usdc/test/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js';
import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js';
import {
denomHash,
withChainCapabilities,
type CosmosChainInfo,
type Denom,
} from '@agoric/orchestration';
Expand Down Expand Up @@ -196,7 +197,7 @@ export const commonSetup = async (t: ExecutionContext<any>) => {
);

const chainInfo = harden(() => {
const { agoric, osmosis, noble } = fetchedChainInfo;
const { agoric, osmosis, noble } = withChainCapabilities(fetchedChainInfo);
return { agoric, osmosis, noble };
})();

Expand Down

0 comments on commit d89a727

Please sign in to comment.