https://github.com/cyfrin/chainlink-gmx-automation
High Frequency Price Automation for GMX, Using Chainlink Keeper Data Streams
https://github.com/cyfrin/chainlink-gmx-automation
arbitrum automation chainlink ethereum gmx
Last synced: 24 days ago
JSON representation
High Frequency Price Automation for GMX, Using Chainlink Keeper Data Streams
- Host: GitHub
- URL: https://github.com/cyfrin/chainlink-gmx-automation
- Owner: Cyfrin
- Created: 2023-08-10T15:36:25.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-26T15:40:42.000Z (almost 2 years ago)
- Last Synced: 2025-09-05T09:53:34.646Z (29 days ago)
- Topics: arbitrum, automation, chainlink, ethereum, gmx
- Language: Solidity
- Homepage:
- Size: 158 KB
- Stars: 4
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chainlink <> GMX Automation
## Prerequisites
1. Git
2. [Foundry](https://book.getfoundry.sh/)
3. [Yarn](https://yarnpkg.com/)
4. Arbitrum Goerli RPC URL## Installation
1. Clone the repo:
```
git clone git@github.com:Cyfrin/chainlink-gmx-automation.git
```
2. Install dependencies:
```
cd chainlink-gmx-automation
forge install
```
3. Install GMX dependencies:
```
cd lib/gmx-synthetics
yarn
cd ../..
```
4. Build:
```
forge build
```
5. Setup environment:
```
cp .env.example .env
```
Enter your RPC URL into the `ARBITRUM_GOERLI_URL` in .env
6. Run the tests:
```
forge test
```## Deployment
1. Ensure that your `.env` file is fully populated, and the address for you PRIVATE_KEY variable is funded with Arbitrum Goerli ETH
2. Run the following command to load your `.env` file into your environment:
```
source .env
```
3. 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` and `script/DeployWithdrawalAutomation.s.sol`
## Automation Contracts
| Automation Contract | Event | Log Type | Log Name | OrderType Enum | Execution Contract | Execute Function |
|--------------------------|-----------------|---------------|-------------------|------|---------------------|-------------------|
| [`MarketAutomation.sol`](./src/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`](./src/DepositAutomation.sol) | Deposit | `emitEventLog1` | `DepositCreated` | - | `DepositHandler` | `executeDeposit` |
| [`WithdrawalAutomation.sol`](./src/WithdrawalAutomation.sol) | Withdrawal | `emitEventLog1` | `WithdrawalCreated` | - | `WathdrawalHandler` | `executeWithdrawal` |