-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from Agoric/rs-automate-liquidation-testing
automate liquidation testing
- Loading branch information
Showing
15 changed files
with
869 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Liquidation Indexing | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Start A3P container | ||
run: docker compose --profile ci up -d a3p | ||
|
||
- run: corepack enable | ||
shell: bash | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Start subql indexer | ||
env: | ||
AGORIC_NET: ci | ||
run: yarn dev | ||
|
||
- name: Print initial logs of all containers | ||
run: | | ||
echo "Fetching initial logs for all containers..." | ||
containers=$(docker ps --format '{{.ID}}') | ||
for container in $containers; do | ||
echo "Fetching initial logs for container $container..." | ||
docker logs $container | ||
done | ||
- name: Set Execute Permission for All Scripts | ||
run: chmod +x ./scripts/*.mjs | ||
|
||
- name: Set ATOM Price to 12.34 | ||
run: ./scripts/changePrice.mjs | ||
env: | ||
amount: 12.34 | ||
containerName: agd | ||
AGORIC_NET: local | ||
|
||
- name: Get active vaults | ||
run: ./scripts/getActiveVaults.mjs | ||
env: | ||
apiUrl: 'http://localhost:3000/' | ||
expectedVaults: 7 | ||
|
||
- name: Create Vault with 100 Minted and 15 Collateral | ||
run: ./scripts/createVault.mjs | ||
env: | ||
wantMinted: '100' | ||
giveCollateral: '15' | ||
userKey: 'gov3' | ||
AGORIC_NET: 'local' | ||
commandTimeout: '120' | ||
containerName: 'agd' | ||
|
||
- name: Create Vault with 103 Minted and 15 Collateral | ||
run: ./scripts/createVault.mjs | ||
env: | ||
wantMinted: '103' | ||
giveCollateral: '15' | ||
userKey: 'gov3' | ||
AGORIC_NET: 'local' | ||
commandTimeout: '120' | ||
containerName: 'agd' | ||
|
||
- name: Create Vault with 105 Minted and 15 Collateral | ||
run: ./scripts/createVault.mjs | ||
env: | ||
wantMinted: '105' | ||
giveCollateral: '15' | ||
userKey: 'gov3' | ||
AGORIC_NET: 'local' | ||
commandTimeout: '120' | ||
containerName: 'agd' | ||
|
||
- name: Get active vaults | ||
run: ./scripts/getActiveVaults.mjs | ||
env: | ||
apiUrl: 'http://localhost:3000/' | ||
expectedVaults: 10 | ||
|
||
- name: Place bid for 90IST | ||
run: ./scripts/placeBid.mjs | ||
env: | ||
fromAddress: 'gov1' | ||
giveAmount: '90IST' | ||
priceOrDiscount: '9' | ||
commandType: 'by-price' | ||
AGORIC_NET: 'local' | ||
containerName: 'agd' | ||
|
||
- name: Place bid for 80IST | ||
run: ./scripts/placeBid.mjs | ||
env: | ||
fromAddress: 'gov1' | ||
giveAmount: '80IST' | ||
priceOrDiscount: '10' | ||
commandType: 'by-discount' | ||
AGORIC_NET: 'local' | ||
containerName: 'agd' | ||
|
||
- name: Place bid for 150IST | ||
run: ./scripts/placeBid.mjs | ||
env: | ||
fromAddress: 'gov1' | ||
giveAmount: '150IST' | ||
priceOrDiscount: '15' | ||
commandType: 'by-discount' | ||
AGORIC_NET: 'local' | ||
containerName: 'agd' | ||
|
||
- name: Set ATOM Price to 9.99 | ||
run: ./scripts/changePrice.mjs | ||
env: | ||
amount: 9.99 | ||
containerName: agd | ||
AGORIC_NET: local | ||
|
||
- name: Check liquidation indexing | ||
run: ./scripts/checkLiquidation.mjs | ||
env: | ||
apiUrl: 'http://localhost:3000/' | ||
|
||
- name: Get active vaults | ||
run: ./scripts/getActiveVaults.mjs | ||
env: | ||
apiUrl: 'http://localhost:3000/' | ||
expectedVaults: 7 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#! /usr/bin/env node | ||
import './lockdown.mjs'; | ||
import { execa } from 'execa'; | ||
import { assertAllDefined } from '@agoric/internal'; | ||
|
||
const agops = '/usr/src/agoric-sdk/packages/agoric-cli/bin/agops'; | ||
const { AGORIC_NET, amount, containerName } = process.env; | ||
|
||
assertAllDefined({ AGORIC_NET, amount, containerName }); | ||
|
||
try { | ||
const env = { | ||
AGORIC_NET, | ||
}; | ||
|
||
console.log(`Initiating price change to ${amount} for ATOM...`); | ||
const command = `${agops} oracle setPrice --keys gov1,gov2 --pair ATOM.USD --price ${amount} --keyring-backend=test`; | ||
const { stdout } = await execa('docker', ['exec', containerName, command], { env, shell: true }); | ||
|
||
console.log('Standard output:', stdout); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
} |
Oops, something went wrong.