From 42e3101d9f9b1cf8cd2a11a7b848bd832a340ba9 Mon Sep 17 00:00:00 2001 From: Paul Cowgill Date: Tue, 12 Dec 2023 00:45:30 -0600 Subject: [PATCH] Initial proof of concept for a Foundation bid --- .../foundation/abis/OriginalMarket.json | 1669 +++++++++++++++++ src/protocol/foundation/constants.ts | 8 + src/protocol/foundation/foundation.spec.ts | 25 + src/protocol/foundation/foundation.ts | 90 + src/protocol/foundation/index.ts | 11 + .../foundation-place-bid-v2-0x86c62822.json | 264 +++ .../contextAction/protocolContextAction.ts | 28 +- src/types/transaction.ts | 3 +- 8 files changed, 2096 insertions(+), 2 deletions(-) create mode 100644 src/protocol/foundation/abis/OriginalMarket.json create mode 100644 src/protocol/foundation/constants.ts create mode 100644 src/protocol/foundation/foundation.spec.ts create mode 100644 src/protocol/foundation/foundation.ts create mode 100644 src/protocol/foundation/index.ts create mode 100644 src/test/transactions/foundation-place-bid-v2-0x86c62822.json diff --git a/src/protocol/foundation/abis/OriginalMarket.json b/src/protocol/foundation/abis/OriginalMarket.json new file mode 100644 index 00000000..b5568d77 --- /dev/null +++ b/src/protocol/foundation/abis/OriginalMarket.json @@ -0,0 +1,1669 @@ +[ + { + "inputs": [ + { + "internalType": "address payable", + "name": "treasury", + "type": "address" + }, + { "internalType": "address", "name": "feth", "type": "address" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" }, + { "internalType": "address", "name": "router", "type": "address" }, + { "internalType": "address", "name": "marketUtils", "type": "address" }, + { "internalType": "address", "name": "worldsNft", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "FETHNode_FETH_Address_Is_Not_A_Contract", + "type": "error" + }, + { + "inputs": [], + "name": "FETHNode_Only_FETH_Can_Transfer_ETH", + "type": "error" + }, + { + "inputs": [], + "name": "FoundationTreasuryNode_Address_Is_Not_A_Contract", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "buyPrice", "type": "uint256" } + ], + "name": "NFTMarketBuyPrice_Cannot_Buy_At_Lower_Price", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketBuyPrice_Cannot_Buy_Unset_Price", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketBuyPrice_Cannot_Cancel_Unset_Price", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "NFTMarketBuyPrice_Only_Owner_Can_Cancel_Price", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "NFTMarketBuyPrice_Only_Owner_Can_Set_Price", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "NFTMarketBuyPrice_Only_Owner_Can_Update_Nft", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketBuyPrice_Price_Already_Set", + "type": "error" + }, + { "inputs": [], "name": "NFTMarketBuyPrice_Price_Too_High", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "seller", "type": "address" } + ], + "name": "NFTMarketBuyPrice_Seller_Mismatch", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketCore_Can_Not_Update_Unlisted_Nft", + "type": "error" + }, + { "inputs": [], "name": "NFTMarketCore_Seller_Not_Found", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "curator", "type": "address" } + ], + "name": "NFTMarketExhibition_Caller_Is_Not_Curator", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "worlds", "type": "address" } + ], + "name": "NFTMarketExhibition_Caller_Is_Not_Worlds_Contract", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Can_Not_Add_Dupe_Seller", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Can_Not_Remove_Not_Associated_With_Exhibition", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Curator_Automatically_Allowed", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "curator", "type": "address" } + ], + "name": "NFTMarketExhibition_Curator_Does_Not_Match", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Exhibition_Does_Not_Exist", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Exhibition_NFT_Already_Set", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "nftTokenId", "type": "uint256" }, + { + "internalType": "uint256", + "name": "currentExhibitionId", + "type": "uint256" + } + ], + "name": "NFTMarketExhibition_NFT_Not_Associated_With_Exhibition", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Seller_Not_Allowed_In_Exhibition", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Sellers_Required", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_Take_Rate_Too_High", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketExhibition_World_Migration_Already_Completed", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketFees_Invalid_Protocol_Fee", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketFees_Market_Utils_Is_Not_A_Contract", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketOffer_Cannot_Be_Made_While_In_Auction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentOfferAmount", + "type": "uint256" + } + ], + "name": "NFTMarketOffer_Offer_Below_Min_Amount", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "expiry", "type": "uint256" } + ], + "name": "NFTMarketOffer_Offer_Expired", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "currentOfferFrom", + "type": "address" + } + ], + "name": "NFTMarketOffer_Offer_From_Does_Not_Match", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "minOfferAmount", "type": "uint256" } + ], + "name": "NFTMarketOffer_Offer_Must_Be_At_Least_Min_Amount", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "name": "NFTMarketReserveAuction_Already_Listed", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "minAmount", "type": "uint256" } + ], + "name": "NFTMarketReserveAuction_Bid_Must_Be_At_Least_Min_Amount", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "NFTMarketReserveAuction_Cannot_Bid_Lower_Than_Reserve_Price", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "endTime", "type": "uint256" } + ], + "name": "NFTMarketReserveAuction_Cannot_Bid_On_Ended_Auction", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Cannot_Bid_On_Nonexistent_Auction", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Cannot_Finalize_Already_Settled_Auction", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "endTime", "type": "uint256" } + ], + "name": "NFTMarketReserveAuction_Cannot_Finalize_Auction_In_Progress", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Cannot_Rebid_Over_Outstanding_Bid", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Cannot_Update_Auction_In_Progress", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Cannot_Update_Nft_While_Auction_In_Progress", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "maxDuration", "type": "uint256" } + ], + "name": "NFTMarketReserveAuction_Exceeds_Max_Duration", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "extensionDuration", + "type": "uint256" + } + ], + "name": "NFTMarketReserveAuction_Less_Than_Extension_Duration", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Must_Set_Non_Zero_Reserve_Price", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "seller", "type": "address" } + ], + "name": "NFTMarketReserveAuction_Not_Matching_Seller", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "NFTMarketReserveAuction_Only_Owner_Can_Update_Auction", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "NFTMarketReserveAuction_Only_Owner_Can_Update_Nft", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Price_Already_Set", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketReserveAuction_Too_Much_Value_Provided", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketScheduling_Sale_Starts_At_Already_Set", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketScheduling_Sale_Starts_At_Is_In_Future", + "type": "error" + }, + { + "inputs": [], + "name": "NFTMarketScheduling_Sale_Starts_At_Is_In_Past", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "maxStartsAt", "type": "uint256" } + ], + "name": "NFTMarketScheduling_Sale_Starts_At_Too_Far_In_The_Future", + "type": "error" + }, + { + "inputs": [], + "name": "RouteCallLibrary_Call_Failed_Without_Revert_Reason", + "type": "error" + }, + { + "inputs": [], + "name": "RouterContextSingle_Address_Is_Not_A_Contract", + "type": "error" + }, + { + "inputs": [], + "name": "WorldsNftNode_Worlds_NFT_Is_Not_A_Contract", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalFees", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "creatorRev", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sellerRev", + "type": "uint256" + } + ], + "name": "BuyPriceAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "BuyPriceCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "BuyPriceInvalidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "BuyPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "buyReferrer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "buyReferrerFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "buyReferrerSellerFee", + "type": "uint256" + } + ], + "name": "BuyReferralPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "curator", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "takeRateInBasisPoints", + "type": "uint16" + } + ], + "name": "ExhibitionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "name": "ExhibitionDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "exhibitionId", + "type": "uint256" + } + ], + "name": "ExhibitionMigratedToWorlds", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "name": "NftAddedToExhibition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "name": "NftRemovedFromExhibition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalFees", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "creatorRev", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sellerRev", + "type": "uint256" + } + ], + "name": "OfferAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "OfferInvalidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expiration", + "type": "uint256" + } + ], + "name": "OfferMade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "auctionId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "bidder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "name": "ReserveAuctionBidPlaced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "auctionId", + "type": "uint256" + } + ], + "name": "ReserveAuctionCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "extensionDuration", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reservePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "auctionId", + "type": "uint256" + } + ], + "name": "ReserveAuctionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "auctionId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "bidder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalFees", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "creatorRev", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sellerRev", + "type": "uint256" + } + ], + "name": "ReserveAuctionFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "auctionId", + "type": "uint256" + } + ], + "name": "ReserveAuctionInvalidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "auctionId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reservePrice", + "type": "uint256" + } + ], + "name": "ReserveAuctionUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "sellerReferrer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sellerReferrerFee", + "type": "uint256" + } + ], + "name": "SellerReferralPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "sellers", + "type": "address[]" + } + ], + "name": "SellersAddedToExhibition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "saleStartsAt", + "type": "uint256" + } + ], + "name": "SetSaleStartsAt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawalToFETH", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "address", "name": "offerFrom", "type": "address" }, + { "internalType": "uint256", "name": "minAmount", "type": "uint256" } + ], + "name": "acceptOffer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { "internalType": "address[]", "name": "sellers", "type": "address[]" } + ], + "name": "addSellersToExhibition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "maxPrice", "type": "uint256" }, + { + "internalType": "address payable", + "name": "referrer", + "type": "address" + } + ], + "name": "buyV2", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "cancelBuyPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "name": "cancelReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "name", "type": "string" }, + { + "internalType": "uint16", + "name": "takeRateInBasisPoints", + "type": "uint16" + }, + { "internalType": "address[]", "name": "sellers", "type": "address[]" } + ], + "name": "createExhibition", + "outputs": [ + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" } + ], + "name": "createReserveAuction", + "outputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" } + ], + "name": "createReserveAuctionV3", + "outputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "name": "deleteExhibition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "name": "finalizeReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getApprovedRouterAddress", + "outputs": [ + { "internalType": "address", "name": "router", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getBuyPrice", + "outputs": [ + { "internalType": "address", "name": "seller", "type": "address" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "name": "getExhibition", + "outputs": [ + { "internalType": "string", "name": "name", "type": "string" }, + { + "internalType": "address payable", + "name": "worldPaymentAddress", + "type": "address" + }, + { + "internalType": "uint16", + "name": "takeRateInBasisPoints", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getExhibitionIdForNft", + "outputs": [ + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { + "internalType": "address payable", + "name": "seller", + "type": "address" + }, + { "internalType": "uint256", "name": "price", "type": "uint256" }, + { + "internalType": "address payable", + "name": "buyReferrer", + "type": "address" + }, + { + "internalType": "uint16", + "name": "sellerReferrerTakeRateInBasisPoints", + "type": "uint16" + } + ], + "name": "getFees", + "outputs": [ + { + "internalType": "uint256", + "name": "protocolFeeAmount", + "type": "uint256" + }, + { + "internalType": "address payable[]", + "name": "creatorRecipients", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "creatorShares", + "type": "uint256[]" + }, + { "internalType": "uint256", "name": "sellerRev", "type": "uint256" }, + { + "internalType": "uint256", + "name": "buyReferrerFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sellerReferrerFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "getFeesAndRecipients", + "outputs": [ + { "internalType": "uint256", "name": "totalFees", "type": "uint256" }, + { "internalType": "uint256", "name": "creatorRev", "type": "uint256" }, + { + "internalType": "address payable[]", + "name": "creatorRecipients", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "creatorShares", + "type": "uint256[]" + }, + { "internalType": "uint256", "name": "sellerRev", "type": "uint256" }, + { "internalType": "address payable", "name": "seller", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFethAddress", + "outputs": [ + { "internalType": "address", "name": "fethAddress", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFoundationTreasury", + "outputs": [ + { + "internalType": "address payable", + "name": "treasuryAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMarketUtilsAddress", + "outputs": [ + { + "internalType": "address", + "name": "marketUtilsAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "name": "getMinBidAmount", + "outputs": [ + { "internalType": "uint256", "name": "minimum", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getMinOfferAmount", + "outputs": [ + { "internalType": "uint256", "name": "minimum", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getOffer", + "outputs": [ + { "internalType": "address", "name": "buyer", "type": "address" }, + { "internalType": "uint256", "name": "expiration", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getOfferReferrer", + "outputs": [ + { + "internalType": "address payable", + "name": "referrer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "name": "getReserveAuction", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { + "internalType": "address payable", + "name": "seller", + "type": "address" + }, + { "internalType": "uint256", "name": "duration", "type": "uint256" }, + { + "internalType": "uint256", + "name": "extensionDuration", + "type": "uint256" + }, + { "internalType": "uint256", "name": "endTime", "type": "uint256" }, + { + "internalType": "address payable", + "name": "bidder", + "type": "address" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "internalType": "struct ReserveAuction", + "name": "auction", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "name": "getReserveAuctionBidReferrer", + "outputs": [ + { + "internalType": "address payable", + "name": "referrer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getReserveAuctionIdFor", + "outputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getSaleStartsAt", + "outputs": [ + { "internalType": "uint256", "name": "saleStartsAt", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + ], + "name": "getSellerOf", + "outputs": [ + { "internalType": "address payable", "name": "seller", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWorldsNftAddress", + "outputs": [ + { "internalType": "address", "name": "worldsNft", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { "internalType": "address", "name": "seller", "type": "address" } + ], + "name": "isAllowedSellerForExhibition", + "outputs": [ + { "internalType": "bool", "name": "allowedSeller", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "address payable", + "name": "referrer", + "type": "address" + } + ], + "name": "makeOfferV2", + "outputs": [ + { "internalType": "uint256", "name": "expiration", "type": "uint256" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "address payable", + "name": "referrer", + "type": "address" + } + ], + "name": "placeBidV2", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setBuyPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setBuyPriceV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "saleStartsAt", "type": "uint256" } + ], + "name": "setSaleStartsAt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "nftContract", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + } + ], + "name": "updateExhibitionNft", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "updateReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { + "internalType": "uint256", + "name": "worldOrExhibitionId", + "type": "uint256" + }, + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "updateReserveAuctionV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "worldsInitializeMigration", + "outputs": [ + { + "internalType": "uint256", + "name": "lastExhibitionIdCreated", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "exhibitionId", "type": "uint256" }, + { "internalType": "address", "name": "curator", "type": "address" } + ], + "name": "worldsMigrateExhibition", + "outputs": [ + { "internalType": "string", "name": "name", "type": "string" }, + { + "internalType": "uint16", + "name": "takeRateInBasisPoints", + "type": "uint16" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "exhibitionId", "type": "uint256" }, + { + "components": [ + { + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { "internalType": "uint256", "name": "nftTokenId", "type": "uint256" } + ], + "internalType": "struct INFTMarketExhibitionMigration.NFTListing[]", + "name": "nftListings", + "type": "tuple[]" + } + ], + "name": "worldsMigrateExhibitionListings", + "outputs": [ + { "internalType": "address[]", "name": "nftSellers", "type": "address[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/src/protocol/foundation/constants.ts b/src/protocol/foundation/constants.ts new file mode 100644 index 00000000..beb9160f --- /dev/null +++ b/src/protocol/foundation/constants.ts @@ -0,0 +1,8 @@ +import OriginalMarket from './abis/OriginalMarket.json'; + +export const FOUNDATION_ORIGINAL_MARKET = + '0xcda72070e455bb31c7690a170224ce43623d0b6f'; // Original Market; + +export const ABIs = { + OriginalMarket, +}; diff --git a/src/protocol/foundation/foundation.spec.ts b/src/protocol/foundation/foundation.spec.ts new file mode 100644 index 00000000..d83d64c4 --- /dev/null +++ b/src/protocol/foundation/foundation.spec.ts @@ -0,0 +1,25 @@ +import { Transaction } from '../../types'; +import { contextSummary } from '../../helpers/utils'; +import { detect, generate } from './foundation'; +import foundationPlaceBidV20x86c62822 from '../../test/transactions/foundation-place-bid-v2-0x86c62822.json'; +import catchall0xc35c01ac from '../../test/transactions/catchall-0xc35c01ac.json'; + +describe('Foundation', () => { + it('Should detect Foundation transaction', () => { + const foundation1 = detect(foundationPlaceBidV20x86c62822 as Transaction); + expect(foundation1).toBe(true); + }); + + it('Should generate Foundation context', () => { + const foundation1 = generate(foundationPlaceBidV20x86c62822 as Transaction); + const desc1 = contextSummary(foundation1.context); + expect(desc1).toBe( + '0x5d7dcb9f59d4e1cf96463a72e866966149df1552 PLACED_BID on auction 224399', + ); + }); + + it('Should not detect as Foundation', () => { + const leeroy1 = detect(catchall0xc35c01ac as Transaction); + expect(leeroy1).toBe(false); + }); +}); diff --git a/src/protocol/foundation/foundation.ts b/src/protocol/foundation/foundation.ts new file mode 100644 index 00000000..78998929 --- /dev/null +++ b/src/protocol/foundation/foundation.ts @@ -0,0 +1,90 @@ +import { Interface } from 'ethers/lib/utils'; +import { Transaction } from '../../types'; +import { decodeTransactionInput } from '../../helpers/utils'; +import { FOUNDATION_ORIGINAL_MARKET, ABIs } from './constants'; + +export const contextualize = (transaction: Transaction): Transaction => { + const isFoundation = detect(transaction); + if (!isFoundation) return transaction; + + return generate(transaction); +}; + +export const detect = (transaction: Transaction): boolean => { + if (!transaction.value) { + return false; + } + + if (transaction.to !== FOUNDATION_ORIGINAL_MARKET) { + return false; + } + + try { + const iface = new Interface(ABIs.OriginalMarket); + const decoded = iface.parseTransaction({ + data: transaction.input, + value: transaction.value, + }); + + return ['placeBidV2'].includes(decoded.name); + } catch (_) { + return false; + } +}; + +// Contextualize for mined txs +export const generate = (transaction: Transaction): Transaction => { + const decoded = decodeTransactionInput( + transaction.input, + ABIs.OriginalMarket, + ); + + switch (decoded.name) { + case 'placeBidV2': { + // Capture auction ID + let auctionID = ''; + if (transaction.receipt?.status) { + const originalMarketLog = transaction.logs?.find((log) => { + return log.address === FOUNDATION_ORIGINAL_MARKET; + }); + if (originalMarketLog) { + try { + const iface = new Interface(ABIs.OriginalMarket); + const decoded = iface.parseLog({ + topics: originalMarketLog.topics, + data: originalMarketLog.data, + }); + auctionID = decoded.args.auctionId.toString(); + } catch (e) { + console.error(e); + } + } + } + transaction.context = { + variables: { + contextAction: { + type: 'contextAction', + value: 'PLACED_BID', + }, + auctionID: { + type: 'auctionID', + value: auctionID, + }, + subject: { + type: 'address', + value: transaction.from, + }, + }, + summaries: { + category: 'PROTOCOL_1', + en: { + title: 'Foundation', + default: '[[subject]] [[contextAction]] on auction [[auctionID]]', + }, + }, + }; + + return transaction; + } + } +}; diff --git a/src/protocol/foundation/index.ts b/src/protocol/foundation/index.ts new file mode 100644 index 00000000..66f2ca71 --- /dev/null +++ b/src/protocol/foundation/index.ts @@ -0,0 +1,11 @@ +import { contextualize as foundation } from './foundation'; +import { makeContextualize } from '../../helpers/utils'; + +const children = { foundation }; + +const contextualize = makeContextualize(children); + +export const ensContextualizer = { + contextualize, + children, +}; diff --git a/src/test/transactions/foundation-place-bid-v2-0x86c62822.json b/src/test/transactions/foundation-place-bid-v2-0x86c62822.json new file mode 100644 index 00000000..46a232a5 --- /dev/null +++ b/src/test/transactions/foundation-place-bid-v2-0x86c62822.json @@ -0,0 +1,264 @@ +{ + "blockHash": "0x4e4bb3d6dc23a03c9a3f3a5b15b9c6f4f53ec0aae1cf90fc436c3c8f8a48e248", + "blockNumber": 15183748, + "from": "0x5d7dcb9f59d4e1cf96463a72e866966149df1552", + "gas": 70747, + "gasPrice": "10157991366", + "maxPriorityFeePerGas": "1500000000", + "maxFeePerGas": "14036425592", + "hash": "0x86c611cd9a9a1a2542f6e0e4fea37d9388f6919c5770171214aa210296ec2822", + "input": "0xb6aff8c10000000000000000000000000000000000000000000000000000000000036c8f0000000000000000000000000000000000000000000000000429d069189e00000000000000000000000000000000000000000000000000000000000000000000", + "nonce": 1244, + "to": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "transactionIndex": 237, + "value": "300000000000000000", + "type": 2, + "accessList": [], + "chainId": 1, + "v": "0x0", + "r": "0xa9a2644684f4010a6ae8e5df399418843d73ac97fbbaaf726aee8f42a51b84c", + "s": "0x2f4928278c3928b5ce21ce6e19ed70c16962f3747a41b6b6948fc70fe12e2d8e", + "timestamp": 1658376986, + "isoTimestamp": "2022-07-21T04:16:26.000Z", + "fork": "gray_glacier", + "baseFeePerGas": 8657991366, + "burntFees": "509237078174022", + "minerFees": "88225500000000", + "transactionFee": "597462578174022", + "delegateCalls": [ + { + "action": { + "from": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "callType": "delegatecall", + "gas": "0xa14f", + "input": "0xb6aff8c10000000000000000000000000000000000000000000000000000000000036c8f0000000000000000000000000000000000000000000000000429d069189e00000000000000000000000000000000000000000000000000000000000000000000", + "to": "0x9b5d1e314a8c8af17150fe4e327e8523ee15d25f", + "value": "0x429d069189e0000" + }, + "blockHash": "0x4e4bb3d6dc23a03c9a3f3a5b15b9c6f4f53ec0aae1cf90fc436c3c8f8a48e248", + "blockNumber": 15183748, + "result": { + "gasUsed": "0x800b", + "output": "0x" + }, + "subtraces": 1, + "traceAddress": [ + 0 + ], + "transactionHash": "0x86c611cd9a9a1a2542f6e0e4fea37d9388f6919c5770171214aa210296ec2822", + "transactionPosition": 237, + "type": "call" + } + ], + "assetTransfers": [ + { + "from": "0x5d7dcb9f59d4e1cf96463a72e866966149df1552", + "to": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "type": "eth", + "value": "300000000000000000" + }, + { + "from": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "to": "0x3d1856446bd64f08173f664e66bc5fe2738e3e47", + "type": "eth", + "value": "250000000000000000" + } + ], + "sigHash": "0xb6aff8c1", + "internalSigHashes": [ + { + "from": "0x5d7dcb9f59d4e1cf96463a72e866966149df1552", + "to": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "sigHash": "0xb6aff8c1" + }, + { + "from": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "to": "0x9b5d1e314a8c8af17150fe4e327e8523ee15d25f", + "sigHash": "0xb6aff8c1" + }, + { + "from": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "to": "0x3d1856446bd64f08173f664e66bc5fe2738e3e47", + "sigHash": "0x" + } + ], + "parties": [ + "0x5d7dcb9f59d4e1cf96463a72e866966149df1552", + "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "0x9b5d1e314a8c8af17150fe4e327e8523ee15d25f", + "0x3d1856446bd64f08173f664e66bc5fe2738e3e47", + "0x0000000000000000000000000000000000000000" + ], + "decode": { + "fragment": { + "type": "function", + "inputs": [ + { + "name": "", + "type": "uint256", + "baseType": "uint256", + "indexed": null, + "components": null, + "arrayLength": null, + "arrayChildren": null + }, + { + "name": "", + "type": "uint256", + "baseType": "uint256", + "indexed": null, + "components": null, + "arrayLength": null, + "arrayChildren": null + }, + { + "name": "", + "type": "address", + "baseType": "address", + "indexed": null, + "components": null, + "arrayLength": null, + "arrayChildren": null + } + ], + "name": "placeBidV2", + "constant": false, + "outputs": [], + "stateMutability": "nonpayable", + "payable": false, + "gas": null + }, + "name": "placeBidV2", + "args": [ + "224399", + "300000000000000000", + "0x0000000000000000000000000000000000000000" + ], + "signature": "placeBidV2(uint256,uint256,address)", + "selector": "0xb6aff8c1", + "value": "0" + }, + "netAssetTransfers": { + "0x5d7dcb9f59d4e1cf96463a72e866966149df1552": { + "received": [], + "sent": [ + { + "asset": "eth", + "id": "eth", + "type": "eth", + "value": "300000000000000000" + } + ] + }, + "0xcda72070e455bb31c7690a170224ce43623d0b6f": { + "received": [ + { + "asset": "eth", + "id": "eth", + "type": "eth", + "value": "50000000000000000" + } + ], + "sent": [] + }, + "0x3d1856446bd64f08173f664e66bc5fe2738e3e47": { + "received": [ + { + "asset": "eth", + "id": "eth", + "type": "eth", + "value": "250000000000000000" + } + ], + "sent": [] + } + }, + "receipt": { + "blockHash": "0x4e4bb3d6dc23a03c9a3f3a5b15b9c6f4f53ec0aae1cf90fc436c3c8f8a48e248", + "blockNumber": 15183748, + "contractAddress": null, + "cumulativeGasUsed": 17041149, + "effectiveGasPrice": 10157991366, + "from": "0x5d7dcb9f59d4e1cf96463a72e866966149df1552", + "gasUsed": 58817, + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000040000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000840000000000000000000000000000000000000000000080000000000000040000000000000000000000000000000000000000008000000000000000000000000000400000000000000000020000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000", + "status": true, + "to": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "transactionHash": "0x86c611cd9a9a1a2542f6e0e4fea37d9388f6919c5770171214aa210296ec2822", + "transactionIndex": 237, + "type": "0x2" + }, + "logs": [ + { + "address": "0xcda72070e455bb31c7690a170224ce43623d0b6f", + "topics": [ + "0x26ea3ebbda62eb1baef13e1c237dddd956c87f80b2801f2616d806d52557b121", + "0x0000000000000000000000000000000000000000000000000000000000036c8f", + "0x0000000000000000000000005d7dcb9f59d4e1cf96463a72e866966149df1552" + ], + "data": "0x0000000000000000000000000000000000000000000000000429d069189e00000000000000000000000000000000000000000000000000000000000062d91bc8", + "blockNumber": 15183748, + "transactionHash": "0x86c611cd9a9a1a2542f6e0e4fea37d9388f6919c5770171214aa210296ec2822", + "transactionIndex": 237, + "blockHash": "0x4e4bb3d6dc23a03c9a3f3a5b15b9c6f4f53ec0aae1cf90fc436c3c8f8a48e248", + "logIndex": 437, + "removed": false, + "chainId": 1, + "decode": { + "fragment": { + "type": "event", + "inputs": [ + { + "name": "auctionId", + "type": "uint256", + "baseType": "uint256", + "indexed": true, + "components": null, + "arrayLength": null, + "arrayChildren": null + }, + { + "name": "bidder", + "type": "address", + "baseType": "address", + "indexed": true, + "components": null, + "arrayLength": null, + "arrayChildren": null + }, + { + "name": "amount", + "type": "uint256", + "baseType": "uint256", + "indexed": null, + "components": null, + "arrayLength": null, + "arrayChildren": null + }, + { + "name": "endTime", + "type": "uint256", + "baseType": "uint256", + "indexed": null, + "components": null, + "arrayLength": null, + "arrayChildren": null + } + ], + "name": "ReserveAuctionBidPlaced", + "anonymous": false + }, + "name": "ReserveAuctionBidPlaced", + "signature": "ReserveAuctionBidPlaced(uint256,address,uint256,uint256)", + "topic": "0x26ea3ebbda62eb1baef13e1c237dddd956c87f80b2801f2616d806d52557b121", + "args": [ + "224399", + "0x5d7dcb9f59d4e1cf96463a72e866966149df1552", + "300000000000000000", + "1658395592" + ] + } + } + ], + "contractsCreated": [] +} \ No newline at end of file diff --git a/src/types/contextAction/protocolContextAction.ts b/src/types/contextAction/protocolContextAction.ts index 80575074..9c695430 100644 --- a/src/types/contextAction/protocolContextAction.ts +++ b/src/types/contextAction/protocolContextAction.ts @@ -46,10 +46,36 @@ export type FarcasterContextAction = | 'REMOVED_A_KEY' | 'ADDED_A_KEY'; +// Foundation +export type FoundationOriginalMarketContextAction = + | 'PLACED_BID' // reserve auction + | 'CREATED_RESERVE_AUCTION' // reserve auction + | 'FINALIZED_RESERVE_AUCTION' // reserve auction + | 'SET_BUY_PRICE' // buy now + | 'ACCEPTED_BUY_PRICE' // buy now + | 'MADE_OFFER' // offers + | 'ACCEPTED_OFFER' // offers + | 'UNLISTED'; // both reserve auction and buy now + +// TODO: Add drop reveal +export type FoundationDropMarketContextAction = + | 'CREATED_FIXED_PRICE_SALE' + | 'CREATED_FIXED_PRICE_SALE_WITH_ALLOWLIST' + | 'MINTED_FROM_FIXED_PRICE_SALE_WITH_ALLOWLIST'; + +export type FoundationWorldsContextAction = + | 'ACCEPTED_TRANSFER' + | 'BEGAN_TRANSFER' + | 'SET_PAYMENT_ADDRESS' + | 'ADDED_TO_WORLD_BY_SPLIT' + | 'MIGRATED_FROM_EXHIBITION' + | 'REMOVED_FROM_ALLOWLIST_BY_SELLER'; + export type ProtocolContextAction = | WETHContextAction | ENSContextAction | CryptoPunksContextAction | LeeroyContextAction | FrenpetContextAction - | FarcasterContextAction; + | FarcasterContextAction + | FoundationOriginalMarketContextAction; diff --git a/src/types/transaction.ts b/src/types/transaction.ts index 678f4bc7..ab7a1fd2 100644 --- a/src/types/transaction.ts +++ b/src/types/transaction.ts @@ -113,7 +113,8 @@ export type ContextSummaryVariableType = | 'address' | 'transaction' | 'eth' - | 'farcasterID' + | 'farcasterID' // TODO: Move to Farcaster protocol + | 'auctionID' // TODO: Move to Foundation protocol | 'crosschain'; value: string; }