Skip to content

Commit edecd95

Browse files
committed
Merge branch 'conflux-plugin' of https://github.com/conflux-fans/eliza into HEAD
2 parents 0ffa45c + fd83efa commit edecd95

19 files changed

+2772
-0
lines changed

.env.example

+11
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,14 @@ COINBASE_PRIVATE_KEY= # from coinbase developer portal
9898
# if not configured it will be generated and written to runtime.character.settings.secrets.COINBASE_GENERATED_WALLET_ID and runtime.character.settings.secrets.COINBASE_GENERATED_WALLET_HEX_SEED
9999
COINBASE_GENERATED_WALLET_ID= # not your address but the wallet id from generating a wallet through the plugin
100100
COINBASE_GENERATED_WALLET_HEX_SEED= # not your address but the wallet hex seed from generating a wallet through the plugin and calling export
101+
102+
# Conflux Configuration
103+
CONFLUX_CORE_PRIVATE_KEY=
104+
CONFLUX_CORE_SPACE_RPC_URL=
105+
CONFLUX_ESPACE_PRIVATE_KEY=
106+
CONFLUX_ESPACE_RPC_URL=
107+
CONFLUX_MEME_CONTRACT_ADDRESS=
108+
109+
# Coinbase Commerce
110+
COINBASE_COMMERCE_KEY=
111+

agent/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@ai16z/client-twitter": "workspace:*",
2222
"@ai16z/eliza": "workspace:*",
2323
"@ai16z/plugin-bootstrap": "workspace:*",
24+
"@ai16z/plugin-conflux": "workspace:*",
2425
"@ai16z/plugin-image-generation": "workspace:*",
2526
"@ai16z/plugin-node": "workspace:*",
2627
"@ai16z/plugin-solana": "workspace:*",

agent/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
validateCharacterConfig,
2424
} from "@ai16z/eliza";
2525
import { bootstrapPlugin } from "@ai16z/plugin-bootstrap";
26+
import { confluxPlugin } from "@ai16z/plugin-conflux";
2627
import { solanaPlugin } from "@ai16z/plugin-solana";
2728
import { nodePlugin } from "@ai16z/plugin-node";
2829
import {
@@ -252,6 +253,9 @@ export function createAgent(
252253
character,
253254
plugins: [
254255
bootstrapPlugin,
256+
character.settings.secrets?.CONFLUX_CORE_PRIVATE_KEY
257+
? confluxPlugin
258+
: null,
255259
nodePlugin,
256260
character.settings.secrets?.WALLET_PUBLIC_KEY ? solanaPlugin : null,
257261
character.settings.secrets?.COINBASE_COMMERCE_KEY ||

packages/plugin-conflux/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# @ai16z/plugin-conflux
2+
3+
This plugin provides actions and providers for interacting with the [Conflux network](https://www.confluxdocs.com/docs/general).
4+
5+
## Actions
6+
7+
### ConfiPump
8+
9+
Buy and sell tokens on Conflux's implementation of pump.fun (ConfiPump).
10+
11+
### Transfer
12+
13+
Transfer tokens from one address to another within Conflux core space.
14+
15+
### Bridge Transfer
16+
17+
Transfer tokens from one address to Conflux eSpace.
18+
19+
### Sponsor (TBD)
20+
21+
Provide gas for Conflux core space contracts so they can be called without the need to have Conflux in user's wallet.
22+
23+
### Swap (TBD)
24+
25+
Swap tokens on Conflux DEXs.

packages/plugin-conflux/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@ai16z/plugin-conflux",
3+
"version": "0.0.1",
4+
"main": "dist/index.js",
5+
"type": "module",
6+
"types": "dist/index.d.ts",
7+
"dependencies": {
8+
"cive": "^0.7.1",
9+
"@ai16z/eliza": "workspace:*"
10+
},
11+
"scripts": {
12+
"build": "tsup --format esm --dts",
13+
"dev": "tsup --watch"
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
const CrossSpaceCallAbi = [
2+
{
3+
anonymous: false,
4+
inputs: [
5+
{
6+
indexed: true,
7+
internalType: "bytes20",
8+
name: "sender",
9+
type: "bytes20",
10+
},
11+
{
12+
indexed: true,
13+
internalType: "bytes20",
14+
name: "receiver",
15+
type: "bytes20",
16+
},
17+
{
18+
indexed: false,
19+
internalType: "uint256",
20+
name: "value",
21+
type: "uint256",
22+
},
23+
{
24+
indexed: false,
25+
internalType: "uint256",
26+
name: "nonce",
27+
type: "uint256",
28+
},
29+
{
30+
indexed: false,
31+
internalType: "bytes",
32+
name: "data",
33+
type: "bytes",
34+
},
35+
],
36+
name: "Call",
37+
type: "event",
38+
},
39+
{
40+
anonymous: false,
41+
inputs: [
42+
{
43+
indexed: true,
44+
internalType: "bytes20",
45+
name: "sender",
46+
type: "bytes20",
47+
},
48+
{
49+
indexed: true,
50+
internalType: "bytes20",
51+
name: "contract_address",
52+
type: "bytes20",
53+
},
54+
{
55+
indexed: false,
56+
internalType: "uint256",
57+
name: "value",
58+
type: "uint256",
59+
},
60+
{
61+
indexed: false,
62+
internalType: "uint256",
63+
name: "nonce",
64+
type: "uint256",
65+
},
66+
{
67+
indexed: false,
68+
internalType: "bytes",
69+
name: "init",
70+
type: "bytes",
71+
},
72+
],
73+
name: "Create",
74+
type: "event",
75+
},
76+
{
77+
anonymous: false,
78+
inputs: [
79+
{
80+
indexed: false,
81+
internalType: "bool",
82+
name: "success",
83+
type: "bool",
84+
},
85+
],
86+
name: "Outcome",
87+
type: "event",
88+
},
89+
{
90+
anonymous: false,
91+
inputs: [
92+
{
93+
indexed: true,
94+
internalType: "bytes20",
95+
name: "sender",
96+
type: "bytes20",
97+
},
98+
{
99+
indexed: true,
100+
internalType: "address",
101+
name: "receiver",
102+
type: "address",
103+
},
104+
{
105+
indexed: false,
106+
internalType: "uint256",
107+
name: "value",
108+
type: "uint256",
109+
},
110+
{
111+
indexed: false,
112+
internalType: "uint256",
113+
name: "nonce",
114+
type: "uint256",
115+
},
116+
],
117+
name: "Withdraw",
118+
type: "event",
119+
},
120+
{
121+
inputs: [{ internalType: "bytes", name: "init", type: "bytes" }],
122+
name: "createEVM",
123+
outputs: [{ internalType: "bytes20", name: "", type: "bytes20" }],
124+
stateMutability: "payable",
125+
type: "function",
126+
},
127+
{
128+
inputs: [{ internalType: "bytes20", name: "to", type: "bytes20" }],
129+
name: "transferEVM",
130+
outputs: [{ internalType: "bytes", name: "output", type: "bytes" }],
131+
stateMutability: "payable",
132+
type: "function",
133+
},
134+
{
135+
inputs: [
136+
{ internalType: "bytes20", name: "to", type: "bytes20" },
137+
{ internalType: "bytes", name: "data", type: "bytes" },
138+
],
139+
name: "callEVM",
140+
outputs: [{ internalType: "bytes", name: "output", type: "bytes" }],
141+
stateMutability: "payable",
142+
type: "function",
143+
},
144+
{
145+
inputs: [
146+
{ internalType: "bytes20", name: "to", type: "bytes20" },
147+
{ internalType: "bytes", name: "data", type: "bytes" },
148+
],
149+
name: "staticCallEVM",
150+
outputs: [{ internalType: "bytes", name: "output", type: "bytes" }],
151+
stateMutability: "view",
152+
type: "function",
153+
},
154+
{
155+
inputs: [],
156+
name: "deployEip1820",
157+
outputs: [],
158+
stateMutability: "nonpayable",
159+
type: "function",
160+
},
161+
{
162+
inputs: [{ internalType: "uint256", name: "value", type: "uint256" }],
163+
name: "withdrawFromMapped",
164+
outputs: [],
165+
stateMutability: "nonpayable",
166+
type: "function",
167+
},
168+
{
169+
inputs: [{ internalType: "address", name: "addr", type: "address" }],
170+
name: "mappedBalance",
171+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
172+
stateMutability: "view",
173+
type: "function",
174+
},
175+
{
176+
inputs: [{ internalType: "address", name: "addr", type: "address" }],
177+
name: "mappedNonce",
178+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
179+
stateMutability: "view",
180+
type: "function",
181+
},
182+
];
183+
184+
export default CrossSpaceCallAbi;
+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
const ERC20ABI = [
2+
{
3+
constant: true,
4+
inputs: [],
5+
name: 'name',
6+
outputs: [{ name: '', type: 'string' }],
7+
payable: false,
8+
stateMutability: 'view',
9+
type: 'function',
10+
},
11+
{
12+
constant: false,
13+
inputs: [
14+
{ name: '_spender', type: 'address' },
15+
{ name: '_value', type: 'uint256' },
16+
],
17+
name: 'approve',
18+
outputs: [{ name: '', type: 'bool' }],
19+
payable: false,
20+
stateMutability: 'view',
21+
type: 'function',
22+
},
23+
{
24+
constant: true,
25+
inputs: [],
26+
name: 'totalSupply',
27+
outputs: [{ name: '', type: 'uint256' }],
28+
payable: false,
29+
stateMutability: 'view',
30+
type: 'function',
31+
},
32+
{
33+
constant: false,
34+
inputs: [
35+
{ name: '_from', type: 'address' },
36+
{ name: '_to', type: 'address' },
37+
{ name: '_value', type: 'uint256' },
38+
],
39+
name: 'transferFrom',
40+
outputs: [{ name: '', type: 'bool' }],
41+
payable: false,
42+
stateMutability: 'nonpayable',
43+
type: 'function',
44+
},
45+
{
46+
constant: true,
47+
inputs: [],
48+
name: 'decimals',
49+
outputs: [{ name: '', type: 'uint8' }],
50+
payable: false,
51+
stateMutability: 'view',
52+
type: 'function',
53+
},
54+
{
55+
constant: true,
56+
inputs: [{ name: '_owner', type: 'address' }],
57+
name: 'balanceOf',
58+
outputs: [{ name: 'balance', type: 'uint256' }],
59+
payable: false,
60+
stateMutability: 'view',
61+
type: 'function',
62+
},
63+
{
64+
constant: true,
65+
inputs: [],
66+
name: 'symbol',
67+
outputs: [{ name: '', type: 'string' }],
68+
payable: false,
69+
stateMutability: 'view',
70+
type: 'function',
71+
},
72+
{
73+
constant: false,
74+
inputs: [
75+
{ name: '_to', type: 'address' },
76+
{ name: '_value', type: 'uint256' },
77+
],
78+
name: 'transfer',
79+
outputs: [{ name: '', type: 'bool' }],
80+
payable: false,
81+
stateMutability: 'nonpayable',
82+
type: 'function',
83+
},
84+
{
85+
constant: true,
86+
inputs: [
87+
{ name: '_owner', type: 'address' },
88+
{ name: '_spender', type: 'address' },
89+
],
90+
name: 'allowance',
91+
outputs: [{ name: '', type: 'uint256' }],
92+
payable: false,
93+
stateMutability: 'view',
94+
type: 'function',
95+
},
96+
{ payable: true, stateMutability: 'payable', type: 'fallback' },
97+
{
98+
anonymous: false,
99+
inputs: [
100+
{ indexed: true, name: 'owner', type: 'address' },
101+
{ indexed: true, name: 'spender', type: 'address' },
102+
{ indexed: false, name: 'value', type: 'uint256' },
103+
],
104+
name: 'Approval',
105+
type: 'event',
106+
},
107+
{
108+
anonymous: false,
109+
inputs: [
110+
{ indexed: true, name: 'from', type: 'address' },
111+
{ indexed: true, name: 'to', type: 'address' },
112+
{ indexed: false, name: 'value', type: 'uint256' },
113+
],
114+
name: 'Transfer',
115+
type: 'event',
116+
},
117+
] as const;
118+
119+
export default ERC20ABI;

0 commit comments

Comments
 (0)