-
Notifications
You must be signed in to change notification settings - Fork 66
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
Showing
1 changed file
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//////////////////////////////////////////////////////////////////////////////////////////// | ||
// Instructions: | ||
// - Setup `.env` file with all 3 variables. | ||
// For instance for goerli network you can use this: | ||
// RPC_URL=https://api.hydrogen.argent47.net/v1/starknet/goerli/rpc/v0.6 | ||
// - Run the command: `yarn tsc && node --loader ts-node/esm scripts/multisig-change-threshold.ts` | ||
//////////////////////////////////////////////////////////////////////////////////////////// | ||
import "dotenv/config"; | ||
import { RPC } from "starknet"; | ||
import { ArgentAccount, LegacyMultisigKeyPair, LegacyMultisigSigner, ensureSuccess, manager } from "../lib"; | ||
|
||
const privateKey2 = ""; | ||
|
||
// You shouldn't modify anything below this line | ||
const contractAddress = process.env.ADDRESS; | ||
const privateKey1 = process.env.PRIVATE_KEY; | ||
const newThreshold = 1; | ||
|
||
if (!contractAddress || !privateKey1 || !privateKey2) { | ||
console.error("Please set the ADDRESS, PRIVATE_KEY environment variables, and fill in the privateKey2 variable"); | ||
process.exit(1); | ||
} | ||
|
||
const signer1 = new LegacyMultisigKeyPair(privateKey1); | ||
const signer2 = new LegacyMultisigKeyPair(privateKey2); | ||
|
||
const signer = new LegacyMultisigSigner([signer1, signer2]); | ||
const account = new ArgentAccount(manager, contractAddress, signer, "1", RPC.ETransactionVersion.V3); | ||
const accountContract = await manager.loadContract(contractAddress); | ||
|
||
// This script only works with this classHash | ||
if (accountContract.classHash !== "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72") { | ||
console.error("Invalid class hash"); | ||
process.exit(1); | ||
} | ||
|
||
accountContract.connect(account); | ||
const { transaction_hash: txHash } = await ensureSuccess(await accountContract.change_threshold(newThreshold)); | ||
console.log(`Threshold successfully updated to ${newThreshold}, transaction hash: ${txHash}`); |