Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/upgrade contract 01 05 2024 #25

Merged
merged 25 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f211f39
v1.1.6
avernikoz Apr 30, 2024
27296e1
upgrade memechan-ts-interface
avernikoz May 1, 2024
d252c10
[wip] remove ticket from bonding curve implementation
avernikoz May 1, 2024
bf314ad
upgrade packages & objecs
avernikoz May 1, 2024
413ac54
update example for bonding curve creation
avernikoz May 1, 2024
1edeea8
remove ticketCoin
avernikoz May 1, 2024
540b784
update parsers for getAllPools
avernikoz May 1, 2024
81fa788
update extract example
avernikoz May 1, 2024
6c2e428
delete example get-token-policy-cap-by-pool-id
avernikoz May 1, 2024
7545469
add getPoolDetailedInfo method & typeguard & example for bonding curve
avernikoz May 1, 2024
f907af3
update BondingPool: add getPoolDetailedInfo & remove legacy methods
avernikoz May 1, 2024
b926900
clean up
avernikoz May 1, 2024
c5f93b2
fix meme coin type in extractRegistryKeyData
avernikoz May 1, 2024
0f0d6dd
upd is-memecoin-ready-to-live-phase example
avernikoz May 1, 2024
fc0a156
fix trading example get-swap-output-amount-for-sui-input
avernikoz May 1, 2024
6aafcf0
update getSwapOutputAmountForSuiInput
avernikoz May 1, 2024
f887038
upd example get-swap-output-amount-for-ticket-input
avernikoz May 1, 2024
3b92335
fix swap-sui-for-ticket example
avernikoz May 1, 2024
dde71a9
update swap-ticket-for-sui
avernikoz May 1, 2024
2429a0a
upd init-secondary-marketplace example
avernikoz May 1, 2024
e5dffc0
organize imports
avernikoz May 1, 2024
0467b57
fix imports
avernikoz May 1, 2024
2838b1b
upd init secondary stuff
avernikoz May 1, 2024
cdfc876
fix examples
avernikoz May 1, 2024
01a16da
sell related methods update
avernikoz May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/admin/init-secondary-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const initSecondaryMarketExample = async ({ transaction }: { transaction?
...initSecondaryMarketData,
lpCoinTreasureCapId: lpCoinData.lpCoin.treasureCapId,
lpCoinType: lpCoinData.lpCoin.coinType,
lpMeta: lpCoinData.lpCoin.metadataObjectId,
};
console.debug("initSecondaryParams: ", initSecondaryParams);

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sleep } from "../../utils/sleep";

// yarn tsx examples/bonding-curve/create/create-coins-and-create-custom-params-bonding-curve.ts
export const createCustomBondingCurveAndCoins = async (params: CreateCoinTransactionParamsWithoutCertainProps) => {
const memeAndTicketCoinTx = await BondingPoolSingleton.createMemeAndTicketCoins(params);
const memeAndTicketCoinTx = await BondingPoolSingleton.createMemeCoin(params);

const res = await provider.signAndExecuteTransactionBlock({
transactionBlock: memeAndTicketCoinTx,
Expand All @@ -23,7 +23,10 @@ export const createCustomBondingCurveAndCoins = async (params: CreateCoinTransac
});
console.debug("create coin tx res: ", res);

const { memeCoin, ticketCoin } = parseTransactionDataCoinAndTicketCreation(res.objectChanges);
const { memeCoin } = parseTransactionDataCoinAndTicketCreation(res.objectChanges);

console.debug("memeCoin: ", memeCoin);

// 10 sui
const THRESHOLD_FOR_GOING_LIVE_IN_SUI = BigInt(10);
// 5 minutes
Expand All @@ -37,7 +40,6 @@ export const createCustomBondingCurveAndCoins = async (params: CreateCoinTransac

const createBondingCurvePoolTx = BondingPoolSingleton.createBondingCurvePool({
memeCoin,
ticketCoin,
bondingCurveCustomParams: bondingCurveCustomParams,
});

Expand Down Expand Up @@ -65,9 +67,9 @@ export const createCustomBondingCurveAndCoins = async (params: CreateCoinTransac
};

createCustomBondingCurveAndCoins({
description: "26 April 2024",
name: "meme262024",
description: "01 May 2024",
name: "meme01052024",
signerAddress: user,
symbol: "MEME_26_2024",
symbol: "MEME_01_05_2024",
url: "",
});
52 changes: 0 additions & 52 deletions examples/bonding-curve/create/create-meme-and-ticket-coins-tx.ts

This file was deleted.

2 changes: 1 addition & 1 deletion examples/bonding-curve/extract-registry-key-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { extractRegistryKeyData } from "../../src/bonding-pool/utils/extractRegi
export const extractRegistryKeyDataExample = () => {
const registryKeyTypenameData =
// eslint-disable-next-line max-len
"9e1701ec8d7942a79874a40d4d5c9d94c45ffd141c9cd2cff4f4fc3820329b61::index::RegistryKey<a4f0b25689b64b5c169d18bd7f57b24ce65a2c737744709b4e44b01e7247760b::ticket_test_token_4am::TICKET_TEST_TOKEN_4AM,0000000000000000000000000000000000000000000000000000000000000002::sui::SUI,5055576faed90f8f32db5d88cb286036ce6df5b77f1edb8544ec11b0f3da4370::test_token_4am::TEST_TOKEN_4AM>";
"a06a92a380b04366b5bf54587b89c0d04772e48170ea3c3d0647dac85be038d9::index::RegistryKey<0000000000000000000000000000000000000000000000000000000000000002::sui::SUI,6b98a3246b0e269466f36e7f22dc3a5e856afade41c00a0be7046c762aaf8787::meme_01_05_2024::MEME_01_05_2024>";

const data = extractRegistryKeyData(registryKeyTypenameData);

Expand Down
14 changes: 14 additions & 0 deletions examples/bonding-curve/get-pool-detailed-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { suiProviderUrl } from "../common";
import { BondingPoolSingleton } from "../../src";

// yarn tsx examples/bonding-curve/get-pool-detailed-info.ts
export const getPoolDetailedInfo = async () => {
const bondingCurveInstance = BondingPoolSingleton.getInstance(suiProviderUrl);
const allPools = await bondingCurveInstance.getAllPools();
const pool = allPools.pools[0];

const res = await bondingCurveInstance.getPoolDetailedInfo({ poolId: pool.objectId });
console.debug("res: ", res);
};

getPoolDetailedInfo();
17 changes: 0 additions & 17 deletions examples/bonding-curve/get-token-policy-cap-by-pool-id.ts

This file was deleted.

3 changes: 2 additions & 1 deletion examples/bonding-curve/is-memecoin-ready-to-live-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export const isMemecoinReadyToLivePhase = async () => {
const { pools } = await bondingCurveInstance.getAllPools();
const [pool] = pools;

console.debug("allPools: ", pools);
console.debug("poolId: ", pool.objectId);
console.debug("pool: ", pool);

const res = await bondingCurveInstance.isMemeCoinReadyToLivePhase({
memeCoin: { coinType: pool.memeCoinType },
ticketCoin: { coinType: pool.ticketCoinType },
poolId: pool.objectId,
});
console.debug("res: ", res);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ import { BondingPoolSingleton } from "../../../src";
export const getSwapOutputAmountByPoolExample = async () => {
const bondingCurveInstance = BondingPoolSingleton.getInstance(suiProviderUrl);
const { pools } = await bondingCurveInstance.getAllPools();
const pool = pools[1];
const pool = pools[0];

console.debug("pool: ", pool);

const inputAmount = "950";
const inputAmount = "951";
// const inputAmount = "30000";

const res = await bondingCurveInstance.getSwapOutputAmountForSuiInput({
bondingCurvePoolObjectId: pool.objectId,
inputAmount,
memeCoin: { coinType: pool.memeCoinType },
ticketCoin: { coinType: pool.ticketCoinType },
// slippagePercentage: 1,
});
console.debug("res: ", res);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BondingPoolSingleton } from "../../../src";
export const getSwapOutputAmountByPoolExample = async () => {
const bondingCurveInstance = BondingPoolSingleton.getInstance(suiProviderUrl);
const { pools } = await bondingCurveInstance.getAllPools();
const pool = pools[1];
const pool = pools[0];

console.debug("pool: ", pool);

Expand All @@ -15,7 +15,6 @@ export const getSwapOutputAmountByPoolExample = async () => {
bondingCurvePoolObjectId: pool.objectId,
inputTicketAmount: inputAmount,
memeCoin: { coinType: pool.memeCoinType },
ticketCoin: { coinType: pool.ticketCoinType },
// slippagePercentage: 1,
});
console.debug("res: ", res);
Expand Down
9 changes: 4 additions & 5 deletions examples/bonding-curve/trading/swap-sui-for-ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ export const swapSuiForTicketExample = async () => {
const bondingCurveInstance = BondingPoolSingleton.getInstance(suiProviderUrl);

// get all pools
const { pools, poolsByMemeCoinTypeMap, poolsByTicketCoinTypeMap } = await bondingCurveInstance.getAllPools();
const { pools, poolsByMemeCoinTypeMap } = await bondingCurveInstance.getAllPools();

// get random pool
const pool = pools[1];
const inputAmount = "0.077";
const pool = pools[0];
const inputAmount = "0.2";
// const inputAmount = "30000";

const outputAmount = await bondingCurveInstance.getSwapOutputAmountForSuiInput({
bondingCurvePoolObjectId: pool.objectId,
inputAmount,
memeCoin: { coinType: pool.memeCoinType },
ticketCoin: { coinType: pool.ticketCoinType },
slippagePercentage: 0,
});

Expand All @@ -27,9 +26,9 @@ export const swapSuiForTicketExample = async () => {
bondingCurvePoolObjectId: pool.objectId,
inputAmount,
memeCoin: { coinType: pool.memeCoinType },
ticketCoin: { coinType: pool.ticketCoinType },
minOutputTicketAmount: outputAmount,
signerAddress: user,
slippagePercentage: 0,
});

console.debug("swapTxData.tx: ", swapTxData.tx);
Expand Down
Loading
Loading