Skip to content

Commit

Permalink
Update Marketplace Precompile ABI (#883)
Browse files Browse the repository at this point in the history
* Update marketplace precompile ABI and duration + marketplace_id input params

* Fix bug in marketplace that allows for 0 duration

* fmt

* Update xrpl-bridge deps

* fmt..

* Update types in abi + update index.ts abi

* prettier
  • Loading branch information
JasonTulp authored Oct 8, 2024
1 parent d9fe340 commit 2c44def
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 142 deletions.
56 changes: 27 additions & 29 deletions e2e/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,43 +398,41 @@ export const FUTUREPASS_PRECOMPILE_ABI = [
...OWNABLE_ABI,
];

export const MARKET_PLACE_ABI = [
"event MarketplaceRegister(address indexed sender, uint256 indexed marketplaceId, address marketplace_account)",
"event FixedPriceSaleListNFT(address indexed seller, uint256 indexed listingId, uint256 indexed fixedPrice, uint256[] serialNumbers, address collectionAddress, uint128 marketplace_id)",
"event FixedPriceSaleListSFT(address indexed seller, uint256 indexed listingId, uint256 indexed fixedPrice, uint256[] serialNumbers, address collectionAddress, uint128 marketplace_id, uint256[] quantities)",
"event FixedPriceSaleUpdate(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed newPrice, address sender, uint256[] serialNumbers, uint128 marketplace_id)",
"event FixedPriceSaleComplete(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed fixedPrice, address sender, uint256[] serialNumbers, uint128 marketplace_id)",
"event AuctionOpenNFT(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed reservePrice, address sender, uint256[] serialNumbers, uint128 marketplace_id)",
"event AuctionOpenSFT(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed reservePrice, address sender, uint256[] serialNumbers, uint128 marketplace_id)",
"event Bid(address indexed bidder, uint256 indexed listingId, uint256 indexed amount, uint128 marketplace_id)",
"event FixedPriceSaleClose(uint256 indexed collectionId, uint256 indexed listingId, address sender, uint256[] serialNumbers, uint128 marketplace_id)", //uint256,uint256,address,uint256[]
"event AuctionClose(uint256 indexed collectionId, uint256 indexed listingId, address sender, uint256[] serialNumbers, uint128 marketplace_id)",
"event Offer(uint256 indexed offerId, address indexed sender, uint256 collectionId, uint256 seriesId, uint128 marketplace_id)",
"event OfferCancel(uint256 indexed offerId, address indexed sender, uint256 collectionId, uint256 seriesId, uint128 marketplace_id)",
"event OfferAccept(uint256 indexed offerId, uint256 indexed amount, address indexed sender, uint256 collectionId, uint256 seriesId, uint128 marketplace_id)", // uint256,uint256,address,uint256
export const MARKETPLACE_ABI = [
"event MarketplaceRegister(address indexed sender, uint256 indexed marketplaceId, address marketplaceAccount)",
"event FixedPriceSaleListNFT(address indexed seller, uint256 indexed listingId, uint256 indexed fixedPrice, uint256[] serialNumbers, address collectionAddress, uint128 marketplaceId)",
"event FixedPriceSaleListSFT(address indexed seller, uint256 indexed listingId, uint256 indexed fixedPrice, uint256[] serialNumbers, address collectionAddress, uint128 marketplaceId, uint256[] quantities)",
"event FixedPriceSaleUpdate(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed newPrice, address sender, uint256[] serialNumbers, uint128 marketplaceId)",
"event FixedPriceSaleComplete(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed fixedPrice, address sender, uint256[] serialNumbers, uint128 marketplaceId)",
"event AuctionOpenNFT(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed reservePrice, address sender, uint256[] serialNumbers, uint128 marketplaceId)",
"event AuctionOpenSFT(uint256 indexed collectionId, uint256 indexed listingId, uint256 indexed reservePrice, address sender, uint256[] serialNumbers, uint128 marketplaceId)",
"event Bid(address indexed bidder, uint256 indexed listingId, uint256 indexed amount, uint128 marketplaceId)",
"event FixedPriceSaleClose(uint256 indexed collectionId, uint256 indexed listingId, address sender, uint256[] serialNumbers, uint128 marketplaceId)",
"event AuctionClose(uint256 indexed collectionId, uint256 indexed listingId, address sender, uint256[] serialNumbers, uint128 marketplaceId)",
"event Offer(uint256 indexed offerId, address indexed sender, uint256 collectionId, uint256 seriesId, uint128 marketplaceId)",
"event OfferCancel(uint256 indexed offerId, address indexed sender, uint256 collectionId, uint256 seriesId, uint128 marketplaceId)",
"event OfferAccept(uint256 indexed offerId, uint256 indexed amount, address indexed sender, uint256 collectionId, uint256 seriesId, uint128 marketplaceId)",

"function registerMarketplace(address marketplaceAccount, uint256 entitlement) external returns (uint marketplaceId)",
"function sellNftWithMarketplaceId(address collectionAddress, uint256[] calldata serialNumberIds, address buyer, address paymentAsset, uint256 fixedPrice, uint256 duration, uint32 marketplaceId) external returns (uint listingId)",
"function sellNft(address collectionAddress, uint256[] calldata serialNumberIds, address buyer, address paymentAsset, uint256 fixedPrice, uint256 duration, uint32 marketplace_id) external returns (uint listingId)",
"function sellSftWithMarketplaceId(address collectionAddress, uint256[] calldata serialNumberIds, uint256[] calldata quantities, address buyer, address paymentAsset, uint256 fixedPrice, uint256 duration, uint32 marketplaceId) external returns (uint listingId)",
"function sellSft(address collectionAddress, uint256[] calldata serialNumberIds, uint256[] calldata quantities, address buyer, address paymentAsset, uint256 fixedPrice, uint256 duration, uint32 marketplace_id) external returns (uint listingId)",
"function updateFixedPrice(uint128 listingId, uint256 newPrice) external",
"function buy(uint128 listingId) external payable",
"function auctionNftWithMarketplaceId(address collectionAddress, uint256[] calldata serialNumberIds, address paymentAsset, uint256 reservePrice, uint256 duration, uint256 marketplaceId)",
"function auctionNft(address collectionAddress, uint256[] calldata serialNumberIds, address paymentAsset, uint256 reservePrice, uint256 duration, uint32 marketplaceId)",
"function auctionSftWithMarketplaceId(address collectionAddress, uint256[] calldata serialNumberIds, uint256[] calldata quantities, address paymentAsset, uint256 reservePrice, uint256 duration, uint32 marketplaceId)",
"function auctionSft(address collectionAddress, uint256[] calldata serialNumberIds, uint256[] calldata quantities, address paymentAsset, uint256 reservePrice, uint256 duration, uint32 marketplaceId)",
"function bid(uint128 listingId, uint256 amount) external",
"function sellNftWithMarketplaceId(address collectionAddress, uint32[] calldata serialNumberIds, address buyer, address paymentAsset, uint128 fixedPrice, uint128 duration, uint32 marketplaceId) external returns (uint listingId)",
"function sellNft(address collectionAddress, uint32[] calldata serialNumberIds, address buyer, address paymentAsset, uint128 fixedPrice, uint128 duration, uint32 marketplaceId) external returns (uint listingId)",
"function sellSft(address collectionAddress, uint32[] calldata serialNumberIds, uint128[] calldata quantities, address buyer, address paymentAsset, uint128 fixedPrice, uint128 duration, uint32 marketplaceId) external returns (uint listingId)",
"function updateFixedPrice(uint128 listingId, uint128 newPrice) external",
"function buy(uint128 listingId) external",
"function auctionNftWithMarketplaceId(address collectionAddress, uint32[] calldata serialNumberIds, address paymentAsset, uint128 reservePrice, uint128 duration, uint32 marketplaceId) external",
"function auctionNft(address collectionAddress, uint32[] calldata serialNumberIds, address paymentAsset, uint128 reservePrice, uint128 duration, uint32 marketplaceId) external",
"function auctionSft(address collectionAddress, uint32[] calldata serialNumberIds, uint128[] calldata quantities, address paymentAsset, uint128 reservePrice, uint128 duration, uint32 marketplaceId) external",
"function bid(uint128 listingId, uint128 amount) external",
"function cancelSale(uint128 listingId) external",
"function makeSimpleOfferWithMarketplaceId(address collectionAddress, uint32 serialNumber, uint256 amount, address assetId, uint32 marketplaceId) external returns (uint offerId)",
"function makeSimpleOffer(address collectionAddress, uint32 serialNumber, uint256 amount, address assetId, uint32 marketplaceId) external returns (uint offerId)",
"function makeSimpleOfferWithMarketplaceId(address collectionAddress, uint32 serialNumber, uint128 amount, address assetId, uint32 marketplaceId) external returns (uint offerId)",
"function makeSimpleOffer(address collectionAddress, uint32 serialNumber, uint128 amount, address assetId, uint32 marketplaceId) external returns (uint offerId)",
"function cancelOffer(uint64 offerId) external",
"function acceptOffer(uint64 offerId) external",

// read
"function getMarketplaceAccount(uint32 marketplaceId) external view returns(address marketplaceAccount)",
"function getListingFromId(uint128 listingId) external view returns (bytes type, uint32 collectionId, uint32[] calldata serial_numbers, uint128 price, uint32 paymentAsset)",
"function getOfferFromId(uint64 offerId) external view returns (uint32 collectionId, uint32 serial_number, uint128 amount, address buyer)",
"function getListingFromId(uint128 listingId) external view returns (bytes memory listingType, uint32 collectionId, uint32[] calldata serialNumbers, uint128 reservePrice, uint32 paymentAsset)",
"function getOfferFromId(uint64 offerId) external view returns (uint32 collectionId, uint32 serialNumber, uint128 amount, address buyer)",
];

export const DEX_PRECOMPILE_ABI = [
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/MarketPlace/MarketPlacePrecompile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
ALITH_PRIVATE_KEY,
BOB_PRIVATE_KEY,
ERC721_PRECOMPILE_ABI,
MARKETPLACE_ABI,
MARKETPLACE_PRECOMPILE_ADDRESS,
MARKET_PLACE_ABI,
NodeProcess,
startNode,
typedefs,
Expand Down Expand Up @@ -78,7 +78,7 @@ describe("Marketplace Precompile", function () {
await tx.wait();
expect(await erc721Precompile.totalSupply()).to.equal(quantity);
// Deploy marketplace contract
marketPlacePrecompile = new Contract(MARKETPLACE_PRECOMPILE_ADDRESS, MARKET_PLACE_ABI, bobSigner);
marketPlacePrecompile = new Contract(MARKETPLACE_PRECOMPILE_ADDRESS, MARKETPLACE_ABI, bobSigner);
});

after(async () => await node.stop());
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/MarketPlace/Marketplace.TxCosts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
ALITH_PRIVATE_KEY,
BOB_PRIVATE_KEY,
ERC721_PRECOMPILE_ABI,
MARKETPLACE_ABI,
MARKETPLACE_PRECOMPILE_ADDRESS,
MARKET_PLACE_ABI,
NodeProcess,
TxCosts,
getScaledGasForExtrinsicFee,
Expand Down Expand Up @@ -92,7 +92,7 @@ describe("Marketplace Precompile Gas Estimates", function () {
await tx.wait();
expect(await erc721Precompile.totalSupply()).to.equal(quantity);
// Deploy marketplace contract
marketPlacePrecompile = new Contract(MARKETPLACE_PRECOMPILE_ADDRESS, MARKET_PLACE_ABI, bobSigner);
marketPlacePrecompile = new Contract(MARKETPLACE_PRECOMPILE_ADDRESS, MARKETPLACE_ABI, bobSigner);
// Register 0th marketplace id which would be used for other tests
const entitlements = 1000;
const marketplaceRegisterTx = await marketPlacePrecompile
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/MarketPlace/MarketplaceSFT.TxCosts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
ALITH_PRIVATE_KEY,
BOB_PRIVATE_KEY,
ERC1155_PRECOMPILE_ABI,
MARKETPLACE_ABI,
MARKETPLACE_PRECOMPILE_ADDRESS,
MARKET_PLACE_ABI,
NodeProcess,
TxCosts,
getScaledGasForExtrinsicFee,
Expand Down Expand Up @@ -103,7 +103,7 @@ describe("Marketplace SFT Precompile Gas Estimates", function () {
await tx3.wait();

// Deploy marketplace contract
marketPlacePrecompile = new Contract(MARKETPLACE_PRECOMPILE_ADDRESS, MARKET_PLACE_ABI, bobSigner);
marketPlacePrecompile = new Contract(MARKETPLACE_PRECOMPILE_ADDRESS, MARKETPLACE_ABI, bobSigner);
// Register 0th marketplace id which would be used for other tests
const entitlements = 1000;
const marketplaceRegisterTx = await marketPlacePrecompile
Expand Down
Loading

0 comments on commit 2c44def

Please sign in to comment.