From 08f585340f50039016ccfd6a1a852868bda06db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hi=E1=BA=BFu=20Ph=E1=BA=A1m?= Date: Thu, 15 Feb 2024 11:38:09 +0700 Subject: [PATCH 1/9] binding for contract v5 --- .gitmodules | 2 +- Makefile | 3 + .../feralfile-exhibition-v5/feralfile.go | 256 ++++++++++++++++++ .../feralfile-exhibition-smart-contract | 2 +- 4 files changed, 261 insertions(+), 2 deletions(-) create mode 100644 contracts/feralfile-exhibition-v5/feralfile.go diff --git a/.gitmodules b/.gitmodules index 6de097f..96aa3a7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "sub_modules/feralfile-exhibition-smart-contract"] path = sub_modules/feralfile-exhibition-smart-contract url = https://github.com/bitmark-inc/feralfile-exhibition-smart-contract.git - branch= main + branch= contract-v5 diff --git a/Makefile b/Makefile index 7516b25..c03098f 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,8 @@ build-contract: check setup-submodules jq -r ".abi" build/contracts/FeralfileExhibitionV3.json > ./build/FeralfileExhibitionV3.abi && \ jq -r ".bytecode" build/contracts/FeralfileExhibitionV4.json > ./build/FeralfileExhibitionV4.bin && \ jq -r ".abi" build/contracts/FeralfileExhibitionV4.json > ./build/FeralfileExhibitionV4.abi && \ + jq -r ".bytecode" build/contracts/FeralfileExhibitionV5.json > ./build/FeralfileExhibitionV5.bin && \ + jq -r ".abi" build/contracts/FeralfileExhibitionV5.json > ./build/FeralfileExhibitionV5.abi && \ jq -r ".bytecode" build/contracts/FeralfileEnglishAuction.json > ./build/FeralfileEnglishAuction.bin && \ jq -r ".abi" build/contracts/FeralfileEnglishAuction.json > ./build/FeralfileEnglishAuction.abi && \ jq -r ".bytecode" build/contracts/FeralFileAirdropV1.json > ./build/FeralFileAirdropV1.bin && \ @@ -39,5 +41,6 @@ build: build-contract abigen --abi sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV2.abi --bin sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV2.bin --pkg feralfilev2 -type FeralfileExhibitionV2 --out contracts/feralfile-exhibition-v2/abi.go abigen --abi sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV3.abi --bin sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV3.bin --pkg feralfilev3 -type FeralfileExhibitionV3 --out contracts/feralfile-exhibition-v3/abi.go abigen --abi sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV4.abi --bin sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV4.bin --pkg feralfilev4 -type FeralfileExhibitionV4 --out contracts/feralfile-exhibition-v4/abi.go + abigen --abi sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV5.abi --bin sub_modules/feralfile-exhibition-smart-contract/build/FeralfileExhibitionV5.bin --pkg feralfilev5 -type FeralfileExhibitionV5 --out contracts/feralfile-exhibition-v5/abi.go abigen --abi sub_modules/feralfile-exhibition-smart-contract/build/FeralfileEnglishAuction.abi --bin sub_modules/feralfile-exhibition-smart-contract/build/FeralfileEnglishAuction.bin --pkg english_auction -type FeralfileEnglishAuction --out contracts/feralfile-english-auction/abi.go abigen --abi sub_modules/feralfile-exhibition-smart-contract/build/FeralFileAirdropV1.abi --bin sub_modules/feralfile-exhibition-smart-contract/build/FeralFileAirdropV1.bin --pkg airdropv1 -type FeralFileAirdropV1 --out contracts/feralfile-airdrop-v1/abi.go diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go new file mode 100644 index 0000000..0255581 --- /dev/null +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -0,0 +1,256 @@ +package feralfilev5 + +import ( + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "math/big" + "strconv" + "strings" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/params" + + ethereum "github.com/bitmark-inc/account-vault-ethereum" +) + +const ( + GasLimitPerMint = 150000 + GasLimitPerBurn = 50000 + GasLimitApproveForAll = 80000 +) + +type FeralfileExhibitionV5Contract struct { + contractAddress string +} + +func FeralfileExhibitionV5ContractFactory(contractAddress string) ethereum.Contract { + return &FeralfileExhibitionV5Contract{ + contractAddress: contractAddress, + } +} + +// Deploy deploys the smart contract to ethereum blockchain +func (c *FeralfileExhibitionV5Contract) Deploy(wallet *ethereum.Wallet, arguments json.RawMessage) (string, string, error) { + var params struct { + BaseTokenURI string `json:"base_token_uri"` + ContractURI string `json:"contract_uri"` + Signer common.Address `json:"signer"` + Vault common.Address `json:"vault"` + CostReceiver common.Address `json:"cost_receiver"` + IsBurnable bool `json:"is_burnable"` + SeriesIDs []*big.Int `json:"series_ids"` + SeriesMaxSupplies []*big.Int `json:"series_max_supplies"` + SeriesArtworkMaxSupplies []*big.Int `json:"series_artwork_max_supplies"` + } + + if err := json.Unmarshal(arguments, ¶ms); err != nil { + return "", "", err + } + + t, err := wallet.Transactor() + if err != nil { + return "", "", err + } + + address, tx, _, err := DeployFeralfileExhibitionV5( + t, + wallet.RPCClient(), + params.BaseTokenURI, + params.ContractURI, + params.Signer, + params.Vault, + params.CostReceiver, + params.IsBurnable, + params.SeriesIDs, + params.SeriesMaxSupplies, + params.SeriesArtworkMaxSupplies, + ) + if err != nil { + return "", "", err + } + return address.String(), tx.Hash().String(), nil +} + +// Call is the entry function for account vault to interact with a smart contract. +func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fund string, arguments json.RawMessage, noSend bool, customizeGasPriceInWei *int64, customizedNonce *uint64) (*types.Transaction, error) { + contract, err := NewFeralfileExhibitionV5(common.HexToAddress(c.contractAddress), wallet.RPCClient()) + if err != nil { + return nil, err + } + + t, err := wallet.Transactor() + if err != nil { + return nil, err + } + + t.NoSend = noSend + if customizeGasPriceInWei != nil && *customizeGasPriceInWei != 0 { + t.GasPrice = big.NewInt(*customizeGasPriceInWei * params.Wei) + } + + if customizedNonce != nil { + t.Nonce = big.NewInt(int64(*customizedNonce)) + } + + switch method { + case "burnArtworks": + var params []struct { + From string `json:"from"` + TokenID ethereum.BigInt `json:"token_id"` + Amount ethereum.BigInt `json:"amount"` + } + if err := json.Unmarshal(arguments, ¶ms); err != nil { + return nil, err + } + if len(params) == 0 { + return nil, errors.New("Invalid token burn parameters") + } + + t.GasLimit = uint64(GasLimitPerBurn * len(params)) + + burnData := make([]FeralfileExhibitionV5BurnData, len(params)) + for i := 0; i < len(params); i++ { + burnData[i] = FeralfileExhibitionV5BurnData{ + From: common.HexToAddress(params[i].From), + TokenId: ¶ms[i].TokenID.Int, + Amount: ¶ms[i].Amount.Int, + } + } + + return contract.BurnArtworks(t, burnData) + case "mintArtworks": + var params []struct { + SeriesID ethereum.BigInt `json:"series_id"` + TokenID ethereum.BigInt `json:"token_id"` + Owner common.Address `json:"owner"` + Amount ethereum.BigInt `json:"amount"` + } + if err := json.Unmarshal(arguments, ¶ms); err != nil { + return nil, err + } + if len(params) == 0 { + return nil, errors.New("Invalid token mint parameters") + } + + t.GasLimit = uint64(GasLimitPerMint * len(params)) + + mintData := make([]FeralfileExhibitionV5MintData, len(params)) + for i := 0; i < len(params); i++ { + mintData[i] = FeralfileExhibitionV5MintData{ + SeriesId: ¶ms[i].SeriesID.Int, + TokenId: ¶ms[i].TokenID.Int, + Owner: params[i].Owner, + Amount: ¶ms[i].Amount.Int, + } + } + + return contract.MintArtworks(t, mintData) + case "buyArtworks": + var params struct { + SaleData struct { + Price ethereum.BigInt `json:"price"` + Cost ethereum.BigInt `json:"cost"` + ExpiryTime ethereum.BigInt `json:"expiry_time"` + Destination common.Address `json:"destination"` + TokenIds []ethereum.BigInt `json:"token_ids"` + RevenueShares [][]struct { + Recipient common.Address `json:"recipient"` + Bps ethereum.BigInt `json:"bps"` + } `json:"revenue_shares"` + PayByVaultContract bool `json:"pay_by_vault_contract"` + BiddingUnixNano ethereum.BigInt `json:"bidding_unix_nano"` + } `json:"sale_data"` + R string `json:"r"` + S string `json:"s"` + V string `json:"v"` + } + + if err := json.Unmarshal(arguments, ¶ms); err != nil { + return nil, err + } + + rVal, err := hex.DecodeString(strings.Replace(params.R, "0x", "", -1)) + if err != nil { + return nil, err + } + sVal, err := hex.DecodeString(strings.Replace(params.S, "0x", "", -1)) + if err != nil { + return nil, err + } + vVal, err := strconv.ParseUint(strings.Replace(params.V, "0x", "", -1), 16, 64) + if err != nil { + return nil, err + } + if len(rVal) != 32 || len(sVal) != 32 { + return nil, errors.New("required signature length is 32") + } + var r32Val [32]byte + var s32Val [32]byte + copy(r32Val[:], rVal) + copy(s32Val[:], sVal) + + tokenIDs := make([]*big.Int, 0) + for _, v := range params.SaleData.TokenIds { + tokenID := v.Int + tokenIDs = append(tokenIDs, &tokenID) + } + + revenueShares := make([][]IFeralfileSaleDataRevenueShare, 0) + for _, v := range params.SaleData.RevenueShares { + revenueShare := make([]IFeralfileSaleDataRevenueShare, 0) + for _, vv := range v { + bps := vv.Bps.Int + revenueShare = append(revenueShare, IFeralfileSaleDataRevenueShare{ + Recipient: vv.Recipient, + Bps: &bps, + }) + } + revenueShares = append(revenueShares, revenueShare) + } + + saleData := IFeralfileSaleDataSaleData{ + Price: ¶ms.SaleData.Price.Int, + Cost: ¶ms.SaleData.Cost.Int, + ExpiryTime: ¶ms.SaleData.ExpiryTime.Int, + Destination: params.SaleData.Destination, + TokenIds: tokenIDs, + RevenueShares: revenueShares, + PayByVaultContract: params.SaleData.PayByVaultContract, + BiddingUnixNano: ¶ms.SaleData.BiddingUnixNano.Int, + } + + tx, err := contract.BuyArtworks(t, r32Val, s32Val, uint8(vVal), saleData) + if err != nil { + return nil, err + } + return tx, nil + case "approve_for_all": + var params struct { + Operator common.Address `json:"operator"` + } + if err := json.Unmarshal(arguments, ¶ms); err != nil { + return nil, err + } + + t.GasLimit = GasLimitApproveForAll + + tx, err := contract.SetApprovalForAll(t, params.Operator, true) + if err != nil { + return nil, err + } + return tx, nil + default: + return nil, fmt.Errorf("unsupported method") + } +} + +func (c *FeralfileExhibitionV5Contract) ParamEncoder(method string, arguments json.RawMessage) ([]byte, error) { + return nil, fmt.Errorf("unsupported method") +} + +func init() { + ethereum.RegisterContract("FeralfileExhibitionV5", FeralfileExhibitionV5ContractFactory) +} diff --git a/sub_modules/feralfile-exhibition-smart-contract b/sub_modules/feralfile-exhibition-smart-contract index 9a07563..84472d2 160000 --- a/sub_modules/feralfile-exhibition-smart-contract +++ b/sub_modules/feralfile-exhibition-smart-contract @@ -1 +1 @@ -Subproject commit 9a07563a931c525e925395240b210b469cd5de95 +Subproject commit 84472d26ed27a834e2c21b19c91e19753972e2f8 From c73f742b35aa0f6fcdc7086651120d6a5631a129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hi=E1=BA=BFu=20Ph=E1=BA=A1m?= Date: Fri, 16 Feb 2024 14:17:30 +0700 Subject: [PATCH 2/9] update binding code --- contracts/feralfile-exhibition-v5/feralfile.go | 4 ++-- sub_modules/feralfile-exhibition-smart-contract | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go index 0255581..0af8bae 100644 --- a/contracts/feralfile-exhibition-v5/feralfile.go +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -161,7 +161,7 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu Bps ethereum.BigInt `json:"bps"` } `json:"revenue_shares"` PayByVaultContract bool `json:"pay_by_vault_contract"` - BiddingUnixNano ethereum.BigInt `json:"bidding_unix_nano"` + BiddingUnix ethereum.BigInt `json:"bidding_unix"` } `json:"sale_data"` R string `json:"r"` S string `json:"s"` @@ -219,7 +219,7 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu TokenIds: tokenIDs, RevenueShares: revenueShares, PayByVaultContract: params.SaleData.PayByVaultContract, - BiddingUnixNano: ¶ms.SaleData.BiddingUnixNano.Int, + BiddingUnix: ¶ms.SaleData.BiddingUnix.Int, } tx, err := contract.BuyArtworks(t, r32Val, s32Val, uint8(vVal), saleData) diff --git a/sub_modules/feralfile-exhibition-smart-contract b/sub_modules/feralfile-exhibition-smart-contract index 84472d2..0e6aa66 160000 --- a/sub_modules/feralfile-exhibition-smart-contract +++ b/sub_modules/feralfile-exhibition-smart-contract @@ -1 +1 @@ -Subproject commit 84472d26ed27a834e2c21b19c91e19753972e2f8 +Subproject commit 0e6aa66d8d20d6d4478277976859466fc6f4b6a2 From 231f2fdaf5dd57c1103933a17ec31a420d2d9ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hi=E1=BA=BFu=20Ph=E1=BA=A1m?= Date: Fri, 16 Feb 2024 17:22:56 +0700 Subject: [PATCH 3/9] support binding new sale data v2 --- contracts/feralfile-english-auction/english_auction.go | 10 ++++++---- contracts/feralfile-exhibition-v5/feralfile.go | 8 ++++---- sub_modules/feralfile-exhibition-smart-contract | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/contracts/feralfile-english-auction/english_auction.go b/contracts/feralfile-english-auction/english_auction.go index f4630c4..01005c5 100644 --- a/contracts/feralfile-english-auction/english_auction.go +++ b/contracts/feralfile-english-auction/english_auction.go @@ -160,6 +160,7 @@ func (c *FeralfileEnglishAuctionContract) Call(wallet *ethereum.Wallet, method, Bps ethereum.BigInt } PayByVaultContract bool + BiddingUnix ethereum.BigInt } R string S string @@ -196,12 +197,12 @@ func (c *FeralfileEnglishAuctionContract) Call(wallet *ethereum.Wallet, method, tokenIDs = append(tokenIDs, &tokenID) } - revenueShares := make([][]IFeralfileSaleDataRevenueShare, 0) + revenueShares := make([][]IFeralfileSaleDataV2RevenueShare, 0) for _, v := range params.SaleData.RevenueShares { - revenueShare := make([]IFeralfileSaleDataRevenueShare, 0) + revenueShare := make([]IFeralfileSaleDataV2RevenueShare, 0) for _, vv := range v { bps := vv.Bps.Int - revenueShare = append(revenueShare, IFeralfileSaleDataRevenueShare{ + revenueShare = append(revenueShare, IFeralfileSaleDataV2RevenueShare{ Recipient: vv.Recipient, Bps: &bps, }) @@ -209,7 +210,7 @@ func (c *FeralfileEnglishAuctionContract) Call(wallet *ethereum.Wallet, method, revenueShares = append(revenueShares, revenueShare) } - saleData := IFeralfileSaleDataSaleData{ + saleData := IFeralfileSaleDataV2SaleData{ Price: ¶ms.SaleData.Price.Int, Cost: ¶ms.SaleData.Cost.Int, ExpiryTime: ¶ms.SaleData.ExpiryTime.Int, @@ -217,6 +218,7 @@ func (c *FeralfileEnglishAuctionContract) Call(wallet *ethereum.Wallet, method, TokenIds: tokenIDs, RevenueShares: revenueShares, PayByVaultContract: params.SaleData.PayByVaultContract, + BiddingUnix: ¶ms.SaleData.BiddingUnix.Int, } tx, err := contract.SettleAuction(t, ¶ms.AuctionID.Int, params.ContractAddress, params.VaultAddress, saleData, r32Val, s32Val, uint8(vVal)) diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go index 0af8bae..9f8f2ca 100644 --- a/contracts/feralfile-exhibition-v5/feralfile.go +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -198,12 +198,12 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu tokenIDs = append(tokenIDs, &tokenID) } - revenueShares := make([][]IFeralfileSaleDataRevenueShare, 0) + revenueShares := make([][]IFeralfileSaleDataV2RevenueShare, 0) for _, v := range params.SaleData.RevenueShares { - revenueShare := make([]IFeralfileSaleDataRevenueShare, 0) + revenueShare := make([]IFeralfileSaleDataV2RevenueShare, 0) for _, vv := range v { bps := vv.Bps.Int - revenueShare = append(revenueShare, IFeralfileSaleDataRevenueShare{ + revenueShare = append(revenueShare, IFeralfileSaleDataV2RevenueShare{ Recipient: vv.Recipient, Bps: &bps, }) @@ -211,7 +211,7 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu revenueShares = append(revenueShares, revenueShare) } - saleData := IFeralfileSaleDataSaleData{ + saleData := IFeralfileSaleDataV2SaleData{ Price: ¶ms.SaleData.Price.Int, Cost: ¶ms.SaleData.Cost.Int, ExpiryTime: ¶ms.SaleData.ExpiryTime.Int, diff --git a/sub_modules/feralfile-exhibition-smart-contract b/sub_modules/feralfile-exhibition-smart-contract index 0e6aa66..61544dd 160000 --- a/sub_modules/feralfile-exhibition-smart-contract +++ b/sub_modules/feralfile-exhibition-smart-contract @@ -1 +1 @@ -Subproject commit 0e6aa66d8d20d6d4478277976859466fc6f4b6a2 +Subproject commit 61544ddbbaf58839963ee7342064cc68c7f1c1e2 From ade8883ba1fccfe5e20343131b6a3bb35db9b575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hi=E1=BA=BFu=20Ph=E1=BA=A1m?= Date: Sat, 17 Feb 2024 18:45:37 +0700 Subject: [PATCH 4/9] update latest submodules --- sub_modules/feralfile-exhibition-smart-contract | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub_modules/feralfile-exhibition-smart-contract b/sub_modules/feralfile-exhibition-smart-contract index 61544dd..7b351f8 160000 --- a/sub_modules/feralfile-exhibition-smart-contract +++ b/sub_modules/feralfile-exhibition-smart-contract @@ -1 +1 @@ -Subproject commit 61544ddbbaf58839963ee7342064cc68c7f1c1e2 +Subproject commit 7b351f8589255a9ed0e0b177ad698c4d69abf43f From 3e744346b2654e98d7495413e2b8d970777ad3eb Mon Sep 17 00:00:00 2001 From: Brandon Yeh Date: Mon, 19 Feb 2024 20:06:24 +0800 Subject: [PATCH 5/9] update latest submodule --- sub_modules/feralfile-exhibition-smart-contract | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub_modules/feralfile-exhibition-smart-contract b/sub_modules/feralfile-exhibition-smart-contract index 7b351f8..b764673 160000 --- a/sub_modules/feralfile-exhibition-smart-contract +++ b/sub_modules/feralfile-exhibition-smart-contract @@ -1 +1 @@ -Subproject commit 7b351f8589255a9ed0e0b177ad698c4d69abf43f +Subproject commit b764673e13ef96c3385d906a7ff0b238090f0736 From cf1358b4d8568dc37f36872b18d74560226ef431 Mon Sep 17 00:00:00 2001 From: Brandon Yeh Date: Tue, 20 Feb 2024 14:47:48 +0800 Subject: [PATCH 6/9] Update the estimated per mint gas limit --- contracts/feralfile-exhibition-v5/feralfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go index 9f8f2ca..815b322 100644 --- a/contracts/feralfile-exhibition-v5/feralfile.go +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -17,7 +17,7 @@ import ( ) const ( - GasLimitPerMint = 150000 + GasLimitPerMint = 250000 GasLimitPerBurn = 50000 GasLimitApproveForAll = 80000 ) From b2e140b93d04121bc48dc641cfb4b1501fe26e4a Mon Sep 17 00:00:00 2001 From: Brandon Yeh Date: Thu, 22 Feb 2024 21:43:21 +0800 Subject: [PATCH 7/9] Add startSale to v5 --- contracts/feralfile-exhibition-v5/feralfile.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go index 815b322..16b5e12 100644 --- a/contracts/feralfile-exhibition-v5/feralfile.go +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -242,6 +242,8 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu return nil, err } return tx, nil + case "startSale": + return contract.StartSale(t) default: return nil, fmt.Errorf("unsupported method") } From c15913914d7e90156a6245343eb1ea609f9d488b Mon Sep 17 00:00:00 2001 From: Brandon Yeh Date: Thu, 22 Feb 2024 22:34:56 +0800 Subject: [PATCH 8/9] Temp add set vault --- contracts/feralfile-exhibition-v5/feralfile.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go index 16b5e12..1cad2a0 100644 --- a/contracts/feralfile-exhibition-v5/feralfile.go +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -244,6 +244,14 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu return tx, nil case "startSale": return contract.StartSale(t) + case "setVault": + var params struct { + Vault common.Address `json:"vault"` + } + if err := json.Unmarshal(arguments, ¶ms); err != nil { + return nil, err + } + return contract.SetVault(t, params.Vault) default: return nil, fmt.Errorf("unsupported method") } From bc186b039fecc22b22fe2b6546851665830ffb89 Mon Sep 17 00:00:00 2001 From: Brandon Yeh Date: Fri, 23 Feb 2024 13:17:59 +0800 Subject: [PATCH 9/9] Fix the param parsing f --- contracts/feralfile-exhibition-v5/feralfile.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/feralfile-exhibition-v5/feralfile.go b/contracts/feralfile-exhibition-v5/feralfile.go index 1cad2a0..8e9d853 100644 --- a/contracts/feralfile-exhibition-v5/feralfile.go +++ b/contracts/feralfile-exhibition-v5/feralfile.go @@ -153,16 +153,16 @@ func (c *FeralfileExhibitionV5Contract) Call(wallet *ethereum.Wallet, method, fu SaleData struct { Price ethereum.BigInt `json:"price"` Cost ethereum.BigInt `json:"cost"` - ExpiryTime ethereum.BigInt `json:"expiry_time"` + ExpiryTime ethereum.BigInt `json:"expiryTime"` Destination common.Address `json:"destination"` - TokenIds []ethereum.BigInt `json:"token_ids"` + TokenIds []ethereum.BigInt `json:"tokenIds"` RevenueShares [][]struct { Recipient common.Address `json:"recipient"` Bps ethereum.BigInt `json:"bps"` - } `json:"revenue_shares"` - PayByVaultContract bool `json:"pay_by_vault_contract"` - BiddingUnix ethereum.BigInt `json:"bidding_unix"` - } `json:"sale_data"` + } `json:"revenueShares"` + PayByVaultContract bool `json:"payByVaultContract"` + BiddingUnix ethereum.BigInt `json:"biddingUnix"` + } `json:"saleData"` R string `json:"r"` S string `json:"s"` V string `json:"v"`