diff --git a/.github/workflows/suins-build-tx.yaml b/.github/workflows/suins-build-tx.yaml index 990ad357..e745a52b 100644 --- a/.github/workflows/suins-build-tx.yaml +++ b/.github/workflows/suins-build-tx.yaml @@ -8,13 +8,13 @@ on: description: 'select transaction type to create' type: choice options: + - Disable Discounts - Disable Free Claims - Publish Discounts - Authorize Discounts - Withdraw Auction Profits - Transfer Reserved Names - Main package upgrade - - Create Deepbook Pools sui_tools_image: description: 'image reference of sui_tools' default: 'mysten/sui-tools:mainnet' @@ -146,16 +146,16 @@ jobs: ORIGIN: gh_action run: | cd scripts && pnpm disable-free-claims - - - name: Create Deepbook Pools - if: ${{ inputs.transaction_type == 'Create Deepbook Pools' }} + + - name: Disable Discounts + if: ${{ inputs.transaction_type == 'Disable Discounts' }} env: NODE_ENV: production GAS_OBJECT: ${{ inputs.gas_object_id }} NETWORK: mainnet ORIGIN: gh_action run: | - cd scripts && pnpm create-deepbook-pools + cd scripts && pnpm disable-discounts - name: Show Transaction Data (To sign) run: | diff --git a/scripts/package.json b/scripts/package.json index 0b41a9fb..447d1340 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -15,6 +15,7 @@ "publish-discounts": "ts-node transactions/publish_discounts.ts", "authorize-discounts": "ts-node transactions/quest_3_setup.ts", "disable-free-claims": "ts-node transactions/quest3/disable_free_claims.ts", + "disable-discounts": "ts-node transactions/quest3/disable_discounts.ts", "create-deepbook-pools": "ts-node transactions/deepbook/create_pools.ts" }, "keywords": [], diff --git a/scripts/transactions/quest3/disable_discounts.ts b/scripts/transactions/quest3/disable_discounts.ts new file mode 100644 index 00000000..cc749744 --- /dev/null +++ b/scripts/transactions/quest3/disable_discounts.ts @@ -0,0 +1,30 @@ +// Copyright (c) 2023, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import dotenv from "dotenv"; +dotenv.config(); +import { executeTx, prepareMultisigTx, prepareSigner } from "../../airdrop/helper"; +import { Network, mainPackage } from "../../config/constants"; +import { TransactionBlock } from "@mysten/sui.js"; +import { DAY_ONE_TYPE, SUIFREN_BULLSHARK_TYPE, SUIFREN_CAPY_TYPE, removeDiscountForType } from "../../config/discounts"; + +const execute = async (network: Network) => { + const setup = mainPackage[network]; + + const txb = new TransactionBlock(); + + removeDiscountForType(txb, setup, SUIFREN_BULLSHARK_TYPE[network]); + removeDiscountForType(txb, setup, SUIFREN_CAPY_TYPE[network]); + removeDiscountForType(txb, setup, DAY_ONE_TYPE[network]); + + // for mainnet, we prepare the multi-sig tx. + if(network === 'mainnet') return prepareMultisigTx(txb, 'mainnet'); + + // For testnet, we execute the TX directly. + return executeTx(prepareSigner(setup.provider), txb); +} + +if(process.env.NETWORK === 'mainnet') execute('mainnet') +else execute('testnet'); + +