-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(upgrade-test): add test of auto-provision
- Loading branch information
Showing
4 changed files
with
58 additions
and
25 deletions.
There are no files selected for viewing
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
48 changes: 36 additions & 12 deletions
48
packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/actions.test.js
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 |
---|---|---|
@@ -1,21 +1,45 @@ | ||
import test from 'ava'; | ||
|
||
import { agops } from '../cliHelper.js'; | ||
import { GOV1ADDR } from '../constants.js'; | ||
import { adjustVault, closeVault, mintIST, openVault } from '../econHelpers.js'; | ||
import { agd } from '../cliHelper.js'; | ||
import { ATOM_DENOM, CHAINID, GOV1ADDR } from '../constants.js'; | ||
import { addUser, getISTBalance } from './actions.js'; | ||
import { mintIST, openVault } from '../econHelpers.js'; | ||
import { waitForBlock } from '../commonUpgradeHelpers.js'; | ||
|
||
test.before(async t => { | ||
await mintIST(GOV1ADDR, 12340000000, 10000, 2000); | ||
|
||
await waitForBlock(2); | ||
const userAddress = await addUser('user-auto'); | ||
await agd.tx( | ||
'bank', | ||
'send', | ||
'gov1', | ||
userAddress, | ||
`1000000uist,2100000000${ATOM_DENOM}`, | ||
'--from', | ||
GOV1ADDR, | ||
'--chain-id', | ||
CHAINID, | ||
'--keyring-backend', | ||
'test', | ||
'--yes', | ||
); | ||
t.context = { userAddress }; | ||
await waitForBlock(2); | ||
}); | ||
|
||
test.skip('Open Vaults', async t => { | ||
const currentVaults = await agops.vaults('list', '--from', GOV1ADDR); | ||
t.is(currentVaults.length, 5); | ||
test('Open Vaults with auto-provisioned wallet', async t => { | ||
const { userAddress } = /** @type {{userAddress: string}} */ (t.context); | ||
t.is(await getISTBalance(userAddress), 1); | ||
|
||
const ATOMGiven = 2000; | ||
const ISTWanted = 400; | ||
await openVault(userAddress, ISTWanted, ATOMGiven); | ||
|
||
await waitForBlock(2); | ||
|
||
// TODO get as return value from openVault | ||
const vaultId = 'vault6'; | ||
await openVault(GOV1ADDR, 7, 11); | ||
await adjustVault(GOV1ADDR, vaultId, { giveMinted: 1.5 }); | ||
await adjustVault(GOV1ADDR, vaultId, { giveCollateral: 2.0 }); | ||
await closeVault(GOV1ADDR, vaultId, 5.75); | ||
const newISTBalance = await getISTBalance(userAddress); | ||
console.log('New IST Balance in u13 account:', newISTBalance); | ||
t.true(newISTBalance >= ISTWanted, 'Got the wanted IST'); | ||
}); |
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