Skip to content

Commit

Permalink
Merge pull request #450 from remiroyc/unruggable
Browse files Browse the repository at this point in the history
feat: replace `unruggable-core` with `unruggable-sdk`
  • Loading branch information
odilitime authored Dec 26, 2024
2 parents 8fb2734 + ad63d26 commit cc4af0f
Show file tree
Hide file tree
Showing 4 changed files with 1,259 additions and 1,115 deletions.
3 changes: 2 additions & 1 deletion packages/plugin-3d-generation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "dist/index.d.ts",
"dependencies": {
"@elizaos/core": "workspace:*",
"tsup": "8.3.5"
"tsup": "8.3.5",
"whatwg-url": "7.1.0"
},
"scripts": {
"build": "tsup --format esm --dts",
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-starknet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@elizaos/plugin-trustdb": "workspace:*",
"@avnu/avnu-sdk": "2.1.1",
"@uniswap/sdk-core": "6.0.0",
"unruggable-sdk": "1.4.0",
"@unruggable_starknet/core": "0.1.0",
"starknet": "6.18.0",
"tsup": "8.3.5",
Expand Down
110 changes: 55 additions & 55 deletions packages/plugin-starknet/src/actions/unruggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import {
Memory,
ModelClass,
State,
type Action,
} from "@elizaos/core";
import { Percent } from "@uniswap/sdk-core";
import { createMemecoin, launchOnEkubo } from "unruggable-sdk";
import { constants } from "starknet";

import {
getStarknetAccount,
getStarknetProvider,
Expand All @@ -22,9 +26,20 @@ import { AMM, QUOTE_TOKEN_SYMBOL } from "@unruggable_starknet/core/constants";
import { ACCOUNTS, TOKENS } from "../utils/constants.ts";
import { validateStarknetConfig } from "../environment.ts";

export function isDeployTokenContent(
content: DeployData
): content is DeployData {
interface SwapContent {
sellTokenAddress: string;
buyTokenAddress: string;
sellAmount: string;
}

interface DeployTokenContent {
name: string;
symbol: string;
owner: string;
initialSupply: string;
}

export function isDeployTokenContent(content: DeployTokenContent) {
// Validate types
const validTypes =
typeof content.name === "string" &&
Expand Down Expand Up @@ -122,77 +137,62 @@ export const deployToken: Action = {
const provider = getStarknetProvider(runtime);
const account = getStarknetAccount(runtime);

const factory = new Factory({
provider,
chainId: await provider.getChainId(),
});
const chainId = await provider.getChainId();
const config = {
starknetChainId: chainId,
starknetProvider: provider,
};

const { tokenAddress, calls: deployCalls } =
factory.getDeployCalldata({
name: response.name,
symbol: response.symbol,
owner: response.owner,
initialSupply: response.initialSupply,
});

const data = await factory.getMemecoinLaunchData(tokenAddress);

const { calls: launchCalls } = await factory.getEkuboLaunchCalldata(
const { tokenAddress, transactionHash } = await createMemecoin(
config,
{
address: tokenAddress,
name: response.name,
symbol: response.symbol,
owner: response.owner,
totalSupply: response.initialSupply,
decimals: 18,
...data,
},
{
fees: parseFormatedPercentage("3"),
amm: AMM.EKUBO,
teamAllocations: [
{
address: ACCOUNTS.ELIZA,
amount: new Percent(
2.5,
response.initialSupply
).toFixed(0),
},
{
address: ACCOUNTS.BLOBERT,
amount: new Percent(
2.5,
response.initialSupply
).toFixed(0),
},
],
holdLimit: parseFormatedPercentage("2"),
antiBotPeriod: 3600,
quoteToken: {
address: TOKENS.LORDS,
symbol: "LORDS" as QUOTE_TOKEN_SYMBOL,
name: "Lords",
decimals: 18,
camelCased: false,
},
startingMarketCap: parseFormatedAmount("5000"),
initialSupply: response.initialSupply,
starknetAccount: account,
}
);

elizaLogger.log(
"Deployment has been initiated for coin: " +
"Token deployment initiated for: " +
response.name +
" at address: " +
tokenAddress
);
const tx = await account.execute([...deployCalls, ...launchCalls]);

await launchOnEkubo(config, {
antiBotPeriodInSecs: 3600,
currencyAddress: TOKENS.LORDS,
fees: "3",
holdLimit: "2",
memecoinAddress: tokenAddress,
starknetAccount: account,
startingMarketCap: "5000",
teamAllocations: [
{
address: ACCOUNTS.ELIZA,
amount: new Percent(
2.5,
response.initialSupply
).toFixed(0),
},
{
address: ACCOUNTS.BLOBERT,
amount: new Percent(
2.5,
response.initialSupply
).toFixed(0),
},
],
});

callback?.({
text:
"Token Deployment completed successfully!" +
response.symbol +
" deployed in tx: " +
tx.transaction_hash,
transactionHash,
});

return true;
Expand Down
Loading

0 comments on commit cc4af0f

Please sign in to comment.