Skip to content

Commit 5857e80

Browse files
committed
test
1 parent 2e88d5d commit 5857e80

File tree

4 files changed

+77
-96
lines changed

4 files changed

+77
-96
lines changed

.github/actions/createVault/action.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/actions/createVault/createVault.mjs

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/scripts/createVault.mjs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { execa } from 'execa';
2+
3+
const agops = '/usr/src/agoric-sdk/packages/agoric-cli/bin/agops';
4+
5+
const createVault = async (containerName, agoricNet, commandTimeout, userKey, wantMinted, giveCollateral) => {
6+
console.log('Starting the vault creation process...');
7+
8+
if (!containerName || !agoricNet || !commandTimeout || !userKey || !wantMinted || !giveCollateral) {
9+
console.error('Error: Missing one or more required parameters:', {
10+
containerName,
11+
agoricNet,
12+
commandTimeout,
13+
userKey,
14+
wantMinted,
15+
giveCollateral,
16+
});
17+
process.exit(1);
18+
}
19+
20+
const createVaultCommand = `${agops} vaults open --wantMinted \"${wantMinted}\" --giveCollateral \"${giveCollateral}\" > /tmp/want-ist.json`;
21+
const executeCreateVaultCommand = `docker exec ${containerName} /bin/bash -c "env AGORIC_NET=${agoricNet} timeout ${commandTimeout} ${createVaultCommand}"`;
22+
23+
try {
24+
console.log(`Executing: ${executeCreateVaultCommand}`);
25+
const { stdout: createVaultOutput } = await execa.command(executeCreateVaultCommand);
26+
console.log('Vault creation output:', createVaultOutput);
27+
28+
console.log('Executing broadcast command...');
29+
const broadcastCommand = `timeout ${commandTimeout} ${agops} perf satisfaction --executeOffer /tmp/want-ist.json --from ${userKey} --keyring-backend=test`;
30+
const executeBroadcastCommand = `docker exec ${containerName} bash -c "env AGORIC_NET=${agoricNet} ${broadcastCommand}"`;
31+
32+
const { stdout: broadcastOutput } = await execa.command(executeBroadcastCommand);
33+
console.log('Broadcast output:', broadcastOutput);
34+
} catch (error) {
35+
console.error('Error during vault creation:', error);
36+
process.exit(1);
37+
}
38+
};
39+
40+
const containerName = process.env.INPUT_CONTAINERNAME;
41+
const agoricNet = process.env.INPUT_AGORICNET;
42+
const commandTimeout = process.env.INPUT_COMMANDTIMEOUT;
43+
const userKey = process.env.INPUT_USERKEY;
44+
const wantMinted = process.env.INPUT_WANTMINTED;
45+
const giveCollateral = process.env.INPUT_GIVECOLLATERAL;
46+
47+
createVault(containerName, agoricNet, commandTimeout, userKey, wantMinted, giveCollateral);

.github/workflows/liquidation.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,38 +51,38 @@ jobs:
5151
run: node .github/scripts/changePrice.mjs
5252
env:
5353
AMOUNT: 12.34
54-
CONTAINER_NAME: a3p
54+
CONTAINER_NAME: agd
5555
AGORIC_NET: local
5656

57-
# - name: Create Vault with 100 Minted and 15 Collateral
58-
# uses: ./.github/actions/createVault
59-
# with:
60-
# wantMinted: '100'
61-
# giveCollateral: '15'
62-
# userKey: 'gov3'
63-
# agoricNet: 'local'
64-
# commandTimeout: '120'
65-
# containerName: 'agd'
66-
67-
# - name: Create Vault with 103 Minted and 15 Collateral
68-
# uses: ./.github/actions/createVault
69-
# with:
70-
# wantMinted: '103'
71-
# giveCollateral: '15'
72-
# userKey: 'gov3'
73-
# agoricNet: 'local'
74-
# commandTimeout: '120'
75-
# containerName: 'agd'
76-
77-
# - name: Create Vault with 105 Minted and 15 Collateral
78-
# uses: ./.github/actions/createVault
79-
# with:
80-
# wantMinted: '105'
81-
# giveCollateral: '15'
82-
# userKey: 'gov3'
83-
# agoricNet: 'local'
84-
# commandTimeout: '120'
85-
# containerName: 'agd'
57+
- name: Create Vault with 100 Minted and 15 Collateral
58+
run: node .github/scripts/createVault.mjs
59+
env:
60+
wantMinted: '100'
61+
giveCollateral: '15'
62+
userKey: 'gov3'
63+
agoricNet: 'local'
64+
commandTimeout: '120'
65+
containerName: 'agd'
66+
67+
- name: Create Vault with 103 Minted and 15 Collateral
68+
run: node .github/scripts/createVault.mjs
69+
env:
70+
wantMinted: '103'
71+
giveCollateral: '15'
72+
userKey: 'gov3'
73+
agoricNet: 'local'
74+
commandTimeout: '120'
75+
containerName: 'agd'
76+
77+
- name: Create Vault with 105 Minted and 15 Collateral
78+
run: node .github/scripts/createVault.mjs
79+
env:
80+
wantMinted: '105'
81+
giveCollateral: '15'
82+
userKey: 'gov3'
83+
agoricNet: 'local'
84+
commandTimeout: '120'
85+
containerName: 'agd'
8686

8787
# - name: Get active vaults
8888
# uses: ./.github/actions/getActiveVaults

0 commit comments

Comments
 (0)