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

Fix pricing for quest 3 #31

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
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
45 changes: 31 additions & 14 deletions scripts/transactions/quest_3_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ export type Range = {
to: number;
}

// remove discount for type
const removeDiscountForType = (txb: TransactionBlock, setup: PackageInfo, type: string) => {
txb.moveCall({
target: `${setup.discountsPackage.packageId}::discounts::deauthorize_type`,
arguments: [
txb.object(setup.adminCap),
txb.object(setup.discountsPackage.discountHouseId),
],
typeArguments: [type]
});
}

// Sets up discount prices for type.
const setupDiscountForType = (txb: TransactionBlock, setup: PackageInfo, type: string, prices: Discount) => {
txb.moveCall({
Expand Down Expand Up @@ -68,33 +80,38 @@ const setup = async (network: Network) => {

const txb = new TransactionBlock();

// authorize `discount` package to claim names
txb.moveCall({
target: `${setup.packageId}::suins::authorize_app`,
arguments: [
txb.object(setup.adminCap),
txb.object(setup.suins),
],
typeArguments: [`${setup.discountsPackage.packageId}::house::DiscountHouseApp`],
});
// // authorize `discount` package to claim names
// txb.moveCall({
// target: `${setup.packageId}::suins::authorize_app`,
// arguments: [
// txb.object(setup.adminCap),
// txb.object(setup.suins),
// ],
// typeArguments: [`${setup.discountsPackage.packageId}::house::DiscountHouseApp`],
// });

// setup `discount` both for free-claims & discounts by presenting type.
// 3 chars -> 250 | 4 chars -> 50 | 5 chars+ -> 10
const priceList: Discount = {
threeCharacterPrice: 250n * MIST_PER_SUI,
fourCharacterPrice: 50n * MIST_PER_SUI,
threeCharacterPrice: 450n * MIST_PER_SUI,
fourCharacterPrice: 90n * MIST_PER_SUI,
fivePlusCharacterPrice: 10n * MIST_PER_SUI
};

/// deauthorize. uplaod fixed
removeDiscountForType(txb, setup, SUIFREN_BULLSHARK_TYPE[network]);
removeDiscountForType(txb, setup, SUIFREN_CAPY_TYPE[network]);
removeDiscountForType(txb, setup, DAY_ONE_TYPE[network]);

/// authorize the discounts package to allow name registrations.
setupDiscountForType(txb, setup, SUIFREN_BULLSHARK_TYPE[network], priceList);
setupDiscountForType(txb, setup, SUIFREN_CAPY_TYPE[network], priceList);
setupDiscountForType(txb, setup, DAY_ONE_TYPE[network], priceList);

// authorize the free claims to allow free claiming for 10+ names.
setupFreeClaimsForType(txb, setup, SUIFREN_BULLSHARK_TYPE[network], { from: 10, to: 63 });
setupFreeClaimsForType(txb, setup, SUIFREN_CAPY_TYPE[network], { from: 10, to: 63 });
setupFreeClaimsForType(txb, setup, DAY_ONE_TYPE[network], { from: 10, to: 63 });
// setupFreeClaimsForType(txb, setup, SUIFREN_BULLSHARK_TYPE[network], { from: 10, to: 63 });
// setupFreeClaimsForType(txb, setup, SUIFREN_CAPY_TYPE[network], { from: 10, to: 63 });
// setupFreeClaimsForType(txb, setup, DAY_ONE_TYPE[network], { from: 10, to: 63 });

// for mainnet, we prepare the multi-sig tx.
if(network === 'mainnet') return prepareMultisigTx(txb, 'mainnet');
Expand Down