Skip to content

Commit

Permalink
test: repair mintHolder test: add sendScript & exclude fastUSDC
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Feb 5, 2025
1 parent 5af83d0 commit b068711
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
true
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* global E */

/// <reference types="@agoric/vats/src/core/core-eval-env"/>
/// <reference types="@agoric/vats/src/core/types-ambient"/>

/**
* The primary purpose of this script is to mint a payment of a certain
* bankAsset and deposit in an user wallet.
*
* The receiverAddress and label placeholders should be replaced with
* the desired address and asset name during the execution of each test case.
*
* See z:acceptance/mintHolder.test.js
*
* @param {BootstrapPowers} powers
*/
const sendBankAsset = async powers => {
const {
consume: { namesByAddress, contractKits: contractKitsP },
} = powers;

const receiverAddress = '{{ADDRESS}}';
const label = '{{LABEL}}';
const valueStr = '{{VALUE}}';
const value = BigInt(valueStr)

const contractKits = await contractKitsP;
const mintHolderKit = Array.from(contractKits.values()).filter(
kit => kit.label && kit.label === label,
);

const { creatorFacet: mint, publicFacet: issuer } = mintHolderKit[0];

/*
* Ensure that publicFacet holds an issuer by verifying that has
* the makeEmptyPurse method.
*/
await E(issuer).makeEmptyPurse()

const brand = await E(issuer).getBrand();
const amount = harden({ value, brand });
const payment = await E(mint).mintPayment(amount);

const receiverDepositFacet = E(namesByAddress).lookup(
receiverAddress,
'depositFacet',
);

await E(receiverDepositFacet).receive(payment);
};

sendBankAsset;
6 changes: 4 additions & 2 deletions a3p-integration/proposals/n:upgrade-next/mintHolder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import {
} from './test-lib/mintHolder-helpers.js';
import { networkConfig } from './test-lib/index.js';

test('mintHolder contract is upgraded', async t => {
test('verify mintHolder contract upgrade', async t => {
const receiver = await addUser('receiver');
await provisionSmartWallet(receiver, `20000000ubld`);

let assetList = await getAssetList();
t.log('List of mintHolder vats being upgraded: ', assetList);
await mintPayment(t, receiver, assetList, 10);
// FastUSDC doesn't have a contractKit indexed by its label
const assetListNoFastUSDC = assetList.filter(x => x.label !== 'FastLP');
await mintPayment(t, receiver, assetListNoFastUSDC, 10);

const psmLabelList = await getPSMChildren(fetch, networkConfig);
assetList = await getAssetList(psmLabelList);
Expand Down

0 comments on commit b068711

Please sign in to comment.