Skip to content

Commit d9144cf

Browse files
committed
remove hardcoding
1 parent 411e07b commit d9144cf

File tree

2 files changed

+71
-99
lines changed

2 files changed

+71
-99
lines changed
+64-64
Original file line numberDiff line numberDiff line change
@@ -1,224 +1,224 @@
1-
2-
31
export const ABI = [
42
{
5-
constant: true,
63
inputs: [],
74
name: "name",
85
outputs: [
96
{
107
name: "",
118
type: "string",
12-
},
9+
internalType: "string"
10+
}
1311
],
14-
payable: false,
1512
stateMutability: "view",
16-
type: "function",
13+
type: "function"
1714
},
1815
{
19-
constant: false,
2016
inputs: [
2117
{
22-
name: "_spender",
18+
name: "spender",
2319
type: "address",
20+
internalType: "address"
2421
},
2522
{
26-
name: "_value",
23+
name: "amount",
2724
type: "uint256",
28-
},
25+
internalType: "uint256"
26+
}
2927
],
3028
name: "approve",
3129
outputs: [
3230
{
3331
name: "",
3432
type: "bool",
35-
},
33+
internalType: "bool"
34+
}
3635
],
37-
payable: false,
3836
stateMutability: "nonpayable",
39-
type: "function",
37+
type: "function"
4038
},
4139
{
42-
constant: true,
4340
inputs: [],
4441
name: "totalSupply",
4542
outputs: [
4643
{
4744
name: "",
4845
type: "uint256",
49-
},
46+
internalType: "uint256"
47+
}
5048
],
51-
payable: false,
5249
stateMutability: "view",
53-
type: "function",
50+
type: "function"
5451
},
5552
{
56-
constant: false,
5753
inputs: [
5854
{
59-
name: "_from",
55+
name: "from",
6056
type: "address",
57+
internalType: "address"
6158
},
6259
{
63-
name: "_to",
60+
name: "to",
6461
type: "address",
62+
internalType: "address"
6563
},
6664
{
67-
name: "_value",
65+
name: "amount",
6866
type: "uint256",
69-
},
67+
internalType: "uint256"
68+
}
7069
],
7170
name: "transferFrom",
7271
outputs: [
7372
{
7473
name: "",
7574
type: "bool",
76-
},
75+
internalType: "bool"
76+
}
7777
],
78-
payable: false,
7978
stateMutability: "nonpayable",
80-
type: "function",
79+
type: "function"
8180
},
8281
{
83-
constant: true,
8482
inputs: [],
8583
name: "decimals",
8684
outputs: [
8785
{
8886
name: "",
8987
type: "uint8",
90-
},
88+
internalType: "uint8"
89+
}
9190
],
92-
payable: false,
9391
stateMutability: "view",
94-
type: "function",
92+
type: "function"
9593
},
9694
{
97-
constant: true,
9895
inputs: [
9996
{
100-
name: "_owner",
97+
name: "account",
10198
type: "address",
102-
},
99+
internalType: "address"
100+
}
103101
],
104102
name: "balanceOf",
105103
outputs: [
106104
{
107-
name: "balance",
105+
name: "",
108106
type: "uint256",
109-
},
107+
internalType: "uint256"
108+
}
110109
],
111-
payable: false,
112110
stateMutability: "view",
113-
type: "function",
111+
type: "function"
114112
},
115113
{
116-
constant: true,
117114
inputs: [],
118115
name: "symbol",
119116
outputs: [
120117
{
121118
name: "",
122119
type: "string",
123-
},
120+
internalType: "string"
121+
}
124122
],
125-
payable: false,
126123
stateMutability: "view",
127-
type: "function",
124+
type: "function"
128125
},
129126
{
130-
constant: false,
131127
inputs: [
132128
{
133-
name: "_to",
129+
name: "to",
134130
type: "address",
131+
internalType: "address"
135132
},
136133
{
137-
name: "_value",
134+
name: "amount",
138135
type: "uint256",
139-
},
136+
internalType: "uint256"
137+
}
140138
],
141139
name: "transfer",
142140
outputs: [
143141
{
144142
name: "",
145143
type: "bool",
146-
},
144+
internalType: "bool"
145+
}
147146
],
148-
payable: false,
149147
stateMutability: "nonpayable",
150-
type: "function",
148+
type: "function"
151149
},
152150
{
153-
constant: true,
154151
inputs: [
155152
{
156-
name: "_owner",
153+
name: "owner",
157154
type: "address",
155+
internalType: "address"
158156
},
159157
{
160-
name: "_spender",
158+
name: "spender",
161159
type: "address",
162-
},
160+
internalType: "address"
161+
}
163162
],
164163
name: "allowance",
165164
outputs: [
166165
{
167166
name: "",
168167
type: "uint256",
169-
},
168+
internalType: "uint256"
169+
}
170170
],
171-
payable: false,
172171
stateMutability: "view",
173-
type: "function",
174-
},
175-
{
176-
payable: true,
177-
stateMutability: "payable",
178-
type: "fallback",
172+
type: "function"
179173
},
180174
{
181-
anonymous: false,
182175
inputs: [
183176
{
184177
indexed: true,
185178
name: "owner",
186179
type: "address",
180+
internalType: "address"
187181
},
188182
{
189183
indexed: true,
190184
name: "spender",
191185
type: "address",
186+
internalType: "address"
192187
},
193188
{
194189
indexed: false,
195190
name: "value",
196191
type: "uint256",
197-
},
192+
internalType: "uint256"
193+
}
198194
],
199195
name: "Approval",
200196
type: "event",
197+
anonymous: false
201198
},
202199
{
203-
anonymous: false,
204200
inputs: [
205201
{
206202
indexed: true,
207203
name: "from",
208204
type: "address",
205+
internalType: "address"
209206
},
210207
{
211208
indexed: true,
212209
name: "to",
213210
type: "address",
211+
internalType: "address"
214212
},
215213
{
216214
indexed: false,
217215
name: "value",
218216
type: "uint256",
219-
},
217+
internalType: "uint256"
218+
}
220219
],
221220
name: "Transfer",
222221
type: "event",
223-
},
222+
anonymous: false
223+
}
224224
];

packages/plugin-coinbase/src/plugins/tokenContract.ts

+7-35
Original file line numberDiff line numberDiff line change
@@ -492,41 +492,13 @@ export const readContractAction: Action = {
492492

493493
const { contractAddress, method, args, networkId, abi } = readDetails.object;
494494
elizaLogger.log("Reading contract:", { contractAddress, method, args, networkId, abi });
495-
// const result = await readContract({
496-
// networkId,
497-
// contractAddress,
498-
// method,
499-
// args,
500-
// abi: ABI as any,
501-
// });
495+
502496
const result = await readContract({
503-
networkId: Coinbase.networks.EthereumMainnet, // Network ID in the format "<chain>-<network>"
504-
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC contract address
505-
method: "balanceOf", // Method name from the contract
506-
args: {
507-
account: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" // Example address (Vitalik's)
508-
},
509-
abi: [
510-
{
511-
"inputs": [
512-
{
513-
"name": "account",
514-
"type": "address",
515-
"internalType": "address"
516-
}
517-
],
518-
"name": "balanceOf",
519-
"outputs": [
520-
{
521-
"name": "",
522-
"type": "uint256",
523-
"internalType": "uint256"
524-
}
525-
],
526-
"stateMutability": "view",
527-
"type": "function"
528-
}
529-
]
497+
networkId,
498+
contractAddress,
499+
method,
500+
args,
501+
abi: ABI as any,
530502
});
531503

532504
// Serialize the result before using it
@@ -550,7 +522,7 @@ export const readContractAction: Action = {
550522
{
551523
user: "{{user1}}",
552524
content: {
553-
text: "Read the balance of address 0xbcF7C64B880FA89a015970dC104E848d485f99A3 from the ERC20 contract at 0x37f2131ebbc8f97717edc3456879ef56b9f4b97b for asset USDC on eth",
525+
text: "Read the balance of address 0xbcF7C64B880FA89a015970dC104E848d485f99A3 from the ERC20 contract at 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 on eth",
554526
},
555527
},
556528
{

0 commit comments

Comments
 (0)