Skip to content

Commit

Permalink
test: make mintHolder test pass by excluding fastUSDC
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Feb 5, 2025
1 parent 19c3bc0 commit 6b1d701
Show file tree
Hide file tree
Showing 5 changed files with 72 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,64 @@
/* 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)

console.log(`Start sendBankAsset for ${label}`, valueStr, value);

const contractKits = await contractKitsP;
console.log(`SEND: ${contractKits}`, contractKits.values());
const mintHolderKit = Array.from(contractKits.values()).filter(
kit => kit.label && kit.label === label,
);
console.log('SEND kit: ', mintHolderKit);

if (!mintHolderKit[0]) {
console.log('No mintHolderKit for ', label);
return;
}

const { creatorFacet: mint, publicFacet: issuer } = mintHolderKit[0];
console.log('SEND: mint', mint, issuer);

/*
* 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);

console.log(`Finished sendBankAsset for ${label}`);
};

sendBankAsset;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export const mintPayment = async (t, address, assetList, value) => {

await evalBundles(SUBMISSION_DIR);

if (denom === 'ufastlp') {
continue;
}

const balance = await getISTBalance(address, denom);

// Add to value the BLD provisioned to smart wallet
Expand Down
3 changes: 2 additions & 1 deletion packages/vats/src/vat-bank.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ const BridgeChannelI = M.interface('BridgeChannel', {
* }>} BalanceUpdater
*/

// See #10929
const BalanceUpdaterI = M.interface('BalanceUpdater', {
update: M.call(M.string()).optional(M.string()).returns(),
update: M.call(M.string()).optional(M.or(M.string(), M.number())).returns(),
});

/**
Expand Down

0 comments on commit 6b1d701

Please sign in to comment.