- Clone the repo:
git clone git@github.com:Cyfrin/chainlink-gmx-automation.git
- Install dependencies:
cd chainlink-gmx-automation forge install
- Install GMX dependencies:
cd lib/gmx-synthetics yarn cd ../..
- Build:
forge build
- Setup environment:
Enter your RPC URL into the
cp .env.example .env
ARBITRUM_GOERLI_URL
in .env - Run the tests:
forge test
-
Ensure that your
.env
file is fully populated, and the address for you PRIVATE_KEY variable is funded with Arbitrum Goerli ETH -
Run the following command to load your
.env
file into your environment:source .env
-
To deploy the
DepositAutomation
contract, run the following script in the terminal:forge script script/DeployDepositAutomation.s.sol --rpc-url $ARBITRUM_GOERLI_URL --broadcast
Other available scripts are
script/DeployMarketAutomation.s.sol
andscript/DeployWithdrawalAutomation.s.sol
Automation Contract | Event | Log Type | Log Name | OrderType Enum | Execution Contract | Execute Function |
---|---|---|---|---|---|---|
MarketAutomation.sol |
Market Swap | emitEventLog2 |
OrderCreated |
0 | OrderHandler |
executeOrder |
- | Market Increase | emitEventLog2 |
OrderCreated |
2 | OrderHandler |
executeOrder |
- | Market Decrease | emitEventLog2 |
OrderCreated |
4 | OrderHandler |
executeOrder |
DepositAutomation.sol |
Deposit | emitEventLog1 |
DepositCreated |
- | DepositHandler |
executeDeposit |
WithdrawalAutomation.sol |
Withdrawal | emitEventLog1 |
WithdrawalCreated |
- | WathdrawalHandler |
executeWithdrawal |