diff --git a/ioctl/cmd/ioid/applyioid.go b/ioctl/cmd/ioid/applyioid.go index 6b976b55dd..7b0346fedc 100644 --- a/ioctl/cmd/ioid/applyioid.go +++ b/ioctl/cmd/ioid/applyioid.go @@ -1,16 +1,17 @@ package ioid import ( - "encoding/hex" + "bytes" + _ "embed" // used to embed contract abi + "fmt" "math/big" - "strings" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/iotexproject/iotex-address/address" - "github.com/iotexproject/iotex-core/ioctl/cmd/action" + "github.com/spf13/cobra" + + "github.com/iotexproject/iotex-core/ioctl/cmd/ws" "github.com/iotexproject/iotex-core/ioctl/config" "github.com/iotexproject/iotex-core/ioctl/output" - "github.com/spf13/cobra" ) // Multi-language support @@ -49,133 +50,21 @@ var _applyCmd = &cobra.Command{ } var ( - ioIDStore string - projectId uint64 - amount uint64 - ioIDStoreABI = `[ - { - "inputs": [], - "name": "price", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "project", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "projectAppliedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "projectActivedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "projectDeviceContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_projectId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "name": "setDeviceContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_projectId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "applyIoIDs", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ]` + ioIDStore string + projectId uint64 + amount uint64 + //go:embed contracts/abis/ioIDStore.json + ioIDStoreJSON []byte + ioIDStoreABI abi.ABI ) func init() { + var err error + ioIDStoreABI, err = abi.JSON(bytes.NewReader(ioIDStoreJSON)) + if err != nil { + panic(err) + } + _applyCmd.Flags().StringVarP( &ioIDStore, "ioIDStore", "i", "0xA0C9f9A884cdAE649a42F16b057735Bc4fE786CD", @@ -192,31 +81,37 @@ func init() { } func apply() error { - ioioIDStore, err := address.FromHex(ioIDStore) + caller, err := ws.NewContractCaller(ioIDStoreABI, ioIDStore) if err != nil { - return output.NewError(output.AddressError, "failed to convert ioIDStore address", err) + return output.NewError(output.SerializationError, "failed to create contract caller", err) } - ioIDStoreAbi, err := abi.JSON(strings.NewReader(ioIDStoreABI)) - if err != nil { - return output.NewError(output.SerializationError, "failed to unmarshal abi", err) + result := ws.NewContractResult(&ioIDStoreABI, "price", new(big.Int)) + if err = caller.Read("price", nil, result); err != nil { + return output.NewError(output.SerializationError, "failed to read contract", err) } - - data, err := ioIDStoreAbi.Pack("price") - if err != nil { - return output.NewError(output.ConvertError, "failed to pack price arguments", err) - } - priceHex, err := action.Read(ioioIDStore, "0", data) + price, err := result.Result() if err != nil { - return output.NewError(output.APIError, "failed to read contract", err) + return output.NewError(output.SerializationError, "failed parse price", err) } - price, _ := hex.DecodeString(priceHex) - total := new(big.Int).Mul(new(big.Int).SetBytes(price), new(big.Int).SetUint64(amount)) + total := new(big.Int).Mul(price.(*big.Int), new(big.Int).SetUint64(amount)) + fmt.Printf( + "Apply %d ioIDs need %s IOTX\n", amount, + new(big.Float).Quo( + new(big.Float).SetInt(total), + new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))).String(), + ) - data, err = ioIDStoreAbi.Pack("applyIoIDs", new(big.Int).SetUint64(projectId), new(big.Int).SetUint64(amount)) + caller.SetAmount(total) + tx, err := caller.CallAndRetrieveResult("applyIoIDs", []any{ + new(big.Int).SetUint64(projectId), + new(big.Int).SetUint64(amount)}, + ) if err != nil { - return output.NewError(output.ConvertError, "failed to pack apply arguments", err) + return output.NewError(output.SerializationError, "failed to call contract", err) } - return action.Execute(ioioIDStore.String(), total, data) + fmt.Printf("Apply ioID txHash: %s\n", tx) + + return nil } diff --git a/ioctl/cmd/ioid/contracts/abis/Project.json b/ioctl/cmd/ioid/contracts/abis/Project.json new file mode 100644 index 0000000000..27b4280a46 --- /dev/null +++ b/ioctl/cmd/ioid/contracts/abis/Project.json @@ -0,0 +1,566 @@ +[ + { + "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": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + } + ], + "name": "SetMinter", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "projectId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "SetName", + "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": [ + { + "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": [], + "name": "count", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "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": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "projectId_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "projectId_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "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": "address", + "name": "_minter", + "type": "address" + } + ], + "name": "setMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "setName", + "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" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/ioctl/cmd/ioid/contracts/abis/ProjectRegistry.json b/ioctl/cmd/ioid/contracts/abis/ProjectRegistry.json new file mode 100644 index 0000000000..da3ed3c485 --- /dev/null +++ b/ioctl/cmd/ioid/contracts/abis/ProjectRegistry.json @@ -0,0 +1,73 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_project", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "project", + "outputs": [ + { + "internalType": "contract IProject", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + } +] diff --git a/ioctl/cmd/ioid/contracts/abis/ioID.json b/ioctl/cmd/ioid/contracts/abis/ioID.json new file mode 100644 index 0000000000..877568faf0 --- /dev/null +++ b/ioctl/cmd/ioid/contracts/abis/ioID.json @@ -0,0 +1,725 @@ +[ + { + "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": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "wallet", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "did", + "type": "string" + } + ], + "name": "CreateIoID", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "wallet", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "did", + "type": "string" + } + ], + "name": "RemoveDIDWallet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + } + ], + "name": "SetMinter", + "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": [ + { + "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": "", + "type": "address" + } + ], + "name": "deviceProject", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_device", + "type": "address" + } + ], + "name": "did", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_minter", + "type": "address" + }, + { + "internalType": "address", + "name": "_walletRegistry", + "type": "address" + }, + { + "internalType": "address", + "name": "_walletImplementation", + "type": "address" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "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": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_device", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "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": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "projectDeviceCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_start", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pageSize", + "type": "uint256" + } + ], + "name": "projectIDs", + "outputs": [ + { + "internalType": "address[]", + "name": "array", + "type": "address[]" + }, + { + "internalType": "address", + "name": "next", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_device", + "type": "address" + } + ], + "name": "removeDID", + "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": "address", + "name": "_minter", + "type": "address" + } + ], + "name": "setMinter", + "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": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "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" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_id", + "type": "uint256" + } + ], + "name": "wallet", + "outputs": [ + { + "internalType": "address", + "name": "wallet_", + "type": "address" + }, + { + "internalType": "string", + "name": "did_", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_did", + "type": "string" + } + ], + "name": "wallet", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "walletImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "walletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/ioctl/cmd/ioid/contracts/abis/ioIDRegistry.json b/ioctl/cmd/ioid/contracts/abis/ioIDRegistry.json new file mode 100644 index 0000000000..2c5c4ac206 --- /dev/null +++ b/ioctl/cmd/ioid/contracts/abis/ioIDRegistry.json @@ -0,0 +1,481 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "device", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "NewDevice", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "device", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "RemoveDevice", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "store", + "type": "address" + } + ], + "name": "SetIoIdStore", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "device", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "UpdateDevice", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EIP712DOMAIN_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "METHOD", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "deviceTokenId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "documentHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "documentID", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "documentURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ioIDStore", + "type": "address" + }, + { + "internalType": "address", + "name": "_ioID", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ioID", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ioIDStore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "device", + "type": "address" + } + ], + "name": "permitHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "deviceContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "device", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "registeredNFT", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "remove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ioIDStore", + "type": "address" + } + ], + "name": "setIoIDStore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "device", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "update", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/ioctl/cmd/ioid/contracts/abis/ioIDStore.json b/ioctl/cmd/ioid/contracts/abis/ioIDStore.json new file mode 100644 index 0000000000..1630e333ea --- /dev/null +++ b/ioctl/cmd/ioid/contracts/abis/ioIDStore.json @@ -0,0 +1,407 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "projectId", + "type": "uint256" + } + ], + "name": "ActiveIoID", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "projectId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ApplyIoIDs", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "ChangePrice", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "project", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "Initialize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "projectId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "deviceContract", + "type": "address" + } + ], + "name": "SetDeviceContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "ioIDRegistry", + "type": "address" + } + ], + "name": "SetIoIDRegistry", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "projectId", + "type": "uint256" + } + ], + "name": "activeIoID", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "applyIoIDs", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "changeDeviceContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "changePrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "deviceContractProject", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_project", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ioIDRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "project", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "projectActivedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "projectAppliedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "projectDeviceContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_projectId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "setDeviceContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ioIDRegistry", + "type": "address" + } + ], + "name": "setIoIDRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipicents", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_amounts", + "type": "uint256[]" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/ioctl/cmd/ioid/contracts/project.go b/ioctl/cmd/ioid/contracts/project.go new file mode 100644 index 0000000000..443bf89b28 --- /dev/null +++ b/ioctl/cmd/ioid/contracts/project.go @@ -0,0 +1,1859 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contracts + +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 +) + +// ProjectMetaData contains all meta data concerning the Project contract. +var ProjectMetaData = &bind.MetaData{ + ABI: "[{\"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\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"}],\"name\":\"SetMinter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"projectId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"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\":[{\"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\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"projectId_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"projectId_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_projectId\",\"type\":\"uint256\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"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\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"setMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_projectId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"setName\",\"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\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ProjectABI is the input ABI used to generate the binding from. +// Deprecated: Use ProjectMetaData.ABI instead. +var ProjectABI = ProjectMetaData.ABI + +// Project is an auto generated Go binding around an Ethereum contract. +type Project struct { + ProjectCaller // Read-only binding to the contract + ProjectTransactor // Write-only binding to the contract + ProjectFilterer // Log filterer for contract events +} + +// ProjectCaller is an auto generated read-only Go binding around an Ethereum contract. +type ProjectCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProjectTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ProjectTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProjectFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ProjectFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProjectSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ProjectSession struct { + Contract *Project // 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 +} + +// ProjectCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ProjectCallerSession struct { + Contract *ProjectCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ProjectTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ProjectTransactorSession struct { + Contract *ProjectTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ProjectRaw is an auto generated low-level Go binding around an Ethereum contract. +type ProjectRaw struct { + Contract *Project // Generic contract binding to access the raw methods on +} + +// ProjectCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ProjectCallerRaw struct { + Contract *ProjectCaller // Generic read-only contract binding to access the raw methods on +} + +// ProjectTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ProjectTransactorRaw struct { + Contract *ProjectTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewProject creates a new instance of Project, bound to a specific deployed contract. +func NewProject(address common.Address, backend bind.ContractBackend) (*Project, error) { + contract, err := bindProject(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Project{ProjectCaller: ProjectCaller{contract: contract}, ProjectTransactor: ProjectTransactor{contract: contract}, ProjectFilterer: ProjectFilterer{contract: contract}}, nil +} + +// NewProjectCaller creates a new read-only instance of Project, bound to a specific deployed contract. +func NewProjectCaller(address common.Address, caller bind.ContractCaller) (*ProjectCaller, error) { + contract, err := bindProject(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ProjectCaller{contract: contract}, nil +} + +// NewProjectTransactor creates a new write-only instance of Project, bound to a specific deployed contract. +func NewProjectTransactor(address common.Address, transactor bind.ContractTransactor) (*ProjectTransactor, error) { + contract, err := bindProject(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ProjectTransactor{contract: contract}, nil +} + +// NewProjectFilterer creates a new log filterer instance of Project, bound to a specific deployed contract. +func NewProjectFilterer(address common.Address, filterer bind.ContractFilterer) (*ProjectFilterer, error) { + contract, err := bindProject(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ProjectFilterer{contract: contract}, nil +} + +// bindProject binds a generic wrapper to an already deployed contract. +func bindProject(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ProjectMetaData.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 (_Project *ProjectRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Project.Contract.ProjectCaller.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 (_Project *ProjectRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Project.Contract.ProjectTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Project *ProjectRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Project.Contract.ProjectTransactor.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 (_Project *ProjectCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Project.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 (_Project *ProjectTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Project.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Project *ProjectTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Project.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Project *ProjectCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Project.Contract.BalanceOf(&_Project.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Project *ProjectCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Project.Contract.BalanceOf(&_Project.CallOpts, owner) +} + +// Count is a free data retrieval call binding the contract method 0x06661abd. +// +// Solidity: function count() view returns(uint256) +func (_Project *ProjectCaller) Count(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Project.contract.Call(opts, &out, "count") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Count is a free data retrieval call binding the contract method 0x06661abd. +// +// Solidity: function count() view returns(uint256) +func (_Project *ProjectSession) Count() (*big.Int, error) { + return _Project.Contract.Count(&_Project.CallOpts) +} + +// Count is a free data retrieval call binding the contract method 0x06661abd. +// +// Solidity: function count() view returns(uint256) +func (_Project *ProjectCallerSession) Count() (*big.Int, error) { + return _Project.Contract.Count(&_Project.CallOpts) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Project *ProjectCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Project.Contract.GetApproved(&_Project.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Project *ProjectCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Project.Contract.GetApproved(&_Project.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Project *ProjectCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Project.Contract.IsApprovedForAll(&_Project.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 (_Project *ProjectCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Project.Contract.IsApprovedForAll(&_Project.CallOpts, owner, operator) +} + +// Minter is a free data retrieval call binding the contract method 0x07546172. +// +// Solidity: function minter() view returns(address) +func (_Project *ProjectCaller) Minter(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Project.contract.Call(opts, &out, "minter") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Minter is a free data retrieval call binding the contract method 0x07546172. +// +// Solidity: function minter() view returns(address) +func (_Project *ProjectSession) Minter() (common.Address, error) { + return _Project.Contract.Minter(&_Project.CallOpts) +} + +// Minter is a free data retrieval call binding the contract method 0x07546172. +// +// Solidity: function minter() view returns(address) +func (_Project *ProjectCallerSession) Minter() (common.Address, error) { + return _Project.Contract.Minter(&_Project.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x00ad800c. +// +// Solidity: function name(uint256 _projectId) view returns(string) +func (_Project *ProjectCaller) Name(opts *bind.CallOpts, _projectId *big.Int) (string, error) { + var out []interface{} + err := _Project.contract.Call(opts, &out, "name", _projectId) + + 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 0x00ad800c. +// +// Solidity: function name(uint256 _projectId) view returns(string) +func (_Project *ProjectSession) Name(_projectId *big.Int) (string, error) { + return _Project.Contract.Name(&_Project.CallOpts, _projectId) +} + +// Name is a free data retrieval call binding the contract method 0x00ad800c. +// +// Solidity: function name(uint256 _projectId) view returns(string) +func (_Project *ProjectCallerSession) Name(_projectId *big.Int) (string, error) { + return _Project.Contract.Name(&_Project.CallOpts, _projectId) +} + +// Name0 is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Project *ProjectCaller) Name0(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Project.contract.Call(opts, &out, "name0") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name0 is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Project *ProjectSession) Name0() (string, error) { + return _Project.Contract.Name0(&_Project.CallOpts) +} + +// Name0 is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Project *ProjectCallerSession) Name0() (string, error) { + return _Project.Contract.Name0(&_Project.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Project *ProjectCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Project.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Project *ProjectSession) Owner() (common.Address, error) { + return _Project.Contract.Owner(&_Project.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Project *ProjectCallerSession) Owner() (common.Address, error) { + return _Project.Contract.Owner(&_Project.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Project *ProjectCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Project.Contract.OwnerOf(&_Project.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Project *ProjectCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Project.Contract.OwnerOf(&_Project.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Project *ProjectCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Project.Contract.SupportsInterface(&_Project.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Project *ProjectCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Project.Contract.SupportsInterface(&_Project.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Project *ProjectCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) Symbol() (string, error) { + return _Project.Contract.Symbol(&_Project.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Project *ProjectCallerSession) Symbol() (string, error) { + return _Project.Contract.Symbol(&_Project.CallOpts) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Project *ProjectCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _Project.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 (_Project *ProjectSession) TokenURI(tokenId *big.Int) (string, error) { + return _Project.Contract.TokenURI(&_Project.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Project *ProjectCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _Project.Contract.TokenURI(&_Project.CallOpts, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Project *ProjectTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.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 (_Project *ProjectSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.Contract.Approve(&_Project.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Project *ProjectTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.Contract.Approve(&_Project.TransactOpts, to, tokenId) +} + +// Initialize is a paid mutator transaction binding the contract method 0x4cd88b76. +// +// Solidity: function initialize(string _name, string _symbol) returns() +func (_Project *ProjectTransactor) Initialize(opts *bind.TransactOpts, _name string, _symbol string) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "initialize", _name, _symbol) +} + +// Initialize is a paid mutator transaction binding the contract method 0x4cd88b76. +// +// Solidity: function initialize(string _name, string _symbol) returns() +func (_Project *ProjectSession) Initialize(_name string, _symbol string) (*types.Transaction, error) { + return _Project.Contract.Initialize(&_Project.TransactOpts, _name, _symbol) +} + +// Initialize is a paid mutator transaction binding the contract method 0x4cd88b76. +// +// Solidity: function initialize(string _name, string _symbol) returns() +func (_Project *ProjectTransactorSession) Initialize(_name string, _symbol string) (*types.Transaction, error) { + return _Project.Contract.Initialize(&_Project.TransactOpts, _name, _symbol) +} + +// Mint is a paid mutator transaction binding the contract method 0x6a627842. +// +// Solidity: function mint(address _owner) returns(uint256 projectId_) +func (_Project *ProjectTransactor) Mint(opts *bind.TransactOpts, _owner common.Address) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "mint", _owner) +} + +// Mint is a paid mutator transaction binding the contract method 0x6a627842. +// +// Solidity: function mint(address _owner) returns(uint256 projectId_) +func (_Project *ProjectSession) Mint(_owner common.Address) (*types.Transaction, error) { + return _Project.Contract.Mint(&_Project.TransactOpts, _owner) +} + +// Mint is a paid mutator transaction binding the contract method 0x6a627842. +// +// Solidity: function mint(address _owner) returns(uint256 projectId_) +func (_Project *ProjectTransactorSession) Mint(_owner common.Address) (*types.Transaction, error) { + return _Project.Contract.Mint(&_Project.TransactOpts, _owner) +} + +// Mint0 is a paid mutator transaction binding the contract method 0xd0def521. +// +// Solidity: function mint(address _owner, string _name) returns(uint256 projectId_) +func (_Project *ProjectTransactor) Mint0(opts *bind.TransactOpts, _owner common.Address, _name string) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "mint0", _owner, _name) +} + +// Mint0 is a paid mutator transaction binding the contract method 0xd0def521. +// +// Solidity: function mint(address _owner, string _name) returns(uint256 projectId_) +func (_Project *ProjectSession) Mint0(_owner common.Address, _name string) (*types.Transaction, error) { + return _Project.Contract.Mint0(&_Project.TransactOpts, _owner, _name) +} + +// Mint0 is a paid mutator transaction binding the contract method 0xd0def521. +// +// Solidity: function mint(address _owner, string _name) returns(uint256 projectId_) +func (_Project *ProjectTransactorSession) Mint0(_owner common.Address, _name string) (*types.Transaction, error) { + return _Project.Contract.Mint0(&_Project.TransactOpts, _owner, _name) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Project *ProjectTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Project *ProjectSession) RenounceOwnership() (*types.Transaction, error) { + return _Project.Contract.RenounceOwnership(&_Project.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Project *ProjectTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Project.Contract.RenounceOwnership(&_Project.TransactOpts) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Project *ProjectTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.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 (_Project *ProjectSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.Contract.SafeTransferFrom(&_Project.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 (_Project *ProjectTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.Contract.SafeTransferFrom(&_Project.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 (_Project *ProjectTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Project.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 (_Project *ProjectSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Project.Contract.SafeTransferFrom0(&_Project.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 (_Project *ProjectTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Project.Contract.SafeTransferFrom0(&_Project.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 (_Project *ProjectTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error) { + return _Project.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 (_Project *ProjectSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Project.Contract.SetApprovalForAll(&_Project.TransactOpts, operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Project *ProjectTransactorSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Project.Contract.SetApprovalForAll(&_Project.TransactOpts, operator, approved) +} + +// SetMinter is a paid mutator transaction binding the contract method 0xfca3b5aa. +// +// Solidity: function setMinter(address _minter) returns() +func (_Project *ProjectTransactor) SetMinter(opts *bind.TransactOpts, _minter common.Address) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "setMinter", _minter) +} + +// SetMinter is a paid mutator transaction binding the contract method 0xfca3b5aa. +// +// Solidity: function setMinter(address _minter) returns() +func (_Project *ProjectSession) SetMinter(_minter common.Address) (*types.Transaction, error) { + return _Project.Contract.SetMinter(&_Project.TransactOpts, _minter) +} + +// SetMinter is a paid mutator transaction binding the contract method 0xfca3b5aa. +// +// Solidity: function setMinter(address _minter) returns() +func (_Project *ProjectTransactorSession) SetMinter(_minter common.Address) (*types.Transaction, error) { + return _Project.Contract.SetMinter(&_Project.TransactOpts, _minter) +} + +// SetName is a paid mutator transaction binding the contract method 0xfe55932a. +// +// Solidity: function setName(uint256 _projectId, string _name) returns() +func (_Project *ProjectTransactor) SetName(opts *bind.TransactOpts, _projectId *big.Int, _name string) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "setName", _projectId, _name) +} + +// SetName is a paid mutator transaction binding the contract method 0xfe55932a. +// +// Solidity: function setName(uint256 _projectId, string _name) returns() +func (_Project *ProjectSession) SetName(_projectId *big.Int, _name string) (*types.Transaction, error) { + return _Project.Contract.SetName(&_Project.TransactOpts, _projectId, _name) +} + +// SetName is a paid mutator transaction binding the contract method 0xfe55932a. +// +// Solidity: function setName(uint256 _projectId, string _name) returns() +func (_Project *ProjectTransactorSession) SetName(_projectId *big.Int, _name string) (*types.Transaction, error) { + return _Project.Contract.SetName(&_Project.TransactOpts, _projectId, _name) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Project *ProjectTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.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 (_Project *ProjectSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.Contract.TransferFrom(&_Project.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 (_Project *ProjectTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Project.Contract.TransferFrom(&_Project.TransactOpts, from, to, tokenId) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Project *ProjectTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Project.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Project *ProjectSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Project.Contract.TransferOwnership(&_Project.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Project *ProjectTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Project.Contract.TransferOwnership(&_Project.TransactOpts, newOwner) +} + +// ProjectApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Project contract. +type ProjectApprovalIterator struct { + Event *ProjectApproval // 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 *ProjectApprovalIterator) 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(ProjectApproval) + 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(ProjectApproval) + 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 *ProjectApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectApproval represents a Approval event raised by the Project contract. +type ProjectApproval 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 (_Project *ProjectFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ProjectApprovalIterator, 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 := _Project.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ProjectApprovalIterator{contract: _Project.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 (_Project *ProjectFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ProjectApproval, 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 := _Project.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(ProjectApproval) + if err := _Project.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 (_Project *ProjectFilterer) ParseApproval(log types.Log) (*ProjectApproval, error) { + event := new(ProjectApproval) + if err := _Project.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ProjectApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the Project contract. +type ProjectApprovalForAllIterator struct { + Event *ProjectApprovalForAll // 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 *ProjectApprovalForAllIterator) 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(ProjectApprovalForAll) + 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(ProjectApprovalForAll) + 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 *ProjectApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectApprovalForAll represents a ApprovalForAll event raised by the Project contract. +type ProjectApprovalForAll 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 (_Project *ProjectFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ProjectApprovalForAllIterator, 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 := _Project.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &ProjectApprovalForAllIterator{contract: _Project.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 (_Project *ProjectFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ProjectApprovalForAll, 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 := _Project.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(ProjectApprovalForAll) + if err := _Project.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 (_Project *ProjectFilterer) ParseApprovalForAll(log types.Log) (*ProjectApprovalForAll, error) { + event := new(ProjectApprovalForAll) + if err := _Project.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ProjectInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Project contract. +type ProjectInitializedIterator struct { + Event *ProjectInitialized // 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 *ProjectInitializedIterator) 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(ProjectInitialized) + 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(ProjectInitialized) + 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 *ProjectInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectInitialized represents a Initialized event raised by the Project contract. +type ProjectInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_Project *ProjectFilterer) FilterInitialized(opts *bind.FilterOpts) (*ProjectInitializedIterator, error) { + + logs, sub, err := _Project.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &ProjectInitializedIterator{contract: _Project.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_Project *ProjectFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ProjectInitialized) (event.Subscription, error) { + + logs, sub, err := _Project.contract.WatchLogs(opts, "Initialized") + 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(ProjectInitialized) + if err := _Project.contract.UnpackLog(event, "Initialized", 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 +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_Project *ProjectFilterer) ParseInitialized(log types.Log) (*ProjectInitialized, error) { + event := new(ProjectInitialized) + if err := _Project.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ProjectOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Project contract. +type ProjectOwnershipTransferredIterator struct { + Event *ProjectOwnershipTransferred // 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 *ProjectOwnershipTransferredIterator) 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(ProjectOwnershipTransferred) + 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(ProjectOwnershipTransferred) + 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 *ProjectOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectOwnershipTransferred represents a OwnershipTransferred event raised by the Project contract. +type ProjectOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Project *ProjectFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ProjectOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Project.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ProjectOwnershipTransferredIterator{contract: _Project.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Project *ProjectFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ProjectOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Project.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + 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(ProjectOwnershipTransferred) + if err := _Project.contract.UnpackLog(event, "OwnershipTransferred", 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 +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Project *ProjectFilterer) ParseOwnershipTransferred(log types.Log) (*ProjectOwnershipTransferred, error) { + event := new(ProjectOwnershipTransferred) + if err := _Project.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ProjectSetMinterIterator is returned from FilterSetMinter and is used to iterate over the raw logs and unpacked data for SetMinter events raised by the Project contract. +type ProjectSetMinterIterator struct { + Event *ProjectSetMinter // 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 *ProjectSetMinterIterator) 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(ProjectSetMinter) + 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(ProjectSetMinter) + 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 *ProjectSetMinterIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectSetMinterIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectSetMinter represents a SetMinter event raised by the Project contract. +type ProjectSetMinter struct { + Minter common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSetMinter is a free log retrieval operation binding the contract event 0xcec52196e972044edde8689a1b608e459c5946b7f3e5c8cd3d6d8e126d422e1c. +// +// Solidity: event SetMinter(address indexed minter) +func (_Project *ProjectFilterer) FilterSetMinter(opts *bind.FilterOpts, minter []common.Address) (*ProjectSetMinterIterator, error) { + + var minterRule []interface{} + for _, minterItem := range minter { + minterRule = append(minterRule, minterItem) + } + + logs, sub, err := _Project.contract.FilterLogs(opts, "SetMinter", minterRule) + if err != nil { + return nil, err + } + return &ProjectSetMinterIterator{contract: _Project.contract, event: "SetMinter", logs: logs, sub: sub}, nil +} + +// WatchSetMinter is a free log subscription operation binding the contract event 0xcec52196e972044edde8689a1b608e459c5946b7f3e5c8cd3d6d8e126d422e1c. +// +// Solidity: event SetMinter(address indexed minter) +func (_Project *ProjectFilterer) WatchSetMinter(opts *bind.WatchOpts, sink chan<- *ProjectSetMinter, minter []common.Address) (event.Subscription, error) { + + var minterRule []interface{} + for _, minterItem := range minter { + minterRule = append(minterRule, minterItem) + } + + logs, sub, err := _Project.contract.WatchLogs(opts, "SetMinter", minterRule) + 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(ProjectSetMinter) + if err := _Project.contract.UnpackLog(event, "SetMinter", 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 +} + +// ParseSetMinter is a log parse operation binding the contract event 0xcec52196e972044edde8689a1b608e459c5946b7f3e5c8cd3d6d8e126d422e1c. +// +// Solidity: event SetMinter(address indexed minter) +func (_Project *ProjectFilterer) ParseSetMinter(log types.Log) (*ProjectSetMinter, error) { + event := new(ProjectSetMinter) + if err := _Project.contract.UnpackLog(event, "SetMinter", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ProjectSetNameIterator is returned from FilterSetName and is used to iterate over the raw logs and unpacked data for SetName events raised by the Project contract. +type ProjectSetNameIterator struct { + Event *ProjectSetName // 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 *ProjectSetNameIterator) 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(ProjectSetName) + 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(ProjectSetName) + 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 *ProjectSetNameIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectSetNameIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectSetName represents a SetName event raised by the Project contract. +type ProjectSetName struct { + ProjectId *big.Int + Name string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSetName is a free log retrieval operation binding the contract event 0x7c11765983c5884b06a9f2e300c2fd2e648e31cf995bd756ce2647c93c6dbb20. +// +// Solidity: event SetName(uint256 indexed projectId, string name) +func (_Project *ProjectFilterer) FilterSetName(opts *bind.FilterOpts, projectId []*big.Int) (*ProjectSetNameIterator, error) { + + var projectIdRule []interface{} + for _, projectIdItem := range projectId { + projectIdRule = append(projectIdRule, projectIdItem) + } + + logs, sub, err := _Project.contract.FilterLogs(opts, "SetName", projectIdRule) + if err != nil { + return nil, err + } + return &ProjectSetNameIterator{contract: _Project.contract, event: "SetName", logs: logs, sub: sub}, nil +} + +// WatchSetName is a free log subscription operation binding the contract event 0x7c11765983c5884b06a9f2e300c2fd2e648e31cf995bd756ce2647c93c6dbb20. +// +// Solidity: event SetName(uint256 indexed projectId, string name) +func (_Project *ProjectFilterer) WatchSetName(opts *bind.WatchOpts, sink chan<- *ProjectSetName, projectId []*big.Int) (event.Subscription, error) { + + var projectIdRule []interface{} + for _, projectIdItem := range projectId { + projectIdRule = append(projectIdRule, projectIdItem) + } + + logs, sub, err := _Project.contract.WatchLogs(opts, "SetName", projectIdRule) + 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(ProjectSetName) + if err := _Project.contract.UnpackLog(event, "SetName", 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 +} + +// ParseSetName is a log parse operation binding the contract event 0x7c11765983c5884b06a9f2e300c2fd2e648e31cf995bd756ce2647c93c6dbb20. +// +// Solidity: event SetName(uint256 indexed projectId, string name) +func (_Project *ProjectFilterer) ParseSetName(log types.Log) (*ProjectSetName, error) { + event := new(ProjectSetName) + if err := _Project.contract.UnpackLog(event, "SetName", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ProjectTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Project contract. +type ProjectTransferIterator struct { + Event *ProjectTransfer // 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 *ProjectTransferIterator) 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(ProjectTransfer) + 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(ProjectTransfer) + 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 *ProjectTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectTransfer represents a Transfer event raised by the Project contract. +type ProjectTransfer 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 (_Project *ProjectFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ProjectTransferIterator, 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 := _Project.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ProjectTransferIterator{contract: _Project.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 (_Project *ProjectFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ProjectTransfer, 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 := _Project.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(ProjectTransfer) + if err := _Project.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 (_Project *ProjectFilterer) ParseTransfer(log types.Log) (*ProjectTransfer, error) { + event := new(ProjectTransfer) + if err := _Project.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/ioctl/cmd/ioid/contracts/projectregistry.go b/ioctl/cmd/ioid/contracts/projectregistry.go new file mode 100644 index 0000000000..5774f3a6cd --- /dev/null +++ b/ioctl/cmd/ioid/contracts/projectregistry.go @@ -0,0 +1,409 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contracts + +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 +) + +// ProjectRegistryMetaData contains all meta data concerning the ProjectRegistry contract. +var ProjectRegistryMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_project\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"project\",\"outputs\":[{\"internalType\":\"contractIProject\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"register\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"register\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", +} + +// ProjectRegistryABI is the input ABI used to generate the binding from. +// Deprecated: Use ProjectRegistryMetaData.ABI instead. +var ProjectRegistryABI = ProjectRegistryMetaData.ABI + +// ProjectRegistry is an auto generated Go binding around an Ethereum contract. +type ProjectRegistry struct { + ProjectRegistryCaller // Read-only binding to the contract + ProjectRegistryTransactor // Write-only binding to the contract + ProjectRegistryFilterer // Log filterer for contract events +} + +// ProjectRegistryCaller is an auto generated read-only Go binding around an Ethereum contract. +type ProjectRegistryCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProjectRegistryTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ProjectRegistryTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProjectRegistryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ProjectRegistryFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProjectRegistrySession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ProjectRegistrySession struct { + Contract *ProjectRegistry // 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 +} + +// ProjectRegistryCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ProjectRegistryCallerSession struct { + Contract *ProjectRegistryCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ProjectRegistryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ProjectRegistryTransactorSession struct { + Contract *ProjectRegistryTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ProjectRegistryRaw is an auto generated low-level Go binding around an Ethereum contract. +type ProjectRegistryRaw struct { + Contract *ProjectRegistry // Generic contract binding to access the raw methods on +} + +// ProjectRegistryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ProjectRegistryCallerRaw struct { + Contract *ProjectRegistryCaller // Generic read-only contract binding to access the raw methods on +} + +// ProjectRegistryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ProjectRegistryTransactorRaw struct { + Contract *ProjectRegistryTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewProjectRegistry creates a new instance of ProjectRegistry, bound to a specific deployed contract. +func NewProjectRegistry(address common.Address, backend bind.ContractBackend) (*ProjectRegistry, error) { + contract, err := bindProjectRegistry(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ProjectRegistry{ProjectRegistryCaller: ProjectRegistryCaller{contract: contract}, ProjectRegistryTransactor: ProjectRegistryTransactor{contract: contract}, ProjectRegistryFilterer: ProjectRegistryFilterer{contract: contract}}, nil +} + +// NewProjectRegistryCaller creates a new read-only instance of ProjectRegistry, bound to a specific deployed contract. +func NewProjectRegistryCaller(address common.Address, caller bind.ContractCaller) (*ProjectRegistryCaller, error) { + contract, err := bindProjectRegistry(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ProjectRegistryCaller{contract: contract}, nil +} + +// NewProjectRegistryTransactor creates a new write-only instance of ProjectRegistry, bound to a specific deployed contract. +func NewProjectRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*ProjectRegistryTransactor, error) { + contract, err := bindProjectRegistry(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ProjectRegistryTransactor{contract: contract}, nil +} + +// NewProjectRegistryFilterer creates a new log filterer instance of ProjectRegistry, bound to a specific deployed contract. +func NewProjectRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*ProjectRegistryFilterer, error) { + contract, err := bindProjectRegistry(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ProjectRegistryFilterer{contract: contract}, nil +} + +// bindProjectRegistry binds a generic wrapper to an already deployed contract. +func bindProjectRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ProjectRegistryMetaData.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 (_ProjectRegistry *ProjectRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ProjectRegistry.Contract.ProjectRegistryCaller.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 (_ProjectRegistry *ProjectRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ProjectRegistry.Contract.ProjectRegistryTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ProjectRegistry *ProjectRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ProjectRegistry.Contract.ProjectRegistryTransactor.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 (_ProjectRegistry *ProjectRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ProjectRegistry.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 (_ProjectRegistry *ProjectRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ProjectRegistry.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ProjectRegistry *ProjectRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ProjectRegistry.Contract.contract.Transact(opts, method, params...) +} + +// Project is a free data retrieval call binding the contract method 0xf60ca60d. +// +// Solidity: function project() view returns(address) +func (_ProjectRegistry *ProjectRegistryCaller) Project(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ProjectRegistry.contract.Call(opts, &out, "project") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Project is a free data retrieval call binding the contract method 0xf60ca60d. +// +// Solidity: function project() view returns(address) +func (_ProjectRegistry *ProjectRegistrySession) Project() (common.Address, error) { + return _ProjectRegistry.Contract.Project(&_ProjectRegistry.CallOpts) +} + +// Project is a free data retrieval call binding the contract method 0xf60ca60d. +// +// Solidity: function project() view returns(address) +func (_ProjectRegistry *ProjectRegistryCallerSession) Project() (common.Address, error) { + return _ProjectRegistry.Contract.Project(&_ProjectRegistry.CallOpts) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _project) returns() +func (_ProjectRegistry *ProjectRegistryTransactor) Initialize(opts *bind.TransactOpts, _project common.Address) (*types.Transaction, error) { + return _ProjectRegistry.contract.Transact(opts, "initialize", _project) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _project) returns() +func (_ProjectRegistry *ProjectRegistrySession) Initialize(_project common.Address) (*types.Transaction, error) { + return _ProjectRegistry.Contract.Initialize(&_ProjectRegistry.TransactOpts, _project) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _project) returns() +func (_ProjectRegistry *ProjectRegistryTransactorSession) Initialize(_project common.Address) (*types.Transaction, error) { + return _ProjectRegistry.Contract.Initialize(&_ProjectRegistry.TransactOpts, _project) +} + +// Register is a paid mutator transaction binding the contract method 0x1aa3a008. +// +// Solidity: function register() payable returns(uint256) +func (_ProjectRegistry *ProjectRegistryTransactor) Register(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ProjectRegistry.contract.Transact(opts, "register") +} + +// Register is a paid mutator transaction binding the contract method 0x1aa3a008. +// +// Solidity: function register() payable returns(uint256) +func (_ProjectRegistry *ProjectRegistrySession) Register() (*types.Transaction, error) { + return _ProjectRegistry.Contract.Register(&_ProjectRegistry.TransactOpts) +} + +// Register is a paid mutator transaction binding the contract method 0x1aa3a008. +// +// Solidity: function register() payable returns(uint256) +func (_ProjectRegistry *ProjectRegistryTransactorSession) Register() (*types.Transaction, error) { + return _ProjectRegistry.Contract.Register(&_ProjectRegistry.TransactOpts) +} + +// Register0 is a paid mutator transaction binding the contract method 0xf2c298be. +// +// Solidity: function register(string _name) payable returns(uint256) +func (_ProjectRegistry *ProjectRegistryTransactor) Register0(opts *bind.TransactOpts, _name string) (*types.Transaction, error) { + return _ProjectRegistry.contract.Transact(opts, "register0", _name) +} + +// Register0 is a paid mutator transaction binding the contract method 0xf2c298be. +// +// Solidity: function register(string _name) payable returns(uint256) +func (_ProjectRegistry *ProjectRegistrySession) Register0(_name string) (*types.Transaction, error) { + return _ProjectRegistry.Contract.Register0(&_ProjectRegistry.TransactOpts, _name) +} + +// Register0 is a paid mutator transaction binding the contract method 0xf2c298be. +// +// Solidity: function register(string _name) payable returns(uint256) +func (_ProjectRegistry *ProjectRegistryTransactorSession) Register0(_name string) (*types.Transaction, error) { + return _ProjectRegistry.Contract.Register0(&_ProjectRegistry.TransactOpts, _name) +} + +// ProjectRegistryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the ProjectRegistry contract. +type ProjectRegistryInitializedIterator struct { + Event *ProjectRegistryInitialized // 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 *ProjectRegistryInitializedIterator) 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(ProjectRegistryInitialized) + 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(ProjectRegistryInitialized) + 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 *ProjectRegistryInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ProjectRegistryInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ProjectRegistryInitialized represents a Initialized event raised by the ProjectRegistry contract. +type ProjectRegistryInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_ProjectRegistry *ProjectRegistryFilterer) FilterInitialized(opts *bind.FilterOpts) (*ProjectRegistryInitializedIterator, error) { + + logs, sub, err := _ProjectRegistry.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &ProjectRegistryInitializedIterator{contract: _ProjectRegistry.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_ProjectRegistry *ProjectRegistryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ProjectRegistryInitialized) (event.Subscription, error) { + + logs, sub, err := _ProjectRegistry.contract.WatchLogs(opts, "Initialized") + 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(ProjectRegistryInitialized) + if err := _ProjectRegistry.contract.UnpackLog(event, "Initialized", 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 +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_ProjectRegistry *ProjectRegistryFilterer) ParseInitialized(log types.Log) (*ProjectRegistryInitialized, error) { + event := new(ProjectRegistryInitialized) + if err := _ProjectRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/ioctl/cmd/ioid/ioid.go b/ioctl/cmd/ioid/ioid.go index c6b18b82f6..97c922e9d6 100644 --- a/ioctl/cmd/ioid/ioid.go +++ b/ioctl/cmd/ioid/ioid.go @@ -6,13 +6,14 @@ import ( "github.com/cenkalti/backoff" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" - "github.com/iotexproject/iotex-core/ioctl/config" - "github.com/iotexproject/iotex-core/ioctl/output" - "github.com/iotexproject/iotex-core/ioctl/util" "github.com/iotexproject/iotex-proto/golang/iotexapi" "github.com/spf13/cobra" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "github.com/iotexproject/iotex-core/ioctl/config" + "github.com/iotexproject/iotex-core/ioctl/output" + "github.com/iotexproject/iotex-core/ioctl/util" ) // Multi-language support diff --git a/ioctl/cmd/ioid/project.go b/ioctl/cmd/ioid/project.go index fe832854bd..bf5d87259b 100644 --- a/ioctl/cmd/ioid/project.go +++ b/ioctl/cmd/ioid/project.go @@ -1,17 +1,19 @@ package ioid import ( + "bytes" + _ "embed" // used to embed contract abi "encoding/hex" "fmt" "math/big" - "strings" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/iotexproject/iotex-address/address" + "github.com/spf13/cobra" + "github.com/iotexproject/iotex-core/ioctl/cmd/action" "github.com/iotexproject/iotex-core/ioctl/config" "github.com/iotexproject/iotex-core/ioctl/output" - "github.com/spf13/cobra" ) // Multi-language support @@ -24,6 +26,10 @@ var ( config.English: "Project detail", config.Chinese: "项目详情", } + + //go:embed contracts/abis/Project.json + projectJSON []byte + projectABI abi.ABI ) // _projectCmd represents the ioID apply command @@ -38,6 +44,12 @@ var _projectCmd = &cobra.Command{ } func init() { + var err error + projectABI, err = abi.JSON(bytes.NewReader(projectJSON)) + if err != nil { + panic(err) + } + _projectCmd.Flags().StringVarP( &ioIDStore, "ioIDStore", "i", "0xA0C9f9A884cdAE649a42F16b057735Bc4fE786CD", @@ -55,12 +67,7 @@ func project() error { return output.NewError(output.AddressError, "failed to convert ioIDStore address", err) } - ioIDStoreAbi, err := abi.JSON(strings.NewReader(ioIDStoreABI)) - if err != nil { - return output.NewError(output.SerializationError, "failed to unmarshal abi", err) - } - - data, err := ioIDStoreAbi.Pack("project") + data, err := ioIDStoreABI.Pack("project") if err != nil { return output.NewError(output.ConvertError, "failed to pack project arguments", err) } @@ -69,12 +76,27 @@ func project() error { return output.NewError(output.APIError, "failed to read contract", err) } data, _ = hex.DecodeString(res) - projectAddr, err := ioIDStoreAbi.Unpack("project", data) + projectAddr, err := ioIDStoreABI.Unpack("project", data) if err != nil { return output.NewError(output.ConvertError, "failed to unpack project response", err) } - data, err = ioIDStoreAbi.Pack("projectDeviceContract", new(big.Int).SetUint64(projectId)) + ioProjectAddr, _ := address.FromHex(projectAddr[0].(address.Address).String()) + data, err = projectABI.Pack("name", new(big.Int).SetUint64(projectId)) + if err != nil { + return output.NewError(output.ConvertError, "failed to pack project name arguments", err) + } + res, err = action.Read(ioProjectAddr, "0", data) + if err != nil { + return output.NewError(output.APIError, "failed to read contract", err) + } + data, _ = hex.DecodeString(res) + name, err := projectABI.Unpack("name", data) + if err != nil { + return output.NewError(output.ConvertError, "failed to unpack project name response", err) + } + + data, err = ioIDStoreABI.Pack("projectDeviceContract", new(big.Int).SetUint64(projectId)) if err != nil { return output.NewError(output.ConvertError, "failed to pack project device contract arguments", err) } @@ -83,12 +105,12 @@ func project() error { return output.NewError(output.APIError, "failed to read contract", err) } data, _ = hex.DecodeString(res) - deviceContractAddr, err := ioIDStoreAbi.Unpack("projectDeviceContract", data) + deviceContractAddr, err := ioIDStoreABI.Unpack("projectDeviceContract", data) if err != nil { return output.NewError(output.ConvertError, "failed to unpack project device contract response", err) } - data, err = ioIDStoreAbi.Pack("projectAppliedAmount", new(big.Int).SetUint64(projectId)) + data, err = ioIDStoreABI.Pack("projectAppliedAmount", new(big.Int).SetUint64(projectId)) if err != nil { return output.NewError(output.ConvertError, "failed to pack project applied amount arguments", err) } @@ -97,12 +119,12 @@ func project() error { return output.NewError(output.APIError, "failed to read contract", err) } data, _ = hex.DecodeString(res) - projectAppliedAmount, err := ioIDStoreAbi.Unpack("projectAppliedAmount", data) + projectAppliedAmount, err := ioIDStoreABI.Unpack("projectAppliedAmount", data) if err != nil { return output.NewError(output.ConvertError, "failed to unpack project applied amount response", err) } - data, err = ioIDStoreAbi.Pack("projectActivedAmount", new(big.Int).SetUint64(projectId)) + data, err = ioIDStoreABI.Pack("projectActivedAmount", new(big.Int).SetUint64(projectId)) if err != nil { return output.NewError(output.ConvertError, "failed to pack project actived amount arguments", err) } @@ -111,7 +133,7 @@ func project() error { return output.NewError(output.APIError, "failed to read contract", err) } data, _ = hex.DecodeString(res) - projectActivedAmount, err := ioIDStoreAbi.Unpack("projectActivedAmount", data) + projectActivedAmount, err := ioIDStoreABI.Unpack("projectActivedAmount", data) if err != nil { return output.NewError(output.ConvertError, "failed to unpack project actived amount response", err) } @@ -119,6 +141,7 @@ func project() error { fmt.Printf(`Project #%d detail: { "projectContractAddress": "%s", + "name": "%s", "deviceNFT": "%s", "appliedIoIDs": "%s", "activedIoIDs": "%s", @@ -126,6 +149,7 @@ func project() error { `, projectId, projectAddr[0].(address.Address).String(), + name[0].(string), deviceContractAddr[0].(address.Address).String(), projectAppliedAmount[0].(*big.Int).String(), projectActivedAmount[0].(*big.Int).String(), diff --git a/ioctl/cmd/ioid/projectdevice.go b/ioctl/cmd/ioid/projectdevice.go index 10f2a9d455..268df26541 100644 --- a/ioctl/cmd/ioid/projectdevice.go +++ b/ioctl/cmd/ioid/projectdevice.go @@ -1,16 +1,15 @@ package ioid import ( + "fmt" "math/big" - "strings" - "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/iotexproject/iotex-address/address" - "github.com/iotexproject/iotex-core/ioctl/cmd/action" + "github.com/spf13/cobra" + + "github.com/iotexproject/iotex-core/ioctl/cmd/ws" "github.com/iotexproject/iotex-core/ioctl/config" "github.com/iotexproject/iotex-core/ioctl/output" - "github.com/spf13/cobra" ) // Multi-language support @@ -49,22 +48,22 @@ func init() { } func device(args []string) error { - nft := common.HexToAddress(args[0]) + contract := common.HexToAddress(args[0]) - ioioIDStore, err := address.FromHex(ioIDStore) + caller, err := ws.NewContractCaller(ioIDStoreABI, ioIDStore) if err != nil { - return output.NewError(output.AddressError, "failed to convert ioIDStore address", err) + return output.NewError(output.SerializationError, "failed to create contract caller", err) } - ioIDStoreAbi, err := abi.JSON(strings.NewReader(ioIDStoreABI)) + tx, err := caller.CallAndRetrieveResult("setDeviceContract", []any{ + new(big.Int).SetUint64(projectId), + contract}, + ) if err != nil { - return output.NewError(output.SerializationError, "failed to unmarshal abi", err) + return output.NewError(output.SerializationError, "failed to call contract", err) } - data, err := ioIDStoreAbi.Pack("setDeviceContract", new(big.Int).SetUint64(projectId), nft) - if err != nil { - return output.NewError(output.ConvertError, "failed to pack arguments", err) - } + fmt.Printf("Set device NFT contract address txHash: %s\n", tx) - return action.Execute(ioioIDStore.String(), big.NewInt(0), data) + return nil } diff --git a/ioctl/cmd/ioid/projectregister.go b/ioctl/cmd/ioid/projectregister.go index 34313e2767..24af996a3e 100644 --- a/ioctl/cmd/ioid/projectregister.go +++ b/ioctl/cmd/ioid/projectregister.go @@ -1,15 +1,15 @@ package ioid import ( + "bytes" + _ "embed" // used to embed contract abi "fmt" "math/big" - "strings" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/iotexproject/iotex-address/address" "github.com/spf13/cobra" - "github.com/iotexproject/iotex-core/ioctl/cmd/action" + "github.com/iotexproject/iotex-core/ioctl/cmd/ws" "github.com/iotexproject/iotex-core/ioctl/config" "github.com/iotexproject/iotex-core/ioctl/output" ) @@ -17,8 +17,8 @@ import ( // Multi-language support var ( _registerUsages = map[config.Language]string{ - config.English: "register", - config.Chinese: "register", + config.English: "register [PROJECT_NAME]", + config.Chinese: "register [项目名称]", } _registerShorts = map[config.Language]string{ config.English: "Register project", @@ -34,33 +34,27 @@ var ( var _projectRegisterCmd = &cobra.Command{ Use: config.TranslateInLang(_registerUsages, config.UILanguage), Short: config.TranslateInLang(_registerShorts, config.UILanguage), - Args: cobra.MinimumNArgs(0), + Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - err := register() + err := register(args) return output.PrintError(err) }, } var ( - projectRegistry string - projectRegistryABI = `[ - { - "inputs": [], - "name": "register", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - } - ]` + projectRegistry string + //go:embed contracts/abis/ProjectRegistry.json + projectRegistryJSON []byte + projectRegistryABI abi.ABI ) func init() { + var err error + projectRegistryABI, err = abi.JSON(bytes.NewReader(projectRegistryJSON)) + if err != nil { + panic(err) + } + _projectRegisterCmd.Flags().StringVarP( &projectRegistry, "projectRegistry", "p", "0xB7E1419d62ef429EE3130aF822e43DaBDDdB4aCE", @@ -68,26 +62,22 @@ func init() { ) } -func register() error { - ioProjectRegistry, err := address.FromHex(projectRegistry) - if err != nil { - return output.NewError(output.AddressError, "failed to convert project register address", err) - } +func register(args []string) error { + name := args[0] - projectRegistryAbi, err := abi.JSON(strings.NewReader(projectRegistryABI)) + caller, err := ws.NewContractCaller(projectRegistryABI, projectRegistry) if err != nil { - return output.NewError(output.SerializationError, "failed to unmarshal abi", err) + return output.NewError(output.SerializationError, "failed to create contract caller", err) } - data, err := projectRegistryAbi.Pack("register") + tx, err := caller.CallAndRetrieveResult("register0", []any{ + name, + }) if err != nil { - return output.NewError(output.ConvertError, "failed to pack registry arguments", err) + return output.NewError(output.SerializationError, "failed to call contract", err) } - res, err := action.ExecuteAndResponse(ioProjectRegistry.String(), big.NewInt(0), data) - if err != nil { - return output.NewError(output.UpdateError, "failed to register project", err) - } - receipt, err := waitReceiptByActionHash(res.ActionHash) + + receipt, err := waitReceiptByActionHash(tx) if err != nil { return output.NewError(output.UpdateError, "failed to register project", err) }