From 6f4f82e93259dbbd2011427b157c06ed256ae84c Mon Sep 17 00:00:00 2001 From: Manolis Liolios Date: Fri, 2 Aug 2024 00:00:16 +0300 Subject: [PATCH] Adds suilink discount (#155) --- .github/workflows/suins-build-tx.yaml | 8 ++-- .../authorize-suilink-discount.ts | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 scripts/transactions/authorize-suilink-discount.ts diff --git a/.github/workflows/suins-build-tx.yaml b/.github/workflows/suins-build-tx.yaml index de828518..cad73861 100644 --- a/.github/workflows/suins-build-tx.yaml +++ b/.github/workflows/suins-build-tx.yaml @@ -12,7 +12,7 @@ on: - Disable Free Claims - Profits to Treasury - Transfer Reserved Names - - Update Display + - SuiLink Discount sui_tools_image: description: 'image reference of sui_tools' default: 'mysten/sui-tools:mainnet' @@ -112,15 +112,15 @@ jobs: run: | cd scripts && pnpm create-deepbook-pools - - name: Update Display - if: ${{ inputs.transaction_type == 'Update Display' }} + - name: SuiLink Discount + if: ${{ inputs.transaction_type == 'SuiLink Discount' }} env: NODE_ENV: production GAS_OBJECT: ${{ inputs.gas_object_id }} NETWORK: mainnet ORIGIN: gh_action run: | - cd scripts && pnpm ts-node transactions/update-mainnet-display.ts + cd scripts && pnpm ts-node transactions/authorize-suilink-discount.ts - name: Show Transaction Data (To sign) run: | diff --git a/scripts/transactions/authorize-suilink-discount.ts b/scripts/transactions/authorize-suilink-discount.ts new file mode 100644 index 00000000..5c7c82c7 --- /dev/null +++ b/scripts/transactions/authorize-suilink-discount.ts @@ -0,0 +1,40 @@ +// Copyright (c) Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 +import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { MIST_PER_SUI } from '@mysten/sui.js/utils'; + +import { mainPackage } from '../config/constants'; +import { setupDiscountForType } from '../config/discounts'; +import { prepareMultisigTx } from '../utils/utils'; + +export const run = async () => { + const txb = new TransactionBlock(); + + const suiLinkType = (innerType: string) => { + return `0xf857fa9df5811e6df2a0240a1029d365db24b5026896776ddd1c3c70803bccd3::suilink::SuiLink<${innerType}>`; + }; + + const suilinkSolanaType = suiLinkType( + '0xf857fa9df5811e6df2a0240a1029d365db24b5026896776ddd1c3c70803bccd3::solana::Solana', + ); + + const ethType = suiLinkType( + '0xf857fa9df5811e6df2a0240a1029d365db24b5026896776ddd1c3c70803bccd3::ethereum::Ethereum', + ); + + setupDiscountForType(txb, mainPackage.mainnet, suilinkSolanaType, { + threeCharacterPrice: 400n * MIST_PER_SUI, + fourCharacterPrice: 60n * MIST_PER_SUI, + fivePlusCharacterPrice: 10n * MIST_PER_SUI, + }); + + setupDiscountForType(txb, mainPackage.mainnet, ethType, { + threeCharacterPrice: 400n * MIST_PER_SUI, + fourCharacterPrice: 60n * MIST_PER_SUI, + fivePlusCharacterPrice: 10n * MIST_PER_SUI, + }); + + await prepareMultisigTx(txb, 'mainnet', mainPackage.mainnet.adminAddress); +}; + +run();