From 86efa78100c725b9e5954d94de79819ebcbe6dc5 Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Sat, 17 Aug 2024 23:56:04 +0530 Subject: [PATCH 1/6] api for adding nft contract address --- api/v1/nftcontract/nftcontract.go | 205 ++++++++++++++++++++++++++++++ api/v1/v1.go | 2 + config/dbconfig/dbconfig.go | 1 + models/Migrate/migrate_models.go | 12 ++ models/NftSubscription.go | 13 ++ 5 files changed, 233 insertions(+) create mode 100644 api/v1/nftcontract/nftcontract.go create mode 100644 models/NftSubscription.go diff --git a/api/v1/nftcontract/nftcontract.go b/api/v1/nftcontract/nftcontract.go new file mode 100644 index 0000000..d2861c7 --- /dev/null +++ b/api/v1/nftcontract/nftcontract.go @@ -0,0 +1,205 @@ +package nftcontract + +import ( + "context" + "fmt" + "math/big" + "strings" + "sync" + + "github.com/NetSepio/gateway/api/middleware/auth/paseto" + "github.com/NetSepio/gateway/config/dbconfig" + "github.com/NetSepio/gateway/models" + "github.com/NetSepio/gateway/util/pkg/logwrapper" + "github.com/TheLazarusNetwork/go-helpers/httpo" + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/gin-gonic/gin" + "gorm.io/gorm" +) + +const NFTContractABI = `[ + {"inputs": [], "name": "name", "outputs": [{"type": "string"}], "stateMutability": "view", "type": "function"}, + {"inputs": [], "name": "symbol", "outputs": [{"type": "string"}], "stateMutability": "view", "type": "function"}, + {"inputs": [], "name": "totalSupply", "outputs": [{"type": "uint256"}], "stateMutability": "view", "type": "function"}, + {"inputs": [], "name": "owner", "outputs": [{"type": "address"}], "stateMutability": "view", "type": "function"}, + {"inputs": [{"type": "uint256"}], "name": "tokenURI", "outputs": [{"type": "string"}], "stateMutability": "view", "type": "function"} +]` + +type NFTContractRequest struct { + ContractAddress string `json:"contractAddress"` + ChainName string `json:"chainName"` +} + +type NFTContractResponse struct { + ContractAddress string `json:"contractAddress"` + ChainName string `json:"chainName"` + Details map[string]string `json:"details"` +} + +// New model for storing contract details + +func ApplyRoutes(r *gin.RouterGroup) { + g := r.Group("/nftcontract") + { + g.Use(paseto.PASETO(true)) + g.POST("", getnftcontractinfo) + } +} + +func getnftcontractinfo(c *gin.Context) { + db := dbconfig.GetDb() + userId := c.GetString(paseto.CTX_USER_ID) + + // Check if user has a domain + var domain models.Domain + if err := db.Where("id = ?", userId).First(&domain).Error; err != nil { + if err == gorm.ErrRecordNotFound { + httpo.NewErrorResponse(403, "User has not created a domain yet").SendD(c) + } else { + logwrapper.Error("Failed to check user domain", err) + httpo.NewErrorResponse(500, "Internal server error").SendD(c) + } + return + } + + var request NFTContractRequest + if err := c.BindJSON(&request); err != nil { + httpo.NewErrorResponse(400, "Invalid request payload").SendD(c) + return + } + + // Check if chain name is "eth" + if strings.ToLower(request.ChainName) != "eth" { + httpo.NewErrorResponse(400, "Unsupported chain name. Only 'eth' is supported").SendD(c) + return + } + + // Validate contract address + if !common.IsHexAddress(request.ContractAddress) { + httpo.NewErrorResponse(400, "Invalid contract address").SendD(c) + return + } + + // Connect to Ethereum mainnet + client, err := ethclient.Dial("https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID") + if err != nil { + logwrapper.Error("Failed to connect to the Ethereum client", err) + httpo.NewErrorResponse(500, "Failed to connect to the Ethereum network").SendD(c) + return + } + + address := common.HexToAddress(request.ContractAddress) + + parsedABI, err := abi.JSON(strings.NewReader(NFTContractABI)) + if err != nil { + logwrapper.Error("Failed to parse ABI", err) + httpo.NewErrorResponse(500, "Failed to parse contract ABI").SendD(c) + return + } + + details := getNFTContractDetails(client, address, parsedABI) + + // Store contract details in the database + contractDetails := models.NftSubscription{ + UserID: userId, + ContractAddress: request.ContractAddress, + ChainName: request.ChainName, + Name: details["name"], + Symbol: details["symbol"], + TotalSupply: details["totalSupply"], + Owner: details["owner"], + TokenURI: details["tokenURI(1)"], + } + + if err := db.Create(&contractDetails).Error; err != nil { + logwrapper.Error("Failed to store contract details", err) + httpo.NewErrorResponse(500, "Failed to store contract details").SendD(c) + return + } + + response := NFTContractResponse{ + ContractAddress: request.ContractAddress, + ChainName: request.ChainName, + Details: details, + } + + httpo.NewSuccessResponseP(200, "NFT contract details retrieved and stored successfully", response).SendD(c) +} + +func getNFTContractDetails(client *ethclient.Client, address common.Address, parsedABI abi.ABI) map[string]string { + details := make(map[string]string) + methods := []string{"name", "symbol", "totalSupply", "owner"} + + var wg sync.WaitGroup + var mu sync.Mutex + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + for _, method := range methods { + wg.Add(1) + go func(m string) { + defer wg.Done() + result, err := callContractMethod(ctx, client, address, parsedABI, m) + mu.Lock() + if err != nil { + details[m] = "N/A" + } else { + details[m] = result + } + mu.Unlock() + }(method) + } + + wg.Add(1) + go func() { + defer wg.Done() + tokenURIResult, err := callContractMethod(ctx, client, address, parsedABI, "tokenURI", big.NewInt(1)) + mu.Lock() + if err != nil { + details["tokenURI(1)"] = "N/A" + } else { + details["tokenURI(1)"] = tokenURIResult + } + mu.Unlock() + }() + + wg.Wait() + return details +} + +func callContractMethod(ctx context.Context, client *ethclient.Client, address common.Address, parsedABI abi.ABI, methodName string, args ...interface{}) (string, error) { + data, err := parsedABI.Pack(methodName, args...) + if err != nil { + return "", fmt.Errorf("failed to pack data for %s: %v", methodName, err) + } + + msg := ethereum.CallMsg{ + To: &address, + Data: data, + } + + result, err := client.CallContract(ctx, msg, nil) + if err != nil { + return "", fmt.Errorf("failed to call %s: %v", methodName, err) + } + + method, exist := parsedABI.Methods[methodName] + if !exist { + return "", fmt.Errorf("method %s not found in ABI", methodName) + } + + output, err := method.Outputs.Unpack(result) + if err != nil { + return "", fmt.Errorf("failed to unpack result for %s: %v", methodName, err) + } + + if len(output) == 0 { + return "", fmt.Errorf("no output for method %s", methodName) + } + + return fmt.Sprintf("%v", output[0]), nil +} diff --git a/api/v1/v1.go b/api/v1/v1.go index 705222e..0da411e 100644 --- a/api/v1/v1.go +++ b/api/v1/v1.go @@ -13,6 +13,7 @@ import ( "github.com/NetSepio/gateway/api/v1/getreviewerdetails" "github.com/NetSepio/gateway/api/v1/getreviews" "github.com/NetSepio/gateway/api/v1/leaderboard" + "github.com/NetSepio/gateway/api/v1/nftcontract" "github.com/NetSepio/gateway/api/v1/profile" "github.com/NetSepio/gateway/api/v1/report" "github.com/NetSepio/gateway/api/v1/sdkauthentication" @@ -51,6 +52,7 @@ func ApplyRoutes(r *gin.RouterGroup) { summary.ApplyRoutes(v1) sdkauthentication.ApplyRoutes(v1) leaderboard.ApplyRoutes(v1) + nftcontract.ApplyRoutes(v1) } } diff --git a/config/dbconfig/dbconfig.go b/config/dbconfig/dbconfig.go index 1b86ce5..49db5b9 100644 --- a/config/dbconfig/dbconfig.go +++ b/config/dbconfig/dbconfig.go @@ -73,6 +73,7 @@ func Init() error { &migrate.Sotreus{}, &migrate.Erebrus{}, &migrate.Leaderboard{}, + &migrate.NftSubscription{}, ); err != nil { log.Fatal(err) } diff --git a/models/Migrate/migrate_models.go b/models/Migrate/migrate_models.go index 424d1ee..91b4d53 100644 --- a/models/Migrate/migrate_models.go +++ b/models/Migrate/migrate_models.go @@ -196,3 +196,15 @@ func (l *Leaderboard) BeforeCreate(tx *gorm.DB) (err error) { l.ID = uuid.New().String() return } + +type NftSubscription struct { + ID uint `gorm:"primaryKey"` + UserID string `gorm:"index"` + ContractAddress string + ChainName string + Name string + Symbol string + TotalSupply string + Owner string + TokenURI string +} diff --git a/models/NftSubscription.go b/models/NftSubscription.go new file mode 100644 index 0000000..8792837 --- /dev/null +++ b/models/NftSubscription.go @@ -0,0 +1,13 @@ +package models + +type NftSubscription struct { + ID uint `gorm:"primaryKey"` + UserID string `gorm:"index"` + ContractAddress string + ChainName string + Name string + Symbol string + TotalSupply string + Owner string + TokenURI string +} From 85b34bd2fb279cf8c93e3f37f5c4be37078f11b7 Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Sun, 18 Aug 2024 00:18:26 +0530 Subject: [PATCH 2/6] add infura project id --- api/v1/nftcontract/nftcontract.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/v1/nftcontract/nftcontract.go b/api/v1/nftcontract/nftcontract.go index d2861c7..52f6645 100644 --- a/api/v1/nftcontract/nftcontract.go +++ b/api/v1/nftcontract/nftcontract.go @@ -55,7 +55,7 @@ func getnftcontractinfo(c *gin.Context) { // Check if user has a domain var domain models.Domain - if err := db.Where("id = ?", userId).First(&domain).Error; err != nil { + if err := db.Where("created_by_id = ?", userId).First(&domain).Error; err != nil { if err == gorm.ErrRecordNotFound { httpo.NewErrorResponse(403, "User has not created a domain yet").SendD(c) } else { @@ -84,7 +84,7 @@ func getnftcontractinfo(c *gin.Context) { } // Connect to Ethereum mainnet - client, err := ethclient.Dial("https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID") + client, err := ethclient.Dial("https://mainnet.infura.io/v3/03532a98837749c0b262f9c5ac5fd8f1") if err != nil { logwrapper.Error("Failed to connect to the Ethereum client", err) httpo.NewErrorResponse(500, "Failed to connect to the Ethereum network").SendD(c) From 5fc6e2977e5f01ceef08fb2e79a247689fa8144b Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Sun, 18 Aug 2024 02:00:13 +0530 Subject: [PATCH 3/6] update and delete function --- api/v1/nftcontract/nftcontract.go | 109 ++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/api/v1/nftcontract/nftcontract.go b/api/v1/nftcontract/nftcontract.go index 52f6645..f8c9e66 100644 --- a/api/v1/nftcontract/nftcontract.go +++ b/api/v1/nftcontract/nftcontract.go @@ -46,6 +46,8 @@ func ApplyRoutes(r *gin.RouterGroup) { { g.Use(paseto.PASETO(true)) g.POST("", getnftcontractinfo) + g.PUT("", updateNFTContractInfo) + g.DELETE("", deleteNFTContractInfo) } } @@ -71,6 +73,17 @@ func getnftcontractinfo(c *gin.Context) { return } + // Check if user already has a contract address + var existingContract models.NftSubscription + if err := db.Where("user_id = ?", userId).First(&existingContract).Error; err == nil { + httpo.NewErrorResponse(400, "User already has a contract address").SendD(c) + return + } else if err != gorm.ErrRecordNotFound { + logwrapper.Error("Failed to check existing contract", err) + httpo.NewErrorResponse(500, "Internal server error").SendD(c) + return + } + // Check if chain name is "eth" if strings.ToLower(request.ChainName) != "eth" { httpo.NewErrorResponse(400, "Unsupported chain name. Only 'eth' is supported").SendD(c) @@ -203,3 +216,99 @@ func callContractMethod(ctx context.Context, client *ethclient.Client, address c return fmt.Sprintf("%v", output[0]), nil } + +func updateNFTContractInfo(c *gin.Context) { + db := dbconfig.GetDb() + userId := c.GetString(paseto.CTX_USER_ID) + + var request NFTContractRequest + if err := c.BindJSON(&request); err != nil { + httpo.NewErrorResponse(400, "Invalid request payload").SendD(c) + return + } + + // Check if chain name is "eth" + if strings.ToLower(request.ChainName) != "eth" { + httpo.NewErrorResponse(400, "Unsupported chain name. Only 'eth' is supported").SendD(c) + return + } + + // Validate contract address + if !common.IsHexAddress(request.ContractAddress) { + httpo.NewErrorResponse(400, "Invalid contract address").SendD(c) + return + } + + // Connect to Ethereum mainnet + client, err := ethclient.Dial("https://mainnet.infura.io/v3/03532a98837749c0b262f9c5ac5fd8f1") + if err != nil { + logwrapper.Error("Failed to connect to the Ethereum client", err) + httpo.NewErrorResponse(500, "Failed to connect to the Ethereum network").SendD(c) + return + } + + address := common.HexToAddress(request.ContractAddress) + + parsedABI, err := abi.JSON(strings.NewReader(NFTContractABI)) + if err != nil { + logwrapper.Error("Failed to parse ABI", err) + httpo.NewErrorResponse(500, "Failed to parse contract ABI").SendD(c) + return + } + + details := getNFTContractDetails(client, address, parsedABI) + + // Update contract details in the database + var existingContract models.NftSubscription + if err := db.Where("user_id = ?", userId).First(&existingContract).Error; err != nil { + if err == gorm.ErrRecordNotFound { + httpo.NewErrorResponse(404, "No existing contract found for this user").SendD(c) + } else { + logwrapper.Error("Failed to fetch existing contract", err) + httpo.NewErrorResponse(500, "Internal server error").SendD(c) + } + return + } + + existingContract.ContractAddress = request.ContractAddress + existingContract.ChainName = request.ChainName + existingContract.Name = details["name"] + existingContract.Symbol = details["symbol"] + existingContract.TotalSupply = details["totalSupply"] + existingContract.Owner = details["owner"] + existingContract.TokenURI = details["tokenURI(1)"] + + if err := db.Save(&existingContract).Error; err != nil { + logwrapper.Error("Failed to update contract details", err) + httpo.NewErrorResponse(500, "Failed to update contract details").SendD(c) + return + } + + response := NFTContractResponse{ + ContractAddress: request.ContractAddress, + ChainName: request.ChainName, + Details: details, + } + + httpo.NewSuccessResponseP(200, "NFT contract details updated successfully", response).SendD(c) +} + +func deleteNFTContractInfo(c *gin.Context) { + db := dbconfig.GetDb() + userId := c.GetString(paseto.CTX_USER_ID) + + // Delete contract details from the database + result := db.Where("user_id = ?", userId).Delete(&models.NftSubscription{}) + if result.Error != nil { + logwrapper.Error("Failed to delete contract details", result.Error) + httpo.NewErrorResponse(500, "Failed to delete contract details").SendD(c) + return + } + + if result.RowsAffected == 0 { + httpo.NewErrorResponse(404, "No contract found for this user").SendD(c) + return + } + + httpo.NewSuccessResponse(200, "NFT contract details deleted successfully").SendD(c) +} From 90c81e66d938aa558b1cf953aef7a3c8f1194502 Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Sun, 18 Aug 2024 02:27:29 +0530 Subject: [PATCH 4/6] add get function in nft subscription --- api/v1/nftcontract/nftcontract.go | 33 +++++++++++++++++++++++++++++++ models/Migrate/migrate_models.go | 3 +++ models/NftSubscription.go | 9 +++++++++ 3 files changed, 45 insertions(+) diff --git a/api/v1/nftcontract/nftcontract.go b/api/v1/nftcontract/nftcontract.go index f8c9e66..2aff05f 100644 --- a/api/v1/nftcontract/nftcontract.go +++ b/api/v1/nftcontract/nftcontract.go @@ -48,6 +48,7 @@ func ApplyRoutes(r *gin.RouterGroup) { g.POST("", getnftcontractinfo) g.PUT("", updateNFTContractInfo) g.DELETE("", deleteNFTContractInfo) + g.GET("", getNFTContractData) } } @@ -312,3 +313,35 @@ func deleteNFTContractInfo(c *gin.Context) { httpo.NewSuccessResponse(200, "NFT contract details deleted successfully").SendD(c) } + +func getNFTContractData(c *gin.Context) { + db := dbconfig.GetDb() + userId := c.GetString(paseto.CTX_USER_ID) + + var contractData models.NftSubscription + if err := db.Where("user_id = ?", userId).First(&contractData).Error; err != nil { + if err == gorm.ErrRecordNotFound { + httpo.NewErrorResponse(404, "No NFT contract data found for this user").SendD(c) + } else { + logwrapper.Error("Failed to fetch NFT contract data", err) + httpo.NewErrorResponse(500, "Internal server error").SendD(c) + } + return + } + + response := NFTContractResponse{ + ContractAddress: contractData.ContractAddress, + ChainName: contractData.ChainName, + Details: map[string]string{ + "name": contractData.Name, + "symbol": contractData.Symbol, + "totalSupply": contractData.TotalSupply, + "owner": contractData.Owner, + "tokenURI(1)": contractData.TokenURI, + "createdAt": contractData.CreatedAt.String(), + "updatedAt": contractData.UpdatedAt.String(), + }, + } + + httpo.NewSuccessResponseP(200, "NFT contract data retrieved successfully", response).SendD(c) +} diff --git a/models/Migrate/migrate_models.go b/models/Migrate/migrate_models.go index 91b4d53..6cf8fda 100644 --- a/models/Migrate/migrate_models.go +++ b/models/Migrate/migrate_models.go @@ -207,4 +207,7 @@ type NftSubscription struct { TotalSupply string Owner string TokenURI string + CreatedAt time.Time `gorm:"autoCreateTime"` + UpdatedAt time.Time `gorm:"autoUpdateTime"` + DeletedAt gorm.DeletedAt `gorm:"index"` } diff --git a/models/NftSubscription.go b/models/NftSubscription.go index 8792837..94f2b1f 100644 --- a/models/NftSubscription.go +++ b/models/NftSubscription.go @@ -1,5 +1,11 @@ package models +import ( + "time" + + "gorm.io/gorm" +) + type NftSubscription struct { ID uint `gorm:"primaryKey"` UserID string `gorm:"index"` @@ -10,4 +16,7 @@ type NftSubscription struct { TotalSupply string Owner string TokenURI string + CreatedAt time.Time `gorm:"autoCreateTime"` + UpdatedAt time.Time `gorm:"autoUpdateTime"` + DeletedAt gorm.DeletedAt `gorm:"index"` } From 30044e2a14343650243b0fd2cab9b4ea45636353 Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Thu, 22 Aug 2024 03:04:11 +0530 Subject: [PATCH 5/6] add: mint api --- api/v1/dvpnnft/contract/contract.go | 2007 +++++++++++++++++++++++++++ api/v1/dvpnnft/dvpnnft.go | 132 ++ api/v1/v1.go | 2 + config/dbconfig/dbconfig.go | 1 + models/DVPNNFTRecord.go | 12 + models/Migrate/migrate_models.go | 7 + 6 files changed, 2161 insertions(+) create mode 100644 api/v1/dvpnnft/contract/contract.go create mode 100644 api/v1/dvpnnft/dvpnnft.go create mode 100644 models/DVPNNFTRecord.go diff --git a/api/v1/dvpnnft/contract/contract.go b/api/v1/dvpnnft/contract/contract.go new file mode 100644 index 0000000..bf868fd --- /dev/null +++ b/api/v1/dvpnnft/contract/contract.go @@ -0,0 +1,2007 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURL\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721IncorrectOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721InsufficientApproval\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC721InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721NonexistentToken\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokendId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NFTMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"delegateMint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isRevealed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"uri\",\"type\":\"string\"}],\"name\":\"reveal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_baseURL\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// ADMINROLE is a free data retrieval call binding the contract method 0x75b238fc. +// +// Solidity: function ADMIN_ROLE() view returns(bytes32) +func (_Contract *ContractCaller) ADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ADMINROLE is a free data retrieval call binding the contract method 0x75b238fc. +// +// Solidity: function ADMIN_ROLE() view returns(bytes32) +func (_Contract *ContractSession) ADMINROLE() ([32]byte, error) { + return _Contract.Contract.ADMINROLE(&_Contract.CallOpts) +} + +// ADMINROLE is a free data retrieval call binding the contract method 0x75b238fc. +// +// Solidity: function ADMIN_ROLE() view returns(bytes32) +func (_Contract *ContractCallerSession) ADMINROLE() ([32]byte, error) { + return _Contract.Contract.ADMINROLE(&_Contract.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Contract *ContractCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Contract *ContractSession) DEFAULTADMINROLE() ([32]byte, error) { + return _Contract.Contract.DEFAULTADMINROLE(&_Contract.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Contract *ContractCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _Contract.Contract.DEFAULTADMINROLE(&_Contract.CallOpts) +} + +// OPERATORROLE is a free data retrieval call binding the contract method 0xf5b541a6. +// +// Solidity: function OPERATOR_ROLE() view returns(bytes32) +func (_Contract *ContractCaller) OPERATORROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "OPERATOR_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// OPERATORROLE is a free data retrieval call binding the contract method 0xf5b541a6. +// +// Solidity: function OPERATOR_ROLE() view returns(bytes32) +func (_Contract *ContractSession) OPERATORROLE() ([32]byte, error) { + return _Contract.Contract.OPERATORROLE(&_Contract.CallOpts) +} + +// OPERATORROLE is a free data retrieval call binding the contract method 0xf5b541a6. +// +// Solidity: function OPERATOR_ROLE() view returns(bytes32) +func (_Contract *ContractCallerSession) OPERATORROLE() ([32]byte, error) { + return _Contract.Contract.OPERATORROLE(&_Contract.CallOpts) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Contract *ContractCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Contract *ContractSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Contract *ContractCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Contract *ContractCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Contract *ContractSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Contract.Contract.GetApproved(&_Contract.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Contract *ContractCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Contract.Contract.GetApproved(&_Contract.CallOpts, tokenId) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_Contract *ContractCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getRoleAdmin", role) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_Contract *ContractSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _Contract.Contract.GetRoleAdmin(&_Contract.CallOpts, role) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_Contract *ContractCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _Contract.Contract.GetRoleAdmin(&_Contract.CallOpts, role) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_Contract *ContractCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "hasRole", role, account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_Contract *ContractSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _Contract.Contract.HasRole(&_Contract.CallOpts, role, account) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_Contract *ContractCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _Contract.Contract.HasRole(&_Contract.CallOpts, role, account) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Contract *ContractCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Contract *ContractSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Contract.Contract.IsApprovedForAll(&_Contract.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Contract *ContractCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Contract.Contract.IsApprovedForAll(&_Contract.CallOpts, owner, operator) +} + +// IsRevealed is a free data retrieval call binding the contract method 0x54214f69. +// +// Solidity: function isRevealed() view returns(bool) +func (_Contract *ContractCaller) IsRevealed(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "isRevealed") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsRevealed is a free data retrieval call binding the contract method 0x54214f69. +// +// Solidity: function isRevealed() view returns(bool) +func (_Contract *ContractSession) IsRevealed() (bool, error) { + return _Contract.Contract.IsRevealed(&_Contract.CallOpts) +} + +// IsRevealed is a free data retrieval call binding the contract method 0x54214f69. +// +// Solidity: function isRevealed() view returns(bool) +func (_Contract *ContractCallerSession) IsRevealed() (bool, error) { + return _Contract.Contract.IsRevealed(&_Contract.CallOpts) +} + +// MaxSupply is a free data retrieval call binding the contract method 0xd5abeb01. +// +// Solidity: function maxSupply() view returns(uint256) +func (_Contract *ContractCaller) MaxSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "maxSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxSupply is a free data retrieval call binding the contract method 0xd5abeb01. +// +// Solidity: function maxSupply() view returns(uint256) +func (_Contract *ContractSession) MaxSupply() (*big.Int, error) { + return _Contract.Contract.MaxSupply(&_Contract.CallOpts) +} + +// MaxSupply is a free data retrieval call binding the contract method 0xd5abeb01. +// +// Solidity: function maxSupply() view returns(uint256) +func (_Contract *ContractCallerSession) MaxSupply() (*big.Int, error) { + return _Contract.Contract.MaxSupply(&_Contract.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Contract *ContractCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Contract *ContractSession) Name() (string, error) { + return _Contract.Contract.Name(&_Contract.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Contract *ContractCallerSession) Name() (string, error) { + return _Contract.Contract.Name(&_Contract.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Contract *ContractCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Contract *ContractSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Contract.Contract.OwnerOf(&_Contract.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Contract *ContractCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Contract.Contract.OwnerOf(&_Contract.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Contract *ContractCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Contract *ContractSession) Symbol() (string, error) { + return _Contract.Contract.Symbol(&_Contract.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Contract *ContractCallerSession) Symbol() (string, error) { + return _Contract.Contract.Symbol(&_Contract.CallOpts) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Contract *ContractCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Contract *ContractSession) TokenURI(tokenId *big.Int) (string, error) { + return _Contract.Contract.TokenURI(&_Contract.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Contract *ContractCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _Contract.Contract.TokenURI(&_Contract.CallOpts, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Contract *ContractTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Contract *ContractSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.Contract.Approve(&_Contract.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Contract *ContractTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.Contract.Approve(&_Contract.TransactOpts, to, tokenId) +} + +// DelegateMint is a paid mutator transaction binding the contract method 0x0bfd468f. +// +// Solidity: function delegateMint(address to) returns() +func (_Contract *ContractTransactor) DelegateMint(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "delegateMint", to) +} + +// DelegateMint is a paid mutator transaction binding the contract method 0x0bfd468f. +// +// Solidity: function delegateMint(address to) returns() +func (_Contract *ContractSession) DelegateMint(to common.Address) (*types.Transaction, error) { + return _Contract.Contract.DelegateMint(&_Contract.TransactOpts, to) +} + +// DelegateMint is a paid mutator transaction binding the contract method 0x0bfd468f. +// +// Solidity: function delegateMint(address to) returns() +func (_Contract *ContractTransactorSession) DelegateMint(to common.Address) (*types.Transaction, error) { + return _Contract.Contract.DelegateMint(&_Contract.TransactOpts, to) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_Contract *ContractTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "grantRole", role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_Contract *ContractSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Contract.Contract.GrantRole(&_Contract.TransactOpts, role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_Contract *ContractTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Contract.Contract.GrantRole(&_Contract.TransactOpts, role, account) +} + +// Mint is a paid mutator transaction binding the contract method 0x1249c58b. +// +// Solidity: function mint() returns() +func (_Contract *ContractTransactor) Mint(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "mint") +} + +// Mint is a paid mutator transaction binding the contract method 0x1249c58b. +// +// Solidity: function mint() returns() +func (_Contract *ContractSession) Mint() (*types.Transaction, error) { + return _Contract.Contract.Mint(&_Contract.TransactOpts) +} + +// Mint is a paid mutator transaction binding the contract method 0x1249c58b. +// +// Solidity: function mint() returns() +func (_Contract *ContractTransactorSession) Mint() (*types.Transaction, error) { + return _Contract.Contract.Mint(&_Contract.TransactOpts) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Contract *ContractTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "renounceRole", role, callerConfirmation) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Contract *ContractSession) RenounceRole(role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Contract.Contract.RenounceRole(&_Contract.TransactOpts, role, callerConfirmation) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Contract *ContractTransactorSession) RenounceRole(role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Contract.Contract.RenounceRole(&_Contract.TransactOpts, role, callerConfirmation) +} + +// Reveal is a paid mutator transaction binding the contract method 0x4c261247. +// +// Solidity: function reveal(string uri) returns() +func (_Contract *ContractTransactor) Reveal(opts *bind.TransactOpts, uri string) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "reveal", uri) +} + +// Reveal is a paid mutator transaction binding the contract method 0x4c261247. +// +// Solidity: function reveal(string uri) returns() +func (_Contract *ContractSession) Reveal(uri string) (*types.Transaction, error) { + return _Contract.Contract.Reveal(&_Contract.TransactOpts, uri) +} + +// Reveal is a paid mutator transaction binding the contract method 0x4c261247. +// +// Solidity: function reveal(string uri) returns() +func (_Contract *ContractTransactorSession) Reveal(uri string) (*types.Transaction, error) { + return _Contract.Contract.Reveal(&_Contract.TransactOpts, uri) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_Contract *ContractTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "revokeRole", role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_Contract *ContractSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Contract.Contract.RevokeRole(&_Contract.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_Contract *ContractTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Contract.Contract.RevokeRole(&_Contract.TransactOpts, role, account) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Contract *ContractTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Contract *ContractSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SafeTransferFrom(&_Contract.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Contract *ContractTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SafeTransferFrom(&_Contract.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_Contract *ContractTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_Contract *ContractSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Contract.Contract.SafeTransferFrom0(&_Contract.TransactOpts, from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_Contract *ContractTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Contract.Contract.SafeTransferFrom0(&_Contract.TransactOpts, from, to, tokenId, data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Contract *ContractTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setApprovalForAll", operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Contract *ContractSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Contract.Contract.SetApprovalForAll(&_Contract.TransactOpts, operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Contract *ContractTransactorSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Contract.Contract.SetApprovalForAll(&_Contract.TransactOpts, operator, approved) +} + +// SetBaseURI is a paid mutator transaction binding the contract method 0x55f804b3. +// +// Solidity: function setBaseURI(string _baseURL) returns() +func (_Contract *ContractTransactor) SetBaseURI(opts *bind.TransactOpts, _baseURL string) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setBaseURI", _baseURL) +} + +// SetBaseURI is a paid mutator transaction binding the contract method 0x55f804b3. +// +// Solidity: function setBaseURI(string _baseURL) returns() +func (_Contract *ContractSession) SetBaseURI(_baseURL string) (*types.Transaction, error) { + return _Contract.Contract.SetBaseURI(&_Contract.TransactOpts, _baseURL) +} + +// SetBaseURI is a paid mutator transaction binding the contract method 0x55f804b3. +// +// Solidity: function setBaseURI(string _baseURL) returns() +func (_Contract *ContractTransactorSession) SetBaseURI(_baseURL string) (*types.Transaction, error) { + return _Contract.Contract.SetBaseURI(&_Contract.TransactOpts, _baseURL) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Contract *ContractTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Contract *ContractSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.Contract.TransferFrom(&_Contract.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Contract *ContractTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Contract.Contract.TransferFrom(&_Contract.TransactOpts, from, to, tokenId) +} + +// ContractApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Contract contract. +type ContractApprovalIterator struct { + Event *ContractApproval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractApproval represents a Approval event raised by the Contract contract. +type ContractApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_Contract *ContractFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ContractApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ContractApprovalIterator{contract: _Contract.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_Contract *ContractFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ContractApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractApproval) + if err := _Contract.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_Contract *ContractFilterer) ParseApproval(log types.Log) (*ContractApproval, error) { + event := new(ContractApproval) + if err := _Contract.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the Contract contract. +type ContractApprovalForAllIterator struct { + Event *ContractApprovalForAll // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractApprovalForAllIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractApprovalForAll) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractApprovalForAll) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractApprovalForAll represents a ApprovalForAll event raised by the Contract contract. +type ContractApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_Contract *ContractFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ContractApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &ContractApprovalForAllIterator{contract: _Contract.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_Contract *ContractFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ContractApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractApprovalForAll) + if err := _Contract.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_Contract *ContractFilterer) ParseApprovalForAll(log types.Log) (*ContractApprovalForAll, error) { + event := new(ContractApprovalForAll) + if err := _Contract.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractNFTMintedIterator is returned from FilterNFTMinted and is used to iterate over the raw logs and unpacked data for NFTMinted events raised by the Contract contract. +type ContractNFTMintedIterator struct { + Event *ContractNFTMinted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractNFTMintedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractNFTMinted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractNFTMinted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractNFTMintedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractNFTMintedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractNFTMinted represents a NFTMinted event raised by the Contract contract. +type ContractNFTMinted struct { + TokendId *big.Int + Owner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNFTMinted is a free log retrieval operation binding the contract event 0x0176f203df400d7bd5f1b1c9ef36c16709bf3b5d9fd35f000a6bae32393f66c3. +// +// Solidity: event NFTMinted(uint256 tokendId, address indexed owner) +func (_Contract *ContractFilterer) FilterNFTMinted(opts *bind.FilterOpts, owner []common.Address) (*ContractNFTMintedIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "NFTMinted", ownerRule) + if err != nil { + return nil, err + } + return &ContractNFTMintedIterator{contract: _Contract.contract, event: "NFTMinted", logs: logs, sub: sub}, nil +} + +// WatchNFTMinted is a free log subscription operation binding the contract event 0x0176f203df400d7bd5f1b1c9ef36c16709bf3b5d9fd35f000a6bae32393f66c3. +// +// Solidity: event NFTMinted(uint256 tokendId, address indexed owner) +func (_Contract *ContractFilterer) WatchNFTMinted(opts *bind.WatchOpts, sink chan<- *ContractNFTMinted, owner []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "NFTMinted", ownerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractNFTMinted) + if err := _Contract.contract.UnpackLog(event, "NFTMinted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseNFTMinted is a log parse operation binding the contract event 0x0176f203df400d7bd5f1b1c9ef36c16709bf3b5d9fd35f000a6bae32393f66c3. +// +// Solidity: event NFTMinted(uint256 tokendId, address indexed owner) +func (_Contract *ContractFilterer) ParseNFTMinted(log types.Log) (*ContractNFTMinted, error) { + event := new(ContractNFTMinted) + if err := _Contract.contract.UnpackLog(event, "NFTMinted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the Contract contract. +type ContractRoleAdminChangedIterator struct { + Event *ContractRoleAdminChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractRoleAdminChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractRoleAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractRoleAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractRoleAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractRoleAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractRoleAdminChanged represents a RoleAdminChanged event raised by the Contract contract. +type ContractRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Contract *ContractFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*ContractRoleAdminChangedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return &ContractRoleAdminChangedIterator{contract: _Contract.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil +} + +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Contract *ContractFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *ContractRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractRoleAdminChanged) + if err := _Contract.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Contract *ContractFilterer) ParseRoleAdminChanged(log types.Log) (*ContractRoleAdminChanged, error) { + event := new(ContractRoleAdminChanged) + if err := _Contract.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the Contract contract. +type ContractRoleGrantedIterator struct { + Event *ContractRoleGranted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractRoleGrantedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractRoleGranted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractRoleGranted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractRoleGrantedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractRoleGrantedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractRoleGranted represents a RoleGranted event raised by the Contract contract. +type ContractRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Contract *ContractFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*ContractRoleGrantedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &ContractRoleGrantedIterator{contract: _Contract.contract, event: "RoleGranted", logs: logs, sub: sub}, nil +} + +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Contract *ContractFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *ContractRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractRoleGranted) + if err := _Contract.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Contract *ContractFilterer) ParseRoleGranted(log types.Log) (*ContractRoleGranted, error) { + event := new(ContractRoleGranted) + if err := _Contract.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the Contract contract. +type ContractRoleRevokedIterator struct { + Event *ContractRoleRevoked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractRoleRevokedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractRoleRevoked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractRoleRevoked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractRoleRevokedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractRoleRevokedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractRoleRevoked represents a RoleRevoked event raised by the Contract contract. +type ContractRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Contract *ContractFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*ContractRoleRevokedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &ContractRoleRevokedIterator{contract: _Contract.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil +} + +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Contract *ContractFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *ContractRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractRoleRevoked) + if err := _Contract.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Contract *ContractFilterer) ParseRoleRevoked(log types.Log) (*ContractRoleRevoked, error) { + event := new(ContractRoleRevoked) + if err := _Contract.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Contract contract. +type ContractTransferIterator struct { + Event *ContractTransfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractTransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractTransfer represents a Transfer event raised by the Contract contract. +type ContractTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_Contract *ContractFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ContractTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ContractTransferIterator{contract: _Contract.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_Contract *ContractFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ContractTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractTransfer) + if err := _Contract.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_Contract *ContractFilterer) ParseTransfer(log types.Log) (*ContractTransfer, error) { + event := new(ContractTransfer) + if err := _Contract.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/api/v1/dvpnnft/dvpnnft.go b/api/v1/dvpnnft/dvpnnft.go new file mode 100644 index 0000000..dbafd32 --- /dev/null +++ b/api/v1/dvpnnft/dvpnnft.go @@ -0,0 +1,132 @@ +package dvpnnft + +import ( + "crypto/ecdsa" + "math/big" + "net/http" + "os" + + contract "github.com/NetSepio/gateway/api/v1/dvpnnft/contract" // Replace with the actual path to your contract bindings + "github.com/NetSepio/gateway/config/dbconfig" + "github.com/NetSepio/gateway/models" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/gin-gonic/gin" + "github.com/joho/godotenv" +) + +type RequestPayload struct { + WalletAddress string `json:"wallet_address"` +} + +type ResponsePayload struct { + TransactionHash string `json:"transaction_hash"` +} + +func ApplyRoutes(r *gin.RouterGroup) { + g := r.Group("/dvpnnft") + { + g.POST("", handleMintNFT) + } +} + +func handleMintNFT(c *gin.Context) { + var payload RequestPayload + if err := c.BindJSON(&payload); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request payload"}) + return + } + + // Load environment variables from the .env file + if err := godotenv.Load(); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error loading .env file"}) + return + } + + // Connect to the Ethereum client + client, err := ethclient.Dial("https://pacific-rpc.manta.network/http") + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to connect to Ethereum client"}) + return + } + + // Load the private key from the environment + privateKey, err := crypto.HexToECDSA(os.Getenv("PRIVATE_KEY")) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error loading private key"}) + return + } + + // Get the public key and address + publicKey := privateKey.Public() + publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) + if !ok { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error casting public key to ECDSA"}) + return + } + + fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA) + nonce, err := client.PendingNonceAt(c, fromAddress) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting nonce"}) + return + } + + gasPrice, err := client.SuggestGasPrice(c) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting gas price"}) + return + } + + chainID, err := client.NetworkID(c) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting chain ID"}) + return + } + + auth, err := bind.NewKeyedTransactorWithChainID(privateKey, chainID) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error creating transactor"}) + return + } + auth.Nonce = big.NewInt(int64(nonce)) + auth.Value = big.NewInt(0) // in wei + auth.GasLimit = uint64(300000) // Adjust as needed + auth.GasPrice = gasPrice + + // Contract address + contractAddress := common.HexToAddress(os.Getenv("CONTRACT_ADDRESS")) + instance, err := contract.NewContract(contractAddress, client) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error creating contract instance"}) + return + } + + // Call the mint function + tx, err := instance.DelegateMint(auth, common.HexToAddress(payload.WalletAddress)) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error calling Mint function"}) + return + } + + // Store the transaction hash in the database + if err := storeTransactionHash(payload.WalletAddress, tx.Hash().Hex()); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "Error storing transaction hash in the database"}) + return + } + + c.JSON(http.StatusOK, ResponsePayload{ + TransactionHash: tx.Hash().Hex(), + }) +} + +func storeTransactionHash(walletAddress, transactionHash string) error { + db := dbconfig.GetDb() + nft := &models.DVPNNFTRecord{ + WalletAddress: walletAddress, + TransactionHash: transactionHash, + } + return db.Create(nft).Error +} diff --git a/api/v1/v1.go b/api/v1/v1.go index 0da411e..5b7ee71 100644 --- a/api/v1/v1.go +++ b/api/v1/v1.go @@ -7,6 +7,7 @@ import ( delegatereviewcreation "github.com/NetSepio/gateway/api/v1/delegateReviewCreation" "github.com/NetSepio/gateway/api/v1/deletereview" "github.com/NetSepio/gateway/api/v1/domain" + "github.com/NetSepio/gateway/api/v1/dvpnnft" "github.com/NetSepio/gateway/api/v1/erebrus" "github.com/NetSepio/gateway/api/v1/feedback" flowid "github.com/NetSepio/gateway/api/v1/flowid" @@ -53,6 +54,7 @@ func ApplyRoutes(r *gin.RouterGroup) { sdkauthentication.ApplyRoutes(v1) leaderboard.ApplyRoutes(v1) nftcontract.ApplyRoutes(v1) + dvpnnft.ApplyRoutes(v1) } } diff --git a/config/dbconfig/dbconfig.go b/config/dbconfig/dbconfig.go index 49db5b9..a41c749 100644 --- a/config/dbconfig/dbconfig.go +++ b/config/dbconfig/dbconfig.go @@ -74,6 +74,7 @@ func Init() error { &migrate.Erebrus{}, &migrate.Leaderboard{}, &migrate.NftSubscription{}, + &migrate.DVPNNFTRecord{}, ); err != nil { log.Fatal(err) } diff --git a/models/DVPNNFTRecord.go b/models/DVPNNFTRecord.go new file mode 100644 index 0000000..cc191cd --- /dev/null +++ b/models/DVPNNFTRecord.go @@ -0,0 +1,12 @@ +package models + +import ( + "time" +) + +type DVPNNFTRecord struct { + ID uint `gorm:"primaryKey;autoIncrement"` + WalletAddress string + TransactionHash string + CreatedAt time.Time `gorm:"not null;default:CURRENT_TIMESTAMP"` +} diff --git a/models/Migrate/migrate_models.go b/models/Migrate/migrate_models.go index 6cf8fda..2c40069 100644 --- a/models/Migrate/migrate_models.go +++ b/models/Migrate/migrate_models.go @@ -211,3 +211,10 @@ type NftSubscription struct { UpdatedAt time.Time `gorm:"autoUpdateTime"` DeletedAt gorm.DeletedAt `gorm:"index"` } + +type DVPNNFTRecord struct { + ID uint `gorm:"primaryKey;autoIncrement"` + WalletAddress string + TransactionHash string + CreatedAt time.Time `gorm:"not null;default:CURRENT_TIMESTAMP"` +} From ee0ef6297d46ec8a41c88da14005945d6c2e4447 Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Thu, 22 Aug 2024 03:41:33 +0530 Subject: [PATCH 6/6] add :wallet check function --- api/v1/dvpnnft/dvpnnft.go | 172 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) diff --git a/api/v1/dvpnnft/dvpnnft.go b/api/v1/dvpnnft/dvpnnft.go index dbafd32..f59b80e 100644 --- a/api/v1/dvpnnft/dvpnnft.go +++ b/api/v1/dvpnnft/dvpnnft.go @@ -5,6 +5,7 @@ import ( "math/big" "net/http" "os" + "regexp" contract "github.com/NetSepio/gateway/api/v1/dvpnnft/contract" // Replace with the actual path to your contract bindings "github.com/NetSepio/gateway/config/dbconfig" @@ -45,6 +46,11 @@ func handleMintNFT(c *gin.Context) { return } + // Check if the wallet address is a valid Manta address + if !isValidMantaAddress(payload.WalletAddress) { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid Manta wallet address"}) + return + } // Connect to the Ethereum client client, err := ethclient.Dial("https://pacific-rpc.manta.network/http") if err != nil { @@ -130,3 +136,169 @@ func storeTransactionHash(walletAddress, transactionHash string) error { } return db.Create(nft).Error } +func isValidMantaAddress(address string) bool { + // Manta address format: 0x[0-9a-fA-F]{40} + mantaAddressRegex := `^0x[0-9a-fA-F]{40}$` + match, err := regexp.MatchString(mantaAddressRegex, address) + if err != nil { + return false + } + return match +} + +// package dvpnnft + +// import ( +// "crypto/ecdsa" +// "math/big" +// "net/http" +// "os" +// "regexp" + +// contract "github.com/NetSepio/gateway/api/v1/dvpnnft/contract" // Replace with the actual path to your contract bindings +// "github.com/NetSepio/gateway/config/dbconfig" +// "github.com/NetSepio/gateway/models" +// "github.com/ethereum/go-ethereum/accounts/abi/bind" +// "github.com/ethereum/go-ethereum/common" +// "github.com/ethereum/go-ethereum/crypto" +// "github.com/ethereum/go-ethereum/ethclient" +// "github.com/gin-gonic/gin" +// "github.com/joho/godotenv" +// ) + +// type RequestPayload struct { +// WalletAddress string `json:"wallet_address"` +// } + +// type ResponsePayload struct { +// TransactionHash string `json:"transaction_hash"` +// } + +// func ApplyRoutes(r *gin.RouterGroup) { +// g := r.Group("/dvpnnft") +// { +// g.POST("", handleMintNFT) +// } +// } + +// func handleMintNFT(c *gin.Context) { +// var payload RequestPayload +// if err := c.BindJSON(&payload); err != nil { +// c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request payload"}) +// return +// } + +// // Load environment variables from the .env file +// if err := godotenv.Load(); err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error loading .env file"}) +// return +// } + +// // Check if the wallet address is a valid Manta address +// if !isValidMantaAddress(payload.WalletAddress) { +// c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid Manta wallet address"}) +// return +// } + +// // Connect to the Ethereum client +// client, err := ethclient.Dial("https://rpc-amoy.polygon.technology/") +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to connect to Ethereum client"}) +// return +// } + +// // Load the private key from the environment +// privateKey, err := crypto.HexToECDSA(os.Getenv("PRIVATE_KEY")) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error loading private key"}) +// return +// } + +// // Get the public key and address +// publicKey := privateKey.Public() +// publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) +// if !ok { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error casting public key to ECDSA"}) +// return +// } + +// fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA) +// nonce, err := client.PendingNonceAt(c, fromAddress) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting nonce"}) +// return +// } + +// gasPrice, err := client.SuggestGasPrice(c) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting gas price"}) +// return +// } + +// chainID, err := client.NetworkID(c) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting chain ID"}) +// return +// } + +// auth, err := bind.NewKeyedTransactorWithChainID(privateKey, chainID) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error creating transactor"}) +// return +// } +// auth.Nonce = big.NewInt(int64(nonce)) +// auth.Value = big.NewInt(0) // in wei +// auth.GasLimit = uint64(300000) // Adjust as needed +// auth.GasPrice = gasPrice + +// // Contract address +// contractAddress := common.HexToAddress(os.Getenv("CONTRACT_ADDRESS")) +// instance, err := contract.NewContract(contractAddress, client) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error creating contract instance"}) +// return +// } + +// // Call the mint function +// tx, err := instance.DelegateMint(auth, common.HexToAddress(payload.WalletAddress)) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error calling Mint function"}) +// return +// } + +// // Store the transaction hash in the database +// if err := storeTransactionHash(payload.WalletAddress, tx.Hash().Hex()); err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error storing transaction hash in the database"}) +// return +// } + +// // Wait for the transaction to be mined +// _, err = client.TransactionReceipt(c, tx.Hash()) +// if err != nil { +// c.JSON(http.StatusInternalServerError, gin.H{"error": "Error waiting for transaction to be mined"}) +// return +// } + +// c.JSON(http.StatusOK, ResponsePayload{ +// TransactionHash: tx.Hash().Hex(), +// }) +// } + +// func storeTransactionHash(walletAddress, transactionHash string) error { +// db := dbconfig.GetDb() +// nft := &models.DVPNNFTRecord{ +// WalletAddress: walletAddress, +// TransactionHash: transactionHash, +// } +// return db.Create(nft).Error +// } + +// func isValidMantaAddress(address string) bool { +// // Manta address format: 0x[0-9a-fA-F]{40} +// mantaAddressRegex := `^0x[0-9a-fA-F]{40}$` +// match, err := regexp.MatchString(mantaAddressRegex, address) +// if err != nil { +// return false +// } +// return match +// }