-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: make mintHolder test pass by excluding fastUSDC
- Loading branch information
1 parent
19c3bc0
commit 6b1d701
Showing
5 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
a3p-integration/proposals/n:upgrade-next/mint-payment/send-script-permit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
64 changes: 64 additions & 0 deletions
64
a3p-integration/proposals/n:upgrade-next/mint-payment/send-script.tjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters