@@ -9,8 +9,12 @@ import {
9
9
Memory ,
10
10
ModelClass ,
11
11
State ,
12
+ type Action ,
12
13
} from "@elizaos/core" ;
13
14
import { Percent } from "@uniswap/sdk-core" ;
15
+ import { createMemecoin , launchOnEkubo } from "unruggable-sdk" ;
16
+ import { constants } from "starknet" ;
17
+
14
18
import {
15
19
getStarknetAccount ,
16
20
getStarknetProvider ,
@@ -22,9 +26,20 @@ import { AMM, QUOTE_TOKEN_SYMBOL } from "@unruggable_starknet/core/constants";
22
26
import { ACCOUNTS , TOKENS } from "../utils/constants.ts" ;
23
27
import { validateStarknetConfig } from "../environment.ts" ;
24
28
25
- export function isDeployTokenContent (
26
- content : DeployData
27
- ) : content is DeployData {
29
+ interface SwapContent {
30
+ sellTokenAddress : string ;
31
+ buyTokenAddress : string ;
32
+ sellAmount : string ;
33
+ }
34
+
35
+ interface DeployTokenContent {
36
+ name : string ;
37
+ symbol : string ;
38
+ owner : string ;
39
+ initialSupply : string ;
40
+ }
41
+
42
+ export function isDeployTokenContent ( content : DeployTokenContent ) {
28
43
// Validate types
29
44
const validTypes =
30
45
typeof content . name === "string" &&
@@ -122,77 +137,62 @@ export const deployToken: Action = {
122
137
const provider = getStarknetProvider ( runtime ) ;
123
138
const account = getStarknetAccount ( runtime ) ;
124
139
125
- const factory = new Factory ( {
126
- provider,
127
- chainId : await provider . getChainId ( ) ,
128
- } ) ;
140
+ const chainId = await provider . getChainId ( ) ;
141
+ const config = {
142
+ starknetChainId : chainId ,
143
+ starknetProvider : provider ,
144
+ } ;
129
145
130
- const { tokenAddress, calls : deployCalls } =
131
- factory . getDeployCalldata ( {
132
- name : response . name ,
133
- symbol : response . symbol ,
134
- owner : response . owner ,
135
- initialSupply : response . initialSupply ,
136
- } ) ;
137
-
138
- const data = await factory . getMemecoinLaunchData ( tokenAddress ) ;
139
-
140
- const { calls : launchCalls } = await factory . getEkuboLaunchCalldata (
146
+ const { tokenAddress, transactionHash } = await createMemecoin (
147
+ config ,
141
148
{
142
- address : tokenAddress ,
143
149
name : response . name ,
144
150
symbol : response . symbol ,
145
151
owner : response . owner ,
146
- totalSupply : response . initialSupply ,
147
- decimals : 18 ,
148
- ...data ,
149
- } ,
150
- {
151
- fees : parseFormatedPercentage ( "3" ) ,
152
- amm : AMM . EKUBO ,
153
- teamAllocations : [
154
- {
155
- address : ACCOUNTS . ELIZA ,
156
- amount : new Percent (
157
- 2.5 ,
158
- response . initialSupply
159
- ) . toFixed ( 0 ) ,
160
- } ,
161
- {
162
- address : ACCOUNTS . BLOBERT ,
163
- amount : new Percent (
164
- 2.5 ,
165
- response . initialSupply
166
- ) . toFixed ( 0 ) ,
167
- } ,
168
- ] ,
169
- holdLimit : parseFormatedPercentage ( "2" ) ,
170
- antiBotPeriod : 3600 ,
171
- quoteToken : {
172
- address : TOKENS . LORDS ,
173
- symbol : "LORDS" as QUOTE_TOKEN_SYMBOL ,
174
- name : "Lords" ,
175
- decimals : 18 ,
176
- camelCased : false ,
177
- } ,
178
- startingMarketCap : parseFormatedAmount ( "5000" ) ,
152
+ initialSupply : response . initialSupply ,
153
+ starknetAccount : account ,
179
154
}
180
155
) ;
181
156
182
157
elizaLogger . log (
183
- "Deployment has been initiated for coin : " +
158
+ "Token deployment initiated for: " +
184
159
response . name +
185
160
" at address: " +
186
161
tokenAddress
187
162
) ;
188
- const tx = await account . execute ( [ ...deployCalls , ...launchCalls ] ) ;
163
+
164
+ await launchOnEkubo ( config , {
165
+ antiBotPeriodInSecs : 3600 ,
166
+ currencyAddress : TOKENS . LORDS ,
167
+ fees : "3" ,
168
+ holdLimit : "2" ,
169
+ memecoinAddress : tokenAddress ,
170
+ starknetAccount : account ,
171
+ startingMarketCap : "5000" ,
172
+ teamAllocations : [
173
+ {
174
+ address : ACCOUNTS . ELIZA ,
175
+ amount : new Percent (
176
+ 2.5 ,
177
+ response . initialSupply
178
+ ) . toFixed ( 0 ) ,
179
+ } ,
180
+ {
181
+ address : ACCOUNTS . BLOBERT ,
182
+ amount : new Percent (
183
+ 2.5 ,
184
+ response . initialSupply
185
+ ) . toFixed ( 0 ) ,
186
+ } ,
187
+ ] ,
188
+ } ) ;
189
189
190
190
callback ?.( {
191
191
text :
192
192
"Token Deployment completed successfully!" +
193
193
response . symbol +
194
194
" deployed in tx: " +
195
- tx . transaction_hash ,
195
+ transactionHash ,
196
196
} ) ;
197
197
198
198
return true ;
0 commit comments