Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Marketplace Offers Logic Tests #125

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions constants/constructor-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,9 @@ export const EnglishAuctionsExtensionArgs = {
TESTNET: {
_nativeTokenWrapper: IRON_G7_ARB_SEPOLIA_NATIVE_TOKEN,
},
};

export const OffersExtensionArgs = {
MAINNET: {},
TESTNET: {},
};
9 changes: 6 additions & 3 deletions constants/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export enum CONTRACT_TYPE {
RewardToken = 'RewardToken',
DirectListingExtension = 'DirectListingExtension',
Marketplace = 'Marketplace',
EnglishAuctionsExtension = 'EnglishAuctionsExtension'
EnglishAuctionsExtension = 'EnglishAuctionsExtension',
OffersExtension = 'OffersExtension'
}

export enum PROXY_CONTRACT_TYPE {
Expand Down Expand Up @@ -57,7 +58,8 @@ export enum CONTRACT_FILE_NAME {
DirectListingsExtension = 'DirectListingsLogic',
ERC20 = 'MockERC20',
Marketplace = 'Marketplace',
EnglishAuctionsExtension = 'EnglishAuctionsLogic'
EnglishAuctionsExtension = 'EnglishAuctionsLogic',
OffersExtension = 'OffersLogic'
}

export enum CONTRACT_UPGRADABLE_FILE_NAME {
Expand Down Expand Up @@ -103,7 +105,8 @@ export enum CONTRACT_NAME {
DirectListingExtension = 'DirectListingExtension',
MartinERC20 = 'MockERC20',
Marketplace = 'Marketplace',
EnglishAuctionsExtension = 'EnglishAuctionsExtension'
EnglishAuctionsExtension = 'EnglishAuctionsExtension',
OffersExtension = 'OffersExtension'
}

export enum CONTRACT_UPGRADABLE_NAME {
Expand Down
28 changes: 27 additions & 1 deletion constants/proxy-deployments/deployments-game7-arb-sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {
import { TENANT } from '@constants/tenant';
import { DeploymentProxyContract } from '../../types/deployment-type';
import { NETWORK_TYPE, NetworkName } from '../network';
import {DirectListingExtensionArgs, EnglishAuctionsExtensionArgs, MarketplaceArgs} from '@constants/constructor-args';
import {
DirectListingExtensionArgs,
EnglishAuctionsExtensionArgs,
MarketplaceArgs,
OffersExtensionArgs,
} from '@constants/constructor-args';

const chain = NetworkName.Game7OrbitArbSepolia;
const networkType = NETWORK_TYPE.TESTNET;
Expand Down Expand Up @@ -90,6 +95,27 @@ export const GAME7_ARB_SEPOLIA_CONTRACTS: DeploymentProxyContract[] = [
'isAuctionExpired(uint256)',
],
},
{
contractFileName: CONTRACT_FILE_NAME.OffersExtension,
type: CONTRACT_TYPE.OffersExtension,
name: CONTRACT_NAME.OffersExtension,
verify: true,
extensionArgs: OffersExtensionArgs.TESTNET,
metadata: {
name: 'OffersLogic',
metadataURI: 'ipfs://{hash}',
implementation: `CONTRACT_${CONTRACT_NAME.OffersExtension}`,
},
functionsToInclude: [
'makeOffer((address,uint256,uint256,address,uint256,uint256))',
'cancelOffer(uint256)',
'acceptOffer(uint256)',
'totalOffers()',
'getOffer(uint256)',
'getAllOffers(uint256,uint256)',
'getAllValidOffers(uint256,uint256)',
],
},
],
implementationArgs: MarketplaceArgs.TESTNET,
},
Expand Down
4 changes: 2 additions & 2 deletions test/hardhatTests/englishAuctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { loadFixture, time } from '@nomicfoundation/hardhat-network-helpers';
import { deployMarketplaceContracts } from './fixture/marketplaceContractsFixture';
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { Auction, AuctionParameters, AuctionStatus, TokenType } from './helpers/types';
import { Auction, AuctionParameters, Status, TokenType } from './helpers/types';
import { NATIVE_TOKEN, ONE_DAY, ONE_HOUR } from './helpers/constants';
import { ASSET_ROLE, LISTER_ROLE } from './helpers/roles';
import { ZeroAddress } from 'ethers';
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('EnglishAuction', function () {
assetContract: auctionParameters.assetContract,
currency: auctionParameters.currency,
tokenType: TokenType.ERC721,
status: AuctionStatus.CREATED,
status: Status.CREATED,
};
});

Expand Down
31 changes: 27 additions & 4 deletions test/hardhatTests/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export type AuctionParameters = {

export enum TokenType {
ERC721,
ERC1155
ERC1155,
ERC20
}

export enum AuctionStatus {
export enum Status {
UNSET,
CREATED,
COMPLETED,
Expand All @@ -37,5 +38,27 @@ export type Auction = {
assetContract: string;
currency: string;
tokenType: TokenType;
status: AuctionStatus;
}
status: Status;
}

export type OfferParams = {
assetContract: string;
tokenId: number;
quantity: number;
currency: string;
totalPrice: bigint;
expirationTimestamp: number;
}

export type Offer = {
offerId: bigint;
tokenId: number;
quantity: number;
totalPrice: bigint;
expirationTimestamp: number;
offeror: string;
assetContract: string;
currency: string;
tokenType: TokenType;
status: Status;
}
Loading
Loading