-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2854e08
commit 3e9a8a0
Showing
6 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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 { MIST_PER_SUI, TransactionBlock } from "@mysten/sui.js"; | ||
import { Network, mainPackage } from "../../config/constants"; | ||
|
||
export const authorize = async (network: Network) => { | ||
const txb = new TransactionBlock(); | ||
|
||
const config = mainPackage[network]; | ||
txb.moveCall({ | ||
target: `${config.packageId}::suins::authorize_app`, | ||
arguments: [ | ||
txb.object(config.adminCap), | ||
txb.object(config.suins), | ||
], | ||
typeArguments: [`${config.renewalsPackageId}::renew::Renew`], | ||
}); | ||
|
||
const configuration = txb.moveCall({ | ||
target: `${config.packageId}::config::new`, | ||
arguments: [ | ||
txb.pure([...Array(33).keys()]), | ||
txb.pure(50n * MIST_PER_SUI), | ||
txb.pure(10n * MIST_PER_SUI), | ||
txb.pure(2n * MIST_PER_SUI), | ||
], | ||
}); | ||
|
||
txb.moveCall({ | ||
target: `${config.renewalsPackageId}::renew::setup`, | ||
arguments: [ | ||
txb.object(config.adminCap), | ||
txb.object(config.suins), | ||
configuration, | ||
], | ||
typeArguments: [], | ||
}); | ||
|
||
// for mainnet, we just prepare multisig TX | ||
if(network === 'mainnet') return prepareMultisigTx(txb, 'mainnet'); | ||
|
||
return executeTx(prepareSigner(config.provider), txb); | ||
} | ||
|
||
authorize("mainnet"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2023, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import dotenv from "dotenv"; | ||
dotenv.config(); | ||
import { execSync } from 'child_process'; | ||
|
||
const gasObject = process.env.GAS_OBJECT; | ||
|
||
// Github actions are always on mainnet. | ||
const publish = async () => { | ||
|
||
if(!gasObject) throw new Error("Gas Object not supplied for a mainnet transaction"); | ||
|
||
// on GH Action, the sui binary is located on root. Referencing that as `/` doesn't work. | ||
const suiFolder = process.env.ORIGIN === 'gh_action' ? '../../sui' : 'sui'; | ||
const publishCall = `${suiFolder} client publish --gas-budget 3000000000 --gas ${gasObject} --serialize-unsigned-transaction` | ||
|
||
// to suins/..(packages)/..(base)/scripts/tx/tx-data.txt | ||
execSync(`cd $PWD/../packages/renewal && ${publishCall} > $PWD/../../scripts/tx/tx-data.txt`); | ||
} | ||
|
||
publish(); |