Skip to content

Commit

Permalink
remove obsolete commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
makarychev committed Aug 9, 2024
1 parent 30776a2 commit 1599874
Showing 1 changed file with 0 additions and 183 deletions.
183 changes: 0 additions & 183 deletions tests/transfer_restrictions/enforce-transfer-restrictions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
// });
// });

0 comments on commit 1599874

Please sign in to comment.