Skip to content

Commit

Permalink
fix: commands and envs
Browse files Browse the repository at this point in the history
  • Loading branch information
DiRaiks committed Nov 1, 2024
1 parent c9ee2a5 commit f6cef3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
3 changes: 2 additions & 1 deletion configs/envs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const envs = parsed;
if (envs) {
envs.DEPLOYED = envs?.DEPLOYED || (process.env.DEPLOYED as string);
envs.RPC_URL_1 = envs?.RPC_URL_1 || (process.env.RPC_URL_1 as string);
envs.RPC_URL_17000 = envs?.RPC_URL_137 || (process.env.RPC_URL_137 as string);
envs.RPC_URL_17000 =
envs?.RPC_URL_17000 || (process.env.RPC_URL_17000 as string);

envs.PRIVATE_KEY_1 =
envs?.PRIVATE_KEY_1 || (process.env.PRIVATE_KEY_1 as string);
Expand Down
36 changes: 18 additions & 18 deletions programs/vault-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const vaultHub = program.command("vh").description("vault hub contract");
vaultHub
.command("constants")
.description("get vault hub constants")
.option("--chainId", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.action(async ({ chainId }) => {
const contract = getVaultHubContract(chainId);

Expand All @@ -26,7 +26,7 @@ vaultHub
vaultHub
.command("v-count")
.description("get vaults count")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.action(async (chainId) => {
const contract = getVaultHubContract(chainId);

Expand All @@ -38,9 +38,9 @@ vaultHub
vaultHub
.command("v")
.description("get vault")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.argument("<index>", "index")
.action(async (chainId, index) => {
.action(async (index, { chainId }) => {
const contract = getVaultHubContract(chainId);

const vault = await contract.read.vault(index);
Expand All @@ -55,9 +55,9 @@ vaultHub
vaultHub
.command("rr-index")
.description("get reserve ratio by index")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.argument("<index>", "index")
.action(async (chainId, index) => {
.action(async (index, { chainId }) => {
const contract = getVaultHubContract(chainId);

const vault = await contract.read.vault(index);
Expand All @@ -69,9 +69,9 @@ vaultHub
vaultHub
.command("rr-vault")
.description("get reserve ratio by vault")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.argument("<vault>", "vault")
.action(async (chainId, vault) => {
.action(async (vault, { chainId }) => {
const contract = getVaultHubContract(chainId);

const reserveRatio = await contract.read.reserveRatio([vault]);
Expand All @@ -82,13 +82,13 @@ vaultHub
vaultHub
.command("v-connect")
.description("connect vault")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.argument("<vault>", "vault")
.argument("<capShares>", "cap shares")
.argument("<minReserveRatioBP>", "min reserve ratio bp")
.argument("<treasuryFeeBP>", "treasury fee bp")
.action(
async (chainId, vault, capShares, minReserveRatioBP, treasuryFeeBP) => {
async (vault, capShares, minReserveRatioBP, treasuryFeeBP, { chainId }) => {
const contract = getVaultHubContract(chainId);

const tx = await contract.write.connectVault(
Expand All @@ -108,10 +108,10 @@ vaultHub
.description(
"mint StETH tokens backed by vault external balance to the receiver address"
) // Description of the command
.argument("<chainId>", "chainId") // Argument: chain ID
.option("-c, --chainId <chainId>", "chainId") // Argument: chain ID
.argument("<receiver>", "receiver") // Argument: receiver address
.argument("<amount>", "amount") // Argument: amount to mint
.action(async (chainId, receiver: Address, amount) => {
.action(async (receiver: Address, amount, { chainId }) => {
// Get the VaultHub contract instance for the specified chain ID
const contract = getVaultHubContract(chainId);

Expand All @@ -128,9 +128,9 @@ vaultHub
vaultHub
.command("v-burn-steth")
.description("burn steth from the balance of the vault contract")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.argument("<amount>", "amount")
.action(async (chainId, amount) => {
.action(async (amount, { chainId }) => {
const contract = getVaultHubContract(chainId);

const tx = await contract.write.burnStethBackedByVault([amount], {
Expand All @@ -144,9 +144,9 @@ vaultHub
vaultHub
.command("v-force-balance")
.description("force rebalance of the vault")
.argument("<chainId>", "chainId")
.option("-c, --chainId <chainId>", "chainId")
.argument("<vault>", "vault")
.action(async (chainId, vault) => {
.action(async (vault, { chainId }) => {
const contract = getVaultHubContract(chainId);

const tx = await contract.write.forceRebalance([vault], {
Expand All @@ -162,8 +162,8 @@ vaultHub
.description(
"rebalances the vault, by writing off the amount equal to passed ether from the vault's minted stETH counter"
)
.argument("<chainId>", "chainId")
.action(async (chainId) => {
.option("-c, --chainId <chainId>", "chainId")
.action(async ({ chainId }) => {
const contract = getVaultHubContract(chainId);

const tx = await contract.write.rebalance({
Expand Down

0 comments on commit f6cef3c

Please sign in to comment.