JupiterPerpsPositionIncreaseAlarmAction currently assumes that the configured wallet contains enough USDC for CollateralUSDC.
This may cause an unnecessary Jupiter transaction-build request when the transaction cannot succeed.
Implementation
Before calling buildPositionIncreaseTransaction(...), retrieve the wallet's USDC balance and compare it with the resolved collateralUsd.
If the balance is lower than the required collateral:
Log the available and required USDC amounts.
Return without requesting, signing, or submitting a transaction.
Allow the remaining alarm actions to continue normally.
Example log message:
Position Increase skipped: wallet has 1.25 USDC, but 2.50 USDC is required.
The balance check must use the SPL-token balance functionality added by the preceding issue.
Checking the SOL balance for transaction fees is out of scope.
Acceptance criteria
The USDC balance is checked after resolving the alarm definition.
The check occurs before requesting a transaction from Jupiter.
Insufficient balance prevents building, signing, and submitting the transaction.
The available and required amounts are logged.
Sufficient balance preserves the existing Increase flow.
Other alarm actions continue to run.
The project compiles successfully.
## Background
`JupiterPerpsPositionIncreaseAlarmAction` currently assumes that the configured wallet contains enough USDC for `CollateralUSDC`.
This may cause an unnecessary Jupiter transaction-build request when the transaction cannot succeed.
## Implementation
Before calling `buildPositionIncreaseTransaction(...)`, retrieve the wallet's USDC balance and compare it with the resolved `collateralUsd`.
If the balance is lower than the required collateral:
* Log the available and required USDC amounts.
* Return without requesting, signing, or submitting a transaction.
* Allow the remaining alarm actions to continue normally.
Example log message:
```text
Position Increase skipped: wallet has 1.25 USDC, but 2.50 USDC is required.
```
The balance check must use the SPL-token balance functionality added by the preceding issue.
Checking the SOL balance for transaction fees is out of scope.
## Acceptance criteria
* The USDC balance is checked after resolving the alarm definition.
* The check occurs before requesting a transaction from Jupiter.
* Insufficient balance prevents building, signing, and submitting the transaction.
* The available and required amounts are logged.
* Sufficient balance preserves the existing Increase flow.
* Other alarm actions continue to run.
* The project compiles successfully.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Background
JupiterPerpsPositionIncreaseAlarmActioncurrently assumes that the configured wallet contains enough USDC forCollateralUSDC.This may cause an unnecessary Jupiter transaction-build request when the transaction cannot succeed.
Implementation
Before calling
buildPositionIncreaseTransaction(...), retrieve the wallet's USDC balance and compare it with the resolvedcollateralUsd.If the balance is lower than the required collateral:
Example log message:
The balance check must use the SPL-token balance functionality added by the preceding issue.
Checking the SOL balance for transaction fees is out of scope.
Acceptance criteria