From 1599874e1b7c4c0bef82c0b3e41636703b80be16 Mon Sep 17 00:00:00 2001 From: makarychev <3645723+makarychev@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:34:28 +0300 Subject: [PATCH] remove obsolete commented code --- .../enforce-transfer-restrictions.ts | 183 ------------------ 1 file changed, 183 deletions(-) diff --git a/tests/transfer_restrictions/enforce-transfer-restrictions.ts b/tests/transfer_restrictions/enforce-transfer-restrictions.ts index b587fe7..d1051d1 100644 --- a/tests/transfer_restrictions/enforce-transfer-restrictions.ts +++ b/tests/transfer_restrictions/enforce-transfer-restrictions.ts @@ -22,7 +22,6 @@ describe("Enforce transfer restrictions", () => { let testEnvironment: TestEnvironment; const firstGroupIdx = new anchor.BN(1); let firstGroupPubkey: PublicKey; - let secondGroupPubkey: PublicKey; const investorWallet0 = Keypair.generate(); let investorWallet0AssociatedAccount: PublicKey; const investorWallet1 = Keypair.generate(); @@ -346,185 +345,3 @@ describe("Enforce transfer restrictions", () => { }); }); }); - -// describe("Enforce transfer restrictions", () => { -// const testEnvironmentParams: TestEnvironmentParams = { -// mint: { -// decimals: 6, -// name: "XYZ Token", -// symbol: "XYZ", -// uri: "https://e.com", -// }, -// initialSupply: 1_000_000_000_000, -// maxHolders: 3, -// }; -// let testEnvironment: TestEnvironment; -// const firstGroupIdx = new anchor.BN(1); -// const secondGroupIdx = new anchor.BN(2); -// let lockedUntil: number; -// let groupFromPubkey: PublicKey, -// groupToPubkey: PublicKey, -// unlockedTransferRulePubkey: PublicKey, -// lockedTransferRulePubkey: PublicKey; -// const signer = Keypair.generate(); - -// before(async () => { -// testEnvironment = new TestEnvironment(testEnvironmentParams); -// await testEnvironment.setupAccessControl(); -// await testEnvironment.setupTransferRestrictions(); -// await testEnvironment.transferRestrictionsHelper.initializeTransferRestrictionGroup( -// firstGroupIdx, -// testEnvironment.accessControlHelper.walletRolePDA( -// testEnvironment.transferAdmin.publicKey -// )[0], -// testEnvironment.transferAdmin -// ); -// lockedUntil = await getNowTs(testEnvironment.connection); -// await testEnvironment.transferRestrictionsHelper.initializeTransferRule( -// new anchor.BN(lockedUntil), -// firstGroupIdx, -// firstGroupIdx, -// testEnvironment.accessControlHelper.walletRolePDA( -// testEnvironment.transferAdmin.publicKey -// )[0], -// testEnvironment.transferAdmin -// ); -// [groupFromPubkey] = -// testEnvironment.transferRestrictionsHelper.groupPDA(firstGroupIdx); -// groupToPubkey = groupFromPubkey; -// [unlockedTransferRulePubkey] = -// testEnvironment.transferRestrictionsHelper.transferRulePDA( -// firstGroupIdx, -// firstGroupIdx -// ); -// await testEnvironment.transferRestrictionsHelper.initializeTransferRule( -// new anchor.BN(0), -// secondGroupIdx, -// secondGroupIdx, -// testEnvironment.accessControlHelper.walletRolePDA( -// testEnvironment.transferAdmin.publicKey -// )[0], -// testEnvironment.transferAdmin -// ); -// [lockedTransferRulePubkey] = -// testEnvironment.transferRestrictionsHelper.transferRulePDA( -// firstGroupIdx, -// firstGroupIdx -// ); -// await topUpWallet(testEnvironment.connection, signer.publicKey, solToLamports(1)); -// }); - -// describe("when transfer rule is locked", () => { -// it("fails transaction with error", async () => { -// try { -// await testEnvironment.transferRestrictionsHelper.program.methods -// .enforceTransferRestrictions() -// .accountsStrict({ -// sourceAccount: -// transferRule: unlockedTransferRulePubkey, -// transferRestrictionData: -// testEnvironment.transferRestrictionsHelper -// .transferRestrictionDataPubkey, -// transferRestrictionGroupFrom: groupFromPubkey, -// transferRestrictionGroupTo: groupToPubkey, -// accessControlAccount: -// testEnvironment.accessControlHelper.accessControlPubkey, -// authorityWalletRole: authorityWalletRolePubkey, -// payer: signer.publicKey, -// }) -// .signers([signer]) -// .rpc({ commitment: testEnvironment.commitment }); -// assert.fail("Expect an error"); -// } catch ({ error }) { -// assert.equal(error.errorCode.code, "Unauthorized"); -// assert.equal(error.errorMessage, "Unauthorized"); -// } -// }); -// }); - -// it("fails to set allow transfer rule by reserve admin", async () => { -// const signer = testEnvironment.reserveAdmin; -// const [authorityWalletRolePubkey] = -// testEnvironment.accessControlHelper.walletRolePDA(signer.publicKey); -// const lockedUntil = new anchor.BN(0); -// try { -// await testEnvironment.transferRestrictionsHelper.program.methods -// .setAllowTransferRule(lockedUntil) -// .accountsStrict({ -// transferRule: unlockedTransferRulePubkey, -// transferRestrictionData: -// testEnvironment.transferRestrictionsHelper -// .transferRestrictionDataPubkey, -// transferRestrictionGroupFrom: groupFromPubkey, -// transferRestrictionGroupTo: groupToPubkey, -// accessControlAccount: -// testEnvironment.accessControlHelper.accessControlPubkey, -// authorityWalletRole: authorityWalletRolePubkey, -// payer: signer.publicKey, -// }) -// .signers([signer]) -// .rpc({ commitment: testEnvironment.commitment }); -// assert.fail("Expect an error"); -// } catch ({ error }) { -// assert.equal(error.errorCode.code, "Unauthorized"); -// assert.equal(error.errorMessage, "Unauthorized"); -// } -// }); - -// it("fails to set allow transfer rule by wallets admin", async () => { -// const signer = testEnvironment.walletsAdmin; -// const [authorityWalletRolePubkey] = -// testEnvironment.accessControlHelper.walletRolePDA(signer.publicKey); -// const lockedUntil = new anchor.BN(0); -// try { -// await testEnvironment.transferRestrictionsHelper.program.methods -// .setAllowTransferRule(lockedUntil) -// .accountsStrict({ -// transferRule: unlockedTransferRulePubkey, -// transferRestrictionData: -// testEnvironment.transferRestrictionsHelper -// .transferRestrictionDataPubkey, -// transferRestrictionGroupFrom: groupFromPubkey, -// transferRestrictionGroupTo: groupToPubkey, -// accessControlAccount: -// testEnvironment.accessControlHelper.accessControlPubkey, -// authorityWalletRole: authorityWalletRolePubkey, -// payer: signer.publicKey, -// }) -// .signers([signer]) -// .rpc({ commitment: testEnvironment.commitment }); -// assert.fail("Expect an error"); -// } catch ({ error }) { -// assert.equal(error.errorCode.code, "Unauthorized"); -// assert.equal(error.errorMessage, "Unauthorized"); -// } -// }); - -// it("sets allow transfer rule by transfer admin", async () => { -// const signer = testEnvironment.transferAdmin; -// const [authorityWalletRolePubkey] = -// testEnvironment.accessControlHelper.walletRolePDA(signer.publicKey); -// const lockedUntil = new anchor.BN(0); -// await testEnvironment.transferRestrictionsHelper.program.methods -// .setAllowTransferRule(lockedUntil) -// .accountsStrict({ -// transferRule: unlockedTransferRulePubkey, -// transferRestrictionData: -// testEnvironment.transferRestrictionsHelper -// .transferRestrictionDataPubkey, -// transferRestrictionGroupFrom: groupFromPubkey, -// transferRestrictionGroupTo: groupToPubkey, -// accessControlAccount: -// testEnvironment.accessControlHelper.accessControlPubkey, -// authorityWalletRole: authorityWalletRolePubkey, -// payer: signer.publicKey, -// }) -// .signers([signer]) -// .rpc({ commitment: testEnvironment.commitment }); -// const transferRuleData = -// await testEnvironment.transferRestrictionsHelper.transferRuleData( -// unlockedTransferRulePubkey -// ); -// assert.equal(transferRuleData.lockedUntil.toNumber(), 0); -// }); -// });