Skip to content

Commit a4ad487

Browse files
authored
Merge pull request elizaOS#450 from remiroyc/unruggable
feat: replace `unruggable-core` with `unruggable-sdk`
2 parents d22ee0e + 154bb14 commit a4ad487

File tree

4 files changed

+1259
-1115
lines changed

4 files changed

+1259
-1115
lines changed

packages/plugin-3d-generation/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"types": "dist/index.d.ts",
77
"dependencies": {
88
"@elizaos/core": "workspace:*",
9-
"tsup": "8.3.5"
9+
"tsup": "8.3.5",
10+
"whatwg-url": "7.1.0"
1011
},
1112
"scripts": {
1213
"build": "tsup --format esm --dts",

packages/plugin-starknet/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@elizaos/plugin-trustdb": "workspace:*",
1010
"@avnu/avnu-sdk": "2.1.1",
1111
"@uniswap/sdk-core": "6.0.0",
12+
"unruggable-sdk": "1.4.0",
1213
"@unruggable_starknet/core": "0.1.0",
1314
"starknet": "6.18.0",
1415
"tsup": "8.3.5",

packages/plugin-starknet/src/actions/unruggable.ts

+55-55
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ import {
99
Memory,
1010
ModelClass,
1111
State,
12+
type Action,
1213
} from "@elizaos/core";
1314
import { Percent } from "@uniswap/sdk-core";
15+
import { createMemecoin, launchOnEkubo } from "unruggable-sdk";
16+
import { constants } from "starknet";
17+
1418
import {
1519
getStarknetAccount,
1620
getStarknetProvider,
@@ -22,9 +26,20 @@ import { AMM, QUOTE_TOKEN_SYMBOL } from "@unruggable_starknet/core/constants";
2226
import { ACCOUNTS, TOKENS } from "../utils/constants.ts";
2327
import { validateStarknetConfig } from "../environment.ts";
2428

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) {
2843
// Validate types
2944
const validTypes =
3045
typeof content.name === "string" &&
@@ -122,77 +137,62 @@ export const deployToken: Action = {
122137
const provider = getStarknetProvider(runtime);
123138
const account = getStarknetAccount(runtime);
124139

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+
};
129145

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,
141148
{
142-
address: tokenAddress,
143149
name: response.name,
144150
symbol: response.symbol,
145151
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,
179154
}
180155
);
181156

182157
elizaLogger.log(
183-
"Deployment has been initiated for coin: " +
158+
"Token deployment initiated for: " +
184159
response.name +
185160
" at address: " +
186161
tokenAddress
187162
);
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+
});
189189

190190
callback?.({
191191
text:
192192
"Token Deployment completed successfully!" +
193193
response.symbol +
194194
" deployed in tx: " +
195-
tx.transaction_hash,
195+
transactionHash,
196196
});
197197

198198
return true;

0 commit comments

Comments
 (0)