@lit-protocol/vincent-ability-aave 0.0.7-mma
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +90 -0
- package/README.md +113 -0
- package/dist/CONTRIBUTING.md +90 -0
- package/dist/README.md +113 -0
- package/dist/package.json +31 -0
- package/dist/src/generated/lit-action.js +9 -0
- package/dist/src/generated/vincent-ability-metadata.json +3 -0
- package/dist/src/generated/vincent-bundled-ability.d.ts +92 -0
- package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
- package/dist/src/generated/vincent-bundled-ability.js +15 -0
- package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
- package/dist/src/generated/vincent-bundled-ability.ts +13 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/helpers/index.d.ts +71 -0
- package/dist/src/lib/helpers/index.d.ts.map +1 -0
- package/dist/src/lib/helpers/index.js +345 -0
- package/dist/src/lib/helpers/index.js.map +1 -0
- package/dist/src/lib/lit-action.d.ts +2 -0
- package/dist/src/lib/lit-action.d.ts.map +1 -0
- package/dist/src/lib/lit-action.js +15 -0
- package/dist/src/lib/lit-action.js.map +1 -0
- package/dist/src/lib/schemas.d.ts +118 -0
- package/dist/src/lib/schemas.d.ts.map +1 -0
- package/dist/src/lib/schemas.js +115 -0
- package/dist/src/lib/schemas.js.map +1 -0
- package/dist/src/lib/vincent-ability.d.ts +90 -0
- package/dist/src/lib/vincent-ability.d.ts.map +1 -0
- package/dist/src/lib/vincent-ability.js +352 -0
- package/dist/src/lib/vincent-ability.js.map +1 -0
- package/package.json +30 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Contributing to Vincent Ability Aave
|
|
2
|
+
|
|
3
|
+
This document provides guidelines for contributing to the Vincent Ability Aave project.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Vincent Ability Aave is a ability to send deposit, withdraw or redeem Aave transactions from a Vincent app on behalf of the delegator. It's part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
1. Follow the global setup instructions in the repository root [CONTRIBUTING.md](../../../CONTRIBUTING.md).
|
|
12
|
+
2. Install dependencies:
|
|
13
|
+
```bash
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Development Workflow
|
|
18
|
+
|
|
19
|
+
### Testing
|
|
20
|
+
|
|
21
|
+
Run tests:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
nx test ability-aave
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Building the Lit Action
|
|
28
|
+
|
|
29
|
+
Build the ability:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
nx action:build ability-aave
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Deploying the Lit Action to IPFS
|
|
36
|
+
|
|
37
|
+
Building will be done automatically. Deploy the ability:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
nx action:deploy ability-erc20-approval
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Project Structure
|
|
44
|
+
|
|
45
|
+
- `src/`: Source code
|
|
46
|
+
- `index.ts`: Main entry point
|
|
47
|
+
|
|
48
|
+
## Ability Development Guidelines
|
|
49
|
+
|
|
50
|
+
1. Use the Vincent Ability SDK to create abilitys
|
|
51
|
+
2. Define clear schemas for ability parameters
|
|
52
|
+
3. Implement the ability lifecycle methods (precheck, execute)
|
|
53
|
+
4. Handle errors gracefully
|
|
54
|
+
5. Write comprehensive tests for all functionality
|
|
55
|
+
6. Document the ability's purpose and usage
|
|
56
|
+
|
|
57
|
+
## Integration with Policies
|
|
58
|
+
|
|
59
|
+
This ability can be integrated with various Vincent Policies to enforce constraints. When developing or modifying the ability, consider how it will be used with policies such as:
|
|
60
|
+
|
|
61
|
+
- Vincent Policy Spending Limit
|
|
62
|
+
|
|
63
|
+
## Testing
|
|
64
|
+
|
|
65
|
+
Write unit tests for all functionality:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
- Document the ability's purpose and usage
|
|
74
|
+
- Update README.md when adding new features
|
|
75
|
+
- Document the ability's parameters and behavior
|
|
76
|
+
|
|
77
|
+
## Pull Request Process
|
|
78
|
+
|
|
79
|
+
1. Ensure your code follows the coding standards
|
|
80
|
+
2. Update documentation if necessary
|
|
81
|
+
3. Include tests for new functionality
|
|
82
|
+
4. Link any related issues in your pull request description
|
|
83
|
+
5. Request a review from a maintainer
|
|
84
|
+
|
|
85
|
+
## Additional Resources
|
|
86
|
+
|
|
87
|
+
- [Vincent Documentation](https://docs.heyvincent.ai/)
|
|
88
|
+
- [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
|
|
89
|
+
- [ERC20 Standard](https://eips.ethereum.org/EIPS/eip-20)
|
|
90
|
+
- [ERC4626 Standard](https://eips.ethereum.org/EIPS/eip-4626)
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Vincent Aave Ability
|
|
2
|
+
|
|
3
|
+
A comprehensive DeFi ability for interacting with Aave v3 protocol on Ethereum, built for the Vincent
|
|
4
|
+
Scaffold SDK and Lit Actions execution environment.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
The Vincent Aave Ability enables secure, decentralized interactions with the Aave v3 lending protocol
|
|
9
|
+
through Lit Actions. It supports all core Aave operations: supplying assets as collateral, borrowing
|
|
10
|
+
against collateral, repaying debt, and withdrawing assets.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Supply assets as collateral to earn interest
|
|
15
|
+
- Withdraw supplied assets
|
|
16
|
+
- Borrow against collateral with stable or variable rates
|
|
17
|
+
- Repay borrowed assets
|
|
18
|
+
- Multi-chain support (Ethereum, Polygon, Arbitrum, Optimism, Base, and more)
|
|
19
|
+
- Integrated with Vincent Ability SDK for secure execution
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @lit-protocol/vincent-ability-aave
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { getVincentAbilityClient } from '@lit-protocol/vincent-app-sdk';
|
|
31
|
+
import { bundledVincentAbility as aaveAbility } from '@lit-protocol/vincent-ability-aave';
|
|
32
|
+
|
|
33
|
+
// Initialize the ability client
|
|
34
|
+
const aaveAbilityClient = getVincentAbilityClient({
|
|
35
|
+
bundledVincentAbility: aaveAbility,
|
|
36
|
+
ethersSigner: yourSigner, // Your ethers signer
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Example: Supply WETH as collateral
|
|
40
|
+
const supplyParams = {
|
|
41
|
+
operation: 'supply',
|
|
42
|
+
asset: '0xC558DBdd856501FCd9aaF1E62eae57A9F0629a3c', // WETH on Sepolia
|
|
43
|
+
amount: '0.01',
|
|
44
|
+
chain: 'sepolia',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// First run precheck
|
|
48
|
+
const precheckRes = await aaveAbilityClient.precheck(supplyParams, {
|
|
49
|
+
delegatorPkpEthAddress: pkpAddress,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (precheckRes.success) {
|
|
53
|
+
// Then execute
|
|
54
|
+
const executeRes = await aaveAbilityClient.execute(supplyParams, {
|
|
55
|
+
delegatorPkpEthAddress: pkpAddress,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (executeRes.success) {
|
|
59
|
+
console.log('Transaction hash:', executeRes.result.data.txHash);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Parameters
|
|
65
|
+
|
|
66
|
+
| Parameter | Type | Required | Description |
|
|
67
|
+
| ------------------ | ----------------------------------------------- | -------- | -------------------------------------------------------------- |
|
|
68
|
+
| `operation` | `"supply" \| "withdraw" \| "borrow" \| "repay"` | ✅ | The Aave operation to perform |
|
|
69
|
+
| `asset` | `string` | ✅ | Token contract address (0x format) |
|
|
70
|
+
| `amount` | `string` | ✅ | Amount as a string (e.g., "1.5") |
|
|
71
|
+
| `chain` | `string` | ✅ | Chain identifier (e.g., "ethereum", "polygon") |
|
|
72
|
+
| `interestRateMode` | `1 \| 2` | ❌ | 1=Stable, 2=Variable (required for borrow/repay) |
|
|
73
|
+
| `onBehalfOf` | `string` | ❌ | Address to perform operation on behalf of (defaults to sender) |
|
|
74
|
+
| `rpcUrl` | `string` | ❌ | Custom RPC URL for precheck validation |
|
|
75
|
+
|
|
76
|
+
## Prerequisites
|
|
77
|
+
|
|
78
|
+
- Node.js 16+ and npm/yarn
|
|
79
|
+
- Sufficient token balance for the operation
|
|
80
|
+
- Token approval for supply/repay operations
|
|
81
|
+
- Properly configured PKP wallet with required permissions
|
|
82
|
+
|
|
83
|
+
## Building
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Build the ability
|
|
87
|
+
npm run build
|
|
88
|
+
|
|
89
|
+
# Build all abilitys and policies
|
|
90
|
+
npm run vincent:build
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Testing
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Run unit tests
|
|
97
|
+
npm test
|
|
98
|
+
|
|
99
|
+
# Run E2E tests
|
|
100
|
+
npm run test:e2e
|
|
101
|
+
|
|
102
|
+
# Reset test state
|
|
103
|
+
npm run test:reset
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how
|
|
109
|
+
to contribute to this project.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Contributing to Vincent Ability Aave
|
|
2
|
+
|
|
3
|
+
This document provides guidelines for contributing to the Vincent Ability Aave project.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Vincent Ability Aave is a ability to send deposit, withdraw or redeem Aave transactions from a Vincent app on behalf of the delegator. It's part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
1. Follow the global setup instructions in the repository root [CONTRIBUTING.md](../../../CONTRIBUTING.md).
|
|
12
|
+
2. Install dependencies:
|
|
13
|
+
```bash
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Development Workflow
|
|
18
|
+
|
|
19
|
+
### Testing
|
|
20
|
+
|
|
21
|
+
Run tests:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
nx test ability-aave
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Building the Lit Action
|
|
28
|
+
|
|
29
|
+
Build the ability:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
nx action:build ability-aave
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Deploying the Lit Action to IPFS
|
|
36
|
+
|
|
37
|
+
Building will be done automatically. Deploy the ability:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
nx action:deploy ability-erc20-approval
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Project Structure
|
|
44
|
+
|
|
45
|
+
- `src/`: Source code
|
|
46
|
+
- `index.ts`: Main entry point
|
|
47
|
+
|
|
48
|
+
## Ability Development Guidelines
|
|
49
|
+
|
|
50
|
+
1. Use the Vincent Ability SDK to create abilitys
|
|
51
|
+
2. Define clear schemas for ability parameters
|
|
52
|
+
3. Implement the ability lifecycle methods (precheck, execute)
|
|
53
|
+
4. Handle errors gracefully
|
|
54
|
+
5. Write comprehensive tests for all functionality
|
|
55
|
+
6. Document the ability's purpose and usage
|
|
56
|
+
|
|
57
|
+
## Integration with Policies
|
|
58
|
+
|
|
59
|
+
This ability can be integrated with various Vincent Policies to enforce constraints. When developing or modifying the ability, consider how it will be used with policies such as:
|
|
60
|
+
|
|
61
|
+
- Vincent Policy Spending Limit
|
|
62
|
+
|
|
63
|
+
## Testing
|
|
64
|
+
|
|
65
|
+
Write unit tests for all functionality:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
- Document the ability's purpose and usage
|
|
74
|
+
- Update README.md when adding new features
|
|
75
|
+
- Document the ability's parameters and behavior
|
|
76
|
+
|
|
77
|
+
## Pull Request Process
|
|
78
|
+
|
|
79
|
+
1. Ensure your code follows the coding standards
|
|
80
|
+
2. Update documentation if necessary
|
|
81
|
+
3. Include tests for new functionality
|
|
82
|
+
4. Link any related issues in your pull request description
|
|
83
|
+
5. Request a review from a maintainer
|
|
84
|
+
|
|
85
|
+
## Additional Resources
|
|
86
|
+
|
|
87
|
+
- [Vincent Documentation](https://docs.heyvincent.ai/)
|
|
88
|
+
- [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
|
|
89
|
+
- [ERC20 Standard](https://eips.ethereum.org/EIPS/eip-20)
|
|
90
|
+
- [ERC4626 Standard](https://eips.ethereum.org/EIPS/eip-4626)
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Vincent Aave Ability
|
|
2
|
+
|
|
3
|
+
A comprehensive DeFi ability for interacting with Aave v3 protocol on Ethereum, built for the Vincent
|
|
4
|
+
Scaffold SDK and Lit Actions execution environment.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
The Vincent Aave Ability enables secure, decentralized interactions with the Aave v3 lending protocol
|
|
9
|
+
through Lit Actions. It supports all core Aave operations: supplying assets as collateral, borrowing
|
|
10
|
+
against collateral, repaying debt, and withdrawing assets.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Supply assets as collateral to earn interest
|
|
15
|
+
- Withdraw supplied assets
|
|
16
|
+
- Borrow against collateral with stable or variable rates
|
|
17
|
+
- Repay borrowed assets
|
|
18
|
+
- Multi-chain support (Ethereum, Polygon, Arbitrum, Optimism, Base, and more)
|
|
19
|
+
- Integrated with Vincent Ability SDK for secure execution
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @lit-protocol/vincent-ability-aave
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { getVincentAbilityClient } from '@lit-protocol/vincent-app-sdk';
|
|
31
|
+
import { bundledVincentAbility as aaveAbility } from '@lit-protocol/vincent-ability-aave';
|
|
32
|
+
|
|
33
|
+
// Initialize the ability client
|
|
34
|
+
const aaveAbilityClient = getVincentAbilityClient({
|
|
35
|
+
bundledVincentAbility: aaveAbility,
|
|
36
|
+
ethersSigner: yourSigner, // Your ethers signer
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Example: Supply WETH as collateral
|
|
40
|
+
const supplyParams = {
|
|
41
|
+
operation: 'supply',
|
|
42
|
+
asset: '0xC558DBdd856501FCd9aaF1E62eae57A9F0629a3c', // WETH on Sepolia
|
|
43
|
+
amount: '0.01',
|
|
44
|
+
chain: 'sepolia',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// First run precheck
|
|
48
|
+
const precheckRes = await aaveAbilityClient.precheck(supplyParams, {
|
|
49
|
+
delegatorPkpEthAddress: pkpAddress,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (precheckRes.success) {
|
|
53
|
+
// Then execute
|
|
54
|
+
const executeRes = await aaveAbilityClient.execute(supplyParams, {
|
|
55
|
+
delegatorPkpEthAddress: pkpAddress,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (executeRes.success) {
|
|
59
|
+
console.log('Transaction hash:', executeRes.result.data.txHash);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Parameters
|
|
65
|
+
|
|
66
|
+
| Parameter | Type | Required | Description |
|
|
67
|
+
| ------------------ | ----------------------------------------------- | -------- | -------------------------------------------------------------- |
|
|
68
|
+
| `operation` | `"supply" \| "withdraw" \| "borrow" \| "repay"` | ✅ | The Aave operation to perform |
|
|
69
|
+
| `asset` | `string` | ✅ | Token contract address (0x format) |
|
|
70
|
+
| `amount` | `string` | ✅ | Amount as a string (e.g., "1.5") |
|
|
71
|
+
| `chain` | `string` | ✅ | Chain identifier (e.g., "ethereum", "polygon") |
|
|
72
|
+
| `interestRateMode` | `1 \| 2` | ❌ | 1=Stable, 2=Variable (required for borrow/repay) |
|
|
73
|
+
| `onBehalfOf` | `string` | ❌ | Address to perform operation on behalf of (defaults to sender) |
|
|
74
|
+
| `rpcUrl` | `string` | ❌ | Custom RPC URL for precheck validation |
|
|
75
|
+
|
|
76
|
+
## Prerequisites
|
|
77
|
+
|
|
78
|
+
- Node.js 16+ and npm/yarn
|
|
79
|
+
- Sufficient token balance for the operation
|
|
80
|
+
- Token approval for supply/repay operations
|
|
81
|
+
- Properly configured PKP wallet with required permissions
|
|
82
|
+
|
|
83
|
+
## Building
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Build the ability
|
|
87
|
+
npm run build
|
|
88
|
+
|
|
89
|
+
# Build all abilitys and policies
|
|
90
|
+
npm run vincent:build
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Testing
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Run unit tests
|
|
97
|
+
npm test
|
|
98
|
+
|
|
99
|
+
# Run E2E tests
|
|
100
|
+
npm run test:e2e
|
|
101
|
+
|
|
102
|
+
# Reset test state
|
|
103
|
+
npm run test:reset
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how
|
|
109
|
+
to contribute to this project.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lit-protocol/vincent-ability-aave",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@bgd-labs/aave-address-book": "^4.19.3",
|
|
9
|
+
"@lit-protocol/vincent-scaffold-sdk": "^1.1.6",
|
|
10
|
+
"@lit-protocol/vincent-ability-sdk": "workspace:*",
|
|
11
|
+
"ethers": "^5.8.0",
|
|
12
|
+
"tslib": "2.8.1",
|
|
13
|
+
"zod": "^3.25.64"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@lit-protocol/vincent-app-sdk": "workspace:^"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"esbuild": "^0.19.12",
|
|
20
|
+
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
21
|
+
"ipfs-only-hash": "^4.0.0"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/src/index.js",
|
|
24
|
+
"module": "./dist/src/index.js",
|
|
25
|
+
"types": "./dist/src/index.d.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/**",
|
|
28
|
+
"*.md"
|
|
29
|
+
],
|
|
30
|
+
"type": "commonjs"
|
|
31
|
+
}
|