diff --git a/abis/contracts/facets/IexecERC20Core.json b/abis/contracts/facets/IexecERC20Core.json index e7ef0d5a6..afb815d48 100644 --- a/abis/contracts/facets/IexecERC20Core.json +++ b/abis/contracts/facets/IexecERC20Core.json @@ -24,6 +24,75 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Lock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Reward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Seize", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -48,5 +117,24 @@ ], "name": "Transfer", "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Unlock", + "type": "event" } ] \ No newline at end of file diff --git a/abis/contracts/facets/IexecERC20Facet.json b/abis/contracts/facets/IexecERC20Facet.json index c7c52b667..01918fc16 100644 --- a/abis/contracts/facets/IexecERC20Facet.json +++ b/abis/contracts/facets/IexecERC20Facet.json @@ -24,6 +24,75 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Lock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Reward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Seize", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -49,6 +118,25 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Unlock", + "type": "event" + }, { "inputs": [ { diff --git a/abis/contracts/facets/IexecEscrowNativeFacet.json b/abis/contracts/facets/IexecEscrowNativeFacet.json index 12ae21a07..fdbb04ebd 100644 --- a/abis/contracts/facets/IexecEscrowNativeFacet.json +++ b/abis/contracts/facets/IexecEscrowNativeFacet.json @@ -24,6 +24,75 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Lock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Reward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Seize", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -49,6 +118,25 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Unlock", + "type": "event" + }, { "stateMutability": "payable", "type": "fallback" diff --git a/abis/contracts/facets/IexecEscrowTokenFacet.json b/abis/contracts/facets/IexecEscrowTokenFacet.json index f8fb2f53a..2ac4a0beb 100644 --- a/abis/contracts/facets/IexecEscrowTokenFacet.json +++ b/abis/contracts/facets/IexecEscrowTokenFacet.json @@ -24,6 +24,75 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Lock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Reward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Seize", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -49,6 +118,25 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Unlock", + "type": "event" + }, { "stateMutability": "payable", "type": "fallback" diff --git a/abis/contracts/facets/IexecEscrowTokenSwapFacet.json b/abis/contracts/facets/IexecEscrowTokenSwapFacet.json deleted file mode 100644 index b4216d024..000000000 --- a/abis/contracts/facets/IexecEscrowTokenSwapFacet.json +++ /dev/null @@ -1,570 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "stateMutability": "payable", - "type": "fallback" - }, - { - "inputs": [], - "name": "UniswapV2Router", - "outputs": [ - { - "internalType": "contract IUniswapV2Router02", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "depositEthFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "eth", - "type": "uint256" - } - ], - "name": "estimateDepositEthSent", - "outputs": [ - { - "internalType": "uint256", - "name": "token", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "token", - "type": "uint256" - } - ], - "name": "estimateDepositTokenWanted", - "outputs": [ - { - "internalType": "uint256", - "name": "eth", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "eth", - "type": "uint256" - } - ], - "name": "estimateWithdrawEthWanted", - "outputs": [ - { - "internalType": "uint256", - "name": "token", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "token", - "type": "uint256" - } - ], - "name": "estimateWithdrawTokenSent", - "outputs": [ - { - "internalType": "uint256", - "name": "eth", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "app", - "type": "address" - }, - { - "internalType": "uint256", - "name": "appprice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "datasetrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "workerpoolrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "requesterrestrict", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.AppOrder", - "name": "_apporder", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "dataset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "datasetprice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "apprestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "workerpoolrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "requesterrestrict", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.DatasetOrder", - "name": "_datasetorder", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "workerpool", - "type": "address" - }, - { - "internalType": "uint256", - "name": "workerpoolprice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "category", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "trust", - "type": "uint256" - }, - { - "internalType": "address", - "name": "apprestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "datasetrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "requesterrestrict", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.WorkerpoolOrder", - "name": "_workerpoolorder", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "app", - "type": "address" - }, - { - "internalType": "uint256", - "name": "appmaxprice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "dataset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "datasetmaxprice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "workerpool", - "type": "address" - }, - { - "internalType": "uint256", - "name": "workerpoolmaxprice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "requester", - "type": "address" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "category", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "trust", - "type": "uint256" - }, - { - "internalType": "address", - "name": "beneficiary", - "type": "address" - }, - { - "internalType": "address", - "name": "callback", - "type": "address" - }, - { - "internalType": "string", - "name": "params", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.RequestOrder", - "name": "_requestorder", - "type": "tuple" - } - ], - "name": "matchOrdersWithEth", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "requestToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "requestTokenFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minimum", - "type": "uint256" - } - ], - "name": "safeDepositEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minimum", - "type": "uint256" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "safeDepositEthFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimum", - "type": "uint256" - } - ], - "name": "safeWithdrawEth", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimum", - "type": "uint256" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "safeWithdrawEthTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawEth", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "withdrawEthTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] \ No newline at end of file diff --git a/abis/contracts/interfaces/IexecERC20.json b/abis/contracts/interfaces/IexecERC20.json index e1a04e342..397064757 100644 --- a/abis/contracts/interfaces/IexecERC20.json +++ b/abis/contracts/interfaces/IexecERC20.json @@ -24,6 +24,75 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Lock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Reward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ref", + "type": "bytes32" + } + ], + "name": "Seize", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -49,6 +118,25 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Unlock", + "type": "event" + }, { "inputs": [ { diff --git a/abis/contracts/interfaces/IexecERC20Common.json b/abis/contracts/interfaces/IexecERC20Common.json index 6437e41f3..afb815d48 100644 --- a/abis/contracts/interfaces/IexecERC20Common.json +++ b/abis/contracts/interfaces/IexecERC20Common.json @@ -1,4 +1,29 @@ [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -68,6 +93,31 @@ "name": "Seize", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/abis/contracts/interfaces/IexecEscrowTokenSwap.json b/abis/contracts/interfaces/IexecEscrowTokenSwap.json deleted file mode 100644 index 377d4b0a0..000000000 --- a/abis/contracts/interfaces/IexecEscrowTokenSwap.json +++ /dev/null @@ -1,520 +0,0 @@ -[ - { - "stateMutability": "payable", - "type": "fallback" - }, - { - "inputs": [], - "name": "UniswapV2Router", - "outputs": [ - { - "internalType": "contract IUniswapV2Router02", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "depositEthFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "estimateDepositEthSent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "estimateDepositTokenWanted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "estimateWithdrawEthWanted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "estimateWithdrawTokenSent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "app", - "type": "address" - }, - { - "internalType": "uint256", - "name": "appprice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "datasetrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "workerpoolrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "requesterrestrict", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.AppOrder", - "name": "", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "dataset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "datasetprice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "apprestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "workerpoolrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "requesterrestrict", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.DatasetOrder", - "name": "", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "workerpool", - "type": "address" - }, - { - "internalType": "uint256", - "name": "workerpoolprice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "category", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "trust", - "type": "uint256" - }, - { - "internalType": "address", - "name": "apprestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "datasetrestrict", - "type": "address" - }, - { - "internalType": "address", - "name": "requesterrestrict", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.WorkerpoolOrder", - "name": "", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "app", - "type": "address" - }, - { - "internalType": "uint256", - "name": "appmaxprice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "dataset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "datasetmaxprice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "workerpool", - "type": "address" - }, - { - "internalType": "uint256", - "name": "workerpoolmaxprice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "requester", - "type": "address" - }, - { - "internalType": "uint256", - "name": "volume", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "tag", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "category", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "trust", - "type": "uint256" - }, - { - "internalType": "address", - "name": "beneficiary", - "type": "address" - }, - { - "internalType": "address", - "name": "callback", - "type": "address" - }, - { - "internalType": "string", - "name": "params", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "sign", - "type": "bytes" - } - ], - "internalType": "struct IexecLibOrders_v5.RequestOrder", - "name": "", - "type": "tuple" - } - ], - "name": "matchOrdersWithEth", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "requestToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "requestTokenFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeDepositEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "safeDepositEthFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeWithdrawEth", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "safeWithdrawEthTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "withdrawEth", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "withdrawEthTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] \ No newline at end of file diff --git a/abis/contracts/interfaces/IexecHubV3Interface.json b/abis/contracts/interfaces/IexecHubV3Interface.json new file mode 100644 index 000000000..4299d0a84 --- /dev/null +++ b/abis/contracts/interfaces/IexecHubV3Interface.json @@ -0,0 +1,21 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "worker", + "type": "address" + } + ], + "name": "viewScore", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abis/contracts/libs/IRegistry.json b/abis/contracts/libs/IRegistry.json deleted file mode 100644 index c1cecf1fb..000000000 --- a/abis/contracts/libs/IRegistry.json +++ /dev/null @@ -1,362 +0,0 @@ -[ - { - "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": "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": "balance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_entry", - "type": "address" - } - ], - "name": "isRegistered", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "stateMutability": "view", - "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": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "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": [], - "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" - } -] \ No newline at end of file diff --git a/abis/contracts/registries/IRegistry.json b/abis/contracts/registries/IRegistry.json index 91766f066..c1cecf1fb 100644 --- a/abis/contracts/registries/IRegistry.json +++ b/abis/contracts/registries/IRegistry.json @@ -252,7 +252,7 @@ }, { "internalType": "bool", - "name": "_approved", + "name": "approved", "type": "bool" } ], @@ -316,7 +316,7 @@ "outputs": [ { "internalType": "uint256", - "name": "tokenId", + "name": "", "type": "uint256" } ], diff --git a/abis/contracts/registries/Registry.json b/abis/contracts/registries/Registry.json index 8041b40b6..f80511965 100644 --- a/abis/contracts/registries/Registry.json +++ b/abis/contracts/registries/Registry.json @@ -1,24 +1,149 @@ [ + { + "inputs": [], + "name": "ERC721EnumerableForbiddenBatchMint", + "type": "error" + }, { "inputs": [ { "internalType": "address", - "name": "_master", + "name": "sender", "type": "address" }, { - "internalType": "string", - "name": "_name", - "type": "string" + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" }, { - "internalType": "string", - "name": "_symbol", - "type": "string" + "internalType": "address", + "name": "owner", + "type": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "name": "ERC721IncorrectOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721InsufficientApproval", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC721InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "ERC721InvalidOperator", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721InvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC721InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC721InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721NonexistentToken", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "ERC721OutOfBoundsIndex", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" }, { "anonymous": false, @@ -398,7 +523,7 @@ }, { "internalType": "bytes", - "name": "_data", + "name": "data", "type": "bytes" } ], @@ -429,7 +554,7 @@ "inputs": [ { "internalType": "string", - "name": "_baseURI", + "name": "baseUri", "type": "string" } ], diff --git a/abis/contracts/registries/apps/AppRegistry.json b/abis/contracts/registries/apps/AppRegistry.json index b4537f4e7..c695c19ee 100644 --- a/abis/contracts/registries/apps/AppRegistry.json +++ b/abis/contracts/registries/apps/AppRegistry.json @@ -4,6 +4,178 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "Create2EmptyBytecode", + "type": "error" + }, + { + "inputs": [], + "name": "Create2FailedDeployment", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "Create2InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "ERC721EnumerableForbiddenBatchMint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721IncorrectOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721InsufficientApproval", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC721InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "ERC721InvalidOperator", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721InvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC721InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC721InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721NonexistentToken", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "ERC721OutOfBoundsIndex", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -470,7 +642,7 @@ }, { "internalType": "bytes", - "name": "_data", + "name": "data", "type": "bytes" } ], @@ -501,7 +673,7 @@ "inputs": [ { "internalType": "string", - "name": "_baseURI", + "name": "baseUri", "type": "string" } ], diff --git a/abis/contracts/registries/datasets/DatasetRegistry.json b/abis/contracts/registries/datasets/DatasetRegistry.json index c4def9e22..eb46ae27f 100644 --- a/abis/contracts/registries/datasets/DatasetRegistry.json +++ b/abis/contracts/registries/datasets/DatasetRegistry.json @@ -4,6 +4,178 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "Create2EmptyBytecode", + "type": "error" + }, + { + "inputs": [], + "name": "Create2FailedDeployment", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "Create2InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "ERC721EnumerableForbiddenBatchMint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721IncorrectOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721InsufficientApproval", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC721InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "ERC721InvalidOperator", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721InvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC721InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC721InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721NonexistentToken", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "ERC721OutOfBoundsIndex", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -450,7 +622,7 @@ }, { "internalType": "bytes", - "name": "_data", + "name": "data", "type": "bytes" } ], @@ -481,7 +653,7 @@ "inputs": [ { "internalType": "string", - "name": "_baseURI", + "name": "baseUri", "type": "string" } ], diff --git a/abis/contracts/registries/proxy/Address.json b/abis/contracts/registries/proxy/Address.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/abis/contracts/registries/proxy/Address.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/abis/contracts/registries/proxy/BaseUpgradeabilityProxy.json b/abis/contracts/registries/proxy/BaseUpgradeabilityProxy.json new file mode 100644 index 000000000..0aa87b9fa --- /dev/null +++ b/abis/contracts/registries/proxy/BaseUpgradeabilityProxy.json @@ -0,0 +1,23 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/abis/contracts/registries/proxy/InitializableUpgradeabilityProxy.json b/abis/contracts/registries/proxy/InitializableUpgradeabilityProxy.json new file mode 100644 index 000000000..dd7301942 --- /dev/null +++ b/abis/contracts/registries/proxy/InitializableUpgradeabilityProxy.json @@ -0,0 +1,41 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/abis/contracts/registries/proxy/Proxy.json b/abis/contracts/registries/proxy/Proxy.json new file mode 100644 index 000000000..fcf60d442 --- /dev/null +++ b/abis/contracts/registries/proxy/Proxy.json @@ -0,0 +1,10 @@ +[ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/abis/contracts/registries/workerpools/WorkerpoolRegistry.json b/abis/contracts/registries/workerpools/WorkerpoolRegistry.json index 158f76e43..8c95342c5 100644 --- a/abis/contracts/registries/workerpools/WorkerpoolRegistry.json +++ b/abis/contracts/registries/workerpools/WorkerpoolRegistry.json @@ -4,6 +4,178 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "Create2EmptyBytecode", + "type": "error" + }, + { + "inputs": [], + "name": "Create2FailedDeployment", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "Create2InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "ERC721EnumerableForbiddenBatchMint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721IncorrectOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721InsufficientApproval", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC721InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "ERC721InvalidOperator", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721InvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC721InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC721InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721NonexistentToken", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "ERC721OutOfBoundsIndex", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -430,7 +602,7 @@ }, { "internalType": "bytes", - "name": "_data", + "name": "data", "type": "bytes" } ], @@ -461,7 +633,7 @@ "inputs": [ { "internalType": "string", - "name": "_baseURI", + "name": "baseUri", "type": "string" } ], diff --git a/config/config.json b/config/config.json index f86c652bf..cc793c538 100644 --- a/config/config.json +++ b/config/config.json @@ -135,7 +135,7 @@ "_tokenComment": "Address of the RLC token contract", "richman": null, "uniswap": false, - "_uniswapComment": "TODO remove when removing `IexecEscrowTokenSwap`", + "_uniswapComment": "Defines whether the PoCo is integrated with Uniswap or not", "v3": { "Hub": null, "AppRegistry": null, diff --git a/contracts/IexecInterfaceNative.sol b/contracts/IexecInterfaceNative.sol index 7ccd1990d..6480bee09 100644 --- a/contracts/IexecInterfaceNative.sol +++ b/contracts/IexecInterfaceNative.sol @@ -32,8 +32,8 @@ interface IexecInterfaceNative is IexecCategoryManager, IexecConfiguration, IexecConfigurationExtra, - IexecERC20, IexecERC20Common, + IexecERC20, IexecEscrowNative, IexecOrderManagement, IexecPoco1, diff --git a/contracts/IexecInterfaceToken.sol b/contracts/IexecInterfaceToken.sol index 2865622d4..b290d4ecf 100644 --- a/contracts/IexecInterfaceToken.sol +++ b/contracts/IexecInterfaceToken.sol @@ -35,8 +35,8 @@ interface IexecInterfaceToken is IexecCategoryManager, IexecConfiguration, IexecConfigurationExtra, - IexecERC20, IexecERC20Common, + IexecERC20, IexecEscrowToken, IexecOrderManagement, IexecPoco1, diff --git a/contracts/facets/FacetBase.sol b/contracts/facets/FacetBase.sol index f42f01523..ffcf7fe1e 100644 --- a/contracts/facets/FacetBase.sol +++ b/contracts/facets/FacetBase.sol @@ -1,10 +1,10 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "../libs/PocoStorageLib.sol"; -import "../interfaces/IOwnable.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; +import {IERC5313} from "@openzeppelin/contracts-v5/interfaces/IERC5313.sol"; // TODO use LibDiamond.contractOwner() when migrating all contracts to v8. @@ -36,7 +36,7 @@ abstract contract FacetBase { function owner() internal view returns (address) { // TODO use LibDiamond.contractOwner() instead of an external call when migrating all contracts to v8. - return IOwnable(address(this)).owner(); + return IERC5313(address(this)).owner(); } function _msgSender() internal view returns (address) { diff --git a/contracts/facets/FacetBase.v8.sol b/contracts/facets/FacetBase.v8.sol deleted file mode 100644 index ed5a74cdb..000000000 --- a/contracts/facets/FacetBase.v8.sol +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH -// SPDX-License-Identifier: Apache-2.0 - -pragma solidity ^0.8.0; - -import {IERC5313} from "@openzeppelin/contracts-v5/interfaces/IERC5313.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; - -// TODO use LibDiamond.contractOwner() when migrating all contracts to v8. - -/** - * @title Base contract of all Facet contracts. - * @dev Every facet must inherit from this contract. - */ -abstract contract FacetBase { - // Poco - Constants - uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7; - uint256 internal constant REVEAL_DEADLINE_RATIO = 2; - uint256 internal constant FINAL_DEADLINE_RATIO = 10; - uint256 internal constant WORKERPOOL_STAKE_RATIO = 30; - uint256 internal constant KITTY_RATIO = 10; - uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE - - // Seized funds of workerpools that do not honor their deals are sent - // out to this kitty address. - // It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1). - address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23; - - // Used with ERC-734 Key Manager identity contract for authorization management. - uint256 internal constant GROUPMEMBER_PURPOSE = 4; - - function _msgSender() internal view returns (address) { - return msg.sender; - } -} diff --git a/contracts/facets/IexecAccessorsABILegacyFacet.sol b/contracts/facets/IexecAccessorsABILegacyFacet.sol index d275f9748..ecd6807d6 100644 --- a/contracts/facets/IexecAccessorsABILegacyFacet.sol +++ b/contracts/facets/IexecAccessorsABILegacyFacet.sol @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./FacetBase.sol"; -import "../interfaces/IexecAccessorsABILegacy.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecAccessorsABILegacy} from "../interfaces/IexecAccessorsABILegacy.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; +import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; contract IexecAccessorsABILegacyFacet is IexecAccessorsABILegacy, FacetBase { function viewDealABILegacy_pt1( diff --git a/contracts/facets/IexecCategoryManagerFacet.sol b/contracts/facets/IexecCategoryManagerFacet.sol index 195f3d391..a1053f22b 100644 --- a/contracts/facets/IexecCategoryManagerFacet.sol +++ b/contracts/facets/IexecCategoryManagerFacet.sol @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./FacetBase.sol"; +import {FacetBase} from "./FacetBase.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import "../interfaces/IexecCategoryManager.sol"; +import {IexecCategoryManager} from "../interfaces/IexecCategoryManager.sol"; +import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; contract IexecCategoryManagerFacet is IexecCategoryManager, FacetBase { /** diff --git a/contracts/facets/IexecConfigurationExtraFacet.sol b/contracts/facets/IexecConfigurationExtraFacet.sol index aa6f1de35..97f24c226 100644 --- a/contracts/facets/IexecConfigurationExtraFacet.sol +++ b/contracts/facets/IexecConfigurationExtraFacet.sol @@ -1,11 +1,11 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./FacetBase.sol"; -import "../interfaces/IexecConfigurationExtra.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecConfigurationExtra} from "../interfaces/IexecConfigurationExtra.sol"; +import {IRegistry} from "../registries/IRegistry.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; contract IexecConfigurationExtraFacet is IexecConfigurationExtra, FacetBase { diff --git a/contracts/facets/IexecConfigurationFacet.sol b/contracts/facets/IexecConfigurationFacet.sol index 41aaac187..99dddaa9a 100644 --- a/contracts/facets/IexecConfigurationFacet.sol +++ b/contracts/facets/IexecConfigurationFacet.sol @@ -1,17 +1,18 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - -import "./FacetBase.sol"; -import "../interfaces/IexecConfiguration.sol"; +import {IERC20} from "@openzeppelin/contracts-v5/token/ERC20/IERC20.sol"; +import {Math} from "@openzeppelin/contracts-v5/utils/math/Math.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecConfiguration} from "../interfaces/IexecConfiguration.sol"; +import {IexecHubV3Interface} from "../interfaces/IexecHubV3Interface.sol"; +import {IRegistry} from "../registries/IRegistry.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; +import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; contract IexecConfigurationFacet is IexecConfiguration, FacetBase { - using SafeMathExtended for uint256; using IexecLibOrders_v5 for IexecLibOrders_v5.EIP712Domain; // TODO move this to DiamondInit.init(). @@ -35,7 +36,7 @@ contract IexecConfigurationFacet is IexecConfiguration, FacetBase { $.m_appregistry = IRegistry(_appregistryAddress); $.m_datasetregistry = IRegistry(_datasetregistryAddress); $.m_workerpoolregistry = IRegistry(_workerpoolregistryAddress); - $.m_v3_iexecHub = IexecHubInterface(_v3_iexecHubAddress); + $.m_v3_iexecHub = IexecHubV3Interface(_v3_iexecHubAddress); $.m_callbackgas = 100000; } @@ -52,7 +53,8 @@ contract IexecConfigurationFacet is IexecConfiguration, FacetBase { function importScore(address _worker) external override { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); require(!$.m_v3_scoreImported[_worker], "score-already-imported"); - $.m_workerScores[_worker] = $.m_workerScores[_worker].max( + $.m_workerScores[_worker] = Math.max( + $.m_workerScores[_worker], $.m_v3_iexecHub.viewScore(_worker) ); $.m_v3_scoreImported[_worker] = true; @@ -68,7 +70,7 @@ contract IexecConfigurationFacet is IexecConfiguration, FacetBase { $.m_callbackgas = _callbackgas; } - function _chainId() internal pure returns (uint256 id) { + function _chainId() internal view returns (uint256 id) { assembly { id := chainid() } diff --git a/contracts/facets/IexecERC20Core.sol b/contracts/facets/IexecERC20Core.sol index 1c2adfe77..567d84719 100644 --- a/contracts/facets/IexecERC20Core.sol +++ b/contracts/facets/IexecERC20Core.sol @@ -1,24 +1,19 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import "./FacetBase.sol"; - -contract IexecERC20Core is FacetBase { - using SafeMathExtended for uint256; - - event Transfer(address indexed from, address indexed to, uint256 value); - event Approval(address indexed owner, address indexed spender, uint256 value); +import {FacetBase} from "./FacetBase.sol"; +import {IexecERC20Common} from "../interfaces/IexecERC20Common.sol"; +contract IexecERC20Core is IexecERC20Common, FacetBase { function _transferUnchecked(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_balances[sender] = $.m_balances[sender].sub(amount); - $.m_balances[recipient] = $.m_balances[recipient].add(amount); + $.m_balances[sender] = $.m_balances[sender] - amount; + $.m_balances[recipient] = $.m_balances[recipient] + amount; emit Transfer(sender, recipient, amount); } @@ -29,16 +24,16 @@ contract IexecERC20Core is FacetBase { function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_totalSupply = $.m_totalSupply.add(amount); - $.m_balances[account] = $.m_balances[account].add(amount); + $.m_totalSupply = $.m_totalSupply + amount; + $.m_balances[account] = $.m_balances[account] + amount; emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_totalSupply = $.m_totalSupply.sub(amount); - $.m_balances[account] = $.m_balances[account].sub(amount); + $.m_totalSupply = $.m_totalSupply - amount; + $.m_balances[account] = $.m_balances[account] - amount; emit Transfer(account, address(0), amount); } diff --git a/contracts/facets/IexecERC20Facet.sol b/contracts/facets/IexecERC20Facet.sol index 490203977..24570e7ec 100644 --- a/contracts/facets/IexecERC20Facet.sol +++ b/contracts/facets/IexecERC20Facet.sol @@ -1,13 +1,12 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./IexecERC20Core.sol"; -import "./FacetBase.sol"; -import "../interfaces/IexecERC20.sol"; -import "../interfaces/IexecTokenSpender.sol"; +import {IexecERC20Core} from "./IexecERC20Core.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecERC20} from "../interfaces/IexecERC20.sol"; +import {IexecTokenSpender} from "../interfaces/IexecTokenSpender.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; contract IexecERC20Facet is IexecERC20, FacetBase, IexecERC20Core { @@ -46,7 +45,7 @@ contract IexecERC20Facet is IexecERC20, FacetBase, IexecERC20Core { ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); _transfer(sender, recipient, amount); - _approve(sender, _msgSender(), $.m_allowances[sender][_msgSender()].sub(amount)); + _approve(sender, _msgSender(), $.m_allowances[sender][_msgSender()] - amount); return true; } @@ -55,7 +54,7 @@ contract IexecERC20Facet is IexecERC20, FacetBase, IexecERC20Core { uint256 addedValue ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _approve(_msgSender(), spender, $.m_allowances[_msgSender()][spender].add(addedValue)); + _approve(_msgSender(), spender, $.m_allowances[_msgSender()][spender] + addedValue); return true; } @@ -64,7 +63,7 @@ contract IexecERC20Facet is IexecERC20, FacetBase, IexecERC20Core { uint256 subtractedValue ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _approve(_msgSender(), spender, $.m_allowances[_msgSender()][spender].sub(subtractedValue)); + _approve(_msgSender(), spender, $.m_allowances[_msgSender()][spender] - subtractedValue); return true; } } diff --git a/contracts/facets/IexecEscrow.v8.sol b/contracts/facets/IexecEscrow.v8.sol index bfbb5daa7..e0efc2b1e 100644 --- a/contracts/facets/IexecEscrow.v8.sol +++ b/contracts/facets/IexecEscrow.v8.sol @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; +import {FacetBase} from "./FacetBase.sol"; /** * @title Manage (lock/unlock/reward/seize) user funds. diff --git a/contracts/facets/IexecEscrowNativeFacet.sol b/contracts/facets/IexecEscrowNativeFacet.sol index 42a1ef056..ee739f680 100644 --- a/contracts/facets/IexecEscrowNativeFacet.sol +++ b/contracts/facets/IexecEscrowNativeFacet.sol @@ -1,16 +1,14 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./IexecERC20Core.sol"; -import "./FacetBase.sol"; -import "../interfaces/IexecEscrowNative.sol"; +import {IexecERC20Core} from "./IexecERC20Core.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecEscrowNative} from "../interfaces/IexecEscrowNative.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; contract IexecEscrowNativeFacet is IexecEscrowNative, FacetBase, IexecERC20Core { - using SafeMathExtended for uint256; uint256 internal constant nRLCtoWei = 10 ** 9; /*************************************************************************** @@ -42,7 +40,7 @@ contract IexecEscrowNativeFacet is IexecEscrowNative, FacetBase, IexecERC20Core uint256 remaining = msg.value; for (uint i = 0; i < amounts.length; ++i) { _mint(targets[i], amounts[i]); - remaining = remaining.sub(amounts[i].mul(nRLCtoWei)); + remaining = remaining - amounts[i] * nRLCtoWei; } _withdraw(_msgSender(), remaining); return true; @@ -50,26 +48,26 @@ contract IexecEscrowNativeFacet is IexecEscrowNative, FacetBase, IexecERC20Core function withdraw(uint256 amount) external override returns (bool) { _burn(_msgSender(), amount); - _withdraw(_msgSender(), amount.mul(nRLCtoWei)); + _withdraw(_msgSender(), amount * nRLCtoWei); return true; } function withdrawTo(uint256 amount, address target) external override returns (bool) { _burn(_msgSender(), amount); - _withdraw(target, amount.mul(nRLCtoWei)); + _withdraw(target, amount * nRLCtoWei); return true; } function recover() external override onlyOwner returns (uint256) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - uint256 delta = address(this).balance.div(nRLCtoWei).sub($.m_totalSupply); + uint256 delta = address(this).balance / nRLCtoWei - $.m_totalSupply; _mint(owner(), delta); return delta; } function _deposit(address target) internal { - _mint(target, msg.value.div(nRLCtoWei)); - _withdraw(_msgSender(), msg.value.mod(nRLCtoWei)); + _mint(target, msg.value / nRLCtoWei); + _withdraw(_msgSender(), msg.value % nRLCtoWei); } function _withdraw(address to, uint256 value) internal { diff --git a/contracts/facets/IexecEscrowTokenFacet.sol b/contracts/facets/IexecEscrowTokenFacet.sol index fd9e833cb..7d044e5df 100644 --- a/contracts/facets/IexecEscrowTokenFacet.sol +++ b/contracts/facets/IexecEscrowTokenFacet.sol @@ -1,17 +1,15 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./IexecERC20Core.sol"; -import "./FacetBase.sol"; -import "../interfaces/IexecEscrowToken.sol"; -import "../interfaces/IexecTokenSpender.sol"; +import {IexecERC20Core} from "./IexecERC20Core.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecEscrowToken} from "../interfaces/IexecEscrowToken.sol"; +import {IexecTokenSpender} from "../interfaces/IexecTokenSpender.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase, IexecERC20Core { - using SafeMathExtended for uint256; /*************************************************************************** * Escrow methods: public * @@ -62,7 +60,7 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase function recover() external override onlyOwner returns (uint256) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - uint256 delta = $.m_baseToken.balanceOf(address(this)).sub($.m_totalSupply); + uint256 delta = $.m_baseToken.balanceOf(address(this)) - $.m_totalSupply; _mint(owner(), delta); return delta; } diff --git a/contracts/facets/IexecEscrowTokenSwapFacet.sol b/contracts/facets/IexecEscrowTokenSwapFacet.sol deleted file mode 100644 index 62bce85a1..000000000 --- a/contracts/facets/IexecEscrowTokenSwapFacet.sol +++ /dev/null @@ -1,214 +0,0 @@ -// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH -// SPDX-License-Identifier: Apache-2.0 - -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; - -import "./IexecERC20Core.sol"; -import "./SignatureVerifier.sol"; -import "./FacetBase.sol"; -import "../interfaces/IexecEscrowTokenSwap.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import "../interfaces/IexecPoco1.sol"; - -contract IexecEscrowTokenSwapFacet is - IexecEscrowTokenSwap, - FacetBase, - IexecERC20Core, - SignatureVerifier -{ - using SafeMathExtended for uint256; - using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; - using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; - using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder; - using IexecLibOrders_v5 for IexecLibOrders_v5.RequestOrder; - - IUniswapV2Router02 internal constant router = - IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); - - /*************************************************************************** - * Accessor * - ***************************************************************************/ - function UniswapV2Router() external view override returns (IUniswapV2Router02) { - return router; - } - - /*************************************************************************** - * Uniswap path - Internal * - ***************************************************************************/ - function _eth2token() internal view returns (address[] memory) { - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - address[] memory path = new address[](2); - path[0] = router.WETH(); - path[1] = address($.m_baseToken); - return path; - } - - function _token2eth() internal view returns (address[] memory) { - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - address[] memory path = new address[](2); - path[0] = address($.m_baseToken); - path[1] = router.WETH(); - return path; - } - - /*************************************************************************** - * Prediction methods - Public * - ***************************************************************************/ - function estimateDepositEthSent(uint256 eth) external view override returns (uint256 token) { - return router.getAmountsOut(eth, _eth2token())[1]; - } - function estimateDepositTokenWanted( - uint256 token - ) external view override returns (uint256 eth) { - return router.getAmountsIn(token, _eth2token())[0]; - } - function estimateWithdrawTokenSent(uint256 token) external view override returns (uint256 eth) { - return router.getAmountsOut(token, _token2eth())[1]; - } - function estimateWithdrawEthWanted(uint256 eth) external view override returns (uint256 token) { - return router.getAmountsIn(eth, _token2eth())[0]; - } - - /*************************************************************************** - * Swapping methods - Public * - ***************************************************************************/ - receive() external payable override { - address sender = _msgSender(); - if (sender != address(router)) { - _deposit(sender, msg.value, 0); - } - } - - fallback() external payable override { - revert("fallback-disabled"); - } - - function depositEth() external payable override { - _deposit(_msgSender(), msg.value, 0); - } - function depositEthFor(address target) external payable override { - _deposit(target, msg.value, 0); - } - function safeDepositEth(uint256 minimum) external payable override { - _deposit(_msgSender(), msg.value, minimum); - } - function safeDepositEthFor(uint256 minimum, address target) external payable override { - _deposit(target, msg.value, minimum); - } - function requestToken(uint256 amount) external payable override { - _request(_msgSender(), msg.value, amount); - } - function requestTokenFor(uint256 amount, address target) external payable override { - _request(target, msg.value, amount); - } - function withdrawEth(uint256 amount) external override { - _withdraw(_msgSender(), amount, 0); - } - function withdrawEthTo(uint256 amount, address target) external override { - _withdraw(target, amount, 0); - } - function safeWithdrawEth(uint256 amount, uint256 minimum) external override { - _withdraw(_msgSender(), amount, minimum); - } - function safeWithdrawEthTo(uint256 amount, uint256 minimum, address target) external override { - _withdraw(target, amount, minimum); - } - - /*************************************************************************** - * Swapping methods - Internal * - ***************************************************************************/ - function _deposit(address target, uint256 value, uint256 minimum) internal { - uint256[] memory amounts = router.swapExactETHForTokens{value: value}( - minimum, - _eth2token(), - address(this), - now + 1 - ); - _mint(target, amounts[1]); - } - - function _request(address target, uint256 value, uint256 amount) internal { - uint256[] memory amounts = router.swapETHForExactTokens{value: value}( - amount, - _eth2token(), - address(this), - now + 1 - ); - _mint(target, amounts[1]); - // Refund remaining ETH - (bool success, ) = _msgSender().call{value: value.sub(amounts[0])}(""); - require(success, "native-transfer-failed"); - } - - function _withdraw(address target, uint256 amount, uint256 minimum) internal { - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_baseToken.approve(address(router), amount); - uint256[] memory amounts = router.swapExactTokensForETH( - amount, - minimum, - _token2eth(), - target, - now + 1 - ); - _burn(_msgSender(), amounts[0]); - } - - /*************************************************************************** - * Extra public methods * - ***************************************************************************/ - function matchOrdersWithEth( - IexecLibOrders_v5.AppOrder memory _apporder, - IexecLibOrders_v5.DatasetOrder memory _datasetorder, - IexecLibOrders_v5.WorkerpoolOrder memory _workerpoolorder, - IexecLibOrders_v5.RequestOrder memory _requestorder - ) public payable override returns (bytes32) { - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - uint256 volume; - volume = _apporder.volume.sub( - $.m_consumed[keccak256(_toEthTypedStruct(_apporder.hash(), $.m_eip712DomainSeparator))] - ); - if (_datasetorder.dataset != address(0)) - volume = volume.min( - _datasetorder.volume.sub( - $.m_consumed[ - keccak256( - _toEthTypedStruct(_datasetorder.hash(), $.m_eip712DomainSeparator) - ) - ] - ) - ); - volume = volume.min( - _workerpoolorder.volume.sub( - $.m_consumed[ - keccak256(_toEthTypedStruct(_workerpoolorder.hash(), $.m_eip712DomainSeparator)) - ] - ) - ); - volume = volume.min( - _requestorder.volume.sub( - $.m_consumed[ - keccak256(_toEthTypedStruct(_requestorder.hash(), $.m_eip712DomainSeparator)) - ] - ) - ); - - _request( - _requestorder.requester, - msg.value, - _apporder - .appprice - .add(_datasetorder.dataset != address(0) ? _datasetorder.datasetprice : 0) - .add(_workerpoolorder.workerpoolprice) - .mul(volume) - ); - - return - IexecPoco1(address(this)).matchOrders( - _apporder, - _datasetorder, - _workerpoolorder, - _requestorder - ); - } -} diff --git a/contracts/facets/IexecOrderManagementFacet.sol b/contracts/facets/IexecOrderManagementFacet.sol index 81f0c9bf6..9bd6866e8 100644 --- a/contracts/facets/IexecOrderManagementFacet.sol +++ b/contracts/facets/IexecOrderManagementFacet.sol @@ -5,9 +5,9 @@ pragma solidity ^0.8.0; import {IERC5313} from "@openzeppelin/contracts-v5/interfaces/IERC5313.sol"; import {SignatureVerifier} from "./SignatureVerifier.v8.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; import {IexecOrderManagement} from "../interfaces/IexecOrderManagement.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase, SignatureVerifier { diff --git a/contracts/facets/IexecPoco1Facet.sol b/contracts/facets/IexecPoco1Facet.sol index c1b4d00bc..b82af2eb3 100644 --- a/contracts/facets/IexecPoco1Facet.sol +++ b/contracts/facets/IexecPoco1Facet.sol @@ -8,8 +8,8 @@ import {Math} from "@openzeppelin/contracts-v5/utils/math/Math.sol"; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; import {IexecPoco1Errors} from "../interfaces/IexecPoco1Errors.sol"; import {IexecEscrow} from "./IexecEscrow.v8.sol"; diff --git a/contracts/facets/IexecPoco2Facet.sol b/contracts/facets/IexecPoco2Facet.sol index 18c130fa1..d671da415 100644 --- a/contracts/facets/IexecPoco2Facet.sol +++ b/contracts/facets/IexecPoco2Facet.sol @@ -4,11 +4,11 @@ pragma solidity ^0.8.0; import {Math} from "@openzeppelin/contracts-v5/utils/math/Math.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IOracleConsumer} from "../external/interfaces/IOracleConsumer.sol"; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; import {IexecPoco2} from "../interfaces/IexecPoco2.sol"; import {IexecEscrow} from "./IexecEscrow.v8.sol"; import {SignatureVerifier} from "./SignatureVerifier.v8.sol"; diff --git a/contracts/facets/IexecPocoAccessorsFacet.sol b/contracts/facets/IexecPocoAccessorsFacet.sol index 9377ecf13..0a962f075 100644 --- a/contracts/facets/IexecPocoAccessorsFacet.sol +++ b/contracts/facets/IexecPocoAccessorsFacet.sol @@ -3,14 +3,15 @@ pragma solidity ^0.8.0; -import {PocoStorageLib, IRegistry} from "../libs/PocoStorageLib.v8.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; +import {FacetBase} from "./FacetBase.sol"; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IDataset} from "../registries/datasets/IDataset.v8.sol"; import {IApp} from "../registries/apps/IApp.v8.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoAccessors} from "../interfaces/IexecPocoAccessors.sol"; +import {IRegistry} from "../registries/IRegistry.sol"; import {IexecPocoCommon} from "./IexecPocoCommon.sol"; import {SignatureVerifier} from "./SignatureVerifier.v8.sol"; diff --git a/contracts/facets/IexecPocoBoostAccessorsFacet.sol b/contracts/facets/IexecPocoBoostAccessorsFacet.sol index 2ec7bb0a6..27ef29e0b 100644 --- a/contracts/facets/IexecPocoBoostAccessorsFacet.sol +++ b/contracts/facets/IexecPocoBoostAccessorsFacet.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.0; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; import {IexecPocoBoostAccessors} from "../interfaces/IexecPocoBoostAccessors.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; // // Not deployed yet! diff --git a/contracts/facets/IexecPocoBoostFacet.sol b/contracts/facets/IexecPocoBoostFacet.sol index 46e0b31b9..2358f5499 100644 --- a/contracts/facets/IexecPocoBoostFacet.sol +++ b/contracts/facets/IexecPocoBoostFacet.sol @@ -13,12 +13,12 @@ import {IOracleConsumer} from "../external/interfaces/IOracleConsumer.sol"; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; import {IexecPocoBoost} from "../interfaces/IexecPocoBoost.sol"; import {IexecEscrow} from "./IexecEscrow.v8.sol"; import {IexecPocoCommon} from "./IexecPocoCommon.sol"; import {SignatureVerifier} from "./SignatureVerifier.v8.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; // // Not deployed yet! diff --git a/contracts/facets/IexecPocoCommon.sol b/contracts/facets/IexecPocoCommon.sol index 1ccdf54f0..6c3e43231 100644 --- a/contracts/facets/IexecPocoCommon.sol +++ b/contracts/facets/IexecPocoCommon.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.0; import {Math} from "@openzeppelin/contracts-v5/utils/math/Math.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; contract IexecPocoCommon is FacetBase { using Math for uint256; diff --git a/contracts/facets/IexecRelayFacet.sol b/contracts/facets/IexecRelayFacet.sol index 11109108c..a5273dfce 100644 --- a/contracts/facets/IexecRelayFacet.sol +++ b/contracts/facets/IexecRelayFacet.sol @@ -1,11 +1,11 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "./FacetBase.sol"; -import "../interfaces/IexecRelay.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {IexecRelay} from "../interfaces/IexecRelay.sol"; +import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; contract IexecRelayFacet is IexecRelay, FacetBase { function broadcastAppOrder(IexecLibOrders_v5.AppOrder calldata _apporder) external override { diff --git a/contracts/facets/SignatureVerifier.sol b/contracts/facets/SignatureVerifier.sol index 00dbd9c46..68bf10902 100644 --- a/contracts/facets/SignatureVerifier.sol +++ b/contracts/facets/SignatureVerifier.sol @@ -1,15 +1,16 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; -import "@iexec/solidity/contracts/ERC734/IERC734.sol"; -import "@iexec/solidity/contracts/ERC1271/IERC1271.sol"; -import "@iexec/solidity/contracts/ERC1654/IERC1654.sol"; +import {IERC734} from "../external/interfaces/IERC734.sol"; +import {IERC1271} from "@openzeppelin/contracts-v5/interfaces/IERC1271.sol"; +// import "@iexec/solidity/contracts/ERC1654/IERC1654.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import "./FacetBase.sol"; +import {FacetBase} from "./FacetBase.sol"; +import {MessageHashUtils} from "@openzeppelin/contracts-v5/utils/cryptography/MessageHashUtils.sol"; +// TODO uncomment and fix file contract SignatureVerifier is FacetBase { /** * Prepare message/structure predicat used for signing @@ -62,6 +63,7 @@ contract SignatureVerifier is FacetBase { /** * Check if contract exist, otherwize assumed to be EOA */ + // TODO refactor this with Address library. function _isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned @@ -79,7 +81,7 @@ contract SignatureVerifier is FacetBase { * Address to bytes32 casting to ERC734 */ function _addrToKey(address _addr) internal pure returns (bytes32) { - return bytes32(uint256(_addr)); + return bytes32(uint256(uint160(_addr))); } /** @@ -106,9 +108,9 @@ contract SignatureVerifier is FacetBase { bytes memory _signature ) internal view returns (bool) { if (_isContract(_identity)) { - try IERC1654(_identity).isValidSignature(_hash, _signature) returns (bytes4 value) { - return value == IERC1654(0).isValidSignature.selector; - } catch (bytes memory /*lowLevelData*/) {} + // try address(0)(_identity).isValidSignature(_hash, _signature) returns (bytes4 value) { + // return value == address(0)(address(0)).isValidSignature.selector; + // } catch (bytes memory /*lowLevelData*/) {} return false; } else { @@ -122,15 +124,15 @@ contract SignatureVerifier is FacetBase { bytes memory _signature ) internal view returns (bool) { if (_isContract(_identity)) { - try IERC1271(_identity).isValidSignature(_predicat, _signature) returns (bytes4 value) { - return value == IERC1271(0).isValidSignature.selector; - } catch (bytes memory /*lowLevelData*/) {} - - try IERC1654(_identity).isValidSignature(keccak256(_predicat), _signature) returns ( - bytes4 value - ) { - return value == IERC1654(0).isValidSignature.selector; - } catch (bytes memory /*lowLevelData*/) {} + // try IERC1271(_identity).isValidSignature(_predicat, _signature) returns (bytes4 value) { + // return value == IERC1271(address(0)).isValidSignature.selector; + // } catch (bytes memory /*lowLevelData*/) {} + + // try IERC1654(_identity).isValidSignature(keccak256(_predicat), _signature) returns ( + // bytes4 value + // ) { + // return value == IERC1654(0).isValidSignature.selector; + // } catch (bytes memory /*lowLevelData*/) {} return false; } else { diff --git a/contracts/facets/SignatureVerifier.v8.sol b/contracts/facets/SignatureVerifier.v8.sol index 4f8a9bda1..f9dd7a049 100644 --- a/contracts/facets/SignatureVerifier.v8.sol +++ b/contracts/facets/SignatureVerifier.v8.sol @@ -6,9 +6,9 @@ pragma solidity ^0.8.0; import {IERC1271} from "@openzeppelin/contracts-v5/interfaces/IERC1271.sol"; import {ECDSA} from "@openzeppelin/contracts-v5/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts-v5/utils/cryptography/MessageHashUtils.sol"; -import {FacetBase} from "./FacetBase.v8.sol"; +import {FacetBase} from "./FacetBase.sol"; import {IERC734} from "../external/interfaces/IERC734.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; contract SignatureVerifier is FacetBase { using ECDSA for bytes32; diff --git a/contracts/interfaces/IexecERC20.sol b/contracts/interfaces/IexecERC20.sol index 1b4451532..281589934 100644 --- a/contracts/interfaces/IexecERC20.sol +++ b/contracts/interfaces/IexecERC20.sol @@ -4,9 +4,9 @@ pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; -interface IexecERC20 { - event Transfer(address indexed from, address indexed to, uint256 value); - event Approval(address indexed owner, address indexed spender, uint256 value); +import {IexecERC20Common} from "./IexecERC20Common.sol"; + +interface IexecERC20 is IexecERC20Common { function transfer(address, uint256) external returns (bool); function approve(address, uint256) external returns (bool); diff --git a/contracts/interfaces/IexecERC20Common.sol b/contracts/interfaces/IexecERC20Common.sol index c2a6247aa..650770883 100644 --- a/contracts/interfaces/IexecERC20Common.sol +++ b/contracts/interfaces/IexecERC20Common.sol @@ -4,7 +4,10 @@ pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; +// TODO merge with IexecERC20 interface. interface IexecERC20Common { + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); event Reward(address owner, uint256 amount, bytes32 ref); event Seize(address owner, uint256 amount, bytes32 ref); event Lock(address owner, uint256 amount); diff --git a/contracts/interfaces/IexecEscrowTokenSwap.sol b/contracts/interfaces/IexecEscrowTokenSwap.sol deleted file mode 100644 index 660bb88a7..000000000 --- a/contracts/interfaces/IexecEscrowTokenSwap.sol +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH -// SPDX-License-Identifier: Apache-2.0 - -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; - -import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; -import "../libs/IexecLibOrders_v5.sol"; - -// TODO add this to IexecInterfaceToken when the facet is deployed. -interface IexecEscrowTokenSwap { - receive() external payable; - fallback() external payable; - - function UniswapV2Router() external view returns (IUniswapV2Router02); - function estimateDepositEthSent(uint256) external view returns (uint256); - function estimateDepositTokenWanted(uint256) external view returns (uint256); - function estimateWithdrawTokenSent(uint256) external view returns (uint256); - function estimateWithdrawEthWanted(uint256) external view returns (uint256); - - function depositEth() external payable; - function depositEthFor(address) external payable; - function safeDepositEth(uint256) external payable; - function safeDepositEthFor(uint256, address) external payable; - function requestToken(uint256) external payable; - function requestTokenFor(uint256, address) external payable; - function withdrawEth(uint256) external; - function withdrawEthTo(uint256, address) external; - function safeWithdrawEth(uint256, uint256) external; - function safeWithdrawEthTo(uint256, uint256, address) external; - - function matchOrdersWithEth( - IexecLibOrders_v5.AppOrder memory, - IexecLibOrders_v5.DatasetOrder memory, - IexecLibOrders_v5.WorkerpoolOrder memory, - IexecLibOrders_v5.RequestOrder memory - ) external payable returns (bytes32); -} diff --git a/contracts/interfaces/IexecHubV3Interface.sol b/contracts/interfaces/IexecHubV3Interface.sol new file mode 100644 index 000000000..51820ab00 --- /dev/null +++ b/contracts/interfaces/IexecHubV3Interface.sol @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +pragma solidity ^0.8.0; + +/** + * iExec PoCo v3 interface. + */ +interface IexecHubV3Interface { + function viewScore(address worker) external returns (uint256); +} diff --git a/contracts/interfaces/IexecPocoAccessors.sol b/contracts/interfaces/IexecPocoAccessors.sol index 01dd4c61d..1c8d38dab 100644 --- a/contracts/interfaces/IexecPocoAccessors.sol +++ b/contracts/interfaces/IexecPocoAccessors.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; -import {IRegistry} from "../libs/PocoStorageLib.v8.sol"; +import {IRegistry} from "../registries/IRegistry.sol"; interface IexecPocoAccessors { // ========= Deal and Task Accessors ========= diff --git a/contracts/libs/PocoStorageLib.sol b/contracts/libs/PocoStorageLib.sol index 8091578dd..709a47c2c 100644 --- a/contracts/libs/PocoStorageLib.sol +++ b/contracts/libs/PocoStorageLib.sol @@ -1,18 +1,13 @@ -// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH +// SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "@iexec/interface/contracts/IexecHub.sol"; -import "@iexec/solidity/contracts/Libs/SafeMathExtended.sol"; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {IexecHubV3Interface} from "../interfaces/IexecHubV3Interface.sol"; +import {IERC20} from "@openzeppelin/contracts-v5/interfaces/IERC20.sol"; +import {IexecLibCore_v5} from "./IexecLibCore_v5.sol"; +import {IRegistry} from "../registries/IRegistry.sol"; -import "./IexecLibCore_v5.sol"; -import "./IexecLibOrders_v5.sol"; -import "./../registries/apps/App.sol"; -import "./../registries/datasets/Dataset.sol"; -import "./../registries/workerpools/Workerpool.sol"; -import "./../registries/IRegistry.sol"; /**************************************************************************** * WARNING: Be carefull when editing this file. * * * @@ -77,13 +72,16 @@ library PocoStorageLib { IexecLibCore_v5.Category[] m_categories; // Backward compatibility // Modified in IexecConfigurationFacet.configure - IexecHubInterface m_v3_iexecHub; + IexecHubV3Interface m_v3_iexecHub; mapping(address /* worker */ => bool) m_v3_scoreImported; + // /!\ New storage variables not present in v6 store. + // A mapping to store PoCo Boost deals. + mapping(bytes32 /* dealId */ => IexecLibCore_v5.DealBoost) m_dealsBoost; } function getPocoStorage() internal pure returns (PocoStorage storage $) { - assembly { - $_slot := POCO_STORAGE_LOCATION + assembly ("memory-safe") { + $.slot := POCO_STORAGE_LOCATION } } } diff --git a/contracts/libs/PocoStorageLib.v8.sol b/contracts/libs/PocoStorageLib.v8.sol deleted file mode 100644 index c9785ced8..000000000 --- a/contracts/libs/PocoStorageLib.v8.sol +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH -// SPDX-License-Identifier: Apache-2.0 - -pragma solidity ^0.8.0; - -import {IERC20} from "@openzeppelin/contracts-v5/interfaces/IERC20.sol"; -import {IERC721Enumerable} from "@openzeppelin/contracts-v5/interfaces/IERC721Enumerable.sol"; -import {Ownable} from "@openzeppelin/contracts-v5/access/Ownable.sol"; -import {IexecLibCore_v5} from "./IexecLibCore_v5.sol"; - -/**************************************************************************** - * WARNING: Be carefull when editing this file. * - * * - * If you want to add new variables, add them to the end of the * - * struct `PocoStorage`. * - * Read more about: * - * - Diamond proxy storage https://eips.ethereum.org/EIPS/eip-2535 * - * - Namespaced storage https://eips.ethereum.org/EIPS/eip-7201 * - * * - ****************************************************************************/ - -library PocoStorageLib { - // keccak256(abi.encode(uint256(keccak256("iexec.poco.storage.PocoStorage")) - 1)) & ~bytes32(uint256(0xff)); - bytes32 private constant POCO_STORAGE_LOCATION = - 0x5862653c6982c162832160cf30593645e8487b257e44d77cdd6b51eee2651b00; - - /// @custom:storage-location erc7201:iexec.poco.storage.PocoStorage - struct PocoStorage { - // Registries - IRegistry m_appregistry; - IRegistry m_datasetregistry; - IRegistry m_workerpoolregistry; - // Escrow - IERC20 m_baseToken; - string m_name; - string m_symbol; - uint8 m_decimals; - uint256 m_totalSupply; - // In order to use the protocol, users have to deposit RLC - // and allow PoCo smart contracts to manage them. This state - // variable keeps track of users balances. - mapping(address /* account */ => uint256 /* amount */) m_balances; - // When a deal is created, the protocol temporarily locks an amount - // of RLC tokens from the balances of both the requester and the workerpool owners. - // This is to guarantee the payment of different actors later. Frozen funds - // are released when the computation is completed and the result is pushed. - mapping(address /* account */ => uint256 /* amount */) m_frozens; - mapping(address /* owner */ => mapping(address /* spender */ => uint256 /* amount */)) m_allowances; - // EIP-712 domain hash. - // Modified in IexecConfigurationFacet.updateDomainSeparator - bytes32 m_eip712DomainSeparator; - // Mapping an order hash to its owner. Since a smart contract cannot sign orders - // with a private key, it adds an entry to this mapping to provide presigned orders. - mapping(bytes32 /* orderHash */ => address /* owner */) m_presigned; - // Each order has a volume (>=1). This tracks how much is consumed from - // the volume of each order. Mapping an order hash to its consumed amount. - mapping(bytes32 /* orderHash */ => uint256 /* consumedAmount */) m_consumed; - // a mapping to store PoCo classic deals. - mapping(bytes32 /* dealId */ => IexecLibCore_v5.Deal) m_deals; - mapping(bytes32 /* taskId */ => IexecLibCore_v5.Task) m_tasks; - mapping(bytes32 /* taskId */ => IexecLibCore_v5.Consensus) m_consensus; - mapping(bytes32 /* taskId */ => mapping(address /* worker */ => IexecLibCore_v5.Contribution)) m_contributions; - mapping(address /* worker */ => uint256 /* score */) m_workerScores; - // Poco - Settings - // Address of a trusted TEE authority that manages enclave challenges. - // Modified in IexecConfigurationFacet.setTeeBroker - address m_teebroker; - // Max amount of gas to be used with callbacks. - // Modified in IexecConfigurationFacet.setCallbackGas - uint256 m_callbackgas; - // List of defined computation categories. - IexecLibCore_v5.Category[] m_categories; - // Backward compatibility - // Modified in IexecConfigurationFacet.configure - address m_v3_iexecHub; // IexecHubInterface - mapping(address /* worker */ => bool) m_v3_scoreImported; - // /!\ New storage variables not present in v6 store. - // A mapping to store PoCo Boost deals. - mapping(bytes32 /* dealId */ => IexecLibCore_v5.DealBoost) m_dealsBoost; - } - - function getPocoStorage() internal pure returns (PocoStorage storage $) { - assembly ("memory-safe") { - $.slot := POCO_STORAGE_LOCATION - } - } -} - -// Use in registries. -interface IRegistry is IERC721Enumerable { - function isRegistered(address _entry) external view returns (bool); -} diff --git a/contracts/registries/IRegistry.sol b/contracts/registries/IRegistry.sol index ccdd27b18..5ff342780 100644 --- a/contracts/registries/IRegistry.sol +++ b/contracts/registries/IRegistry.sol @@ -1,9 +1,9 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; +import {IERC721Enumerable} from "@openzeppelin/contracts-v5/token/ERC721/extensions/IERC721Enumerable.sol"; interface IRegistry is IERC721Enumerable { function isRegistered(address _entry) external view returns (bool); diff --git a/contracts/registries/Registry.sol b/contracts/registries/Registry.sol index 61994856d..eddbb4013 100644 --- a/contracts/registries/Registry.sol +++ b/contracts/registries/Registry.sol @@ -1,26 +1,28 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "@iexec/solidity/contracts/Upgradeability/InitializableUpgradeabilityProxy.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; -import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; -import "@openzeppelin/contracts/utils/Create2.sol"; -import "./IRegistry.sol"; +import "./proxy/InitializableUpgradeabilityProxy.sol"; +import {Ownable} from "@openzeppelin/contracts-v5/access/Ownable.sol"; +import {ERC721} from "@openzeppelin/contracts-v5/token/ERC721/ERC721.sol"; +import {Create2} from "@openzeppelin/contracts-v5/utils/Create2.sol"; +import {IRegistry} from "./IRegistry.sol"; +import {ERC721Enumerable} from "@openzeppelin/contracts-v5/token/ERC721/extensions/ERC721Enumerable.sol"; -abstract contract Registry is IRegistry, ERC721, Ownable { +abstract contract Registry is IRegistry, ERC721Enumerable, Ownable { address public master; bytes public proxyCode; bytes32 public proxyCodeHash; IRegistry public previous; bool public initialized; + string private _baseUri; constructor( address _master, string memory _name, string memory _symbol - ) public ERC721(_name, _symbol) { + ) ERC721(_name, _symbol) Ownable(msg.sender) { master = _master; proxyCode = type(InitializableUpgradeabilityProxy).creationCode; proxyCodeHash = keccak256(proxyCode); @@ -32,14 +34,24 @@ abstract contract Registry is IRegistry, ERC721, Ownable { previous = IRegistry(_previous); } - function setBaseURI(string calldata _baseURI) external onlyOwner { - _setBaseURI(_baseURI); + function setBaseURI(string calldata baseUri) external onlyOwner { + _baseUri = baseUri; + } + + /** + * @dev Added for retrocompatibility! + * + * @dev Returns the base URI set via {setBaseURI}. This will be + * automatically added as a prefix in {tokenURI} to each token's ID. + */ + function baseURI() public view returns (string memory) { + return _baseURI(); } /* Interface */ function isRegistered(address _entry) external view override returns (bool) { return - _exists(uint256(_entry)) || + _ownerOf(uint256(uint160(_entry))) != address(0) || (address(previous) != address(0) && previous.isRegistered(_entry)); } @@ -56,21 +68,28 @@ abstract contract Registry is IRegistry, ERC721, Ownable { } /* Factory */ - function _mintCreate(address _owner, bytes memory _args) internal returns (uint256) { + function _mintCreate(address _owner, bytes memory _args) internal returns (address) { // Create entry (proxy) address entry = Create2.deploy(0, keccak256(abi.encodePacked(_args, _owner)), proxyCode); - // Initialize entry (casting to address payable is a pain in ^0.5.0) InitializableUpgradeabilityProxy(payable(entry)).initialize(master, _args); // Mint corresponding token - _mint(_owner, uint256(entry)); - return uint256(entry); + _mint(_owner, uint256(uint160(entry))); + return entry; } - function _mintPredict(address _owner, bytes memory _args) internal view returns (uint256) { + function _mintPredict(address _owner, bytes memory _args) internal view returns (address) { address entry = Create2.computeAddress( keccak256(abi.encodePacked(_args, _owner)), proxyCodeHash ); - return uint256(entry); + return entry; + } + + /** + * Overridden to use `_baseUri`. + * @dev See {ERC721-_baseURI}. + */ + function _baseURI() internal view override returns (string memory) { + return _baseUri; } } diff --git a/contracts/registries/RegistryEntry.sol b/contracts/registries/RegistryEntry.sol index 4c347b567..bcb5b308f 100644 --- a/contracts/registries/RegistryEntry.sol +++ b/contracts/registries/RegistryEntry.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "./Registry.sol"; @@ -18,7 +18,7 @@ abstract contract RegistryEntry { } function owner() public view returns (address) { - return registry.ownerOf(uint256(address(this))); + return registry.ownerOf(uint256(uint160(address(this)))); } /** diff --git a/contracts/registries/apps/App.sol b/contracts/registries/apps/App.sol index ba1adff69..d8884aedc 100644 --- a/contracts/registries/apps/App.sol +++ b/contracts/registries/apps/App.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../RegistryEntry.sol"; diff --git a/contracts/registries/apps/AppRegistry.sol b/contracts/registries/apps/AppRegistry.sol index 6d542a561..9e8680765 100644 --- a/contracts/registries/apps/AppRegistry.sol +++ b/contracts/registries/apps/AppRegistry.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../Registry.sol"; import "./App.sol"; @@ -14,10 +14,7 @@ contract AppRegistry is Registry { /** * Constructor */ - constructor() - public - Registry(address(new App()), "iExec Application Registry (V5)", "iExecAppsV5") - {} + constructor() Registry(address(new App()), "iExec Application Registry (V5)", "iExecAppsV5") {} /** * App creation diff --git a/contracts/registries/datasets/Dataset.sol b/contracts/registries/datasets/Dataset.sol index d6d7bb514..2e6037cbc 100644 --- a/contracts/registries/datasets/Dataset.sol +++ b/contracts/registries/datasets/Dataset.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../RegistryEntry.sol"; diff --git a/contracts/registries/datasets/DatasetRegistry.sol b/contracts/registries/datasets/DatasetRegistry.sol index ca5cfd818..fcf580b1d 100644 --- a/contracts/registries/datasets/DatasetRegistry.sol +++ b/contracts/registries/datasets/DatasetRegistry.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../Registry.sol"; import "./Dataset.sol"; @@ -15,7 +15,6 @@ contract DatasetRegistry is Registry { * Constructor */ constructor() - public Registry(address(new Dataset()), "iExec Dataset Registry (V5)", "iExecDatasetsV5") {} diff --git a/contracts/registries/proxy/Address.sol b/contracts/registries/proxy/Address.sol new file mode 100644 index 000000000..f182a7114 --- /dev/null +++ b/contracts/registries/proxy/Address.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: MIT + +/** + * Copied and adapted from: + * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/utils/Address.sol + * + * Changes: + * - Bump pragma solidity from 0.6.2 to 0.8.0; + * - Removed all functions except `isContract`. + */ + +pragma solidity ^0.8.0; + +// TODO refactor this with SignatureVerifier._isContract +library Address { + /** + * @dev Returns true if `account` is a contract. + * + * [IMPORTANT] + * ==== + * It is unsafe to assume that an address for which this function returns + * false is an externally-owned account (EOA) and not a contract. + * + * Among others, `isContract` will return false for the following + * types of addresses: + * + * - an externally-owned account + * - a contract in construction + * - an address where a contract will be created + * - an address where a contract lived, but was destroyed + * ==== + */ + function isContract(address account) internal view returns (bool) { + // This method relies in extcodesize, which returns 0 for contracts in + // construction, since the code is only stored at the end of the + // constructor execution. + + uint256 size; + // solhint-disable-next-line no-inline-assembly + assembly { size := extcodesize(account) } + return size > 0; + } +} diff --git a/contracts/registries/proxy/BaseUpgradeabilityProxy.sol b/contracts/registries/proxy/BaseUpgradeabilityProxy.sol new file mode 100644 index 000000000..43f4a8b34 --- /dev/null +++ b/contracts/registries/proxy/BaseUpgradeabilityProxy.sol @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +/** + * Copied and adapted from: + * https://github.com/iExecBlockchainComputing/iexec-solidity/tree/fec925a/contracts/Upgradeability + * + * Changes: + * - Bump pragma solidity from 0.6.0 to 0.8.0; + * - Use custom Address library instead of OpenZeppelin's; + */ + +pragma solidity ^0.8.0; + +import './Address.sol'; +import './Proxy.sol'; + +/** + * @title BaseUpgradeabilityProxy + * @dev This contract implements a proxy that allows to change the + * implementation address to which it will delegate. + * Such a change is called an implementation upgrade. + */ +contract BaseUpgradeabilityProxy is Proxy { + /** + * @dev Emitted when the implementation is upgraded. + * @param implementation Address of the new implementation. + */ + event Upgraded(address indexed implementation); + + /** + * @dev Storage slot with the address of the current implementation. + * This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and is + * validated in the constructor. + */ + bytes32 internal constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3; + + /** + * @dev Returns the current implementation. + * @return impl Address of the current implementation + */ + function _implementation() internal override view returns (address impl) { + bytes32 slot = IMPLEMENTATION_SLOT; + assembly { + impl := sload(slot) + } + } + + /** + * @dev Upgrades the proxy to a new implementation. + * @param newImplementation Address of the new implementation. + */ + function _upgradeTo(address newImplementation) internal { + _setImplementation(newImplementation); + emit Upgraded(newImplementation); + } + + /** + * @dev Sets the implementation address of the proxy. + * @param newImplementation Address of the new implementation. + */ + function _setImplementation(address newImplementation) internal { + require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address"); + + bytes32 slot = IMPLEMENTATION_SLOT; + + assembly { + sstore(slot, newImplementation) + } + } +} diff --git a/contracts/registries/proxy/InitializableUpgradeabilityProxy.sol b/contracts/registries/proxy/InitializableUpgradeabilityProxy.sol new file mode 100644 index 000000000..b621080d4 --- /dev/null +++ b/contracts/registries/proxy/InitializableUpgradeabilityProxy.sol @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +/** + * Copied and adapted from: + * https://github.com/iExecBlockchainComputing/iexec-solidity/tree/fec925a/contracts/Upgradeability + * + * Changes: + * - Bump pragma solidity from 0.6.0 to 0.8.0; + */ + +pragma solidity ^0.8.0; + +import './BaseUpgradeabilityProxy.sol'; + +/** + * @title InitializableUpgradeabilityProxy + * @dev Extends BaseUpgradeabilityProxy with an initializer for initializing + * implementation and init data. + */ +contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy { + /** + * @dev Contract initializer. + * @param _logic Address of the initial implementation. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + function initialize(address _logic, bytes memory _data) public payable { + require(_implementation() == address(0)); + assert(IMPLEMENTATION_SLOT == keccak256("org.zeppelinos.proxy.implementation")); + _setImplementation(_logic); + if(_data.length > 0) { + (bool success,) = _logic.delegatecall(_data); + require(success); + } + } +} diff --git a/contracts/registries/proxy/Proxy.sol b/contracts/registries/proxy/Proxy.sol new file mode 100644 index 000000000..c67b81079 --- /dev/null +++ b/contracts/registries/proxy/Proxy.sol @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +/** + * Copied and adapted from: + * https://github.com/iExecBlockchainComputing/iexec-solidity/tree/fec925a/contracts/Upgradeability + * + * Changes: + * - Bump pragma solidity from 0.6.0 to 0.8.0; + */ +pragma solidity ^0.8.0; + +/** + * @title Proxy + * @dev Implements delegation of calls to other contracts, with proper + * forwarding of return values and bubbling of failures. + * It defines a fallback function that delegates all calls to the address + * returned by the abstract _implementation() internal function. + */ +abstract contract Proxy { + /** + * @dev Receive function. + * Implemented entirely in `_fallback`. + */ + receive() external payable virtual { + _fallback(); + } + + /** + * @dev Fallback function. + * Implemented entirely in `_fallback`. + */ + fallback() external payable { + _fallback(); + } + + /** + * @return impl The Address of the implementation. + */ + function _implementation() internal virtual view returns (address impl); + + /** + * @dev Delegates execution to an implementation contract. + * This is a low level function that doesn't return to its internal call site. + * It will return to the external caller whatever the implementation returns. + * @param implementation Address to delegate. + */ + function _delegate(address implementation) internal { + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize()) + + // Call the implementation. + // out and outsize are 0 because we don't know the size yet. + let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) + + // Copy the returned data. + returndatacopy(0, 0, returndatasize()) + + switch result + // delegatecall returns 0 on error. + case 0 { revert(0, returndatasize()) } + default { return(0, returndatasize()) } + } + } + + /** + * @dev Function that is run as the first thing in the fallback function. + * Can be redefined in derived contracts to add functionality. + * Redefinitions must call super._willFallback(). + */ + function _willFallback() internal virtual { + } + + /** + * @dev fallback implementation. + * Extracted to enable manual triggering. + */ + function _fallback() internal { + _willFallback(); + _delegate(_implementation()); + } +} diff --git a/contracts/registries/workerpools/Workerpool.sol b/contracts/registries/workerpools/Workerpool.sol index c9ad8e95f..2c6f1e5eb 100644 --- a/contracts/registries/workerpools/Workerpool.sol +++ b/contracts/registries/workerpools/Workerpool.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../RegistryEntry.sol"; diff --git a/contracts/registries/workerpools/WorkerpoolRegistry.sol b/contracts/registries/workerpools/WorkerpoolRegistry.sol index 26908e863..91df9dffa 100644 --- a/contracts/registries/workerpools/WorkerpoolRegistry.sol +++ b/contracts/registries/workerpools/WorkerpoolRegistry.sol @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../Registry.sol"; import "./Workerpool.sol"; @@ -15,7 +15,6 @@ contract WorkerpoolRegistry is Registry { * Constructor */ constructor() - public Registry(address(new Workerpool()), "iExec Workerpool Registry (V5)", "iExecWorkerpoolV5") {} diff --git a/contracts/tools/diagrams/StorageDiagrams.sol b/contracts/tools/diagrams/StorageDiagrams.sol index 659838437..735c70fd0 100644 --- a/contracts/tools/diagrams/StorageDiagrams.sol +++ b/contracts/tools/diagrams/StorageDiagrams.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {LibDiamond} from "@mudgen/diamond-1/contracts/libraries/LibDiamond.sol"; -import {PocoStorageLib} from "../../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../../libs/PocoStorageLib.sol"; // /!\ These contracts are only used to generate storage diagrams, they are not meant // to be deployed or used in any way. diff --git a/contracts/tools/testing/IexecEscrowTestContract.sol b/contracts/tools/testing/IexecEscrowTestContract.sol index 9fce2bf49..13863259d 100644 --- a/contracts/tools/testing/IexecEscrowTestContract.sol +++ b/contracts/tools/testing/IexecEscrowTestContract.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {IexecEscrow} from "../../facets/IexecEscrow.v8.sol"; -import {PocoStorageLib} from "../../libs/PocoStorageLib.v8.sol"; +import {PocoStorageLib} from "../../libs/PocoStorageLib.sol"; /** * @notice a wrapper contract to make internal functions of diff --git a/contracts/tools/testing/TestClient.sol b/contracts/tools/testing/TestClient.sol index f5e11e949..3486508b8 100644 --- a/contracts/tools/testing/TestClient.sol +++ b/contracts/tools/testing/TestClient.sol @@ -1,9 +1,9 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "@iexec/solidity/contracts/ERC1154/IERC1154.sol"; +import {IOracleConsumer} from "../../external/interfaces/IOracleConsumer.sol"; contract TestClient is IOracleConsumer { event GotResult(bytes32 indexed id, bytes result); @@ -11,8 +11,6 @@ contract TestClient is IOracleConsumer { mapping(bytes32 => uint256) public gstore; mapping(bytes32 => bytes) public store; - constructor() public {} - function receiveResult(bytes32 id, bytes calldata result) external override { gstore[id] = gasleft(); store[id] = result; diff --git a/contracts/tools/testing/TestReceiver.sol b/contracts/tools/testing/TestReceiver.sol index bf6da27f4..2d2821723 100644 --- a/contracts/tools/testing/TestReceiver.sol +++ b/contracts/tools/testing/TestReceiver.sol @@ -1,15 +1,13 @@ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../../interfaces/IexecTokenSpender.sol"; contract TestReceiver is IexecTokenSpender { event GotApproval(address sender, uint256 value, address token, bytes extraData); - constructor() public {} - function receiveApproval( address _sender, uint256 _value, diff --git a/deploy/0_deploy.ts b/deploy/0_deploy.ts index 6a3402465..f4b507594 100644 --- a/deploy/0_deploy.ts +++ b/deploy/0_deploy.ts @@ -31,12 +31,12 @@ import { IexecPocoBoostAccessorsFacet__factory, IexecPocoBoostFacet__factory, IexecRelayFacet__factory, + Ownable__factory, OwnershipFacet__factory, RLC__factory, WorkerpoolRegistry__factory, } from '../typechain'; import { DiamondArgsStruct } from '../typechain/contracts/Diamond'; -import { Ownable__factory } from '../typechain/factories/@openzeppelin/contracts/access'; import { FactoryDeployer } from '../utils/FactoryDeployer'; import config, { isArbitrumChainId, isArbitrumSepoliaChainId } from '../utils/config'; import { getDeployerAndOwnerSigners } from '../utils/deploy-tools'; @@ -102,7 +102,6 @@ export default async function deploy() { new IexecConfigurationFacet__factory(iexecLibOrders), new IexecERC20Facet__factory(), isTokenMode ? new IexecEscrowTokenFacet__factory() : new IexecEscrowNativeFacet__factory(), - // new IexecEscrowTokenSwapFacet__factory(), not deployed. new IexecOrderManagementFacet__factory(iexecLibOrders), new IexecPoco1Facet__factory(iexecLibOrders), new IexecPoco2Facet__factory(), diff --git a/docs/solidity/index.md b/docs/solidity/index.md index fb587fc8d..88fdf3fb9 100644 --- a/docs/solidity/index.md +++ b/docs/solidity/index.md @@ -1437,7 +1437,7 @@ struct PocoStorage { address m_teebroker; uint256 m_callbackgas; struct IexecLibCore_v5.Category[] m_categories; - contract IexecHubInterface m_v3_iexecHub; + contract IexecHubV3Interface m_v3_iexecHub; mapping(address => bool) m_v3_scoreImported; } ``` diff --git a/hardhat.config.ts b/hardhat.config.ts index f87b74197..b419a23b5 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -241,7 +241,6 @@ const config: HardhatUserConfig = { 'facets/FacetBase.sol', // duplicated in FacetBase.v8.sol 'facets/IexecAccessorsABILegacyFacet.sol', // not relevant // kept for events 'facets/IexecERC20Core.sol', // contains only internal/private - 'facets/IexecEscrowTokenSwapFacet.sol', // not relevant // kept for events 'facets/IexecEscrow.v8.sol', // contains only internal/private 'facets/IexecPocoCommon.sol', // contains only internal/private 'facets/SignatureVerifier.sol', // contains only internal/private @@ -249,8 +248,6 @@ const config: HardhatUserConfig = { 'interfaces', // interesting for events but too much doc duplication if enabled 'tools', 'Diamond.sol', // not relevant - 'IexecInterfaceNativeABILegacy.sol', // not relevant - 'IexecInterfaceTokenABILegacy.sol', // not relevant ], }, mocha: { timeout: 300000 }, diff --git a/scripts/tools/sol-to-uml.mjs b/scripts/tools/sol-to-uml.mjs index af32a3dcd..71b6d7c1c 100644 --- a/scripts/tools/sol-to-uml.mjs +++ b/scripts/tools/sol-to-uml.mjs @@ -21,14 +21,9 @@ await generateClassDiagramOfContracts( ) await generateClassDiagramOfContracts( - [ - 'IexecEscrowNativeFacet', - 'IexecEscrowTokenFacet', - 'IexecEscrowTokenSwapFacet', - 'IexecEscrow', - ], + ['IexecEscrowNativeFacet', 'IexecEscrowTokenFacet', 'IexecEscrow'], 'IexecEscrows', -) +); await generateClassDiagramOfContracts( ['IexecPocoBoostFacet'], diff --git a/test/000_fullchain-boost.test.ts b/test/000_fullchain-boost.test.ts index 16956acd4..9f47385f9 100644 --- a/test/000_fullchain-boost.test.ts +++ b/test/000_fullchain-boost.test.ts @@ -14,7 +14,7 @@ import { IexecPocoBoostFacet, IexecPocoBoostFacet__factory, TestClient__factory, - WorkerpoolInterface__factory, + IWorkerpool__factory, } from '../typechain'; import * as constants from '../utils/constants'; import { TAG_TEE } from '../utils/constants'; @@ -204,7 +204,7 @@ describe('IexecPocoBoostFacet (IT)', function () { expect(deal.workerpoolOwner).to.be.equal(scheduler.address); expect(deal.workerpoolPrice).to.be.equal(workerpoolPrice); expect(deal.requester).to.be.equal(requester.address); - const schedulerRewardRatio = await WorkerpoolInterface__factory.connect( + const schedulerRewardRatio = await IWorkerpool__factory.connect( workerpoolAddress, anyone, ).m_schedulerRewardRatioPolicy(); @@ -369,7 +369,7 @@ describe('IexecPocoBoostFacet (IT)', function () { expect(deal.workerpoolPrice).to.be.equal(workerpoolPrice); expect(deal.requester).to.be.equal(requester.address); expect(deal.sponsor).to.be.equal(sponsor.address); - const schedulerRewardRatio = await WorkerpoolInterface__factory.connect( + const schedulerRewardRatio = await IWorkerpool__factory.connect( workerpoolAddress, anyone, ).m_schedulerRewardRatioPolicy(); diff --git a/test/byContract/IexecERC20/IexecERC20.test.ts b/test/byContract/IexecERC20/IexecERC20.test.ts index c812e0a6d..1708f9eb7 100644 --- a/test/byContract/IexecERC20/IexecERC20.test.ts +++ b/test/byContract/IexecERC20/IexecERC20.test.ts @@ -97,7 +97,7 @@ describe('ERC20', async () => { it('Should not transfer when sender balance is too low', async () => { await expect( iexecPocoAsHolder.transfer(recipient.address, value + 1n), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); }); @@ -201,13 +201,13 @@ describe('ERC20', async () => { it('Should not transferFrom when owner balance is too low', async () => { await expect( iexecPocoAsSpender.transferFrom(holder.address, spender.address, value + 1n), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); it('Should not transferFrom when spender allowance is too low', async () => { await iexecPocoAsHolder.approve(spender.address, value - 1n).then((tx) => tx.wait()); await expect( iexecPocoAsSpender.transferFrom(holder.address, spender.address, value), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); }); @@ -260,7 +260,7 @@ describe('ERC20', async () => { it('Should not decrease allowance of a value greater than old allowance', async () => { await expect( iexecPocoAsHolder.decreaseAllowance(spender.address, 1), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); it('Should not decrease allowance from the zero address', async () => { await expect( diff --git a/test/byContract/IexecEscrow/IexecEscrowNative.test.ts b/test/byContract/IexecEscrow/IexecEscrowNative.test.ts index 0c396a957..657c8334d 100644 --- a/test/byContract/IexecEscrow/IexecEscrowNative.test.ts +++ b/test/byContract/IexecEscrow/IexecEscrowNative.test.ts @@ -254,9 +254,9 @@ if (config.isNativeChain()) { }); it('Should not withdraw native tokens with empty balance', async () => { - await expect( - iexecPocoAsAccountA.withdraw(...withdrawArg), - ).to.be.revertedWithoutReason(); + await expect(iexecPocoAsAccountA.withdraw(...withdrawArg)).to.be.revertedWithPanic( + 0x11, + ); }); it('Should not withdraw native tokens with insufficient balance', async () => { @@ -264,7 +264,7 @@ if (config.isNativeChain()) { await expect( iexecPocoAsAccountA.withdraw(depositAmount * 2n), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); }); @@ -289,7 +289,7 @@ if (config.isNativeChain()) { const withdrawToArgs = [...withdrawArg, accountB.address] as [bigint, string]; await expect( iexecPocoAsAccountA.withdrawTo(...withdrawToArgs), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); it('Should not withdraw To native tokens with insufficient balance', async () => { @@ -297,7 +297,7 @@ if (config.isNativeChain()) { const withdrawToArgs = [...withdrawArg, accountB.address] as [bigint, string]; await expect( iexecPocoAsAccountA.withdrawTo(withdrawToArgs[0] * 2n, withdrawToArgs[1]), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); }); diff --git a/test/byContract/IexecEscrow/IexecEscrowToken.test.ts b/test/byContract/IexecEscrow/IexecEscrowToken.test.ts index f7bf57223..10978d2ec 100644 --- a/test/byContract/IexecEscrow/IexecEscrowToken.test.ts +++ b/test/byContract/IexecEscrow/IexecEscrowToken.test.ts @@ -305,13 +305,13 @@ describe('IexecEscrowToken', () => { .withArgs(proxyAddress, accountA.address, 0); }); it('Should not withdraw tokens with empty balance', async () => { - await expect(iexecPocoAsAccountA.withdraw(amount)).to.be.revertedWithoutReason(); + await expect(iexecPocoAsAccountA.withdraw(amount)).to.be.revertedWithPanic(0x11); }); it('Should not withdraw tokens with insufficient balance', async () => { await rlcInstanceAsAccountA.approve(proxyAddress, amount).then((tx) => tx.wait()); await iexecPocoAsAccountA.deposit(amount).then((tx) => tx.wait()); - await expect(iexecPocoAsAccountA.withdraw(amount + 1n)).to.be.revertedWithoutReason(); + await expect(iexecPocoAsAccountA.withdraw(amount + 1n)).to.be.revertedWithPanic(0x11); }); }); @@ -366,7 +366,7 @@ describe('IexecEscrowToken', () => { it('Should not withdraw to another address with empty balance', async () => { await expect( iexecPocoAsAccountA.withdrawTo(amount, accountB.address), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); it('Should not withdraw to another address with insufficient balance', async () => { await rlcInstanceAsAccountA.approve(proxyAddress, amount).then((tx) => tx.wait()); @@ -374,7 +374,7 @@ describe('IexecEscrowToken', () => { await expect( iexecPocoAsAccountA.withdrawTo(amount + 1n, accountB.address), - ).to.be.revertedWithoutReason(); + ).to.be.revertedWithPanic(0x11); }); }); diff --git a/test/byContract/registries/registries.test.ts b/test/byContract/registries/registries.test.ts index 96f4837d5..1a13006f3 100644 --- a/test/byContract/registries/registries.test.ts +++ b/test/byContract/registries/registries.test.ts @@ -97,15 +97,15 @@ describe('Registries', () => { }); it('Should not initialize when user is not the owner', async () => { - await expect(appRegistry.initialize(ZeroAddress)).to.be.revertedWith( - 'Ownable: caller is not the owner', - ); - await expect(datasetRegistry.initialize(ZeroAddress)).to.be.revertedWith( - 'Ownable: caller is not the owner', - ); - await expect(workerpoolRegistry.initialize(ZeroAddress)).to.be.revertedWith( - 'Ownable: caller is not the owner', - ); + await expect(appRegistry.initialize(ZeroAddress)) + .to.be.revertedWithCustomError(appRegistry, 'OwnableUnauthorizedAccount') + .withArgs(anyone.address); + await expect(datasetRegistry.initialize(ZeroAddress)) + .to.be.revertedWithCustomError(datasetRegistry, 'OwnableUnauthorizedAccount') + .withArgs(anyone.address); + await expect(workerpoolRegistry.initialize(ZeroAddress)) + .to.be.revertedWithCustomError(workerpoolRegistry, 'OwnableUnauthorizedAccount') + .withArgs(anyone.address); }); it('Should not reinitialize', async () => { @@ -131,15 +131,15 @@ describe('Registries', () => { }); it('Should not set base URI when user is not the owner', async () => { - await expect(appRegistry.setBaseURI(`https://new.url.iex.ec/app/`)).to.be.revertedWith( - 'Ownable: caller is not the owner', - ); - await expect( - datasetRegistry.setBaseURI(`https://new.url.iex.ec/dataset/`), - ).to.be.revertedWith('Ownable: caller is not the owner'); - await expect( - workerpoolRegistry.setBaseURI(`https://new.url.iex.ec/workerpool/`), - ).to.be.revertedWith('Ownable: caller is not the owner'); + await expect(appRegistry.setBaseURI(`https://new.url.iex.ec/app/`)) + .to.be.revertedWithCustomError(appRegistry, 'OwnableUnauthorizedAccount') + .withArgs(anyone.address); + await expect(datasetRegistry.setBaseURI(`https://new.url.iex.ec/dataset/`)) + .to.be.revertedWithCustomError(datasetRegistry, 'OwnableUnauthorizedAccount') + .withArgs(anyone.address); + await expect(workerpoolRegistry.setBaseURI(`https://new.url.iex.ec/workerpool/`)) + .to.be.revertedWithCustomError(workerpoolRegistry, 'OwnableUnauthorizedAccount') + .withArgs(anyone.address); }); }); @@ -280,7 +280,7 @@ describe('Registries', () => { await expect( appRegistry.createApp(appProvider.address, ...createAppArgs), - ).to.be.revertedWith('Create2: Failed on deploy'); + ).to.be.revertedWithCustomError(appRegistry, 'Create2FailedDeployment'); }); it('Should check that a new app is well registered on new app registry', async () => { @@ -385,7 +385,7 @@ describe('Registries', () => { await expect( datasetRegistry.createDataset(datasetProvider.address, ...createDatasetArgs), - ).to.be.revertedWith('Create2: Failed on deploy'); + ).to.be.revertedWithCustomError(datasetRegistry, 'Create2FailedDeployment'); }); }); @@ -469,7 +469,7 @@ describe('Registries', () => { await expect( workerpoolRegistry.createWorkerpool(scheduler.address, ...createWorkerpoolArgs), - ).to.be.revertedWith('Create2: Failed on deploy'); + ).to.be.revertedWithCustomError(workerpoolRegistry, 'Create2FailedDeployment'); }); }); diff --git a/utils/proxy-tools.ts b/utils/proxy-tools.ts index a51898ae9..ae8c1979f 100644 --- a/utils/proxy-tools.ts +++ b/utils/proxy-tools.ts @@ -19,7 +19,6 @@ import { IexecERC20Facet__factory, IexecEscrowNativeFacet__factory, IexecEscrowTokenFacet__factory, - IexecEscrowTokenSwapFacet__factory, IexecOrderManagementFacet__factory, IexecPoco1Facet__factory, IexecPoco2Facet__factory, @@ -145,7 +144,6 @@ function getAllLocalFacetFunctions(): Map { IexecERC20Facet__factory.createInterface(), IexecEscrowNativeFacet__factory.createInterface(), IexecEscrowTokenFacet__factory.createInterface(), - IexecEscrowTokenSwapFacet__factory.createInterface(), IexecOrderManagementFacet__factory.createInterface(), IexecPoco1Facet__factory.createInterface(), IexecPoco2Facet__factory.createInterface(),