@elizaos/plugin-form 0.1.9
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/LICENSE +21 -0
- package/README.md +175 -0
- package/dist/ccip-WZ25DRWK.js +12 -0
- package/dist/chunk-TKDWHZ6M.js +3946 -0
- package/dist/index.js +9301 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Shaw Walters, aka Moon aka @lalalune
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# @elizaos/plugin-form
|
|
2
|
+
|
|
3
|
+
A plugin for integrating Form chain capabilities within the ElizaOS ecosystem, providing direct access to curves-based token economics and ERC20 conversions.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
[Form Chain](https://form.network/) is a blockchain platform that implements curves-based token economics, allowing users to interact with bonding curves for token creation, trading, and management. This plugin integrates Form chain with Eliza, giving your agent the ability to:
|
|
8
|
+
|
|
9
|
+
- Buy and sell curves tokens
|
|
10
|
+
- Convert between curves and ERC20 tokens
|
|
11
|
+
- Manage token holdings
|
|
12
|
+
- Query prices and balances
|
|
13
|
+
- Create new ERC20 tokens for curves
|
|
14
|
+
|
|
15
|
+
The plugin supports both QUADRATIC and LOGRITHMIC formulas, optimizing for different use cases and trading volumes.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm install @elizaos/plugin-form
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
### Environment Variables
|
|
26
|
+
```bash
|
|
27
|
+
FORM_PRIVATE_KEY=<Your Form chain wallet private key>
|
|
28
|
+
FORM_TESTNET=true # Optional, defaults to false
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Plugin Setup
|
|
32
|
+
```typescript
|
|
33
|
+
// In your agent configuration
|
|
34
|
+
import { formPlugin } from "@elizaos/plugin-form";
|
|
35
|
+
|
|
36
|
+
const character = {
|
|
37
|
+
plugins: [formPlugin],
|
|
38
|
+
// ... other configuration
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Actions
|
|
43
|
+
|
|
44
|
+
### BUY_CURVES_TOKEN
|
|
45
|
+
Buy curves tokens for a subject address.
|
|
46
|
+
```typescript
|
|
47
|
+
await runtime.processAction("BUY_CURVES_TOKEN", {
|
|
48
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
49
|
+
amount: 1,
|
|
50
|
+
formula: "QUADRATIC" // or "LOGRITHMIC" for high volume
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### SELL_CURVES_TOKEN
|
|
55
|
+
Sell curves tokens back to the protocol.
|
|
56
|
+
```typescript
|
|
57
|
+
await runtime.processAction("SELL_CURVES_TOKEN", {
|
|
58
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
59
|
+
amount: 1,
|
|
60
|
+
formula: "QUADRATIC"
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### WITHDRAW_CURVES_TOKEN
|
|
65
|
+
Convert curves tokens to their ERC20 equivalent.
|
|
66
|
+
```typescript
|
|
67
|
+
await runtime.processAction("WITHDRAW_CURVES_TOKEN", {
|
|
68
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
69
|
+
amount: 1,
|
|
70
|
+
formula: "QUADRATIC"
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### DEPOSIT_CURVES_TOKEN
|
|
75
|
+
Convert ERC20 tokens back to curves.
|
|
76
|
+
```typescript
|
|
77
|
+
await runtime.processAction("DEPOSIT_CURVES_TOKEN", {
|
|
78
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
79
|
+
amount: "1000000000000000000", // 1 token in 18 decimals
|
|
80
|
+
formula: "QUADRATIC"
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### MINT_CURVES_ERC20
|
|
85
|
+
Mint new ERC20 token for curves holdings.
|
|
86
|
+
```typescript
|
|
87
|
+
await runtime.processAction("MINT_CURVES_ERC20", {
|
|
88
|
+
name: "My Token",
|
|
89
|
+
symbol: "MTK",
|
|
90
|
+
formula: "QUADRATIC"
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### GET_CURVES_BALANCE
|
|
95
|
+
Check curves token balance.
|
|
96
|
+
```typescript
|
|
97
|
+
await runtime.processAction("GET_CURVES_BALANCE", {
|
|
98
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
99
|
+
formula: "QUADRATIC"
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### GET_CURVES_BUY_PRICE
|
|
104
|
+
Get price quote for buying curves.
|
|
105
|
+
```typescript
|
|
106
|
+
await runtime.processAction("GET_CURVES_BUY_PRICE", {
|
|
107
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
108
|
+
amount: 1,
|
|
109
|
+
formula: "QUADRATIC"
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### GET_CURVES_SELL_PRICE
|
|
114
|
+
Get price quote for selling curves.
|
|
115
|
+
```typescript
|
|
116
|
+
await runtime.processAction("GET_CURVES_SELL_PRICE", {
|
|
117
|
+
subject: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
118
|
+
amount: 1,
|
|
119
|
+
formula: "QUADRATIC"
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Formula Selection
|
|
124
|
+
|
|
125
|
+
The plugin supports two bonding curve formulas:
|
|
126
|
+
|
|
127
|
+
### QUADRATIC
|
|
128
|
+
|
|
129
|
+
- Default formula for standard operations
|
|
130
|
+
- Suitable for personal and small group usage
|
|
131
|
+
- Balanced price impact
|
|
132
|
+
|
|
133
|
+
### LOGRITHMIC
|
|
134
|
+
|
|
135
|
+
- Optimized for high volume trading
|
|
136
|
+
- Better price stability
|
|
137
|
+
- Recommended for large-scale operations
|
|
138
|
+
|
|
139
|
+
## Best Practices
|
|
140
|
+
### Security
|
|
141
|
+
|
|
142
|
+
- Store private keys securely using environment variables
|
|
143
|
+
- Never expose keys in code or commits
|
|
144
|
+
- Validate addresses before transactions
|
|
145
|
+
- Check balances before operations
|
|
146
|
+
|
|
147
|
+
### Performance
|
|
148
|
+
|
|
149
|
+
- Use caching for repeated price checks
|
|
150
|
+
|
|
151
|
+
Trading
|
|
152
|
+
|
|
153
|
+
- Always check price quotes before trading
|
|
154
|
+
- Use appropriate formula for volume
|
|
155
|
+
- Monitor price impact
|
|
156
|
+
|
|
157
|
+
## Error Handling
|
|
158
|
+
The plugin provides detailed error messages for common issues:
|
|
159
|
+
```typescript
|
|
160
|
+
try {
|
|
161
|
+
await runtime.processAction("BUY_CURVES_TOKEN", {...});
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (error.message.includes("insufficient balance")) {
|
|
164
|
+
// Handle insufficient funds
|
|
165
|
+
} else if (error.message.includes("price impact too high")) {
|
|
166
|
+
// Handle excessive price impact
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
This plugin is part of the ElizaOS project. See the main project repository Contributing Guide for details.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
This plugin is part of the ElizaOS project. See the main project repository for license information.
|