-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from MystenLabs/ml/authorize-bogo-app
[Suins DayOne] Authorize / deauthorize actions for bogo deal
- Loading branch information
Showing
10 changed files
with
176 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { TransactionBlock } from "@mysten/sui.js"; | ||
import { executeTx, prepareSigner } from "./helper"; | ||
import { addressConfig, mainnetConfig } from "../config/day_one"; | ||
import { Network, mainPackage } from "../config/constants"; | ||
|
||
export const authorizeBogoApp = async (network: Network): Promise<TransactionBlock | void> => { | ||
|
||
const suinsPackageConfig = mainPackage[network]; | ||
const airdropConfig = network === 'mainnet' ? mainnetConfig : addressConfig; | ||
const tx = new TransactionBlock(); | ||
|
||
tx.moveCall({ | ||
target: `${suinsPackageConfig.packageId}::suins::authorize_app`, | ||
arguments: [ | ||
tx.object(suinsPackageConfig.adminCap), | ||
tx.object(suinsPackageConfig.suins), | ||
], | ||
typeArguments: [`${airdropConfig.packageId}::bogo::BogoApp`], | ||
}); | ||
|
||
// return if we're on multisig execution. | ||
if(airdropConfig.isMainnet) return tx; | ||
|
||
const signer = prepareSigner(mainPackage[network].provider); | ||
await executeTx(signer, tx); | ||
} | ||
|
||
|
||
/* | ||
uncomment any of these when running locally. | ||
*/ | ||
|
||
// authorizeBogoApp('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,33 @@ | ||
import { TransactionBlock } from "@mysten/sui.js"; | ||
import { executeTx, prepareSigner } from "./helper"; | ||
import { addressConfig, mainnetConfig } from "../config/day_one"; | ||
import { Network, mainPackage } from "../config/constants"; | ||
|
||
export const deauthorizeBogoApp = async (network: Network): Promise<TransactionBlock | void> => { | ||
|
||
const suinsPackageConfig = mainPackage[network]; | ||
const airdropConfig = network === 'mainnet' ? mainnetConfig : addressConfig; | ||
const tx = new TransactionBlock(); | ||
|
||
tx.moveCall({ | ||
target: `${suinsPackageConfig.packageId}::suins::deauthorize_app`, | ||
arguments: [ | ||
tx.object(suinsPackageConfig.adminCap), | ||
tx.object(suinsPackageConfig.suins), | ||
], | ||
typeArguments: [`${airdropConfig.packageId}::bogo::BogoApp`], | ||
}); | ||
|
||
// return if we're on multisig execution. | ||
if(airdropConfig.isMainnet) return tx; | ||
|
||
const signer = prepareSigner(mainPackage[network].provider); | ||
await executeTx(signer, tx); | ||
} | ||
|
||
|
||
/* | ||
uncomment any of these when running locally. | ||
*/ | ||
|
||
// deauthorizeBogoApp('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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,19 @@ | ||
// Copyright (c) 2023, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import dotenv from "dotenv"; | ||
dotenv.config(); | ||
import { prepareMultisigTx } from "../airdrop/helper"; | ||
import { authorizeBogoApp } from "../airdrop/authorize-app"; | ||
|
||
const authorizeApp = async () => { | ||
// read addresses from file | ||
// convert to batches. | ||
const tx = await authorizeBogoApp('mainnet'); | ||
|
||
if(!tx) throw new Error("TX not defined"); | ||
|
||
prepareMultisigTx(tx, 'mainnet'); | ||
} | ||
|
||
authorizeApp(); |
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,19 @@ | ||
// Copyright (c) 2023, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import dotenv from "dotenv"; | ||
dotenv.config(); | ||
import { prepareMultisigTx } from "../airdrop/helper"; | ||
import { deauthorizeBogoApp } from "../airdrop/deauthorize-app"; | ||
|
||
const deauthorizeApp = async () => { | ||
// read addresses from file | ||
// convert to batches. | ||
const tx = await deauthorizeBogoApp('mainnet'); | ||
|
||
if(!tx) throw new Error("TX not defined"); | ||
|
||
prepareMultisigTx(tx, 'mainnet'); | ||
} | ||
|
||
deauthorizeApp(); |