Skip to content

Commit

Permalink
refactor: updated contract name
Browse files Browse the repository at this point in the history
  • Loading branch information
capedcrusader21 committed Oct 9, 2023
1 parent 540d0b3 commit 81a63f3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
15 changes: 15 additions & 0 deletions packages/marketplace/contracts/mocks/RoyaltyInfoMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.21;

/// @title RoyaltyInfoMock Contract
/// @dev Implements royaltyInfo function but not supportInferace.
/// @dev used to execute getRoyalties() in RoyaltiesRegistry contract with royaltyType = 3
contract RoyaltyInfoMock {
function royaltyInfo(
uint256 /* _tokenId */,
uint256 /* _salePrice */
) external view returns (address receiver, uint256 royaltyAmount) {
return (msg.sender, 0);
}
}
13 changes: 5 additions & 8 deletions packages/marketplace/test/exchange/RoyaltiesRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,27 +369,24 @@ describe('RoyaltiesRegistry.sol', function () {
});

it('should getRoyalties for token with royaltiesType 3 that only implements royaltyInfo', async function () {
const {
RoyaltiesRegistryAsDeployer,
RoyaltiesRegistryAsUser,
TestRoyaltyInfo,
} = await loadFixture(deployFixtures);
const {RoyaltiesRegistryAsDeployer, RoyaltiesRegistryAsUser, RoyaltyInfo} =
await loadFixture(deployFixtures);
await loadFixture(deployFixtures);

await RoyaltiesRegistryAsDeployer.forceSetRoyaltiesType(
await TestRoyaltyInfo.getAddress(),
await RoyaltyInfo.getAddress(),
3
);

expect(
await RoyaltiesRegistryAsUser.getRoyaltiesType(
await TestRoyaltyInfo.getAddress()
await RoyaltyInfo.getAddress()
)
).to.be.equal(3);

expect(
await RoyaltiesRegistryAsUser.getRoyalties.staticCall(
await TestRoyaltyInfo.getAddress(),
await RoyaltyInfo.getAddress(),
1
)
).to.be.deep.eq([]);
Expand Down
10 changes: 4 additions & 6 deletions packages/marketplace/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ async function deploy() {
);
await TestERC721WithRoyaltyWithoutIROYALTYUGC.waitForDeployment();

const TestRoyaltyInfoFactory = await ethers.getContractFactory(
'TestRoyaltyInfo'
);
const TestRoyaltyInfo = await TestRoyaltyInfoFactory.deploy();
await TestRoyaltyInfo.waitForDeployment();
const RoyaltyInfoFactory = await ethers.getContractFactory('RoyaltyInfoMock');
const RoyaltyInfo = await RoyaltyInfoFactory.deploy();
await RoyaltyInfo.waitForDeployment();

const ERC20ContractFactory = await ethers.getContractFactory('TestERC20');
const ERC20Contract = await ERC20ContractFactory.deploy();
Expand Down Expand Up @@ -167,7 +165,7 @@ async function deploy() {
ERC721WithRoyalty,
ERC1155WithRoyalty,
TestERC721WithRoyaltyWithoutIROYALTYUGC,
TestRoyaltyInfo,
RoyaltyInfo,
RoyaltiesProvider,
ERC1271Contract,
deployer,
Expand Down

1 comment on commit 81a63f3

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

99.35%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/marketplace/contracts/exchange
   Exchange.sol95.65%96.67%93.75%95.65%175, 63
   ExchangeCore.sol98.73%96.15%100%100%65
   OrderValidator.sol98.21%96.15%100%100%41
   WhiteList.sol97.62%93.75%100%100%64
packages/marketplace/contracts/exchange/libraries
   LibFill.sol100%100%100%100%
   LibMath.sol100%100%100%100%
packages/marketplace/contracts/interfaces
   IOrderValidator.sol100%100%100%100%
   IRoyaltiesProvider.sol100%100%100%100%
   IWhiteList.sol100%100%100%100%
packages/marketplace/contracts/lib-asset
   LibAsset.sol100%100%100%100%
packages/marketplace/contracts/lib-bp
   BpLibrary.sol100%100%100%100%
packages/marketplace/contracts/lib-order
   LibOrder.sol100%100%100%100%
packages/marketplace/contracts/lib-part
   LibPart.sol100%100%100%100%
packages/marketplace/contracts/royalties
   IERC2981.sol100%100%100%100%
   LibRoyalties2981.sol100%100%100%100%
packages/marketplace/contracts/royalties-registry
   IMultiRoyaltyRecipients.sol100%100%100%100%
   RoyaltiesRegistry.sol96.58%90%100%98.61%166–167, 239, 60
packages/marketplace/contracts/transfer-manager
   TransferExecutor.sol100%100%100%100%
   TransferManager.sol99.11%97.06%100%100%63
packages/marketplace/contracts/transfer-manager/interfaces
   IRoyaltyUGC.sol100%100%100%100%
   ITransferExecutor.sol100%100%100%100%
   ITransferManager.sol100%100%100%100%

Please sign in to comment.