Skip to content

Commit

Permalink
chore: removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
RishabhSGT committed Aug 16, 2024
1 parent 27e1175 commit 4f27b20
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 72 deletions.
2 changes: 0 additions & 2 deletions contracts/mocks/SimpleCaller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.0;

contract SimpleCaller {
// event SimpleCallerCalled(address target);
/**
* @dev Calls a function of another contract.
* @param target The address of the target contract.
Expand All @@ -15,7 +14,6 @@ contract SimpleCaller {
(bool success, bytes memory result) = target.call{ value: msg.value }(data);

require(success, "Function call failed");
// emit SimpleCallerCalled(target);
return result;
}
}
4 changes: 1 addition & 3 deletions contracts/mocks/TradeTrustTokenMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pragma solidity ^0.8.0;
import "../TradeTrustToken.sol";

contract TradeTrustTokenMock is TradeTrustToken {
// mapping(uint256 => address) private _owners; // Declare the _owners mapping

constructor(
string memory name,
string memory symbol,
Expand All @@ -14,7 +12,7 @@ contract TradeTrustTokenMock is TradeTrustToken {

function mintInternal(address to, uint256 tokenId) public virtual onlyRole(MINTER_ROLE) returns (bool) {
_safeMint(to, tokenId);
return true;
return true;
}

function burnInternal(uint256 tokenId) public virtual {
Expand Down
12 changes: 0 additions & 12 deletions test/TitleEscrow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ import {
impersonateAccount,
TestUsers,
} from "./helpers";
// import createFakeRegistry from "../src/utils/fakes/fakeRegistry";
// import { Provider } from "@ethersproject/abstract-provider";
// import TradeTrustAbi from "../artifacts/contracts/TradeTrustToken.sol/TradeTrustToken.json";
// import FakeRegistry from "./../contracts/fakes/fakeRegistry";

describe("Title Escrow", async () => {
let users: TestUsers;
Expand Down Expand Up @@ -143,9 +139,6 @@ describe("Title Escrow", async () => {
let fakeRegistry: any;

beforeEach(async () => {
// fakeRegistry = (await smock.fake("TradeTrustToken")) as FakeContract<TradeTrustToken>;
// fakeAddress = ethers.utils.getAddress(faker.finance.ethereumAddress());

// using registry contract as fake registry, no special set state is needed for these tests
fakeRegistry = registryContract;
(fakeRegistry as any).wallet = await impersonateAccount({
Expand Down Expand Up @@ -184,11 +177,6 @@ describe("Title Escrow", async () => {
["address", "address"],
[users.beneficiary.address, users.holder.address]
);

// await users.carrier.sendTransaction({
// to: fakeRegistry.address,
// value: ethers.utils.parseEther("0.1"),
// });
});

describe("Minting Token Receive", () => {
Expand Down
21 changes: 0 additions & 21 deletions test/TitleEscrowSignable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ describe("TitleEscrowSignable", async () => {

return [titleEscrowWithProxy];
};

// deployTokenFixtureRunner = async () =>
// createDeployFixtureRunner(
// ...(await deployTokenFixture<TradeTrustTokenMock>({
// tokenContractName: "TradeTrustTokenMock",
// tokenName: registryName,
// tokenInitials: registrySymbol,
// deployer: users.carrier,
// }))
// );
});

beforeEach(async () => {
Expand Down Expand Up @@ -170,11 +160,6 @@ describe("TitleEscrowSignable", async () => {

await titleEscrowContract.initialize(fakeRegistryContract.address, fakeTokenId);

// await users.carrier.sendTransaction({
// to: fakeRegistryContract.address,
// value: ethers.utils.parseEther("0.1"),
// });

const data = new ethers.utils.AbiCoder().encode(
["address", "address"],
[users.beneficiary.address, users.holder.address]
Expand Down Expand Up @@ -222,9 +207,6 @@ describe("TitleEscrowSignable", async () => {

describe("When title escrow is inactive", () => {
beforeEach(async () => {
// fakeRegistryContract.ownerOf.returns(faker.finance.ethereumAddress());
// await titleEscrowContract.connect(fakeRegistryContract.wallet as Signer).shred();

await titleEscrowContract.connect(users.holder).transferHolder(users.beneficiary.address);
await titleEscrowContract.connect(users.beneficiary).surrender();
await titleEscrowContract.connect(registrySigner as Signer).shred();
Expand All @@ -245,11 +227,8 @@ describe("TitleEscrowSignable", async () => {

describe("When title escrow is not holding token", () => {
beforeEach(async () => {
// fakeRegistryContract.ownerOf.returns(faker.finance.ethereumAddress());

await titleEscrowContract.connect(users.holder).transferHolder(users.beneficiary.address);
await titleEscrowContract.connect(users.beneficiary).surrender();
// // await titleEscrowContract.connect(registrySigner as Signer).shred();
});

it("should revert when calling: transferBeneficiaryWithSig", async () => {
Expand Down
3 changes: 0 additions & 3 deletions test/TradeTrustTokenMintable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ describe("TradeTrustTokenMintable", async () => {
registrySymbol = "GSC";

deployMockTitleEscrowAndTokenFixtureRunner = async () => {
// const mockTitleEscrowFactoryContractFixture = (await (
// await smock.mock("TitleEscrowFactory", users.carrier)
// ).deploy()) as unknown as MockContract<TitleEscrowFactory>;
const mockTitleEscrowFactoryContractFixture = (await (
await ethers.getContractFactory("TitleEscrowFactory")
).deploy()) as TitleEscrowFactory;
Expand Down
11 changes: 1 addition & 10 deletions test/fixtures/deploy-token.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export const deployTokenFixture = async <T extends Contract | unknown>({
tokenInitials,
deployer,
escrowFactoryAddress = undefined,
}: // useMock = false,
{
}: {
tokenContractName: string;
tokenName: string;
tokenInitials: string;
Expand All @@ -29,17 +28,9 @@ export const deployTokenFixture = async <T extends Contract | unknown>({
}

const tradeTrustTokenFactory = await ethers.getContractFactory(tokenContractName);
// const tradeTrustTokenContract: T;

// if (useMock) {
// tradeTrustTokenContract = (await (
// await smock.mock(tokenContractName, deployer)
// ).deploy(tokenName, tokenInitials, escrowFactoryAddress)) as unknown as T;
// } else {
const tradeTrustTokenContract: T = (await tradeTrustTokenFactory
.connect(deployer)
.deploy(tokenName, tokenInitials, escrowFactoryAddress)) as T;
// }

return [titleEscrowFactoryContract, tradeTrustTokenContract];
};
21 changes: 0 additions & 21 deletions test/token/SBTUpgradeable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,31 +124,11 @@ describe("SBTUpgradeable", async () => {
await expect(mockSbtContract.safeMintWithDataInternal(erc721ReceiverContract.address, tokenId, data))
.to.emit(erc721ReceiverContract, "TokenReceived")
.withArgs(users.beneficiary.address, users.holder.address, true, mockSbtContract.address, tokenId);

// The following code (commented out) checks if the onERC721Received function was called with specific arguments.
// expect(erc721ReceiverContract.onERC721Received).to.have.been.calledWith(
// deployer.address,
// ethers.constants.AddressZero,
// tokenId,
// "0x1234"
// );
});

it("should call onERC721Received without data", async () => {
// The following code (commented out) was meant to test the minting process without additional data.
// It checks if onERC721Received was called with the expected arguments.
// await mockSbtContract.safeMintInternal(erc721ReceiverContract.address, tokenId);

// The expectation here is that calling safeMintInternal without data should revert.
await expect(mockSbtContract.safeMintInternal(erc721ReceiverContract.address, tokenId)).to.be.reverted;

// The following code (commented out) checks if the onERC721Received function was called with specific arguments. This test won't work with our solidity mock contracts.
// expect(erc721ReceiverContract.onERC721Received).to.have.been.calledWith(
// deployer.address,
// ethers.constants.AddressZero,
// tokenId,
// "0x"
// );
});

it("should revert with standard reason when onERC721Received reverts without reason", async () => {
Expand Down Expand Up @@ -322,7 +302,6 @@ describe("SBTUpgradeable", async () => {
});

it("should revert when transferring to a non ERC721Receiver implementer", async () => {
// erc721ReceiverContract.onERC721Received.returns("0x1234");
const fakeAddress = ethers.Wallet.createRandom().address;
// Define fake bytecode (e.g., simple contract that returns true on `isContract` call)
const fakeCode = "0x60006000"; // Minimal example, real contract code would be more complex
Expand Down

0 comments on commit 4f27b20

Please sign in to comment.