-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: repair mintHolder test: add sendScript & exclude fastUSDC
- Loading branch information
1 parent
5af83d0
commit b068711
Showing
3 changed files
with
57 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 |
52 changes: 52 additions & 0 deletions
52
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,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; |
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