Skip to content

Commit dd63aab

Browse files
committed
fix: moved flashloans into example directory
1 parent d550e0d commit dd63aab

File tree

7 files changed

+151
-94
lines changed

7 files changed

+151
-94
lines changed

.github/workflows/examples.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Examples
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
branches:
7+
- main
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
GITHUB_ACTIONS: true
12+
APTOS_NETWORK: local
13+
MOVE_VERSION: 2.1
14+
COMPILER_VERSION: 2.0
15+
ARTIFACTS_LEVEL: all
16+
DEFAULT_FUND_AMOUNT: 40000000
17+
DEFAULT_FUNDER_PRIVATE_KEY: ${{ secrets.GH_DEFAULT_FUNDER_PRIVATE_KEY }}
18+
19+
# aave profiles
20+
AAVE_ACL_PRIVATE_KEY: ${{ secrets.GH_AAVE_ACL_PRIVATE_KEY }}
21+
AAVE_CONFIG_PRIVATE_KEY: ${{ secrets.GH_AAVE_CONFIG_PRIVATE_KEY }}
22+
AAVE_MATH_PRIVATE_KEY: ${{ secrets.GH_AAVE_MATH_PRIVATE_KEY }}
23+
AAVE_ORACLE_PRIVATE_KEY: ${{ secrets.GH_AAVE_ORACLE_PRIVATE_KEY }}
24+
AAVE_POOL_PRIVATE_KEY: ${{ secrets.GH_AAVE_POOL_PRIVATE_KEY }}
25+
AAVE_MOCK_UNDERLYING_TOKENS_PRIVATE_KEY: ${{ secrets.GH_AAVE_MOCK_UNDERLYING_TOKENS_PRIVATE_KEY }}
26+
AAVE_LARGE_PACKAGES_PRIVATE_KEY: ${{ secrets.GH_AAVE_LARGE_PACKAGES_PRIVATE_KEY }}
27+
AAVE_DATA_PRIVATE_KEY: ${{ secrets.GH_AAVE_DATA_PRIVATE_KEY }}
28+
AAVE_DATA_FEEDS_PRIVATE_KEY: ${{ secrets.GH_AAVE_DATA_FEEDS_PRIVATE_KEY }}
29+
AAVE_PLATFORM_PRIVATE_KEY: ${{ secrets.GH_AAVE_PLATFORM_PRIVATE_KEY }}
30+
31+
jobs:
32+
compile-examples:
33+
name: Run Aptos Unit Tests
34+
runs-on: Larger-Github-Runners
35+
timeout-minutes: 60
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install Aptos CLI
40+
uses: ./.github/actions/install-aptos-cli
41+
with:
42+
version: "7.7.0"
43+
44+
- name: Set Local Aptos Workspace Config
45+
run: make set-workspace-config
46+
47+
- name: Init Local Aptos Workspace Config
48+
run: make init-workspace-config
49+
50+
- name: Run Aptos Compile All Examples
51+
working-directory: examples
52+
run: make compile

Makefile

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -806,78 +806,6 @@ configure-price-feeds:
806806
--function-id '0x${AAVE_DATA_ADDRESS}::v1_deployment::configure_price_feeds' \
807807
--args string:$(APTOS_NETWORK)
808808

809-
810-
# ===================== AAVE-SCRIPTS ===================== #
811-
812-
compile-scripts-testnet:
813-
cd aave-core && aptos move compile \
814-
--included-artifacts none \
815-
--save-metadata \
816-
--package-dir "aave-scripts" \
817-
--skip-fetch-latest-git-deps \
818-
--language-version "$(MOVE_VERSION)" \
819-
--compiler-version "$(COMPILER_VERSION)" \
820-
--named-addresses "aave_acl=0xb23539ad6490a465e92e751943a3eaedf4b48d7d844ff59adf2ae66bcb09f53d,aave_config=0x4fb5d8348c8873295f97136bbe1c43d976fb18a4a966a85e21d16958eaecef99,aave_math=0xf6f896cefd7b1b1e85ff56033981cf92dcd5d6e93b1349a7ab5003761c52498d,aave_oracle=0xcb9eb79a52f41933192c2e1e37a9e72bfd726fdb9a687cd6cfe45527e52f4e41,aave_pool=0xbd7912c555a06809c2e385eab635ff0ef52b1fa062ce865c785c67694a12bb12,aave_large_packages=0x0e1ca3011bdd07246d4d16d909dbb2d6953a86c4735d5acf5865d962c630cce7,aave_mock_underlyings=0xe2b42cab2f84bf57edaf87bcaffee409c2b3d5243e3def00d9d2f7dec568d867,aave_data=0xb0ec364235f47ad2a8eb52d639c80579b11497d0711879840f1ce51c885b165f,data_feeds=0xf1099f135ddddad1c065203431be328a408b0ca452ada70374ce26bd2b32fdd3,platform=0x516e771e1b4a903afe74c27d057c65849ecc1383782f6642d7ff21425f4f9c99,aave_oracle_racc_address=0x3836084d178459c08f27620462d531f5b5b23d14ddbf4f47c4a72d404d87bcb4"
821-
822-
compile-scripts-mainnet:
823-
cd aave-core && aptos move compile \
824-
--included-artifacts none \
825-
--save-metadata \
826-
--package-dir "aave-scripts" \
827-
--skip-fetch-latest-git-deps \
828-
--language-version "$(MOVE_VERSION)" \
829-
--compiler-version "$(COMPILER_VERSION)" \
830-
--named-addresses "aave_acl=0x34c3e6af238f3a7fa3f3b0088cbc4b194d21f62e65a15b79ae91364de5a81a3a,aave_config=0x531069f4741cdead39d70b76e5779863864654fae6db8a752a244ff2f9916c15,aave_math=0xc0338eea778de2a5348824ddbfcec033c7f7cbe18da6da40869562906b63c78c,aave_oracle=0x249676f3faddb83d64fd101baa3f84a171ae02505d796e3edbf4861038a4b5cc,aave_pool=0x39ddcd9e1a39fa14f25e3f9ec8a86074d05cc0881cbf667df8a6ee70942016fb,aave_large_packages=0x0e1ca3011bdd07246d4d16d909dbb2d6953a86c4735d5acf5865d962c630cce7,aave_mock_underlyings=0x12b05c42ac3209a3c6ffadff4ebb6c3e983e5115f26031d56652815b49a14245,aave_data=0x5eb5cc775c5a446db0f3a1c944e11563b97e6a7e1387b9fb459aa26168f738dc,data_feeds=0x3f985798ce4975f430ef5c75776ff98a77b9f9d0fb38184d225adc9c1cc6b79b,platform=0x9976bb288ed9177b542d568fa1ac386819dc99141630e582315804840f41928a,aave_oracle_racc_address=0x3836084d178459c08f27620462d531f5b5b23d14ddbf4f47c4a72d404d87bcb4"
831-
832-
execute-flashloan-simple-dry-run:
833-
aptos move run-script \
834-
--local \
835-
--assume-yes \
836-
--compiled-script-path aave-core/aave-scripts/build/AaveScripts/bytecode_scripts/flashloan_simple.mv \
837-
--language-version "$(MOVE_VERSION)" \
838-
--compiler-version "$(COMPILER_VERSION)" \
839-
--sender-account "$(FLASHLOANER)" \
840-
--profile "$(FLASHLOANER)" \
841-
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
842-
843-
execute-flashloan-complex-dry-run:
844-
aptos move run-script \
845-
--local \
846-
--assume-yes \
847-
--compiled-script-path aave-core/aave-scripts/build/AaveScripts/bytecode_scripts/flashloan_complex.mv \
848-
--language-version "$(MOVE_VERSION)" \
849-
--compiler-version "$(COMPILER_VERSION)" \
850-
--sender-account "$(FLASHLOANER)" \
851-
--profile "$(FLASHLOANER)" \
852-
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
853-
854-
execute-flashloan-simple:
855-
aptos move run-script \
856-
--assume-yes \
857-
--compiled-script-path aave-core/aave-scripts/build/AaveScripts/bytecode_scripts/flashloan_simple.mv \
858-
--language-version "$(MOVE_VERSION)" \
859-
--compiler-version "$(COMPILER_VERSION)" \
860-
--sender-account "$(FLASHLOANER)" \
861-
--profile "$(FLASHLOANER)" \
862-
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
863-
864-
execute-flashloan-complex:
865-
aptos move run-script \
866-
--assume-yes \
867-
--compiled-script-path aave-core/aave-scripts/build/AaveScripts/bytecode_scripts/flashloan_complex.mv \
868-
--language-version "$(MOVE_VERSION)" \
869-
--compiler-version "$(COMPILER_VERSION)" \
870-
--sender-account "$(FLASHLOANER)" \
871-
--profile "$(FLASHLOANER)" \
872-
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
873-
874-
fmt-scripts:
875-
aptos move fmt \
876-
--package-path "aave-core/aave-scripts" \
877-
--config-path ./movefmt.toml \
878-
--emit-mode "overwrite" \
879-
-v
880-
881809
# ===================== GLOBAL COMMANDS ===================== #
882810

883811
ifeq ($(APTOS_NETWORK), local)
@@ -900,8 +828,6 @@ compile-all:
900828
make compile-mock-underlyings
901829
make compile-pool
902830
make compile-data
903-
make compile-scripts-testnet
904-
make compile-scripts-mainnet
905831

906832
publish-all:
907833
make publish-config
@@ -947,7 +873,6 @@ clean-all:
947873
make clean-mock-underlyings
948874
make clean-core
949875
make clean-data
950-
make clean-scripts
951876

952877
# ------------------------------------------------------------
953878
# Coverage
@@ -976,7 +901,6 @@ fmt-move:
976901
make fmt-pool
977902
make fmt-mock-underlyings
978903
make fmt-data
979-
make fmt-scripts
980904

981905
fmt-prettier:
982906
pnpm prettier:fix

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
├── aave-mock-underlyings // Mock Underlyings Package
3838
├── aave-oracle // Oracle Package
3939
├── aave-core // Core Package
40-
├── aave-scripts // Scripts Package
4140
```
4241

4342
---
@@ -52,7 +51,6 @@ flowchart TD
5251
chainlink-data-feeds
5352
aave-large-packages
5453
aave-mock-underlyings
55-
aave-scripts
5654
5755
%% Level 2
5856
aave-acl --> aave-config
@@ -244,25 +242,25 @@ Browse all modules, structs, functions, and events used across Aave's V3 Aptos p
244242

245243
---
246244

247-
## 📜 Running Scripts
245+
## 📜 Running Examples
248246

249-
In addition to Move unit tests and integration tests, this repository contains **example scripts** (such as flashloans) that demonstrate how to interact with the deployed protocol on Aptos.
247+
In addition to Move unit tests and integration tests, this repository contains **example scripts** (such as flashloans) that demonstrate how to interact with the deployed protocol on Aptos. They are all located under the `./examples` packages at root level.
250248

251-
### 🛠️ Compile Scripts
249+
### 🛠️ Compile Example Scripts
252250

253-
Scripts are compiled separately from the core packages:
251+
Example are compiled separately via calling the main commands listed under `./examples/Makefile`:
254252

255253
```bash
256-
# For testnet deployments
254+
# For testnet
257255
make compile-scripts-testnet
258256

259-
# For mainnet deployments
257+
# For mainnet
260258
make compile-scripts-mainnet
261259
```
262260

263261
### 🚀 Execute Example Scripts
264262

265-
Once compiled, scripts can be executed against the target network. For example:
263+
Once compiled, scripts can be executed against the target network compiled above. For example:
266264

267265
```bash
268266
# Simple flashloan example
@@ -272,8 +270,7 @@ make execute-flashloan-simple
272270
make execute-flashloan-complex
273271
```
274272

275-
Each script corresponds to a .mv compiled Move script under `aave-scripts/build/AaveScripts/bytecode_scripts/`.
276-
They are executed via aptos move run-script, with arguments such as asset addresses and flashloan amounts passed in from the Makefile.
273+
Each script corresponds to a .mv compiled Move script under `./examples/build/AaveScripts/bytecode_scripts/`. They are executed via aptos move run-script, with arguments such as asset addresses and flashloan amounts passed in from the Makefile.
277274

278275
🔍 These scripts are primarily intended as examples and tests of protocol functionality, such as taking and repaying flashloans.
279276

examples/Makefile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Conditionally include .env file if not running in CI/CD environment
2+
ifndef GITHUB_ACTIONS
3+
-include ../.env
4+
endif
5+
6+
compile-scripts-testnet:
7+
aptos move compile \
8+
--included-artifacts none \
9+
--save-metadata \
10+
--skip-fetch-latest-git-deps \
11+
--language-version "$(MOVE_VERSION)" \
12+
--compiler-version "$(COMPILER_VERSION)" \
13+
--named-addresses "aave_acl=0xb23539ad6490a465e92e751943a3eaedf4b48d7d844ff59adf2ae66bcb09f53d,aave_config=0x4fb5d8348c8873295f97136bbe1c43d976fb18a4a966a85e21d16958eaecef99,aave_math=0xf6f896cefd7b1b1e85ff56033981cf92dcd5d6e93b1349a7ab5003761c52498d,aave_oracle=0xcb9eb79a52f41933192c2e1e37a9e72bfd726fdb9a687cd6cfe45527e52f4e41,aave_pool=0xbd7912c555a06809c2e385eab635ff0ef52b1fa062ce865c785c67694a12bb12,aave_large_packages=0x0e1ca3011bdd07246d4d16d909dbb2d6953a86c4735d5acf5865d962c630cce7,aave_mock_underlyings=0xe2b42cab2f84bf57edaf87bcaffee409c2b3d5243e3def00d9d2f7dec568d867,aave_data=0xb0ec364235f47ad2a8eb52d639c80579b11497d0711879840f1ce51c885b165f,data_feeds=0xf1099f135ddddad1c065203431be328a408b0ca452ada70374ce26bd2b32fdd3,platform=0x516e771e1b4a903afe74c27d057c65849ecc1383782f6642d7ff21425f4f9c99,aave_oracle_racc_address=0x3836084d178459c08f27620462d531f5b5b23d14ddbf4f47c4a72d404d87bcb4"
14+
15+
compile-scripts-mainnet:
16+
aptos move compile \
17+
--included-artifacts none \
18+
--save-metadata \
19+
--skip-fetch-latest-git-deps \
20+
--language-version "$(MOVE_VERSION)" \
21+
--compiler-version "$(COMPILER_VERSION)" \
22+
--named-addresses "aave_acl=0x34c3e6af238f3a7fa3f3b0088cbc4b194d21f62e65a15b79ae91364de5a81a3a,aave_config=0x531069f4741cdead39d70b76e5779863864654fae6db8a752a244ff2f9916c15,aave_math=0xc0338eea778de2a5348824ddbfcec033c7f7cbe18da6da40869562906b63c78c,aave_oracle=0x249676f3faddb83d64fd101baa3f84a171ae02505d796e3edbf4861038a4b5cc,aave_pool=0x39ddcd9e1a39fa14f25e3f9ec8a86074d05cc0881cbf667df8a6ee70942016fb,aave_large_packages=0x0e1ca3011bdd07246d4d16d909dbb2d6953a86c4735d5acf5865d962c630cce7,aave_mock_underlyings=0x12b05c42ac3209a3c6ffadff4ebb6c3e983e5115f26031d56652815b49a14245,aave_data=0x5eb5cc775c5a446db0f3a1c944e11563b97e6a7e1387b9fb459aa26168f738dc,data_feeds=0x3f985798ce4975f430ef5c75776ff98a77b9f9d0fb38184d225adc9c1cc6b79b,platform=0x9976bb288ed9177b542d568fa1ac386819dc99141630e582315804840f41928a,aave_oracle_racc_address=0x3836084d178459c08f27620462d531f5b5b23d14ddbf4f47c4a72d404d87bcb4"
23+
24+
execute-flashloan-simple-dry-run:
25+
aptos move run-script \
26+
--local \
27+
--assume-yes \
28+
--compiled-script-path ./build/Examples/bytecode_scripts/flashloan_simple.mv \
29+
--language-version "$(MOVE_VERSION)" \
30+
--compiler-version "$(COMPILER_VERSION)" \
31+
--sender-account "$(FLASHLOANER)" \
32+
--profile "$(FLASHLOANER)" \
33+
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
34+
35+
execute-flashloan-complex-dry-run:
36+
aptos move run-script \
37+
--local \
38+
--assume-yes \
39+
--compiled-script-path ./build/Examples/bytecode_scripts/flashloan_complex.mv \
40+
--language-version "$(MOVE_VERSION)" \
41+
--compiler-version "$(COMPILER_VERSION)" \
42+
--sender-account "$(FLASHLOANER)" \
43+
--profile "$(FLASHLOANER)" \
44+
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
45+
46+
execute-flashloan-simple:
47+
aptos move run-script \
48+
--assume-yes \
49+
--compiled-script-path ./build/Examples/bytecode_scripts/flashloan_simple.mv \
50+
--language-version "$(MOVE_VERSION)" \
51+
--compiler-version "$(COMPILER_VERSION)" \
52+
--sender-account "$(FLASHLOANER)" \
53+
--profile "$(FLASHLOANER)" \
54+
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
55+
56+
execute-flashloan-complex:
57+
aptos move run-script \
58+
--assume-yes \
59+
--compiled-script-path ./build/Examples/bytecode_scripts/flashloan_complex.mv \
60+
--language-version "$(MOVE_VERSION)" \
61+
--compiler-version "$(COMPILER_VERSION)" \
62+
--sender-account "$(FLASHLOANER)" \
63+
--profile "$(FLASHLOANER)" \
64+
--args address:$(FLASHLOAN_ASSET) u256:$(FLASHLOAN_AMOUNT)
65+
66+
fmt-scripts:
67+
aptos move fmt \
68+
--package-path "." \
69+
--config-path ../movefmt.toml \
70+
--emit-mode "overwrite" \
71+
-v
72+
73+
# ------------------------------------------------------------
74+
# Common
75+
# ------------------------------------------------------------
76+
77+
compile:
78+
make compile-scripts-testnet
79+
make compile-scripts-mainnet
80+
81+
fmt:
82+
make fmt-scripts
83+
84+
clean: rm -rf build
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "AaveScripts"
3-
version = "1.0.0"
2+
name = "Examples"
3+
version = "1.1.0"
44
upgrade_policy = "compatible"
55
authors = []
66

@@ -13,10 +13,10 @@ AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "
1313
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "mainnet" }
1414
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token", rev = "mainnet" }
1515
AptosTokenObjects = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token-objects", rev = "mainnet" }
16-
AaveAcl = { local = "../aave-acl" }
17-
AaveConfig = { local = "../aave-config" }
18-
AaveOracle = { local = "../aave-oracle" }
19-
AaveData = { local = "../aave-data" }
20-
AavePool = { local = "../" }
16+
AaveAcl = { local = "../aave-core/aave-acl" }
17+
AaveConfig = { local = "../aave-core/aave-config" }
18+
AaveOracle = { local = "../aave-core/aave-oracle" }
19+
AaveData = { local = "../aave-core/aave-data" }
20+
AavePool = { local = "../aave-core" }
2121

2222
[dev-dependencies]

0 commit comments

Comments
 (0)