Skip to content

Commit 4252ae2

Browse files
authored
Examples: Implement bridge and invest in Aave (#16)
1 parent d1aed59 commit 4252ae2

17 files changed

Lines changed: 4587 additions & 1 deletion

examples/05-invest-aave-idle-balance/manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: 1.0.0
2-
name: Invest in a AAVE idle balance
2+
name: Invest in AAVE idle balance
33
description: Automated task to invest in AAVE idle balance above certain threshold in USD
44
inputs:
55
- chainId: uint32
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PRIVATE_KEY=
2+
INVEST_CID=
3+
SMART_ACCOUNT=
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import eslintPluginTypeScript from "@typescript-eslint/eslint-plugin"
2+
import eslintParserTypeScript from "@typescript-eslint/parser"
3+
import eslintPluginImport from "eslint-plugin-import"
4+
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort"
5+
import eslintConfigPrettier from "eslint-config-prettier"
6+
import eslintPluginPrettier from "eslint-plugin-prettier"
7+
8+
export default [
9+
{
10+
ignores: ["node_modules/**", "**/dist/**", "**/build/**", "**/.prettierrc.*", "./src/types/**"]
11+
},
12+
{
13+
files: ["**/*.{ts,tsx}"],
14+
languageOptions: {
15+
ecmaVersion: "latest",
16+
sourceType: "module",
17+
parser: eslintParserTypeScript,
18+
parserOptions: {
19+
project: "./tsconfig.json"
20+
}
21+
},
22+
plugins: {
23+
"@typescript-eslint": eslintPluginTypeScript,
24+
prettier: eslintPluginPrettier,
25+
import: eslintPluginImport,
26+
"simple-import-sort": eslintPluginSimpleImportSort
27+
},
28+
rules: {
29+
...eslintPluginTypeScript.configs.recommended.rules,
30+
"@typescript-eslint/no-namespace": "off",
31+
"@typescript-eslint/no-unused-vars": ["error"],
32+
"@typescript-eslint/explicit-function-return-type": "error",
33+
"@typescript-eslint/no-explicit-any": "error",
34+
35+
"prettier/prettier": [
36+
"error",
37+
{
38+
"semi": false,
39+
"singleQuote": true,
40+
"trailingComma": "es5",
41+
"arrowParens": "always",
42+
"bracketSpacing": true,
43+
"printWidth": 120,
44+
"tabWidth": 2,
45+
"useTabs": false
46+
}
47+
],
48+
49+
"simple-import-sort/imports": [
50+
"error",
51+
{
52+
groups: [
53+
["^@?\\w"],
54+
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
55+
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"]
56+
]
57+
}
58+
],
59+
"simple-import-sort/exports": "error",
60+
61+
"comma-spacing": ["error", { before: false, after: true }],
62+
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1 }]
63+
},
64+
settings: {
65+
"import/resolver": {
66+
typescript: {
67+
alwaysTryTypes: true,
68+
project: "./tsconfig.json"
69+
}
70+
}
71+
}
72+
},
73+
// configuration for test files
74+
{
75+
files: ["tests/**/*.{ts,tsx}", "**/*.spec.{ts,tsx}", "**/*.test.{ts,tsx}"],
76+
languageOptions: {
77+
ecmaVersion: "latest",
78+
sourceType: "module",
79+
parser: eslintParserTypeScript,
80+
parserOptions: {
81+
project: "./tests/tsconfig.json"
82+
}
83+
},
84+
rules: {
85+
"@typescript-eslint/no-unused-expressions": "off"
86+
}
87+
},
88+
eslintConfigPrettier
89+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 1.0.0
2+
name: Bridge USDC and emit an event
3+
description: Bridge USDC between Arbitrum, Base and Optimism, and emit a custom event to trigger another task
4+
inputs:
5+
- sourceChain: uint32
6+
- destinationChain: uint32
7+
- smartAccount: address # Important: The smart account should exist in both chains
8+
- amount: string
9+
- minAmountOut: string
10+
- feeToken: address
11+
- maxFee: string
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 1.0.0
2+
name: Deposit USDC in Aave (event trigger)
3+
description: Deposit in Aave USDC tokens that were bridged from another chain
4+
inputs:
5+
- chainId: uint32
6+
- smartAccount: address
7+
- feeToken: address
8+
- maxFee: string
9+
abis:
10+
- AavePool: ./src/abis/AavePool.json
11+
- ERC20: ./src/abis/ERC20.json
12+
- Settler: ./src/abis/Settler.json
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@mimicprotocol/13-bridge-and-invest-aave",
3+
"version": "0.0.1",
4+
"license": "Unlicensed",
5+
"private": true,
6+
"type": "module",
7+
"scripts": {
8+
"build": "yarn codegen && yarn compile",
9+
"codegen": "yarn codegen:bridge && yarn codegen:invest",
10+
"codegen:bridge": "yarn mimic codegen -m manifest.bridge.yaml -o ./src/types/bridge",
11+
"codegen:invest": "yarn mimic codegen -m manifest.invest.yaml -o ./src/types/invest",
12+
"compile": "yarn compile:bridge && yarn compile:invest",
13+
"compile:bridge": "mimic compile -t src/bridge.ts -m manifest.bridge.yaml -o ./build/bridge",
14+
"compile:invest": "mimic compile -t src/invest.ts -m manifest.invest.yaml -o ./build/invest",
15+
"deploy:bridge": "yarn codegen:bridge && yarn compile:bridge && mimic deploy --input ./build/bridge --output ./build/bridge --skip-compile",
16+
"deploy:invest": "yarn codegen:invest && yarn compile:invest && mimic deploy --input ./build/invest --output ./build/invest --skip-compile",
17+
"test": "yarn build && mimic test --skipCompile",
18+
"create-config:invest": "tsc -p tsconfig.create-config.json && tsx src/create-config.invest.ts",
19+
"lint": "eslint ."
20+
},
21+
"dependencies": {
22+
"dotenv": "^17.0.0",
23+
"ethers": "^6.13.5",
24+
"semver": "^7.7.3"
25+
},
26+
"devDependencies": {
27+
"@mimicprotocol/cli": "latest",
28+
"@mimicprotocol/lib-ts": "latest",
29+
"@mimicprotocol/sdk": "latest",
30+
"@mimicprotocol/test-ts": "latest",
31+
"@types/chai": "^5.2.2",
32+
"@types/mocha": "^10.0.10",
33+
"@types/node": "^22.10.5",
34+
"assemblyscript": "0.27.36",
35+
"chai": "^4.3.7",
36+
"eslint": "^9.10.0",
37+
"json-as": "1.1.7",
38+
"mocha": "^10.2.0",
39+
"tsx": "^4.20.3",
40+
"typescript": "^5.8.3",
41+
"visitor-as": "0.11.4"
42+
}
43+
}

0 commit comments

Comments
 (0)