diff --git a/abis/Swan.json b/abis/Swan.json new file mode 100644 index 0000000..2da2ca3 --- /dev/null +++ b/abis/Swan.json @@ -0,0 +1,1126 @@ +[ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "addOperator", + "inputs": [ + { + "name": "_operator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "agentFactory", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract SwanAgentFactory" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "artifactFactory", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract SwanArtifactFactory" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "artifactsPerAgentRound", + "inputs": [ + { + "name": "agent", + "type": "address", + "internalType": "address" + }, + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "coordinator", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract LLMOracleCoordinator" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "createAgent", + "inputs": [ + { + "name": "_name", + "type": "string", + "internalType": "string" + }, + { + "name": "_description", + "type": "string", + "internalType": "string" + }, + { + "name": "_feeRoyalty", + "type": "uint96", + "internalType": "uint96" + }, + { + "name": "_amountPerRound", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract SwanAgent" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getCurrentMarketParameters", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct SwanMarketParameters", + "components": [ + { + "name": "withdrawInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "listingInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "buyInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "platformFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxArtifactCount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minArtifactPrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxAgentFee", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getListedArtifacts", + "inputs": [ + { + "name": "_agent", + "type": "address", + "internalType": "address" + }, + { + "name": "_round", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getListing", + "inputs": [ + { + "name": "_artifact", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct Swan.ArtifactListing", + "components": [ + { + "name": "createdAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "feeRoyalty", + "type": "uint96", + "internalType": "uint96" + }, + { + "name": "price", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "seller", + "type": "address", + "internalType": "address" + }, + { + "name": "agent", + "type": "address", + "internalType": "address" + }, + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "status", + "type": "uint8", + "internalType": "enum Swan.ArtifactStatus" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getListingPrice", + "inputs": [ + { + "name": "_artifact", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getMarketParameters", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple[]", + "internalType": "struct SwanMarketParameters[]", + "components": [ + { + "name": "withdrawInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "listingInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "buyInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "platformFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxArtifactCount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minArtifactPrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxAgentFee", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getOracleFee", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getOracleParameters", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct LLMOracleTaskParameters", + "components": [ + { + "name": "difficulty", + "type": "uint8", + "internalType": "uint8" + }, + { + "name": "numGenerations", + "type": "uint40", + "internalType": "uint40" + }, + { + "name": "numValidations", + "type": "uint40", + "internalType": "uint40" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_marketParameters", + "type": "tuple", + "internalType": "struct SwanMarketParameters", + "components": [ + { + "name": "withdrawInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "listingInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "buyInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "platformFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxArtifactCount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minArtifactPrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxAgentFee", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "_oracleParameters", + "type": "tuple", + "internalType": "struct LLMOracleTaskParameters", + "components": [ + { + "name": "difficulty", + "type": "uint8", + "internalType": "uint8" + }, + { + "name": "numGenerations", + "type": "uint40", + "internalType": "uint40" + }, + { + "name": "numValidations", + "type": "uint40", + "internalType": "uint40" + } + ] + }, + { + "name": "_coordinator", + "type": "address", + "internalType": "address" + }, + { + "name": "_token", + "type": "address", + "internalType": "address" + }, + { + "name": "_agentFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "_artifactFactory", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "isOperator", + "inputs": [ + { + "name": "operator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "list", + "inputs": [ + { + "name": "_name", + "type": "string", + "internalType": "string" + }, + { + "name": "_symbol", + "type": "string", + "internalType": "string" + }, + { + "name": "_desc", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "_price", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_agent", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "listings", + "inputs": [ + { + "name": "artifact", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "createdAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "feeRoyalty", + "type": "uint96", + "internalType": "uint96" + }, + { + "name": "price", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "seller", + "type": "address", + "internalType": "address" + }, + { + "name": "agent", + "type": "address", + "internalType": "address" + }, + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "status", + "type": "uint8", + "internalType": "enum Swan.ArtifactStatus" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "purchase", + "inputs": [ + { + "name": "_artifact", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "relist", + "inputs": [ + { + "name": "_artifact", + "type": "address", + "internalType": "address" + }, + { + "name": "_agent", + "type": "address", + "internalType": "address" + }, + { + "name": "_price", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "removeOperator", + "inputs": [ + { + "name": "_operator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFactories", + "inputs": [ + { + "name": "_agentFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "_artifactFactory", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setMarketParameters", + "inputs": [ + { + "name": "_marketParameters", + "type": "tuple", + "internalType": "struct SwanMarketParameters", + "components": [ + { + "name": "withdrawInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "listingInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "buyInterval", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "platformFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxArtifactCount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minArtifactPrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxAgentFee", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setOracleParameters", + "inputs": [ + { + "name": "_oracleParameters", + "type": "tuple", + "internalType": "struct LLMOracleTaskParameters", + "components": [ + { + "name": "difficulty", + "type": "uint8", + "internalType": "uint8" + }, + { + "name": "numGenerations", + "type": "uint40", + "internalType": "uint40" + }, + { + "name": "numValidations", + "type": "uint40", + "internalType": "uint40" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "token", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract ERC20" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "AgentCreated", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "agent", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ArtifactListed", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "artifact", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "price", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ArtifactRelisted", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "agent", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "artifact", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "price", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ArtifactSold", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "agent", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "artifact", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "price", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ArtifactLimitExceeded", + "inputs": [ + { + "name": "limit", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "FailedCall", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidPhase", + "inputs": [ + { + "name": "have", + "type": "uint8", + "internalType": "enum SwanAgent.Phase" + }, + { + "name": "want", + "type": "uint8", + "internalType": "enum SwanAgent.Phase" + } + ] + }, + { + "type": "error", + "name": "InvalidPrice", + "inputs": [ + { + "name": "price", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InvalidStatus", + "inputs": [ + { + "name": "have", + "type": "uint8", + "internalType": "enum Swan.ArtifactStatus" + }, + { + "name": "want", + "type": "uint8", + "internalType": "enum Swan.ArtifactStatus" + } + ] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "RoundNotFinished", + "inputs": [ + { + "name": "artifact", + "type": "address", + "internalType": "address" + }, + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "Unauthorized", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + } +] diff --git a/abis/SwanAgent.json b/abis/SwanAgent.json new file mode 100644 index 0000000..805a942 --- /dev/null +++ b/abis/SwanAgent.json @@ -0,0 +1,624 @@ +[ + { + "type": "constructor", + "inputs": [ + { + "name": "_name", + "type": "string", + "internalType": "string" + }, + { + "name": "_description", + "type": "string", + "internalType": "string" + }, + { + "name": "_feeRoyalty", + "type": "uint96", + "internalType": "uint96" + }, + { + "name": "_amountPerRound", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_operator", + "type": "address", + "internalType": "address" + }, + { + "name": "_owner", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "amountPerRound", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "createdAt", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "description", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "feeRoyalty", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint96", + "internalType": "uint96" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoundPhase", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint8", + "internalType": "enum SwanAgent.Phase" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "inventory", + "inputs": [ + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "artifacts", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isOracleRequestProcessed", + "inputs": [ + { + "name": "taskId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "isProcessed", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "marketParameterIdx", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "minFundAmount", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "oraclePurchaseRequest", + "inputs": [ + { + "name": "_input", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "_models", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "oraclePurchaseRequests", + "inputs": [ + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "taskId", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "oracleResult", + "inputs": [ + { + "name": "taskId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "oracleStateRequest", + "inputs": [ + { + "name": "_input", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "_models", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "oracleStateRequests", + "inputs": [ + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "taskId", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "purchase", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setAmountPerRound", + "inputs": [ + { + "name": "_amountPerRound", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFeeRoyalty", + "inputs": [ + { + "name": "newFeeRoyalty", + "type": "uint96", + "internalType": "uint96" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "spendings", + "inputs": [ + { + "name": "round", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "spending", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "state", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "swan", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract Swan" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "treasury", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "updateState", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "_amount", + "type": "uint96", + "internalType": "uint96" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Purchase", + "inputs": [ + { + "name": "taskId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "round", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PurchaseRequest", + "inputs": [ + { + "name": "taskId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "round", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StateRequest", + "inputs": [ + { + "name": "taskId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "round", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StateUpdate", + "inputs": [ + { + "name": "taskId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "round", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "BuyLimitExceeded", + "inputs": [ + { + "name": "have", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "want", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InvalidFee", + "inputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InvalidPhase", + "inputs": [ + { + "name": "have", + "type": "uint8", + "internalType": "enum SwanAgent.Phase" + }, + { + "name": "want", + "type": "uint8", + "internalType": "enum SwanAgent.Phase" + } + ] + }, + { + "type": "error", + "name": "MinFundSubceeded", + "inputs": [ + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "TaskAlreadyProcessed", + "inputs": [] + }, + { + "type": "error", + "name": "TaskNotRequested", + "inputs": [] + }, + { + "type": "error", + "name": "Unauthorized", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + } +] diff --git a/abis/SwanArtifact.json b/abis/SwanArtifact.json new file mode 100644 index 0000000..aeb4bed --- /dev/null +++ b/abis/SwanArtifact.json @@ -0,0 +1,566 @@ +[ + { + "type": "constructor", + "inputs": [ + { + "name": "_name", + "type": "string", + "internalType": "string" + }, + { + "name": "_symbol", + "type": "string", + "internalType": "string" + }, + { + "name": "_description", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "_owner", + "type": "address", + "internalType": "address" + }, + { + "name": "_operator", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "createdAt", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "description", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getApproved", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isApprovedForAll", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "ownerOf", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "safeTransferFrom", + "inputs": [ + { + "name": "from", + "type": "address", + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "safeTransferFrom", + "inputs": [ + { + "name": "from", + "type": "address", + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setApprovalForAll", + "inputs": [ + { + "name": "operator", + "type": "address", + "internalType": "address" + }, + { + "name": "approved", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "tokenURI", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "from", + "type": "address", + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ApprovalForAll", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "ERC721IncorrectOwner", + "inputs": [ + { + "name": "sender", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC721InsufficientApproval", + "inputs": [ + { + "name": "operator", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ERC721InvalidApprover", + "inputs": [ + { + "name": "approver", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC721InvalidOperator", + "inputs": [ + { + "name": "operator", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC721InvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC721InvalidReceiver", + "inputs": [ + { + "name": "receiver", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC721InvalidSender", + "inputs": [ + { + "name": "sender", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC721NonexistentToken", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } +] diff --git a/abis/parseAbi.js b/abis/parseAbi.js new file mode 100644 index 0000000..e4e2cfe --- /dev/null +++ b/abis/parseAbi.js @@ -0,0 +1,37 @@ +const fs = require("fs"); + +if (process.argv.length < 3) { + console.error("Please provide a filename as a parameter."); + process.exit(1); +} + +const filename = process.argv[2]; + +fs.readFile(filename, "utf8", (err, data) => { + if (err) { + console.error(`Error reading file: ${err}`); + process.exit(1); + } + + try { + const jsonData = JSON.parse(data); + const abi = jsonData.abi; + + if (!abi) { + console.error("No `abi` field found in the JSON data."); + process.exit(1); + } + + fs.writeFile(filename, JSON.stringify(abi, null, 2), (err) => { + if (err) { + console.error(`Error writing file: ${err}`); + process.exit(1); + } + + console.log("ABI extracted and written to abi.json"); + }); + } catch (parseErr) { + console.error(`Error parsing JSON: ${parseErr}`); + process.exit(1); + } +}); diff --git a/export-abis.sh b/export-abis.sh new file mode 100755 index 0000000..2880b72 --- /dev/null +++ b/export-abis.sh @@ -0,0 +1,11 @@ +#!/bin/bash +mkdir abis + +cp ./out/Swan.sol/Swan.json ./abis/Swan.json +node ./abis/parseAbi.js ./abis/Swan.json + +cp ./out/SwanAgent.sol/SwanAgent.json ./abis/SwanAgent.json +node ./abis/parseAbi.js ./abis/SwanAgent.json + +cp ./out/SwanArtifact.sol/SwanArtifact.json ./abis/SwanArtifact.json +node ./abis/parseAbi.js ./abis/SwanArtifact.json