diff --git a/deployments/mainnet/GelatoCore.json b/deployments/mainnet/GelatoCore.json
new file mode 100644
index 0000000..006e878
--- /dev/null
+++ b/deployments/mainnet/GelatoCore.json
@@ -0,0 +1,3856 @@
+{
+ "address": "0x025030bdaa159f281cae63873e68313a703725a5",
+ "abi": [
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "gelatoGasPriceOracle",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "oracleRequestData",
+ "type": "bytes"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gelatoMaxGas",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "internalGasRequirement",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "minExecutorStake",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "executorSuccessShare",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "sysAdminSuccessShare",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "totalSuccessShare",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct IGelatoSysAdmin.GelatoSysAdminInitialState",
+ "name": "_",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "executor",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "taskReceiptId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "string",
+ "name": "reason",
+ "type": "string"
+ }
+ ],
+ "name": "LogCanExecFailed",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "executor",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "taskReceiptId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "executorRefund",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "string",
+ "name": "reason",
+ "type": "string"
+ }
+ ],
+ "name": "LogExecReverted",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "executor",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "taskReceiptId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "executorSuccessFee",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "sysAdminSuccessFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogExecSuccess",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "oldExecutor",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "newExecutor",
+ "type": "address"
+ }
+ ],
+ "name": "LogExecutorAssignedExecutor",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "executor",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "withdrawAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogExecutorBalanceWithdrawn",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "executor",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldStake",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newStake",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogExecutorStaked",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldShare",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newShare",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "total",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogExecutorSuccessShareSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "executor",
+ "type": "address"
+ }
+ ],
+ "name": "LogExecutorUnstaked",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newProviderFunds",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogFundsProvided",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "realWithdrawAmount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newProviderFunds",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogFundsUnprovided",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "oldOracle",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "newOracle",
+ "type": "address"
+ }
+ ],
+ "name": "LogGelatoGasPriceOracleSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldMaxGas",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newMaxGas",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogGelatoMaxGasSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldRequirment",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newRequirment",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogInternalGasRequirementSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldMin",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newMin",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogMinExecutorStakeSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "bytes",
+ "name": "oldData",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "internalType": "bytes",
+ "name": "newData",
+ "type": "bytes"
+ }
+ ],
+ "name": "LogOracleRequestDataSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "oldExecutor",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "newExecutor",
+ "type": "address"
+ }
+ ],
+ "name": "LogProviderAssignedExecutor",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "name": "LogProviderModuleAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "name": "LogProviderModuleRemoved",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldBalance",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newBalance",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogSysAdminFundsWithdrawn",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldShare",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newShare",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "total",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogSysAdminSuccessShareSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "taskReceiptId",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "cancellor",
+ "type": "address"
+ }
+ ],
+ "name": "LogTaskCancelled",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "bytes32",
+ "name": "taskSpecHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "oldTaskSpecGasPriceCeil",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "newTaskSpecGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "name": "LogTaskSpecGasPriceCeilSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "bytes32",
+ "name": "taskSpecHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTaskSpecProvided",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "provider",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "bytes32",
+ "name": "taskSpecHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTaskSpecUnprovided",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "taskReceiptId",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "internalType": "bytes32",
+ "name": "taskReceiptHash",
+ "type": "bytes32"
+ },
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "indexed": false,
+ "internalType": "struct TaskReceipt",
+ "name": "taskReceipt",
+ "type": "tuple"
+ }
+ ],
+ "name": "LogTaskSubmitted",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "previousOwner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnershipTransferred",
+ "type": "event"
+ },
+ {
+ "inputs": [],
+ "name": "EXEC_TX_OVERHEAD",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "NO_CEIL",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "contract IGelatoProviderModule[]",
+ "name": "_modules",
+ "type": "address[]"
+ }
+ ],
+ "name": "addProviderModules",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskReceipt",
+ "name": "_TR",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gelatoGasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "canExec",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task",
+ "name": "_task",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_expiryDate",
+ "type": "uint256"
+ }
+ ],
+ "name": "canSubmitTask",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskReceipt",
+ "name": "_TR",
+ "type": "tuple"
+ }
+ ],
+ "name": "cancelTask",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "currentTaskReceiptId",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskReceipt",
+ "name": "_TR",
+ "type": "tuple"
+ }
+ ],
+ "name": "exec",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskReceipt",
+ "name": "taskReceipt",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gelatoGasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "executionWrapper",
+ "outputs": [
+ {
+ "internalType": "enum GelatoCore.ExecutionResult",
+ "name": "",
+ "type": "uint8"
+ },
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_provider",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "_newExecutor",
+ "type": "address"
+ }
+ ],
+ "name": "executorAssignsExecutor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "executorByProvider",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "executorProvidersCount",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "executorStake",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_gas",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "executorSuccessFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "executorSuccessShare",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "gelatoGasPriceOracle",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "gelatoMaxGas",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskReceipt",
+ "name": "_TR",
+ "type": "tuple"
+ }
+ ],
+ "name": "hashTaskReceipt",
+ "outputs": [
+ {
+ "internalType": "bytes32",
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition[]",
+ "name": "conditions",
+ "type": "address[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskSpec",
+ "name": "_taskSpec",
+ "type": "tuple"
+ }
+ ],
+ "name": "hashTaskSpec",
+ "outputs": [
+ {
+ "internalType": "bytes32",
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "internalGasRequirement",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_executor",
+ "type": "address"
+ }
+ ],
+ "name": "isExecutorAssigned",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_executor",
+ "type": "address"
+ }
+ ],
+ "name": "isExecutorMinStaked",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_provider",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "_module",
+ "type": "address"
+ }
+ ],
+ "name": "isModuleProvided",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "isOwner",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_provider",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gelatoMaxGas",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gelatoGasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "isProviderLiquid",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task",
+ "name": "_task",
+ "type": "tuple"
+ }
+ ],
+ "name": "isTaskProvided",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "res",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_provider",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition[]",
+ "name": "conditions",
+ "type": "address[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskSpec",
+ "name": "_taskSpec",
+ "type": "tuple"
+ }
+ ],
+ "name": "isTaskSpecProvided",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_gelatoMaxGas",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gelatoGasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "minExecProviderFunds",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "minExecutorStake",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "id",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address",
+ "name": "userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "provider",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "cycleId",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "submissionsLeft",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskReceipt[]",
+ "name": "_taskReceipts",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "multiCancelTasks",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_executor",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition[]",
+ "name": "conditions",
+ "type": "address[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskSpec[]",
+ "name": "_taskSpecs",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule[]",
+ "name": "_modules",
+ "type": "address[]"
+ }
+ ],
+ "name": "multiProvide",
+ "outputs": [],
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address[]",
+ "name": "_providers",
+ "type": "address[]"
+ },
+ {
+ "internalType": "address",
+ "name": "_newExecutor",
+ "type": "address"
+ }
+ ],
+ "name": "multiReassignProviders",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_withdrawAmount",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition[]",
+ "name": "conditions",
+ "type": "address[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskSpec[]",
+ "name": "_taskSpecs",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule[]",
+ "name": "_modules",
+ "type": "address[]"
+ }
+ ],
+ "name": "multiUnprovide",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "oracleRequestData",
+ "outputs": [
+ {
+ "internalType": "bytes",
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_provider",
+ "type": "address"
+ }
+ ],
+ "name": "provideFunds",
+ "outputs": [],
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition[]",
+ "name": "conditions",
+ "type": "address[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskSpec[]",
+ "name": "_taskSpecs",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "provideTaskSpecs",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_newExecutor",
+ "type": "address"
+ }
+ ],
+ "name": "providerAssignsExecutor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task",
+ "name": "_task",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gelatoGasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "providerCanExec",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "providerFunds",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_userProxy",
+ "type": "address"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task",
+ "name": "_task",
+ "type": "tuple"
+ }
+ ],
+ "name": "providerModuleChecks",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_provider",
+ "type": "address"
+ }
+ ],
+ "name": "providerModules",
+ "outputs": [
+ {
+ "internalType": "contract IGelatoProviderModule[]",
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "contract IGelatoProviderModule[]",
+ "name": "_modules",
+ "type": "address[]"
+ }
+ ],
+ "name": "removeProviderModules",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "renounceOwnership",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_percentage",
+ "type": "uint256"
+ }
+ ],
+ "name": "setExecutorSuccessShare",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "_newOracle",
+ "type": "address"
+ }
+ ],
+ "name": "setGelatoGasPriceOracle",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_newMaxGas",
+ "type": "uint256"
+ }
+ ],
+ "name": "setGelatoMaxGas",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_newRequirement",
+ "type": "uint256"
+ }
+ ],
+ "name": "setInternalGasRequirement",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_newMin",
+ "type": "uint256"
+ }
+ ],
+ "name": "setMinExecutorStake",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes",
+ "name": "_requestData",
+ "type": "bytes"
+ }
+ ],
+ "name": "setOracleRequestData",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_percentage",
+ "type": "uint256"
+ }
+ ],
+ "name": "setSysAdminSuccessShare",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes32",
+ "name": "_taskSpecHash",
+ "type": "bytes32"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "name": "setTaskSpecGasPriceCeil",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "stakeExecutor",
+ "outputs": [],
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task",
+ "name": "_task",
+ "type": "tuple"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_expiryDate",
+ "type": "uint256"
+ }
+ ],
+ "name": "submitTask",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "_tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_sumOfRequestedTaskSubmits",
+ "type": "uint256"
+ }
+ ],
+ "name": "submitTaskChain",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "contract IGelatoProviderModule",
+ "name": "module",
+ "type": "address"
+ }
+ ],
+ "internalType": "struct Provider",
+ "name": "_provider",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition",
+ "name": "inst",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "internalType": "struct Condition[]",
+ "name": "conditions",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasLimit",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "selfProviderGasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Task[]",
+ "name": "_tasks",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_expiryDate",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_cycles",
+ "type": "uint256"
+ }
+ ],
+ "name": "submitTaskCycle",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "sysAdminFunds",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_gas",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "_gasPrice",
+ "type": "uint256"
+ }
+ ],
+ "name": "sysAdminSuccessFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "sysAdminSuccessShare",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "taskReceiptHash",
+ "outputs": [
+ {
+ "internalType": "bytes32",
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes32",
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "taskSpecGasPriceCeil",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSuccessShare",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_withdrawAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "unprovideFunds",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "realWithdrawAmount",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ {
+ "internalType": "contract IGelatoCondition[]",
+ "name": "conditions",
+ "type": "address[]"
+ },
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bytes",
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "internalType": "enum Operation",
+ "name": "operation",
+ "type": "uint8"
+ },
+ {
+ "internalType": "enum DataFlow",
+ "name": "dataFlow",
+ "type": "uint8"
+ },
+ {
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "termsOkCheck",
+ "type": "bool"
+ }
+ ],
+ "internalType": "struct Action[]",
+ "name": "actions",
+ "type": "tuple[]"
+ },
+ {
+ "internalType": "uint256",
+ "name": "gasPriceCeil",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct TaskSpec[]",
+ "name": "_taskSpecs",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "unprovideTaskSpecs",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "unstakeExecutor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_withdrawAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "withdrawExcessExecutorStake",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "realWithdrawAmount",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "_amount",
+ "type": "uint256"
+ },
+ {
+ "internalType": "address payable",
+ "name": "_to",
+ "type": "address"
+ }
+ ],
+ "name": "withdrawSysAdminFunds",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "realWithdrawAmount",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "transactionHash": "0xe1525de7b17464c90d5dfaa71098745058c42ef36c1d7854139115a48b5bf1e6",
+ "receipt": {
+ "to": null,
+ "from": "0x5b753bf02a42bc73b5846dfd16a8f2e082b99a6a",
+ "contractAddress": "0x025030bdaa159f281cae63873e68313a703725a5",
+ "transactionIndex": "0x39",
+ "gasUsed": "0x533987",
+ "logsBloom": "0x00000000000000000400000000000000000000000000000000800000000000000000000000040000000000000000000000000000000000000000000000000000000000400000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000004000000000001000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
+ "blockHash": "0x5b1944d37d02d405bbb798661730a787c0be6fc1e99274ea495933d25167eb2a",
+ "transactionHash": "0xe1525de7b17464c90d5dfaa71098745058c42ef36c1d7854139115a48b5bf1e6",
+ "logs": [
+ {
+ "address": "0x025030bdaa159f281cae63873e68313a703725a5",
+ "blockHash": "0x5b1944d37d02d405bbb798661730a787c0be6fc1e99274ea495933d25167eb2a",
+ "blockNumber": "0xad5ec3",
+ "data": "0x",
+ "logIndex": "0xa3",
+ "removed": false,
+ "topics": [
+ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
+ "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "0x0000000000000000000000005b753bf02a42bc73b5846dfd16a8f2e082b99a6a"
+ ],
+ "transactionHash": "0xe1525de7b17464c90d5dfaa71098745058c42ef36c1d7854139115a48b5bf1e6",
+ "transactionIndex": "0x39"
+ }
+ ],
+ "blockNumber": "0xad5ec3",
+ "cumulativeGasUsed": "0xb2b0aa",
+ "status": "0x1"
+ },
+ "args": [
+ {
+ "gelatoGasPriceOracle": "0x169e633a2d1e6c10dd91238ba11c4a708dfef37c",
+ "oracleRequestData": "0x50d25bcd",
+ "gelatoMaxGas": 5000000,
+ "internalGasRequirement": 100000,
+ "minExecutorStake": 0,
+ "executorSuccessShare": 0,
+ "sysAdminSuccessShare": 0,
+ "totalSuccessShare": 0
+ }
+ ],
+ "solcInputHash": "d9397bda7e9d5c90e2ef9a83ef888759",
+ "metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"gelatoGasPriceOracle\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"oracleRequestData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"gelatoMaxGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"internalGasRequirement\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minExecutorStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"executorSuccessShare\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sysAdminSuccessShare\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalSuccessShare\",\"type\":\"uint256\"}],\"internalType\":\"struct IGelatoSysAdmin.GelatoSysAdminInitialState\",\"name\":\"_\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"taskReceiptId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"LogCanExecFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"taskReceiptId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"executorRefund\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"LogExecReverted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"taskReceiptId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"executorSuccessFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sysAdminSuccessFee\",\"type\":\"uint256\"}],\"name\":\"LogExecSuccess\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldExecutor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newExecutor\",\"type\":\"address\"}],\"name\":\"LogExecutorAssignedExecutor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"LogExecutorBalanceWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"LogExecutorStaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldShare\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newShare\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"name\":\"LogExecutorSuccessShareSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"executor\",\"type\":\"address\"}],\"name\":\"LogExecutorUnstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newProviderFunds\",\"type\":\"uint256\"}],\"name\":\"LogFundsProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"realWithdrawAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newProviderFunds\",\"type\":\"uint256\"}],\"name\":\"LogFundsUnprovided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldOracle\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOracle\",\"type\":\"address\"}],\"name\":\"LogGelatoGasPriceOracleSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldMaxGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newMaxGas\",\"type\":\"uint256\"}],\"name\":\"LogGelatoMaxGasSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldRequirment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newRequirment\",\"type\":\"uint256\"}],\"name\":\"LogInternalGasRequirementSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldMin\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newMin\",\"type\":\"uint256\"}],\"name\":\"LogMinExecutorStakeSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"oldData\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newData\",\"type\":\"bytes\"}],\"name\":\"LogOracleRequestDataSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldExecutor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newExecutor\",\"type\":\"address\"}],\"name\":\"LogProviderAssignedExecutor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"name\":\"LogProviderModuleAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"name\":\"LogProviderModuleRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBalance\",\"type\":\"uint256\"}],\"name\":\"LogSysAdminFundsWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldShare\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newShare\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"name\":\"LogSysAdminSuccessShareSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"taskReceiptId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"cancellor\",\"type\":\"address\"}],\"name\":\"LogTaskCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"taskSpecHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldTaskSpecGasPriceCeil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTaskSpecGasPriceCeil\",\"type\":\"uint256\"}],\"name\":\"LogTaskSpecGasPriceCeilSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"taskSpecHash\",\"type\":\"bytes32\"}],\"name\":\"LogTaskSpecProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"taskSpecHash\",\"type\":\"bytes32\"}],\"name\":\"LogTaskSpecUnprovided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"taskReceiptId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"taskReceiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct TaskReceipt\",\"name\":\"taskReceipt\",\"type\":\"tuple\"}],\"name\":\"LogTaskSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"EXEC_TX_OVERHEAD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NO_CEIL\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IGelatoProviderModule[]\",\"name\":\"_modules\",\"type\":\"address[]\"}],\"name\":\"addProviderModules\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskReceipt\",\"name\":\"_TR\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gelatoGasPrice\",\"type\":\"uint256\"}],\"name\":\"canExec\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task\",\"name\":\"_task\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_expiryDate\",\"type\":\"uint256\"}],\"name\":\"canSubmitTask\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskReceipt\",\"name\":\"_TR\",\"type\":\"tuple\"}],\"name\":\"cancelTask\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentTaskReceiptId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskReceipt\",\"name\":\"_TR\",\"type\":\"tuple\"}],\"name\":\"exec\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskReceipt\",\"name\":\"taskReceipt\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gelatoGasPrice\",\"type\":\"uint256\"}],\"name\":\"executionWrapper\",\"outputs\":[{\"internalType\":\"enum GelatoCore.ExecutionResult\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newExecutor\",\"type\":\"address\"}],\"name\":\"executorAssignsExecutor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"executorByProvider\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"executorProvidersCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"executorStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gasPrice\",\"type\":\"uint256\"}],\"name\":\"executorSuccessFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"executorSuccessShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoGasPriceOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoMaxGas\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskReceipt\",\"name\":\"_TR\",\"type\":\"tuple\"}],\"name\":\"hashTaskReceipt\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition[]\",\"name\":\"conditions\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"gasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskSpec\",\"name\":\"_taskSpec\",\"type\":\"tuple\"}],\"name\":\"hashTaskSpec\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"internalGasRequirement\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_executor\",\"type\":\"address\"}],\"name\":\"isExecutorAssigned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_executor\",\"type\":\"address\"}],\"name\":\"isExecutorMinStaked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"_module\",\"type\":\"address\"}],\"name\":\"isModuleProvided\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gelatoMaxGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gelatoGasPrice\",\"type\":\"uint256\"}],\"name\":\"isProviderLiquid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task\",\"name\":\"_task\",\"type\":\"tuple\"}],\"name\":\"isTaskProvided\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"res\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"contract IGelatoCondition[]\",\"name\":\"conditions\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"gasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskSpec\",\"name\":\"_taskSpec\",\"type\":\"tuple\"}],\"name\":\"isTaskSpecProvided\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gelatoMaxGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gelatoGasPrice\",\"type\":\"uint256\"}],\"name\":\"minExecProviderFunds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minExecutorStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"provider\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cycleId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"submissionsLeft\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskReceipt[]\",\"name\":\"_taskReceipts\",\"type\":\"tuple[]\"}],\"name\":\"multiCancelTasks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_executor\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"contract IGelatoCondition[]\",\"name\":\"conditions\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"gasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskSpec[]\",\"name\":\"_taskSpecs\",\"type\":\"tuple[]\"},{\"internalType\":\"contract IGelatoProviderModule[]\",\"name\":\"_modules\",\"type\":\"address[]\"}],\"name\":\"multiProvide\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_providers\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"_newExecutor\",\"type\":\"address\"}],\"name\":\"multiReassignProviders\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"contract IGelatoCondition[]\",\"name\":\"conditions\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"gasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskSpec[]\",\"name\":\"_taskSpecs\",\"type\":\"tuple[]\"},{\"internalType\":\"contract IGelatoProviderModule[]\",\"name\":\"_modules\",\"type\":\"address[]\"}],\"name\":\"multiUnprovide\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracleRequestData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"}],\"name\":\"provideFunds\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition[]\",\"name\":\"conditions\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"gasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskSpec[]\",\"name\":\"_taskSpecs\",\"type\":\"tuple[]\"}],\"name\":\"provideTaskSpecs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newExecutor\",\"type\":\"address\"}],\"name\":\"providerAssignsExecutor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task\",\"name\":\"_task\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_gelatoGasPrice\",\"type\":\"uint256\"}],\"name\":\"providerCanExec\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"providerFunds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_userProxy\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task\",\"name\":\"_task\",\"type\":\"tuple\"}],\"name\":\"providerModuleChecks\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"}],\"name\":\"providerModules\",\"outputs\":[{\"internalType\":\"contract IGelatoProviderModule[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IGelatoProviderModule[]\",\"name\":\"_modules\",\"type\":\"address[]\"}],\"name\":\"removeProviderModules\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_percentage\",\"type\":\"uint256\"}],\"name\":\"setExecutorSuccessShare\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOracle\",\"type\":\"address\"}],\"name\":\"setGelatoGasPriceOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newMaxGas\",\"type\":\"uint256\"}],\"name\":\"setGelatoMaxGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newRequirement\",\"type\":\"uint256\"}],\"name\":\"setInternalGasRequirement\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newMin\",\"type\":\"uint256\"}],\"name\":\"setMinExecutorStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_requestData\",\"type\":\"bytes\"}],\"name\":\"setOracleRequestData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_percentage\",\"type\":\"uint256\"}],\"name\":\"setSysAdminSuccessShare\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_taskSpecHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_gasPriceCeil\",\"type\":\"uint256\"}],\"name\":\"setTaskSpecGasPriceCeil\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakeExecutor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task\",\"name\":\"_task\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_expiryDate\",\"type\":\"uint256\"}],\"name\":\"submitTask\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"_tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"_expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_sumOfRequestedTaskSubmits\",\"type\":\"uint256\"}],\"name\":\"submitTaskChain\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"contract IGelatoProviderModule\",\"name\":\"module\",\"type\":\"address\"}],\"internalType\":\"struct Provider\",\"name\":\"_provider\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition\",\"name\":\"inst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Condition[]\",\"name\":\"conditions\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"selfProviderGasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct Task[]\",\"name\":\"_tasks\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"_expiryDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cycles\",\"type\":\"uint256\"}],\"name\":\"submitTaskCycle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sysAdminFunds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gasPrice\",\"type\":\"uint256\"}],\"name\":\"sysAdminSuccessFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sysAdminSuccessShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"taskReceiptHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"taskSpecGasPriceCeil\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSuccessShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"unprovideFunds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"realWithdrawAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IGelatoCondition[]\",\"name\":\"conditions\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"enum DataFlow\",\"name\":\"dataFlow\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"termsOkCheck\",\"type\":\"bool\"}],\"internalType\":\"struct Action[]\",\"name\":\"actions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"gasPriceCeil\",\"type\":\"uint256\"}],\"internalType\":\"struct TaskSpec[]\",\"name\":\"_taskSpecs\",\"type\":\"tuple[]\"}],\"name\":\"unprovideTaskSpecs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unstakeExecutor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"withdrawExcessExecutorStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"realWithdrawAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"withdrawSysAdminFunds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"realWithdrawAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Luis Schliesske & Hilmar Orth\",\"details\":\"Find all NatSpecs inside IGelatoCore\",\"methods\":{\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"GelatoCore\"},\"userdoc\":{\"methods\":{},\"notice\":\"Task: submission, validation, execution, and cancellation\"}},\"settings\":{\"compilationTarget\":{\"contracts/gelato_core/GelatoCore.sol\":\"GelatoCore\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/external/Address.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * This test is non-exhaustive, and there may be false-negatives: during the\\n * execution of a contract's constructor, its address will be reported as\\n * not containing a contract.\\n *\\n * IMPORTANT: It is unsafe to assume that an address for which this\\n * function returns false is an externally-owned account (EOA) and not a\\n * contract.\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies in extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != 0x0 && codehash != accountHash);\\n }\\n\\n /**\\n * @dev Converts an `address` into `address payable`. Note that this is\\n * simply a type cast: the actual underlying value is not changed.\\n *\\n * _Available since v2.4.0._\\n */\\n function toPayable(address account) internal pure returns (address payable) {\\n return address(uint160(account));\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n *\\n * _Available since v2.4.0._\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-call-value\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n}\\n\",\"keccak256\":\"0x30adf47fefa21c2abfe4e65150533a21fa2a50b09d35d52049d7d5062c58c36c\",\"license\":\"UNLICENSED\"},\"contracts/external/Math.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\",\"keccak256\":\"0x74e34fb87a21ce297c493468c203770b16f4afeb9e451520875ec08fe2a30c74\",\"license\":\"UNLICENSED\"},\"contracts/external/Ownable.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\ncontract Ownable {\\n address private _owner;\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() internal {\\n _owner = msg.sender;\\n emit OwnershipTransferred(address(0), _owner);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(isOwner(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the caller is the current owner.\\n */\\n function isOwner() public view returns (bool) {\\n return msg.sender == _owner;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n require(\\n newOwner != address(0),\\n \\\"Ownable: new owner is the zero address\\\"\\n );\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xbd17809400b98353ba6de08b9529d3213cd008eebc059728b0538bbd409f64a1\",\"license\":\"UNLICENSED\"},\"contracts/external/SafeMath.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return sub(a, b, \\\"SafeMath: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n * - Subtraction cannot overflow.\\n *\\n * _Available since v2.4.0._\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return div(a, b, \\\"SafeMath: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n *\\n * _Available since v2.4.0._\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n // Solidity only automatically asserts when dividing by 0\\n require(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return mod(a, b, \\\"SafeMath: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n *\\n * _Available since v2.4.0._\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b != 0, errorMessage);\\n return a % b;\\n }\\n}\",\"keccak256\":\"0x6c5c35e292963cbfd8d30c28a9f0d32ab062c89fc49056fc0b0d19de404f3601\",\"license\":\"UNLICENSED\"},\"contracts/gelato_actions/IGelatoAction.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\nimport {DataFlow} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\n/// @title IGelatoAction - solidity interface of GelatoActionsStandard\\n/// @notice all the APIs and events of GelatoActionsStandard\\n/// @dev all the APIs are implemented inside GelatoActionsStandard\\ninterface IGelatoAction {\\n event LogOneWay(\\n address origin,\\n address sendToken,\\n uint256 sendAmount,\\n address destination\\n );\\n\\n event LogTwoWay(\\n address origin,\\n address sendToken,\\n uint256 sendAmount,\\n address destination,\\n address receiveToken,\\n uint256 receiveAmount,\\n address receiver\\n );\\n\\n /// @notice Providers can use this for pre-execution sanity checks, to prevent reverts.\\n /// @dev GelatoCore checks this in canExec and passes the parameters.\\n /// @param _taskReceiptId The id of the task from which all arguments are passed.\\n /// @param _userProxy The userProxy of the task. Often address(this) for delegatecalls.\\n /// @param _actionData The encoded payload to be used in the Action.\\n /// @param _dataFlow The dataFlow of the Action.\\n /// @param _value A special param for ETH sending Actions. If the Action sends ETH\\n /// in its Action function implementation, one should expect msg.value therein to be\\n /// equal to _value. So Providers can check in termsOk that a valid ETH value will\\n /// be used because they also have access to the same value when encoding the\\n /// execPayload on their ProviderModule.\\n /// @param _cycleId For tasks that are part of a Cycle.\\n /// @return Returns OK, if Task can be executed safely according to the Provider's\\n /// terms laid out in this function implementation.\\n function termsOk(\\n uint256 _taskReceiptId,\\n address _userProxy,\\n bytes calldata _actionData,\\n DataFlow _dataFlow,\\n uint256 _value,\\n uint256 _cycleId\\n )\\n external\\n view\\n returns(string memory);\\n}\\n\",\"keccak256\":\"0x2317c4f8be3253dad83d6b601b39819318c216792ec074798fea590c7ec016b0\",\"license\":\"UNLICENSED\"},\"contracts/gelato_conditions/IGelatoCondition.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\\n/// @notice all the APIs of GelatoConditionsStandard\\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\\ninterface IGelatoCondition {\\n\\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\\n /// \\\"ok\\\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\\n /// source of Task identification.\\n /// @param _conditionData This is the Condition.data field developers must encode their\\n /// Condition's specific parameters in.\\n /// @param _cycleId For Tasks that are executed as part of a cycle.\\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\\n external\\n view\\n returns(string memory);\\n}\",\"keccak256\":\"0xd7cb47dc6a898e5f8934a7f4b908ef8bc29637d51d323ca9fb35484faaf5110f\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/GelatoCore.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoCore, Provider, Task, TaskReceipt} from \\\"./interfaces/IGelatoCore.sol\\\";\\nimport {GelatoExecutors} from \\\"./GelatoExecutors.sol\\\";\\nimport {GelatoBytes} from \\\"../libraries/GelatoBytes.sol\\\";\\nimport {GelatoTaskReceipt} from \\\"../libraries/GelatoTaskReceipt.sol\\\";\\nimport {SafeMath} from \\\"../external/SafeMath.sol\\\";\\nimport {IGelatoCondition} from \\\"../gelato_conditions/IGelatoCondition.sol\\\";\\nimport {IGelatoAction} from \\\"../gelato_actions/IGelatoAction.sol\\\";\\nimport {IGelatoProviderModule} from \\\"../gelato_provider_modules/IGelatoProviderModule.sol\\\";\\n\\n/// @title GelatoCore\\n/// @author Luis Schliesske & Hilmar Orth\\n/// @notice Task: submission, validation, execution, and cancellation\\n/// @dev Find all NatSpecs inside IGelatoCore\\ncontract GelatoCore is IGelatoCore, GelatoExecutors {\\n\\n using GelatoBytes for bytes;\\n using GelatoTaskReceipt for TaskReceipt;\\n using SafeMath for uint256;\\n\\n // Setting State Vars for GelatoSysAdmin\\n constructor(GelatoSysAdminInitialState memory _) public {\\n gelatoGasPriceOracle = _.gelatoGasPriceOracle;\\n oracleRequestData = _.oracleRequestData;\\n gelatoMaxGas = _.gelatoMaxGas;\\n internalGasRequirement = _.internalGasRequirement;\\n minExecutorStake = _.minExecutorStake;\\n executorSuccessShare = _.executorSuccessShare;\\n sysAdminSuccessShare = _.sysAdminSuccessShare;\\n totalSuccessShare = _.totalSuccessShare;\\n }\\n\\n // ================ STATE VARIABLES ======================================\\n // TaskReceiptIds\\n uint256 public override currentTaskReceiptId;\\n // taskReceipt.id => taskReceiptHash\\n mapping(uint256 => bytes32) public override taskReceiptHash;\\n\\n // ================ SUBMIT ==============================================\\n function canSubmitTask(\\n address _userProxy,\\n Provider memory _provider,\\n Task memory _task,\\n uint256 _expiryDate\\n )\\n external\\n view\\n override\\n returns(string memory)\\n {\\n // EXECUTOR CHECKS\\n if (!isExecutorMinStaked(executorByProvider[_provider.addr]))\\n return \\\"GelatoCore.canSubmitTask: executor not minStaked\\\";\\n\\n // ExpiryDate\\n if (_expiryDate != 0)\\n if (_expiryDate < block.timestamp)\\n return \\\"GelatoCore.canSubmitTask: expiryDate\\\";\\n\\n // Check Provider details\\n string memory isProvided;\\n if (_userProxy == _provider.addr) {\\n if (_task.selfProviderGasLimit < internalGasRequirement.mul(2))\\n return \\\"GelatoCore.canSubmitTask:selfProviderGasLimit too low\\\";\\n isProvided = providerModuleChecks(_userProxy, _provider, _task);\\n }\\n else isProvided = isTaskProvided(_userProxy, _provider, _task);\\n if (!isProvided.startsWithOK())\\n return string(abi.encodePacked(\\\"GelatoCore.canSubmitTask.isProvided:\\\", isProvided));\\n\\n // Success\\n return OK;\\n }\\n\\n function submitTask(\\n Provider memory _provider,\\n Task memory _task,\\n uint256 _expiryDate\\n )\\n external\\n override\\n {\\n Task[] memory singleTask = new Task[](1);\\n singleTask[0] = _task;\\n if (msg.sender == _provider.addr) _handleSelfProviderGasDefaults(singleTask);\\n _storeTaskReceipt(false, msg.sender, _provider, 0, singleTask, _expiryDate, 0, 1);\\n }\\n\\n function submitTaskCycle(\\n Provider memory _provider,\\n Task[] memory _tasks,\\n uint256 _expiryDate,\\n uint256 _cycles // how many full cycles should be submitted\\n )\\n external\\n override\\n {\\n if (msg.sender == _provider.addr) _handleSelfProviderGasDefaults(_tasks);\\n _storeTaskReceipt(\\n true, msg.sender, _provider, 0, _tasks, _expiryDate, 0, _cycles * _tasks.length\\n );\\n }\\n\\n function submitTaskChain(\\n Provider memory _provider,\\n Task[] memory _tasks,\\n uint256 _expiryDate,\\n uint256 _sumOfRequestedTaskSubmits // see IGelatoCore for explanation\\n )\\n external\\n override\\n {\\n if (_sumOfRequestedTaskSubmits != 0) {\\n require(\\n _sumOfRequestedTaskSubmits >= _tasks.length,\\n \\\"GelatoCore.submitTaskChain: less requested submits than tasks\\\"\\n );\\n }\\n if (msg.sender == _provider.addr) _handleSelfProviderGasDefaults(_tasks);\\n _storeTaskReceipt(\\n true, msg.sender, _provider, 0, _tasks, _expiryDate, 0, _sumOfRequestedTaskSubmits\\n );\\n }\\n\\n function _storeTaskReceipt(\\n bool _newCycle,\\n address _userProxy,\\n Provider memory _provider,\\n uint256 _index,\\n Task[] memory _tasks,\\n uint256 _expiryDate,\\n uint256 _cycleId,\\n uint256 _submissionsLeft\\n )\\n private\\n {\\n // Increment TaskReceipt ID storage\\n uint256 nextTaskReceiptId = currentTaskReceiptId + 1;\\n currentTaskReceiptId = nextTaskReceiptId;\\n\\n // Generate new Task Receipt\\n TaskReceipt memory taskReceipt = TaskReceipt({\\n id: nextTaskReceiptId,\\n userProxy: _userProxy, // Smart Contract Accounts ONLY\\n provider: _provider,\\n index: _index,\\n tasks: _tasks,\\n expiryDate: _expiryDate,\\n cycleId: _newCycle ? nextTaskReceiptId : _cycleId,\\n submissionsLeft: _submissionsLeft // 0=infinity, 1=once, X=maxTotalExecutions\\n });\\n\\n // Hash TaskReceipt\\n bytes32 hashedTaskReceipt = hashTaskReceipt(taskReceipt);\\n\\n // Store TaskReceipt Hash\\n taskReceiptHash[taskReceipt.id] = hashedTaskReceipt;\\n\\n emit LogTaskSubmitted(taskReceipt.id, hashedTaskReceipt, taskReceipt);\\n }\\n\\n // ================ CAN EXECUTE EXECUTOR API ============================\\n // _gasLimit must be gelatoMaxGas for all Providers except SelfProviders.\\n function canExec(TaskReceipt memory _TR, uint256 _gasLimit, uint256 _gelatoGasPrice)\\n public\\n view\\n override\\n returns(string memory)\\n {\\n if (!isExecutorMinStaked(executorByProvider[_TR.provider.addr]))\\n return \\\"ExecutorNotMinStaked\\\";\\n\\n if (!isProviderLiquid(_TR.provider.addr, _gasLimit, _gelatoGasPrice))\\n return \\\"ProviderIlliquidity\\\";\\n\\n string memory res = providerCanExec(\\n _TR.userProxy,\\n _TR.provider,\\n _TR.task(),\\n _gelatoGasPrice\\n );\\n if (!res.startsWithOK()) return res;\\n\\n bytes32 hashedTaskReceipt = hashTaskReceipt(_TR);\\n if (taskReceiptHash[_TR.id] != hashedTaskReceipt) return \\\"InvalidTaskReceiptHash\\\";\\n\\n if (_TR.expiryDate != 0 && _TR.expiryDate <= block.timestamp)\\n return \\\"TaskReceiptExpired\\\";\\n\\n // Optional CHECK Condition for user proxies\\n if (_TR.task().conditions.length != 0) {\\n for (uint i; i < _TR.task().conditions.length; i++) {\\n try _TR.task().conditions[i].inst.ok(\\n _TR.id,\\n _TR.task().conditions[i].data,\\n _TR.cycleId\\n )\\n returns(string memory condition)\\n {\\n if (!condition.startsWithOK())\\n return string(abi.encodePacked(\\\"ConditionNotOk:\\\", condition));\\n } catch Error(string memory error) {\\n return string(abi.encodePacked(\\\"ConditionReverted:\\\", error));\\n } catch {\\n return \\\"ConditionReverted:undefined\\\";\\n }\\n }\\n }\\n\\n // Optional CHECK Action Terms\\n for (uint i; i < _TR.task().actions.length; i++) {\\n // Only check termsOk if specified, else continue\\n if (!_TR.task().actions[i].termsOkCheck) continue;\\n\\n try IGelatoAction(_TR.task().actions[i].addr).termsOk(\\n _TR.id,\\n _TR.userProxy,\\n _TR.task().actions[i].data,\\n _TR.task().actions[i].dataFlow,\\n _TR.task().actions[i].value,\\n _TR.cycleId\\n )\\n returns(string memory actionTermsOk)\\n {\\n if (!actionTermsOk.startsWithOK())\\n return string(abi.encodePacked(\\\"ActionTermsNotOk:\\\", actionTermsOk));\\n } catch Error(string memory error) {\\n return string(abi.encodePacked(\\\"ActionReverted:\\\", error));\\n } catch {\\n return \\\"ActionRevertedNoMessage\\\";\\n }\\n }\\n\\n // Executor Validation\\n if (msg.sender == address(this)) return OK;\\n else if (msg.sender == executorByProvider[_TR.provider.addr]) return OK;\\n else return \\\"InvalidExecutor\\\";\\n }\\n\\n // ================ EXECUTE EXECUTOR API ============================\\n enum ExecutionResult { ExecSuccess, CanExecFailed, ExecRevert }\\n enum ExecutorPay { Reward, Refund }\\n\\n // Execution Entry Point: tx.gasprice must be greater or equal to _getGelatoGasPrice()\\n function exec(TaskReceipt memory _TR) external override {\\n\\n // Store startGas for gas-consumption based cost and payout calcs\\n uint256 startGas = gasleft();\\n\\n // memcopy of gelatoGasPrice, to avoid multiple storage reads\\n uint256 gelatoGasPrice = _getGelatoGasPrice();\\n\\n // Only assigned executor can execute this function\\n require(\\n msg.sender == executorByProvider[_TR.provider.addr],\\n \\\"GelatoCore.exec: Invalid Executor\\\"\\n );\\n\\n // The gas stipend the executor must provide. Special case for SelfProviders.\\n uint256 gasLimit\\n = _TR.selfProvider() ? _TR.task().selfProviderGasLimit : gelatoMaxGas;\\n\\n ExecutionResult executionResult;\\n string memory reason;\\n\\n try this.executionWrapper{\\n gas: gasleft().sub(internalGasRequirement, \\\"GelatoCore.exec: Insufficient gas\\\")\\n }(_TR, gasLimit, gelatoGasPrice)\\n returns (ExecutionResult _executionResult, string memory _reason)\\n {\\n executionResult = _executionResult;\\n reason = _reason;\\n } catch Error(string memory error) {\\n executionResult = ExecutionResult.ExecRevert;\\n reason = error;\\n } catch {\\n // If any of the external calls in executionWrapper resulted in e.g. out of gas,\\n // Executor is eligible for a Refund, but only if Executor sent gelatoMaxGas.\\n executionResult = ExecutionResult.ExecRevert;\\n reason = \\\"GelatoCore.executionWrapper:undefined\\\";\\n }\\n\\n if (executionResult == ExecutionResult.ExecSuccess) {\\n // END-1: SUCCESS => TaskReceipt was deleted in _exec & Reward\\n (uint256 executorSuccessFee, uint256 sysAdminSuccessFee) = _processProviderPayables(\\n _TR.provider.addr,\\n ExecutorPay.Reward,\\n startGas,\\n gasLimit,\\n gelatoGasPrice\\n );\\n emit LogExecSuccess(msg.sender, _TR.id, executorSuccessFee, sysAdminSuccessFee);\\n\\n } else if (executionResult == ExecutionResult.CanExecFailed) {\\n // END-2: CanExecFailed => No TaskReceipt Deletion & No Refund\\n emit LogCanExecFailed(msg.sender, _TR.id, reason);\\n\\n } else {\\n // executionResult == ExecutionResult.ExecRevert\\n // END-3.1: ExecReverted NO gelatoMaxGas => No TaskReceipt Deletion & No Refund\\n if (startGas < gasLimit)\\n emit LogExecReverted(msg.sender, _TR.id, 0, reason);\\n else {\\n // END-3.2: ExecReverted BUT gelatoMaxGas was used\\n // => TaskReceipt Deletion (delete in _exec was reverted) & Refund\\n delete taskReceiptHash[_TR.id];\\n (uint256 executorRefund,) = _processProviderPayables(\\n _TR.provider.addr,\\n ExecutorPay.Refund,\\n startGas,\\n gasLimit,\\n gelatoGasPrice\\n );\\n emit LogExecReverted(msg.sender, _TR.id, executorRefund, reason);\\n }\\n }\\n }\\n\\n // Used by GelatoCore.exec(), to handle Out-Of-Gas from execution gracefully\\n function executionWrapper(\\n TaskReceipt memory taskReceipt,\\n uint256 _gasLimit, // gelatoMaxGas or task.selfProviderGasLimit\\n uint256 _gelatoGasPrice\\n )\\n external\\n returns(ExecutionResult, string memory)\\n {\\n require(msg.sender == address(this), \\\"GelatoCore.executionWrapper:onlyGelatoCore\\\");\\n\\n // canExec()\\n string memory canExecRes = canExec(taskReceipt, _gasLimit, _gelatoGasPrice);\\n if (!canExecRes.startsWithOK()) return (ExecutionResult.CanExecFailed, canExecRes);\\n\\n // Will revert if exec failed => will be caught in exec flow\\n _exec(taskReceipt);\\n\\n // Execution Success: Executor REWARD\\n return (ExecutionResult.ExecSuccess, \\\"\\\");\\n }\\n\\n function _exec(TaskReceipt memory _TR) private {\\n // INTERACTIONS\\n // execPayload and proxyReturndataCheck values read from ProviderModule\\n bytes memory execPayload;\\n bool proxyReturndataCheck;\\n\\n try IGelatoProviderModule(_TR.provider.module).execPayload(\\n _TR.id,\\n _TR.userProxy,\\n _TR.provider.addr,\\n _TR.task(),\\n _TR.cycleId\\n )\\n returns(bytes memory _execPayload, bool _proxyReturndataCheck)\\n {\\n execPayload = _execPayload;\\n proxyReturndataCheck = _proxyReturndataCheck;\\n } catch Error(string memory _error) {\\n revert(string(abi.encodePacked(\\\"GelatoCore._exec.execPayload:\\\", _error)));\\n } catch {\\n revert(\\\"GelatoCore._exec.execPayload:undefined\\\");\\n }\\n\\n // To prevent single task exec reentrancy we delete hash before external call\\n delete taskReceiptHash[_TR.id];\\n\\n // Execution via UserProxy\\n (bool success, bytes memory userProxyReturndata) = _TR.userProxy.call(execPayload);\\n\\n // Check if actions reverts were caught by userProxy\\n if (success && proxyReturndataCheck) {\\n try _TR.provider.module.execRevertCheck(userProxyReturndata) {\\n // success: no revert from providerModule signifies no revert found\\n } catch Error(string memory _error) {\\n revert(string(abi.encodePacked(\\\"GelatoCore._exec.execRevertCheck:\\\", _error)));\\n } catch {\\n revert(\\\"GelatoCore._exec.execRevertCheck:undefined\\\");\\n }\\n }\\n\\n // SUCCESS\\n if (success) {\\n // Optional: Automated Cyclic Task Submissions\\n if (_TR.submissionsLeft != 1) {\\n _storeTaskReceipt(\\n false, // newCycle?\\n _TR.userProxy,\\n _TR.provider,\\n _TR.nextIndex(),\\n _TR.tasks,\\n _TR.expiryDate,\\n _TR.cycleId,\\n _TR.submissionsLeft == 0 ? 0 : _TR.submissionsLeft - 1\\n );\\n }\\n } else {\\n // FAILURE: reverts, caught or uncaught in userProxy.call, were detected\\n // We revert all state from _exec/userProxy.call and catch revert in exec flow\\n // Caution: we also revert the deletion of taskReceiptHash.\\n userProxyReturndata.revertWithErrorString(\\\"GelatoCore._exec:\\\");\\n }\\n }\\n\\n function _processProviderPayables(\\n address _provider,\\n ExecutorPay _payType,\\n uint256 _startGas,\\n uint256 _gasLimit, // gelatoMaxGas or selfProviderGasLimit\\n uint256 _gelatoGasPrice\\n )\\n private\\n returns(uint256 executorCompensation, uint256 sysAdminCompensation)\\n {\\n uint256 estGasUsed = _startGas - gasleft();\\n\\n // Provider payable Gas Refund capped at gelatoMaxGas\\n // (- consecutive state writes + gas refund from deletion)\\n uint256 cappedGasUsed =\\n estGasUsed < _gasLimit\\n ? estGasUsed + EXEC_TX_OVERHEAD\\n : _gasLimit + EXEC_TX_OVERHEAD;\\n\\n if (_payType == ExecutorPay.Reward) {\\n executorCompensation = executorSuccessFee(cappedGasUsed, _gelatoGasPrice);\\n sysAdminCompensation = sysAdminSuccessFee(cappedGasUsed, _gelatoGasPrice);\\n // ExecSuccess: Provider pays ExecutorSuccessFee and SysAdminSuccessFee\\n providerFunds[_provider] = providerFunds[_provider].sub(\\n executorCompensation.add(sysAdminCompensation),\\n \\\"GelatoCore._processProviderPayables: providerFunds underflow\\\"\\n );\\n executorStake[msg.sender] += executorCompensation;\\n sysAdminFunds += sysAdminCompensation;\\n } else {\\n // ExecFailure: Provider REFUNDS estimated costs to executor\\n executorCompensation = cappedGasUsed.mul(_gelatoGasPrice);\\n providerFunds[_provider] = providerFunds[_provider].sub(\\n executorCompensation,\\n \\\"GelatoCore._processProviderPayables: providerFunds underflow\\\"\\n );\\n executorStake[msg.sender] += executorCompensation;\\n }\\n }\\n\\n // ================ CANCEL USER / EXECUTOR API ============================\\n function cancelTask(TaskReceipt memory _TR) public override {\\n // Checks\\n require(\\n msg.sender == _TR.userProxy || msg.sender == _TR.provider.addr,\\n \\\"GelatoCore.cancelTask: sender\\\"\\n );\\n // Effects\\n bytes32 hashedTaskReceipt = hashTaskReceipt(_TR);\\n require(\\n hashedTaskReceipt == taskReceiptHash[_TR.id],\\n \\\"GelatoCore.cancelTask: invalid taskReceiptHash\\\"\\n );\\n delete taskReceiptHash[_TR.id];\\n emit LogTaskCancelled(_TR.id, msg.sender);\\n }\\n\\n function multiCancelTasks(TaskReceipt[] memory _taskReceipts) external override {\\n for (uint i; i < _taskReceipts.length; i++) cancelTask(_taskReceipts[i]);\\n }\\n\\n // Helpers\\n function hashTaskReceipt(TaskReceipt memory _TR) public pure override returns(bytes32) {\\n return keccak256(abi.encode(_TR));\\n }\\n\\n function _handleSelfProviderGasDefaults(Task[] memory _tasks) private view {\\n for (uint256 i; i < _tasks.length; i++) {\\n if (_tasks[i].selfProviderGasLimit == 0) {\\n _tasks[i].selfProviderGasLimit = gelatoMaxGas;\\n } else {\\n require(\\n _tasks[i].selfProviderGasLimit >= internalGasRequirement.mul(2),\\n \\\"GelatoCore._handleSelfProviderGasDefaults:selfProviderGasLimit too low\\\"\\n );\\n }\\n if (_tasks[i].selfProviderGasPriceCeil == 0)\\n _tasks[i].selfProviderGasPriceCeil = NO_CEIL;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xdd8a85b0e532bd205237a734b683d0947c531af082e7a729d54e6dc587e0be96\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/GelatoExecutors.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoExecutors} from \\\"./interfaces/IGelatoExecutors.sol\\\";\\nimport {GelatoProviders} from \\\"./GelatoProviders.sol\\\";\\nimport {Address} from \\\"../external/Address.sol\\\";\\nimport {SafeMath} from \\\"../external/SafeMath.sol\\\";\\nimport {Math} from \\\"../external/Math.sol\\\";\\n\\n/// @title GelatoExecutors\\n/// @author Luis Schliesske & Hilmar Orth\\n/// @notice Stake Management of executors & batch Unproving providers\\n/// @dev Find all NatSpecs inside IGelatoExecutors\\nabstract contract GelatoExecutors is IGelatoExecutors, GelatoProviders {\\n\\n using Address for address payable; /// for sendValue method\\n using SafeMath for uint256;\\n\\n // Executor De/Registrations and Staking\\n function stakeExecutor() external payable override {\\n uint256 currentStake = executorStake[msg.sender];\\n uint256 newStake = currentStake + msg.value;\\n require(\\n newStake >= minExecutorStake,\\n \\\"GelatoExecutors.stakeExecutor: below minStake\\\"\\n );\\n executorStake[msg.sender] = newStake;\\n emit LogExecutorStaked(msg.sender, currentStake, newStake);\\n }\\n\\n function unstakeExecutor() external override {\\n require(\\n !isExecutorAssigned(msg.sender),\\n \\\"GelatoExecutors.unstakeExecutor: msg.sender still assigned\\\"\\n );\\n uint256 unbondedStake = executorStake[msg.sender];\\n require(\\n unbondedStake != 0,\\n \\\"GelatoExecutors.unstakeExecutor: already unstaked\\\"\\n );\\n delete executorStake[msg.sender];\\n msg.sender.sendValue(unbondedStake);\\n emit LogExecutorUnstaked(msg.sender);\\n }\\n\\n function withdrawExcessExecutorStake(uint256 _withdrawAmount)\\n external\\n override\\n returns(uint256 realWithdrawAmount)\\n {\\n require(\\n isExecutorMinStaked(msg.sender),\\n \\\"GelatoExecutors.withdrawExcessExecutorStake: not minStaked\\\"\\n );\\n\\n uint256 currentExecutorStake = executorStake[msg.sender];\\n uint256 excessExecutorStake = currentExecutorStake - minExecutorStake;\\n\\n realWithdrawAmount = Math.min(_withdrawAmount, excessExecutorStake);\\n\\n uint256 newExecutorStake = currentExecutorStake - realWithdrawAmount;\\n\\n // Effects\\n executorStake[msg.sender] = newExecutorStake;\\n\\n // Interaction\\n msg.sender.sendValue(realWithdrawAmount);\\n emit LogExecutorBalanceWithdrawn(msg.sender, realWithdrawAmount);\\n }\\n\\n // To unstake, Executors must reassign ALL their Providers to another staked Executor\\n function multiReassignProviders(address[] calldata _providers, address _newExecutor)\\n external\\n override\\n {\\n for (uint i; i < _providers.length; i++)\\n executorAssignsExecutor(_providers[i], _newExecutor);\\n }\\n}\",\"keccak256\":\"0x8ed764f14d3538b3aabd0dfa1a5a27694d1fe5365f0e8b2fc75aff4a045254e2\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/GelatoProviders.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviders, TaskSpec} from \\\"./interfaces/IGelatoProviders.sol\\\";\\nimport {GelatoSysAdmin} from \\\"./GelatoSysAdmin.sol\\\";\\nimport {Address} from \\\"../external/Address.sol\\\";\\nimport {GelatoString} from \\\"../libraries/GelatoString.sol\\\";\\nimport {Math} from \\\"../external/Math.sol\\\";\\nimport {SafeMath} from \\\"../external/SafeMath.sol\\\";\\nimport {IGelatoProviderModule} from \\\"../gelato_provider_modules/IGelatoProviderModule.sol\\\";\\nimport {ProviderModuleSet} from \\\"../libraries/ProviderModuleSet.sol\\\";\\nimport {\\n Condition, Action, Operation, DataFlow, Provider, Task, TaskReceipt\\n} from \\\"./interfaces/IGelatoCore.sol\\\";\\nimport {IGelatoCondition} from \\\"../gelato_conditions/IGelatoCondition.sol\\\";\\n\\n/// @title GelatoProviders\\n/// @notice Provider Management API - Whitelist TaskSpecs\\n/// @dev Find all NatSpecs inside IGelatoProviders\\nabstract contract GelatoProviders is IGelatoProviders, GelatoSysAdmin {\\n\\n using Address for address payable; /// for sendValue method\\n using GelatoString for string;\\n using ProviderModuleSet for ProviderModuleSet.Set;\\n using SafeMath for uint256;\\n\\n // This is only for internal use by hashTaskSpec()\\n struct NoDataAction {\\n address addr;\\n Operation operation;\\n DataFlow dataFlow;\\n bool value;\\n bool termsOkCheck;\\n }\\n\\n uint256 public constant override NO_CEIL = type(uint256).max;\\n\\n mapping(address => uint256) public override providerFunds;\\n mapping(address => uint256) public override executorStake;\\n mapping(address => address) public override executorByProvider;\\n mapping(address => uint256) public override executorProvidersCount;\\n // The Task-Spec Gas-Price-Ceil => taskSpecGasPriceCeil\\n mapping(address => mapping(bytes32 => uint256)) public override taskSpecGasPriceCeil;\\n mapping(address => ProviderModuleSet.Set) internal _providerModules;\\n\\n // GelatoCore: canSubmit\\n function isTaskSpecProvided(address _provider, TaskSpec memory _taskSpec)\\n public\\n view\\n override\\n returns(string memory)\\n {\\n if (taskSpecGasPriceCeil[_provider][hashTaskSpec(_taskSpec)] == 0)\\n return \\\"TaskSpecNotProvided\\\";\\n return OK;\\n }\\n\\n // IGelatoProviderModule: GelatoCore canSubmit & canExec\\n function providerModuleChecks(\\n address _userProxy,\\n Provider memory _provider,\\n Task memory _task\\n )\\n public\\n view\\n override\\n returns(string memory)\\n {\\n if (!isModuleProvided(_provider.addr, _provider.module))\\n return \\\"InvalidProviderModule\\\";\\n\\n if (_userProxy != _provider.addr) {\\n IGelatoProviderModule providerModule = IGelatoProviderModule(\\n _provider.module\\n );\\n\\n try providerModule.isProvided(_userProxy, _provider.addr, _task)\\n returns(string memory res)\\n {\\n return res;\\n } catch {\\n return \\\"GelatoProviders.providerModuleChecks\\\";\\n }\\n } else return OK;\\n }\\n\\n // GelatoCore: canSubmit\\n function isTaskProvided(\\n address _userProxy,\\n Provider memory _provider,\\n Task memory _task\\n )\\n public\\n view\\n override\\n returns(string memory res)\\n {\\n TaskSpec memory _taskSpec = _castTaskToSpec(_task);\\n res = isTaskSpecProvided(_provider.addr, _taskSpec);\\n if (res.startsWithOK())\\n return providerModuleChecks(_userProxy, _provider, _task);\\n }\\n\\n // GelatoCore canExec Gate\\n function providerCanExec(\\n address _userProxy,\\n Provider memory _provider,\\n Task memory _task,\\n uint256 _gelatoGasPrice\\n )\\n public\\n view\\n override\\n returns(string memory)\\n {\\n if (_userProxy == _provider.addr) {\\n if (_task.selfProviderGasPriceCeil < _gelatoGasPrice)\\n return \\\"SelfProviderGasPriceCeil\\\";\\n } else {\\n bytes32 taskSpecHash = hashTaskSpec(_castTaskToSpec(_task));\\n if (taskSpecGasPriceCeil[_provider.addr][taskSpecHash] < _gelatoGasPrice)\\n return \\\"taskSpecGasPriceCeil-OR-notProvided\\\";\\n }\\n return providerModuleChecks(_userProxy, _provider, _task);\\n }\\n\\n // Provider Funding\\n function provideFunds(address _provider) public payable override {\\n require(msg.value > 0, \\\"GelatoProviders.provideFunds: zero value\\\");\\n uint256 newProviderFunds = providerFunds[_provider].add(msg.value);\\n emit LogFundsProvided(_provider, msg.value, newProviderFunds);\\n providerFunds[_provider] = newProviderFunds;\\n }\\n\\n // Unprovide funds\\n function unprovideFunds(uint256 _withdrawAmount)\\n public\\n override\\n returns(uint256 realWithdrawAmount)\\n {\\n uint256 previousProviderFunds = providerFunds[msg.sender];\\n realWithdrawAmount = Math.min(_withdrawAmount, previousProviderFunds);\\n\\n uint256 newProviderFunds = previousProviderFunds - realWithdrawAmount;\\n\\n // Effects\\n providerFunds[msg.sender] = newProviderFunds;\\n\\n // Interaction\\n msg.sender.sendValue(realWithdrawAmount);\\n\\n emit LogFundsUnprovided(msg.sender, realWithdrawAmount, newProviderFunds);\\n }\\n\\n // Called by Providers\\n function providerAssignsExecutor(address _newExecutor) public override {\\n address currentExecutor = executorByProvider[msg.sender];\\n\\n // CHECKS\\n require(\\n currentExecutor != _newExecutor,\\n \\\"GelatoProviders.providerAssignsExecutor: already assigned.\\\"\\n );\\n if (_newExecutor != address(0)) {\\n require(\\n isExecutorMinStaked(_newExecutor),\\n \\\"GelatoProviders.providerAssignsExecutor: isExecutorMinStaked()\\\"\\n );\\n }\\n\\n // EFFECTS: Provider reassigns from currentExecutor to newExecutor (or no executor)\\n if (currentExecutor != address(0)) executorProvidersCount[currentExecutor]--;\\n executorByProvider[msg.sender] = _newExecutor;\\n if (_newExecutor != address(0)) executorProvidersCount[_newExecutor]++;\\n\\n emit LogProviderAssignedExecutor(msg.sender, currentExecutor, _newExecutor);\\n }\\n\\n // Called by Executors\\n function executorAssignsExecutor(address _provider, address _newExecutor) public override {\\n address currentExecutor = executorByProvider[_provider];\\n\\n // CHECKS\\n require(\\n currentExecutor == msg.sender,\\n \\\"GelatoProviders.executorAssignsExecutor: msg.sender is not assigned executor\\\"\\n );\\n require(\\n currentExecutor != _newExecutor,\\n \\\"GelatoProviders.executorAssignsExecutor: already assigned.\\\"\\n );\\n // Checks at the same time if _nexExecutor != address(0)\\n require(\\n isExecutorMinStaked(_newExecutor),\\n \\\"GelatoProviders.executorAssignsExecutor: isExecutorMinStaked()\\\"\\n );\\n\\n // EFFECTS: currentExecutor reassigns to newExecutor\\n executorProvidersCount[currentExecutor]--;\\n executorByProvider[_provider] = _newExecutor;\\n executorProvidersCount[_newExecutor]++;\\n\\n emit LogExecutorAssignedExecutor(_provider, currentExecutor, _newExecutor);\\n }\\n\\n // (Un-)provide Condition Action Combos at different Gas Price Ceils\\n function provideTaskSpecs(TaskSpec[] memory _taskSpecs) public override {\\n for (uint i; i < _taskSpecs.length; i++) {\\n if (_taskSpecs[i].gasPriceCeil == 0) _taskSpecs[i].gasPriceCeil = NO_CEIL;\\n bytes32 taskSpecHash = hashTaskSpec(_taskSpecs[i]);\\n setTaskSpecGasPriceCeil(taskSpecHash, _taskSpecs[i].gasPriceCeil);\\n emit LogTaskSpecProvided(msg.sender, taskSpecHash);\\n }\\n }\\n\\n function unprovideTaskSpecs(TaskSpec[] memory _taskSpecs) public override {\\n for (uint i; i < _taskSpecs.length; i++) {\\n bytes32 taskSpecHash = hashTaskSpec(_taskSpecs[i]);\\n require(\\n taskSpecGasPriceCeil[msg.sender][taskSpecHash] != 0,\\n \\\"GelatoProviders.unprovideTaskSpecs: redundant\\\"\\n );\\n delete taskSpecGasPriceCeil[msg.sender][taskSpecHash];\\n emit LogTaskSpecUnprovided(msg.sender, taskSpecHash);\\n }\\n }\\n\\n function setTaskSpecGasPriceCeil(bytes32 _taskSpecHash, uint256 _gasPriceCeil)\\n public\\n override\\n {\\n uint256 currentTaskSpecGasPriceCeil = taskSpecGasPriceCeil[msg.sender][_taskSpecHash];\\n require(\\n currentTaskSpecGasPriceCeil != _gasPriceCeil,\\n \\\"GelatoProviders.setTaskSpecGasPriceCeil: Already whitelisted with gasPriceCeil\\\"\\n );\\n taskSpecGasPriceCeil[msg.sender][_taskSpecHash] = _gasPriceCeil;\\n emit LogTaskSpecGasPriceCeilSet(\\n msg.sender,\\n _taskSpecHash,\\n currentTaskSpecGasPriceCeil,\\n _gasPriceCeil\\n );\\n }\\n\\n // Provider Module\\n function addProviderModules(IGelatoProviderModule[] memory _modules) public override {\\n for (uint i; i < _modules.length; i++) {\\n require(\\n !isModuleProvided(msg.sender, _modules[i]),\\n \\\"GelatoProviders.addProviderModules: redundant\\\"\\n );\\n _providerModules[msg.sender].add(_modules[i]);\\n emit LogProviderModuleAdded(msg.sender, _modules[i]);\\n }\\n }\\n\\n function removeProviderModules(IGelatoProviderModule[] memory _modules) public override {\\n for (uint i; i < _modules.length; i++) {\\n require(\\n isModuleProvided(msg.sender, _modules[i]),\\n \\\"GelatoProviders.removeProviderModules: redundant\\\"\\n );\\n _providerModules[msg.sender].remove(_modules[i]);\\n emit LogProviderModuleRemoved(msg.sender, _modules[i]);\\n }\\n }\\n\\n // Batch (un-)provide\\n function multiProvide(\\n address _executor,\\n TaskSpec[] memory _taskSpecs,\\n IGelatoProviderModule[] memory _modules\\n )\\n public\\n payable\\n override\\n {\\n if (msg.value != 0) provideFunds(msg.sender);\\n if (_executor != address(0)) providerAssignsExecutor(_executor);\\n provideTaskSpecs(_taskSpecs);\\n addProviderModules(_modules);\\n }\\n\\n function multiUnprovide(\\n uint256 _withdrawAmount,\\n TaskSpec[] memory _taskSpecs,\\n IGelatoProviderModule[] memory _modules\\n )\\n public\\n override\\n {\\n if (_withdrawAmount != 0) unprovideFunds(_withdrawAmount);\\n unprovideTaskSpecs(_taskSpecs);\\n removeProviderModules(_modules);\\n }\\n\\n // Provider Liquidity\\n function minExecProviderFunds(uint256 _gelatoMaxGas, uint256 _gelatoGasPrice)\\n public\\n view\\n override\\n returns(uint256)\\n {\\n uint256 maxExecTxCost = (EXEC_TX_OVERHEAD + _gelatoMaxGas) * _gelatoGasPrice;\\n return maxExecTxCost + (maxExecTxCost * totalSuccessShare) / 100;\\n }\\n\\n function isProviderLiquid(\\n address _provider,\\n uint256 _gelatoMaxGas,\\n uint256 _gelatoGasPrice\\n )\\n public\\n view\\n override\\n returns(bool)\\n {\\n return minExecProviderFunds(_gelatoMaxGas, _gelatoGasPrice) <= providerFunds[_provider];\\n }\\n\\n // An Executor qualifies and remains registered for as long as he has minExecutorStake\\n function isExecutorMinStaked(address _executor) public view override returns(bool) {\\n return executorStake[_executor] >= minExecutorStake;\\n }\\n\\n // Providers' Executor Assignment\\n function isExecutorAssigned(address _executor) public view override returns(bool) {\\n return executorProvidersCount[_executor] != 0;\\n }\\n\\n // Helper fn that can also be called to query taskSpecHash off-chain\\n function hashTaskSpec(TaskSpec memory _taskSpec) public view override returns(bytes32) {\\n NoDataAction[] memory noDataActions = new NoDataAction[](_taskSpec.actions.length);\\n for (uint i = 0; i < _taskSpec.actions.length; i++) {\\n NoDataAction memory noDataAction = NoDataAction({\\n addr: _taskSpec.actions[i].addr,\\n operation: _taskSpec.actions[i].operation,\\n dataFlow: _taskSpec.actions[i].dataFlow,\\n value: _taskSpec.actions[i].value == 0 ? false : true,\\n termsOkCheck: _taskSpec.actions[i].termsOkCheck\\n });\\n noDataActions[i] = noDataAction;\\n }\\n return keccak256(abi.encode(_taskSpec.conditions, noDataActions));\\n }\\n\\n // Providers' Module Getters\\n function isModuleProvided(address _provider, IGelatoProviderModule _module)\\n public\\n view\\n override\\n returns(bool)\\n {\\n return _providerModules[_provider].contains(_module);\\n }\\n\\n function providerModules(address _provider)\\n external\\n view\\n override\\n returns(IGelatoProviderModule[] memory)\\n {\\n return _providerModules[_provider].enumerate();\\n }\\n\\n // Internal helper for is isTaskProvided() and providerCanExec\\n function _castTaskToSpec(Task memory _task)\\n private\\n pure\\n returns(TaskSpec memory taskSpec)\\n {\\n taskSpec = TaskSpec({\\n conditions: _stripConditionData(_task.conditions),\\n actions: _task.actions,\\n gasPriceCeil: 0 // default: provider can set gasPriceCeil dynamically.\\n });\\n }\\n\\n function _stripConditionData(Condition[] memory _conditionsWithData)\\n private\\n pure\\n returns(IGelatoCondition[] memory conditionInstances)\\n {\\n conditionInstances = new IGelatoCondition[](_conditionsWithData.length);\\n for (uint i; i < _conditionsWithData.length; i++)\\n conditionInstances[i] = _conditionsWithData[i].inst;\\n }\\n\\n}\\n\",\"keccak256\":\"0x78036e60e0c14bbb4fa5a30e46dfb9e85222bdae97519a3193b49e45d1dc61ef\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/GelatoSysAdmin.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\nimport {IGelatoSysAdmin} from \\\"./interfaces/IGelatoSysAdmin.sol\\\";\\nimport {Ownable} from \\\"../external/Ownable.sol\\\";\\nimport {Address} from \\\"../external/Address.sol\\\";\\nimport {GelatoBytes} from \\\"../libraries/GelatoBytes.sol\\\";\\nimport {SafeMath} from \\\"../external/SafeMath.sol\\\";\\nimport {Math} from \\\"../external/Math.sol\\\";\\n\\nabstract contract GelatoSysAdmin is IGelatoSysAdmin, Ownable {\\n\\n using Address for address payable;\\n using GelatoBytes for bytes;\\n using SafeMath for uint256;\\n\\n // Executor compensation for estimated tx costs not accounted for by startGas\\n uint256 public constant override EXEC_TX_OVERHEAD = 55000;\\n string internal constant OK = \\\"OK\\\";\\n\\n address public override gelatoGasPriceOracle;\\n bytes public override oracleRequestData;\\n uint256 public override gelatoMaxGas;\\n uint256 public override internalGasRequirement;\\n uint256 public override minExecutorStake;\\n uint256 public override executorSuccessShare;\\n uint256 public override sysAdminSuccessShare;\\n uint256 public override totalSuccessShare;\\n uint256 public override sysAdminFunds;\\n\\n // == The main functions of the Sys Admin (DAO) ==\\n // The oracle defines the system-critical gelatoGasPrice\\n function setGelatoGasPriceOracle(address _newOracle) external override onlyOwner {\\n require(_newOracle != address(0), \\\"GelatoSysAdmin.setGelatoGasPriceOracle: 0\\\");\\n emit LogGelatoGasPriceOracleSet(gelatoGasPriceOracle, _newOracle);\\n gelatoGasPriceOracle = _newOracle;\\n }\\n\\n function setOracleRequestData(bytes calldata _requestData) external override onlyOwner {\\n emit LogOracleRequestDataSet(oracleRequestData, _requestData);\\n oracleRequestData = _requestData;\\n }\\n\\n // exec-tx gasprice: pulled in from the Oracle by the Executor during exec()\\n function _getGelatoGasPrice() internal view returns(uint256) {\\n (bool success, bytes memory returndata) = gelatoGasPriceOracle.staticcall(\\n oracleRequestData\\n );\\n if (!success)\\n returndata.revertWithErrorString(\\\"GelatoSysAdmin._getGelatoGasPrice:\\\");\\n int oracleGasPrice = abi.decode(returndata, (int256));\\n if (oracleGasPrice <= 0) revert(\\\"GelatoSysAdmin._getGelatoGasPrice:0orBelow\\\");\\n return uint256(oracleGasPrice);\\n }\\n\\n // exec-tx gas\\n function setGelatoMaxGas(uint256 _newMaxGas) external override onlyOwner {\\n emit LogGelatoMaxGasSet(gelatoMaxGas, _newMaxGas);\\n gelatoMaxGas = _newMaxGas;\\n }\\n\\n // exec-tx GelatoCore internal gas requirement\\n function setInternalGasRequirement(uint256 _newRequirement) external override onlyOwner {\\n emit LogInternalGasRequirementSet(internalGasRequirement, _newRequirement);\\n internalGasRequirement = _newRequirement;\\n }\\n\\n // Minimum Executor Stake Per Provider\\n function setMinExecutorStake(uint256 _newMin) external override onlyOwner {\\n emit LogMinExecutorStakeSet(minExecutorStake, _newMin);\\n minExecutorStake = _newMin;\\n }\\n\\n // Executors' profit share on exec costs\\n function setExecutorSuccessShare(uint256 _percentage) external override onlyOwner {\\n emit LogExecutorSuccessShareSet(\\n executorSuccessShare,\\n _percentage,\\n _percentage + sysAdminSuccessShare\\n );\\n executorSuccessShare = _percentage;\\n totalSuccessShare = _percentage + sysAdminSuccessShare;\\n }\\n\\n // Sys Admin (DAO) Business Model\\n function setSysAdminSuccessShare(uint256 _percentage) external override onlyOwner {\\n emit LogSysAdminSuccessShareSet(\\n sysAdminSuccessShare,\\n _percentage,\\n executorSuccessShare + _percentage\\n );\\n sysAdminSuccessShare = _percentage;\\n totalSuccessShare = executorSuccessShare + _percentage;\\n }\\n\\n function withdrawSysAdminFunds(uint256 _amount, address payable _to)\\n external\\n override\\n onlyOwner\\n returns(uint256 realWithdrawAmount)\\n {\\n uint256 currentBalance = sysAdminFunds;\\n\\n realWithdrawAmount = Math.min(_amount, currentBalance);\\n\\n uint256 newSysAdminFunds = currentBalance - realWithdrawAmount;\\n\\n // Effects\\n sysAdminFunds = newSysAdminFunds;\\n\\n _to.sendValue(realWithdrawAmount);\\n emit LogSysAdminFundsWithdrawn(currentBalance, newSysAdminFunds);\\n }\\n\\n // Executors' total fee for a successful exec\\n function executorSuccessFee(uint256 _gas, uint256 _gasPrice)\\n public\\n view\\n override\\n returns(uint256)\\n {\\n uint256 estExecCost = _gas.mul(_gasPrice);\\n return estExecCost + estExecCost.mul(executorSuccessShare).div(\\n 100,\\n \\\"GelatoSysAdmin.executorSuccessFee: div error\\\"\\n );\\n }\\n\\n function sysAdminSuccessFee(uint256 _gas, uint256 _gasPrice)\\n public\\n view\\n override\\n returns(uint256)\\n {\\n uint256 estExecCost = _gas.mul(_gasPrice);\\n return\\n estExecCost.mul(sysAdminSuccessShare).div(\\n 100,\\n \\\"GelatoSysAdmin.sysAdminSuccessShare: div error\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1fb0eb57365fcadf5b1f9837620f0fa4071c3b1caf1c7325647e80d8f98f0566\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/interfaces/IGelatoCore.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviderModule} from \\\"../../gelato_provider_modules/IGelatoProviderModule.sol\\\";\\nimport {IGelatoCondition} from \\\"../../gelato_conditions/IGelatoCondition.sol\\\";\\n\\nstruct Provider {\\n address addr; // if msg.sender == provider => self-Provider\\n IGelatoProviderModule module; // can be IGelatoProviderModule(0) for self-Providers\\n}\\n\\nstruct Condition {\\n IGelatoCondition inst; // can be AddressZero for self-conditional Actions\\n bytes data; // can be bytes32(0) for self-conditional Actions\\n}\\n\\nenum Operation { Call, Delegatecall }\\n\\nenum DataFlow { None, In, Out, InAndOut }\\n\\nstruct Action {\\n address addr;\\n bytes data;\\n Operation operation;\\n DataFlow dataFlow;\\n uint256 value;\\n bool termsOkCheck;\\n}\\n\\nstruct Task {\\n Condition[] conditions; // optional\\n Action[] actions;\\n uint256 selfProviderGasLimit; // optional: 0 defaults to gelatoMaxGas\\n uint256 selfProviderGasPriceCeil; // optional: 0 defaults to NO_CEIL\\n}\\n\\nstruct TaskReceipt {\\n uint256 id;\\n address userProxy;\\n Provider provider;\\n uint256 index;\\n Task[] tasks;\\n uint256 expiryDate;\\n uint256 cycleId; // auto-filled by GelatoCore. 0 for non-cyclic/chained tasks\\n uint256 submissionsLeft;\\n}\\n\\ninterface IGelatoCore {\\n event LogTaskSubmitted(\\n uint256 indexed taskReceiptId,\\n bytes32 indexed taskReceiptHash,\\n TaskReceipt taskReceipt\\n );\\n\\n event LogExecSuccess(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorSuccessFee,\\n uint256 sysAdminSuccessFee\\n );\\n event LogCanExecFailed(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n string reason\\n );\\n event LogExecReverted(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorRefund,\\n string reason\\n );\\n\\n event LogTaskCancelled(uint256 indexed taskReceiptId, address indexed cancellor);\\n\\n /// @notice API to query whether Task can be submitted successfully.\\n /// @dev In submitTask the msg.sender must be the same as _userProxy here.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _userProxy The userProxy from which the task will be submitted.\\n /// @param _task Selected provider, conditions, actions, expiry date of the task\\n function canSubmitTask(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external\\n view\\n returns(string memory);\\n\\n /// @notice API to submit a single Task.\\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task A Gelato Task object: provider, conditions, actions.\\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\\n function submitTask(\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _cycles How many full cycles will be submitted\\n function submitTaskCycle(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _cycles\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\\n /// @dev If _sumOfRequestedTaskSubmits = 1 && _tasks.length = 2, only the first task\\n /// would be submitted, but not the second\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\\n /// that should have occured once the cycle is complete:\\n /// _sumOfRequestedTaskSubmits = 0 => One Task will resubmit the next Task infinitly\\n /// _sumOfRequestedTaskSubmits = 1 => One Task will resubmit no other task\\n /// _sumOfRequestedTaskSubmits = 2 => One Task will resubmit 1 other task\\n /// ...\\n function submitTaskChain(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _sumOfRequestedTaskSubmits\\n )\\n external;\\n\\n // ================ Exec Suite =========================\\n /// @notice Off-chain API for executors to check, if a TaskReceipt is executable\\n /// @dev GelatoCore checks this during execution, in order to safeguard the Conditions\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @param _gasLimit Task.selfProviderGasLimit is used for SelfProviders. All other\\n /// Providers must use gelatoMaxGas. If the _gasLimit is used by an Executor and the\\n /// tx reverts, a refund is paid by the Provider and the TaskReceipt is annulated.\\n /// @param _execTxGasPrice Must be used by Executors. Gas Price fed by gelatoCore's\\n /// Gas Price Oracle. Executors can query the current gelatoGasPrice from events.\\n function canExec(TaskReceipt calldata _TR, uint256 _gasLimit, uint256 _execTxGasPrice)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Executors call this when Conditions allow it to execute submitted Tasks.\\n /// @dev Executors get rewarded for successful Execution. The Task remains open until\\n /// successfully executed, or when the execution failed, despite of gelatoMaxGas usage.\\n /// In the latter case Executors are refunded by the Task Provider.\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function exec(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel task\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function cancelTask(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel multiple tasks at once\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _taskReceipts TaskReceipts: id, userProxy, Task.\\n function multiCancelTasks(TaskReceipt[] calldata _taskReceipts) external;\\n\\n /// @notice Compute hash of task receipt\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @return hash of taskReceipt\\n function hashTaskReceipt(TaskReceipt calldata _TR) external pure returns(bytes32);\\n\\n // ================ Getters =========================\\n /// @notice Returns the taskReceiptId of the last TaskReceipt submitted\\n /// @return currentId currentId, last TaskReceiptId submitted\\n function currentTaskReceiptId() external view returns(uint256);\\n\\n /// @notice Returns computed taskReceipt hash, used to check for taskReceipt validity\\n /// @param _taskReceiptId Id of taskReceipt emitted in submission event\\n /// @return hash of taskReceipt\\n function taskReceiptHash(uint256 _taskReceiptId) external view returns(bytes32);\\n}\\n\",\"keccak256\":\"0x90a617cc3f21af14490d94ce0cc08be6445761424fe2286fc82e0950ecb003d8\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/interfaces/IGelatoExecutors.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\ninterface IGelatoExecutors {\\n event LogExecutorStaked(address indexed executor, uint256 oldStake, uint256 newStake);\\n event LogExecutorUnstaked(address indexed executor);\\n\\n event LogExecutorBalanceWithdrawn(\\n address indexed executor,\\n uint256 withdrawAmount\\n );\\n\\n /// @notice Stake on Gelato to become a whitelisted executor\\n /// @dev Msg.value has to be >= minExecutorStake\\n function stakeExecutor() external payable;\\n\\n /// @notice Unstake on Gelato to become de-whitelisted and withdraw minExecutorStake\\n function unstakeExecutor() external;\\n\\n /// @notice Re-assigns multiple providers to other executors\\n /// @dev Executors must re-assign all providers before being able to unstake\\n /// @param _providers List of providers to re-assign\\n /// @param _newExecutor Address of new executor to assign providers to\\n function multiReassignProviders(address[] calldata _providers, address _newExecutor)\\n external;\\n\\n\\n /// @notice Withdraw excess Execur Stake\\n /// @dev Can only be called if executor is isExecutorMinStaked\\n /// @param _withdrawAmount Amount to withdraw\\n /// @return Amount that was actually withdrawn\\n function withdrawExcessExecutorStake(uint256 _withdrawAmount) external returns(uint256);\\n\\n}\\n\",\"keccak256\":\"0x29091cf4506ebbb4ca14b55f0230cd055eb97d0644b721b1daf611f04fd07d91\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/interfaces/IGelatoProviders.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviderModule} from \\\"../../gelato_provider_modules/IGelatoProviderModule.sol\\\";\\nimport {Action, Provider, Task, TaskReceipt} from \\\"../interfaces/IGelatoCore.sol\\\";\\nimport {IGelatoCondition} from \\\"../../gelato_conditions/IGelatoCondition.sol\\\";\\n\\n// TaskSpec - Will be whitelised by providers and selected by users\\nstruct TaskSpec {\\n IGelatoCondition[] conditions; // Address: optional AddressZero for self-conditional actions\\n Action[] actions;\\n uint256 gasPriceCeil;\\n}\\n\\ninterface IGelatoProviders {\\n // Provider Funding\\n event LogFundsProvided(\\n address indexed provider,\\n uint256 amount,\\n uint256 newProviderFunds\\n );\\n event LogFundsUnprovided(\\n address indexed provider,\\n uint256 realWithdrawAmount,\\n uint256 newProviderFunds\\n );\\n\\n // Executor By Provider\\n event LogProviderAssignedExecutor(\\n address indexed provider,\\n address indexed oldExecutor,\\n address indexed newExecutor\\n );\\n event LogExecutorAssignedExecutor(\\n address indexed provider,\\n address indexed oldExecutor,\\n address indexed newExecutor\\n );\\n\\n // Actions\\n event LogTaskSpecProvided(address indexed provider, bytes32 indexed taskSpecHash);\\n event LogTaskSpecUnprovided(address indexed provider, bytes32 indexed taskSpecHash);\\n event LogTaskSpecGasPriceCeilSet(\\n address indexed provider,\\n bytes32 taskSpecHash,\\n uint256 oldTaskSpecGasPriceCeil,\\n uint256 newTaskSpecGasPriceCeil\\n );\\n\\n // Provider Module\\n event LogProviderModuleAdded(\\n address indexed provider,\\n IGelatoProviderModule indexed module\\n );\\n event LogProviderModuleRemoved(\\n address indexed provider,\\n IGelatoProviderModule indexed module\\n );\\n\\n // =========== GELATO PROVIDER APIs ==============\\n\\n /// @notice Validation that checks whether Task Spec is being offered by the selected provider\\n /// @dev Checked in submitTask(), unless provider == userProxy\\n /// @param _provider Address of selected provider\\n /// @param _taskSpec Task Spec\\n /// @return Expected to return \\\"OK\\\"\\n function isTaskSpecProvided(address _provider, TaskSpec calldata _taskSpec)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Validates that provider has provider module whitelisted + conducts isProvided check in ProviderModule\\n /// @dev Checked in submitTask() if provider == userProxy\\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task Task defined in IGelatoCore\\n /// @return Expected to return \\\"OK\\\"\\n function providerModuleChecks(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task\\n )\\n external\\n view\\n returns(string memory);\\n\\n\\n /// @notice Validate if provider module and seleced TaskSpec is whitelisted by provider\\n /// @dev Combines \\\"isTaskSpecProvided\\\" and providerModuleChecks\\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task Task defined in IGelatoCore\\n /// @return res Expected to return \\\"OK\\\"\\n function isTaskProvided(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task\\n )\\n external\\n view\\n returns(string memory res);\\n\\n\\n /// @notice Validate if selected TaskSpec is whitelisted by provider and that current gelatoGasPrice is below GasPriceCeil\\n /// @dev If gasPriceCeil is != 0, Task Spec is whitelisted\\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task Task defined in IGelatoCore\\n /// @param _gelatoGasPrice Task Receipt defined in IGelatoCore\\n /// @return res Expected to return \\\"OK\\\"\\n function providerCanExec(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _gelatoGasPrice\\n )\\n external\\n view\\n returns(string memory res);\\n\\n // =========== PROVIDER STATE WRITE APIs ==============\\n // Provider Funding\\n /// @notice Deposit ETH as provider on Gelato\\n /// @param _provider Address of provider who receives ETH deposit\\n function provideFunds(address _provider) external payable;\\n\\n /// @notice Withdraw provider funds from gelato\\n /// @param _withdrawAmount Amount\\n /// @return amount that will be withdrawn\\n function unprovideFunds(uint256 _withdrawAmount) external returns(uint256);\\n\\n /// @notice Assign executor as provider\\n /// @param _executor Address of new executor\\n function providerAssignsExecutor(address _executor) external;\\n\\n /// @notice Assign executor as previous selected executor\\n /// @param _provider Address of provider whose executor to change\\n /// @param _newExecutor Address of new executor\\n function executorAssignsExecutor(address _provider, address _newExecutor) external;\\n\\n // (Un-)provide Task Spec\\n\\n /// @notice Whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from\\n /// @dev If gasPriceCeil is == 0, Task Spec will be executed at any gas price (no ceil)\\n /// @param _taskSpecs Task Receipt List defined in IGelatoCore\\n function provideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;\\n\\n /// @notice De-whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from\\n /// @dev If gasPriceCeil was set to NO_CEIL, Input NO_CEIL constant as GasPriceCeil\\n /// @param _taskSpecs Task Receipt List defined in IGelatoCore\\n function unprovideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;\\n\\n /// @notice Update gasPriceCeil of selected Task Spec\\n /// @param _taskSpecHash Result of hashTaskSpec()\\n /// @param _gasPriceCeil New gas price ceil for Task Spec\\n function setTaskSpecGasPriceCeil(bytes32 _taskSpecHash, uint256 _gasPriceCeil) external;\\n\\n // Provider Module\\n /// @notice Whitelist new provider Module(s)\\n /// @param _modules Addresses of the modules which will be called during providerModuleChecks()\\n function addProviderModules(IGelatoProviderModule[] calldata _modules) external;\\n\\n /// @notice De-Whitelist new provider Module(s)\\n /// @param _modules Addresses of the modules which will be removed\\n function removeProviderModules(IGelatoProviderModule[] calldata _modules) external;\\n\\n // Batch (un-)provide\\n\\n /// @notice Whitelist new executor, TaskSpec(s) and Module(s) in one tx\\n /// @param _executor Address of new executor of provider\\n /// @param _taskSpecs List of Task Spec which will be whitelisted by provider\\n /// @param _modules List of module addresses which will be whitelisted by provider\\n function multiProvide(\\n address _executor,\\n TaskSpec[] calldata _taskSpecs,\\n IGelatoProviderModule[] calldata _modules\\n )\\n external\\n payable;\\n\\n\\n /// @notice De-Whitelist TaskSpec(s), Module(s) and withdraw funds from gelato in one tx\\n /// @param _withdrawAmount Amount to withdraw from ProviderFunds\\n /// @param _taskSpecs List of Task Spec which will be de-whitelisted by provider\\n /// @param _modules List of module addresses which will be de-whitelisted by provider\\n function multiUnprovide(\\n uint256 _withdrawAmount,\\n TaskSpec[] calldata _taskSpecs,\\n IGelatoProviderModule[] calldata _modules\\n )\\n external;\\n\\n // =========== PROVIDER STATE READ APIs ==============\\n // Provider Funding\\n\\n /// @notice Get balance of provider\\n /// @param _provider Address of provider\\n /// @return Provider Balance\\n function providerFunds(address _provider) external view returns(uint256);\\n\\n /// @notice Get min stake required by all providers for executors to call exec\\n /// @param _gelatoMaxGas Current gelatoMaxGas\\n /// @param _gelatoGasPrice Current gelatoGasPrice\\n /// @return How much provider balance is required for executor to submit exec tx\\n function minExecProviderFunds(uint256 _gelatoMaxGas, uint256 _gelatoGasPrice)\\n external\\n view\\n returns(uint256);\\n\\n /// @notice Check if provider has sufficient funds for executor to call exec\\n /// @param _provider Address of provider\\n /// @param _gelatoMaxGas Currentt gelatoMaxGas\\n /// @param _gelatoGasPrice Current gelatoGasPrice\\n /// @return Whether provider is liquid (true) or not (false)\\n function isProviderLiquid(\\n address _provider,\\n uint256 _gelatoMaxGas,\\n uint256 _gelatoGasPrice\\n )\\n external\\n view\\n returns(bool);\\n\\n // Executor Stake\\n\\n /// @notice Get balance of executor\\n /// @param _executor Address of executor\\n /// @return Executor Balance\\n function executorStake(address _executor) external view returns(uint256);\\n\\n /// @notice Check if executor has sufficient stake on gelato\\n /// @param _executor Address of provider\\n /// @return Whether executor has sufficient stake (true) or not (false)\\n function isExecutorMinStaked(address _executor) external view returns(bool);\\n\\n /// @notice Get executor of provider\\n /// @param _provider Address of provider\\n /// @return Provider's executor\\n function executorByProvider(address _provider)\\n external\\n view\\n returns(address);\\n\\n /// @notice Get num. of providers which haved assigned an executor\\n /// @param _executor Address of executor\\n /// @return Count of how many providers assigned the executor\\n function executorProvidersCount(address _executor) external view returns(uint256);\\n\\n /// @notice Check if executor has one or more providers assigned\\n /// @param _executor Address of provider\\n /// @return Where 1 or more providers have assigned the executor\\n function isExecutorAssigned(address _executor) external view returns(bool);\\n\\n // Task Spec and Gas Price Ceil\\n /// @notice The maximum gas price the transaction will be executed with\\n /// @param _provider Address of provider\\n /// @param _taskSpecHash Hash of provider TaskSpec\\n /// @return Max gas price an executor will execute the transaction with in wei\\n function taskSpecGasPriceCeil(address _provider, bytes32 _taskSpecHash)\\n external\\n view\\n returns(uint256);\\n\\n /// @notice Returns the hash of the formatted TaskSpec.\\n /// @dev The action.data field of each Action is stripped before hashing.\\n /// @param _taskSpec TaskSpec\\n /// @return keccak256 hash of encoded condition address and Action List\\n function hashTaskSpec(TaskSpec calldata _taskSpec) external view returns(bytes32);\\n\\n /// @notice Constant used to specify the highest gas price available in the gelato system\\n /// @dev Input 0 as gasPriceCeil and it will be assigned to NO_CEIL\\n /// @return MAX_UINT\\n function NO_CEIL() external pure returns(uint256);\\n\\n // Providers' Module Getters\\n\\n /// @notice Check if inputted module is whitelisted by provider\\n /// @param _provider Address of provider\\n /// @param _module Address of module\\n /// @return true if it is whitelisted\\n function isModuleProvided(address _provider, IGelatoProviderModule _module)\\n external\\n view\\n returns(bool);\\n\\n /// @notice Get all whitelisted provider modules from a given provider\\n /// @param _provider Address of provider\\n /// @return List of whitelisted provider modules\\n function providerModules(address _provider)\\n external\\n view\\n returns(IGelatoProviderModule[] memory);\\n}\\n\",\"keccak256\":\"0x64e51b4931dd097741c136c0859c340b439934a0c08f4f932babd22d5884945c\",\"license\":\"UNLICENSED\"},\"contracts/gelato_core/interfaces/IGelatoSysAdmin.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\ninterface IGelatoSysAdmin {\\n struct GelatoSysAdminInitialState {\\n address gelatoGasPriceOracle;\\n bytes oracleRequestData;\\n uint256 gelatoMaxGas;\\n uint256 internalGasRequirement;\\n uint256 minExecutorStake;\\n uint256 executorSuccessShare;\\n uint256 sysAdminSuccessShare;\\n uint256 totalSuccessShare;\\n }\\n\\n // Events\\n event LogGelatoGasPriceOracleSet(address indexed oldOracle, address indexed newOracle);\\n event LogOracleRequestDataSet(bytes oldData, bytes newData);\\n\\n event LogGelatoMaxGasSet(uint256 oldMaxGas, uint256 newMaxGas);\\n event LogInternalGasRequirementSet(uint256 oldRequirment, uint256 newRequirment);\\n\\n event LogMinExecutorStakeSet(uint256 oldMin, uint256 newMin);\\n\\n event LogExecutorSuccessShareSet(uint256 oldShare, uint256 newShare, uint256 total);\\n event LogSysAdminSuccessShareSet(uint256 oldShare, uint256 newShare, uint256 total);\\n\\n event LogSysAdminFundsWithdrawn(uint256 oldBalance, uint256 newBalance);\\n\\n // State Writing\\n\\n /// @notice Assign new gas price oracle\\n /// @dev Only callable by sysAdmin\\n /// @param _newOracle Address of new oracle\\n function setGelatoGasPriceOracle(address _newOracle) external;\\n\\n /// @notice Assign new gas price oracle\\n /// @dev Only callable by sysAdmin\\n /// @param _requestData The encoded payload for the staticcall to the oracle.\\n function setOracleRequestData(bytes calldata _requestData) external;\\n\\n /// @notice Assign new maximum gas limit providers can consume in executionWrapper()\\n /// @dev Only callable by sysAdmin\\n /// @param _newMaxGas New maximum gas limit\\n function setGelatoMaxGas(uint256 _newMaxGas) external;\\n\\n /// @notice Assign new interal gas limit requirement for exec()\\n /// @dev Only callable by sysAdmin\\n /// @param _newRequirement New internal gas requirement\\n function setInternalGasRequirement(uint256 _newRequirement) external;\\n\\n /// @notice Assign new minimum executor stake\\n /// @dev Only callable by sysAdmin\\n /// @param _newMin New minimum executor stake\\n function setMinExecutorStake(uint256 _newMin) external;\\n\\n /// @notice Assign new success share for executors to receive after successful execution\\n /// @dev Only callable by sysAdmin\\n /// @param _percentage New % success share of total gas consumed\\n function setExecutorSuccessShare(uint256 _percentage) external;\\n\\n /// @notice Assign new success share for sysAdmin to receive after successful execution\\n /// @dev Only callable by sysAdmin\\n /// @param _percentage New % success share of total gas consumed\\n function setSysAdminSuccessShare(uint256 _percentage) external;\\n\\n /// @notice Withdraw sysAdmin funds\\n /// @dev Only callable by sysAdmin\\n /// @param _amount Amount to withdraw\\n /// @param _to Address to receive the funds\\n function withdrawSysAdminFunds(uint256 _amount, address payable _to) external returns(uint256);\\n\\n // State Reading\\n /// @notice Unaccounted tx overhead that will be refunded to executors\\n function EXEC_TX_OVERHEAD() external pure returns(uint256);\\n\\n /// @notice Addess of current Gelato Gas Price Oracle\\n function gelatoGasPriceOracle() external view returns(address);\\n\\n /// @notice Getter for oracleRequestData state variable\\n function oracleRequestData() external view returns(bytes memory);\\n\\n /// @notice Gas limit an executor has to submit to get refunded even if actions revert\\n function gelatoMaxGas() external view returns(uint256);\\n\\n /// @notice Internal gas limit requirements ti ensure executor payout\\n function internalGasRequirement() external view returns(uint256);\\n\\n /// @notice Minimum stake required from executors\\n function minExecutorStake() external view returns(uint256);\\n\\n /// @notice % Fee executors get as a reward for a successful execution\\n function executorSuccessShare() external view returns(uint256);\\n\\n /// @notice Total % Fee executors and sysAdmin collectively get as a reward for a successful execution\\n /// @dev Saves a state read\\n function totalSuccessShare() external view returns(uint256);\\n\\n /// @notice Get total fee providers pay executors for a successful execution\\n /// @param _gas Gas consumed by transaction\\n /// @param _gasPrice Current gelato gas price\\n function executorSuccessFee(uint256 _gas, uint256 _gasPrice)\\n external\\n view\\n returns(uint256);\\n\\n /// @notice % Fee sysAdmin gets as a reward for a successful execution\\n function sysAdminSuccessShare() external view returns(uint256);\\n\\n /// @notice Get total fee providers pay sysAdmin for a successful execution\\n /// @param _gas Gas consumed by transaction\\n /// @param _gasPrice Current gelato gas price\\n function sysAdminSuccessFee(uint256 _gas, uint256 _gasPrice)\\n external\\n view\\n returns(uint256);\\n\\n /// @notice Get sysAdminds funds\\n function sysAdminFunds() external view returns(uint256);\\n}\\n\",\"keccak256\":\"0x497e7b7dabc3c7cfe3e0968b36ef70a96b02245492004dd51a22100eea9e6c4a\",\"license\":\"UNLICENSED\"},\"contracts/gelato_provider_modules/IGelatoProviderModule.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {Action, Task} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ninterface IGelatoProviderModule {\\n\\n /// @notice Check if provider agrees to pay for inputted task receipt\\n /// @dev Enables arbitrary checks by provider\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @return \\\"OK\\\" if provider agrees\\n function isProvided(address _userProxy, address _provider, Task calldata _task)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Convert action specific payload into proxy specific payload\\n /// @dev Encoded multiple actions into a multisend\\n /// @param _taskReceiptId Unique ID of Gelato Task to be executed.\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @param _cycleId For Tasks that form part of a cycle/chain.\\n /// @return Encoded payload that will be used for low-level .call on user proxy\\n /// @return checkReturndata if true, fwd returndata from userProxy.call to ProviderModule\\n function execPayload(\\n uint256 _taskReceiptId,\\n address _userProxy,\\n address _provider,\\n Task calldata _task,\\n uint256 _cycleId\\n )\\n external\\n view\\n returns(bytes memory, bool checkReturndata);\\n\\n /// @notice Called by GelatoCore.exec to verifiy that no revert happend on userProxy\\n /// @dev If a caught revert is detected, this fn should revert with the detected error\\n /// @param _proxyReturndata Data from GelatoCore._exec.userProxy.call(execPayload)\\n function execRevertCheck(bytes calldata _proxyReturndata) external pure;\\n}\\n\",\"keccak256\":\"0x7e5b43174b2ebe041a6ca60d4c6670e8be27601bc31fa06ca4ec37b25aa06400\",\"license\":\"UNLICENSED\"},\"contracts/libraries/GelatoBytes.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\nlibrary GelatoBytes {\\n function calldataSliceSelector(bytes calldata _bytes)\\n internal\\n pure\\n returns (bytes4 selector)\\n {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function memorySliceSelector(bytes memory _bytes)\\n internal\\n pure\\n returns (bytes4 selector)\\n {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function revertWithErrorString(bytes memory _bytes, string memory _tracingInfo)\\n internal\\n pure\\n {\\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\\n if (_bytes.length % 32 == 4) {\\n bytes4 selector;\\n assembly { selector := mload(add(0x20, _bytes)) }\\n if (selector == 0x08c379a0) { // Function selector for Error(string)\\n assembly { _bytes := add(_bytes, 68) }\\n revert(string(abi.encodePacked(_tracingInfo, string(_bytes))));\\n } else {\\n revert(string(abi.encodePacked(_tracingInfo, \\\"NoErrorSelector\\\")));\\n }\\n } else {\\n revert(string(abi.encodePacked(_tracingInfo, \\\"UnexpectedReturndata\\\")));\\n }\\n }\\n}\",\"keccak256\":\"0xf771b45f4569c758d07b095a7ba3a6e275b15e3f669997695f548e72f3bb09cf\",\"license\":\"UNLICENSED\"},\"contracts/libraries/GelatoString.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\nlibrary GelatoString {\\n function startsWithOK(string memory _str) internal pure returns(bool) {\\n if (bytes(_str).length >= 2 && bytes(_str)[0] == \\\"O\\\" && bytes(_str)[1] == \\\"K\\\")\\n return true;\\n return false;\\n }\\n}\",\"keccak256\":\"0x9cfe0ab25862fd1beb724f57046f19cc37faf862551916aefc96830252e8eba9\",\"license\":\"UNLICENSED\"},\"contracts/libraries/GelatoTaskReceipt.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\nimport {Task, TaskReceipt} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\nlibrary GelatoTaskReceipt {\\n function task(TaskReceipt memory _TR) internal pure returns(Task memory) {\\n return _TR.tasks[_TR.index];\\n }\\n\\n function nextIndex(TaskReceipt memory _TR) internal pure returns(uint256) {\\n return _TR.index == _TR.tasks.length - 1 ? 0 : _TR.index + 1;\\n }\\n\\n function selfProvider(TaskReceipt memory _TR) internal pure returns(bool) {\\n return _TR.provider.addr == _TR.userProxy;\\n }\\n}\",\"keccak256\":\"0xe7a14a415520afbfdb7295378c6ed71e807e30085da917aaba5a78a3576ef315\",\"license\":\"UNLICENSED\"},\"contracts/libraries/ProviderModuleSet.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity ^0.6.10;\\n\\nimport {IGelatoProviderModule} from \\\"../gelato_provider_modules/IGelatoProviderModule.sol\\\";\\n\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * As of v2.5.0, only `IGelatoProviderModule` sets are supported.\\n *\\n * Include with `using EnumerableSet for EnumerableSet.Set;`.\\n *\\n * _Available since v2.5.0._\\n *\\n * @author Alberto Cuesta Ca\\u00f1ada\\n * @author Luis Schliessske (modified to ProviderModuleSet)\\n */\\nlibrary ProviderModuleSet {\\n\\n struct Set {\\n // Position of the module in the `modules` array, plus 1 because index 0\\n // means a module is not in the set.\\n mapping (IGelatoProviderModule => uint256) index;\\n IGelatoProviderModule[] modules;\\n }\\n\\n /**\\n * @dev Add a module to a set. O(1).\\n * Returns false if the module was already in the set.\\n */\\n function add(Set storage set, IGelatoProviderModule module)\\n internal\\n returns (bool)\\n {\\n if (!contains(set, module)) {\\n set.modules.push(module);\\n // The element is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel module\\n set.index[module] = set.modules.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a module from a set. O(1).\\n * Returns false if the module was not present in the set.\\n */\\n function remove(Set storage set, IGelatoProviderModule module)\\n internal\\n returns (bool)\\n {\\n if (contains(set, module)){\\n uint256 toDeleteIndex = set.index[module] - 1;\\n uint256 lastIndex = set.modules.length - 1;\\n\\n // If the element we're deleting is the last one, we can just remove it without doing a swap\\n if (lastIndex != toDeleteIndex) {\\n IGelatoProviderModule lastValue = set.modules[lastIndex];\\n\\n // Move the last module to the index where the deleted module is\\n set.modules[toDeleteIndex] = lastValue;\\n // Update the index for the moved module\\n set.index[lastValue] = toDeleteIndex + 1; // All indexes are 1-based\\n }\\n\\n // Delete the index entry for the deleted module\\n delete set.index[module];\\n\\n // Delete the old entry for the moved module\\n set.modules.pop();\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the module is in the set. O(1).\\n */\\n function contains(Set storage set, IGelatoProviderModule module)\\n internal\\n view\\n returns (bool)\\n {\\n return set.index[module] != 0;\\n }\\n\\n /**\\n * @dev Returns an array with all modules in the set. O(N).\\n * Note that there are no guarantees on the ordering of modules inside the\\n * array, and it may change when more modules are added or removed.\\n\\n * WARNING: This function may run out of gas on large sets: use {length} and\\n * {get} instead in these cases.\\n */\\n function enumerate(Set storage set)\\n internal\\n view\\n returns (IGelatoProviderModule[] memory)\\n {\\n IGelatoProviderModule[] memory output = new IGelatoProviderModule[](set.modules.length);\\n for (uint256 i; i < set.modules.length; i++) output[i] = set.modules[i];\\n return output;\\n }\\n\\n /**\\n * @dev Returns the number of elements on the set. O(1).\\n */\\n function length(Set storage set)\\n internal\\n view\\n returns (uint256)\\n {\\n return set.modules.length;\\n }\\n\\n /** @dev Returns the element stored at position `index` in the set. O(1).\\n * Note that there are no guarantees on the ordering of modules inside the\\n * array, and it may change when more modules are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function get(Set storage set, uint256 index)\\n internal\\n view\\n returns (IGelatoProviderModule)\\n {\\n return set.modules[index];\\n }\\n}\",\"keccak256\":\"0x0f604b468729ed0696080c596d42b4ddb6f833b6cec568367ae1b525191fe619\",\"license\":\"UNLICENSED\"}},\"version\":1}",
+ "bytecode": "0x60806040523480156200001157600080fd5b50604051620062b0380380620062b083398101604081905262000034916200023e565b600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a38051600180546001600160a01b0319166001600160a01b039092169190911790556020808201518051620000b6926002920190620000ec565b5060408101516003556060810151600455608081015160055560a081015160065560c081015160075560e001516008556200032c565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200012f57805160ff19168380011785556200015f565b828001600101855582156200015f579182015b828111156200015f57825182559160200191906001019062000142565b506200016d92915062000171565b5090565b6200018e91905b808211156200016d576000815560010162000178565b90565b80516001600160a01b0381168114620001a957600080fd5b92915050565b600082601f830112620001c0578081fd5b81516001600160401b03811115620001d6578182fd5b6020620001ec601f8301601f1916820162000305565b925081835284818386010111156200020357600080fd5b60005b828110156200022357848101820151848201830152810162000206565b82811115620002355760008284860101525b50505092915050565b60006020828403121562000250578081fd5b81516001600160401b038082111562000267578283fd5b6101009184018086038313156200027c578384fd5b620002878362000305565b62000293878362000191565b81526020820151935082841115620002a9578485fd5b620002b787858401620001af565b602082015260408201516040820152606082015160608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201528094505050505092915050565b6040518181016001600160401b03811182821017156200032457600080fd5b604052919050565b615f74806200033c6000396000f3fe6080604052600436106103ef5760003560e01c80639075180f11610208578063bf2a458a11610118578063d58b172c116100ab578063e9d1a8a91161007a578063e9d1a8a914610b4c578063f2fde38b14610b6c578063f323609914610b8c578063f8559c0814610bac578063ff92b1a814610bcc576103ef565b8063d58b172c14610acc578063d922de9914610aec578063e138d05014610b0c578063e61235b714610b2c576103ef565b8063ca1efcdb116100e7578063ca1efcdb14610a4c578063cf37b49514610a6c578063d378597414610a8c578063d3ab1f7a14610aac576103ef565b8063bf2a458a146109bf578063c234feb6146109ec578063c6638a8b14610a0c578063ca05abe114610a2c576103ef565b8063a4ceb6a31161019b578063b348e2681161016a578063b348e2681461092a578063bac3bf131461094a578063bb07c5031461096a578063bedf04a71461097f578063beecd4931461099f576103ef565b8063a4ceb6a3146108d8578063a4fffd2c146108ed578063b300f75214610902578063b30f457214610922576103ef565b80639a53cb79116101d75780639a53cb79146108705780639aad3798146108905780639d703cdf146108a3578063a4c12256146108b8576103ef565b80639075180f146107fb578063949d87901461081057806394caca6f1461083057806399b2261714610850576103ef565b8063613f2b7d1161030357806385f75f70116102965780638e2e925f116102655780638e2e925f146107875780638e68595d1461079c5780638f01bf77146107bc5780638f32d59b146107d1578063905bc3e3146107e6576103ef565b806385f75f7014610705578063888a4a7a1461072557806388a5e330146107455780638da5cb5b14610765576103ef565b8063715018a6116102d2578063715018a61461069057806372d55083146106a55780637c3ceda4146106c55780637f9fe1a2146106e5576103ef565b8063613f2b7d146106105780636264f6981461063057806363905be8146106505780636d00e9a014610670576103ef565b80631f3bb9bc116103865780633e75a9a8116103555780633e75a9a814610560578063413a0ed31461058057806348f3c009146105a05780634a088019146105ce57806352ee5bc7146105fb576103ef565b80631f3bb9bc146104eb5780632325b1801461051857806323eaa5df1461053857806328d0cad71461054d576103ef565b8063172e7bc9116103c2578063172e7bc9146104765780631746a2b41461048b578063193d4922146104ab5780631a69e173146104cb576103ef565b806302526490146103f45780630b379b1814610416578063114c3bcd1461044c57806311c7662414610461575b600080fd5b34801561040057600080fd5b5061041461040f366004614787565b610bec565b005b34801561042257600080fd5b506104366104313660046148e7565b610c50565b604051610443919061506b565b60405180910390f35b34801561045857600080fd5b50610414610d08565b34801561046d57600080fd5b50610436610da9565b34801561048257600080fd5b50610436610daf565b34801561049757600080fd5b506104146104a63660046144b9565b610db5565b3480156104b757600080fd5b506104146104c63660046148e7565b610df2565b3480156104d757600080fd5b506104146104e6366004614628565b610e56565b3480156104f757600080fd5b5061050b61050636600461486a565b610eef565b604051610443919061508a565b34801561052457600080fd5b50610436610533366004614628565b6114ad565b34801561054457600080fd5b5061043661150b565b61041461055b36600461427b565b611511565b34801561056c57600080fd5b5061041461057b36600461456b565b6115bb565b34801561058c57600080fd5b5061041461059b3660046145f6565b6115ef565b3480156105ac57600080fd5b506105c06105bb36600461486a565b6116b2565b604051610443929190615142565b3480156105da57600080fd5b506105ee6105e936600461436c565b611722565b6040516104439190615060565b34801561060757600080fd5b5061043661174a565b34801561061c57600080fd5b5061043661062b366004614341565b611750565b34801561063c57600080fd5b5061043661064b36600461427b565b61176d565b34801561065c57600080fd5b5061041461066b3660046148e7565b61177f565b34801561067c57600080fd5b5061043661068b36600461427b565b6117e3565b34801561069c57600080fd5b506104146117f5565b3480156106b157600080fd5b506104146106c0366004614539565b611863565b3480156106d157600080fd5b506104146106e0366004614539565b61193b565b3480156106f157600080fd5b506104146107003660046145f6565b611a07565b34801561071157600080fd5b506105ee61072036600461427b565b611aac565b34801561073157600080fd5b50610436610740366004614628565b611ad0565b34801561075157600080fd5b5061041461076036600461427b565b611b1f565b34801561077157600080fd5b5061077a611c4f565b6040516104439190614f47565b34801561079357600080fd5b50610436611c5f565b3480156107a857600080fd5b5061050b6107b73660046143d2565b611c65565b3480156107c857600080fd5b50610436611d44565b3480156107dd57600080fd5b506105ee611d4a565b3480156107f257600080fd5b50610436611d5b565b34801561080757600080fd5b50610436611d61565b34801561081c57600080fd5b5061043661082b3660046148e7565b611d67565b34801561083c57600080fd5b5061041461084b366004614297565b611d79565b34801561085c57600080fd5b5061043661086b3660046148b5565b611e8b565b34801561087c57600080fd5b5061041461088b3660046148e7565b612037565b61041461089e3660046142cf565b6120aa565b3480156108af57600080fd5b506104366120e8565b3480156108c457600080fd5b506104146108d3366004614838565b6120ee565b3480156108e457600080fd5b5061050b6121b9565b3480156108f957600080fd5b5061077a612244565b34801561090e57600080fd5b5061041461091d366004614923565b612253565b610414612276565b34801561093657600080fd5b50610414610945366004614787565b6122fc565b34801561095657600080fd5b5061043661096536600461427b565b61232d565b34801561097657600080fd5b5061043661233f565b34801561098b57600080fd5b5061050b61099a36600461437e565b612345565b3480156109ab57600080fd5b506104366109ba366004614838565b612393565b3480156109cb57600080fd5b506109df6109da36600461427b565b6123c3565b6040516104439190615013565b3480156109f857600080fd5b50610414610a073660046148e7565b6123e7565b348015610a1857600080fd5b50610436610a273660046148e7565b61245a565b348015610a3857600080fd5b506105ee610a47366004614485565b6124e7565b348015610a5857600080fd5b5061050b610a67366004614438565b612514565b348015610a7857600080fd5b50610414610a8736600461427b565b61259f565b348015610a9857600080fd5b50610436610aa7366004614628565b612645565b348015610ab857600080fd5b5061050b610ac736600461437e565b612661565b348015610ad857600080fd5b5061077a610ae736600461427b565b61278e565b348015610af857600080fd5b50610414610b07366004614838565b6127a9565b348015610b1857600080fd5b5061050b610b273660046143d2565b612aaf565b348015610b3857600080fd5b50610436610b473660046148ff565b612c02565b348015610b5857600080fd5b50610414610b67366004614649565b612c9a565b348015610b7857600080fd5b50610414610b8736600461427b565b612d06565b348015610b9857600080fd5b506105ee610ba736600461427b565b612d36565b348015610bb857600080fd5b50610414610bc73660046148e7565b612d53565b348015610bd857600080fd5b50610414610be73660046147e3565b612db7565b8015610c1c578251811015610c1c5760405162461bcd60e51b8152600401610c13906156d1565b60405180910390fd5b83516001600160a01b0316331415610c3757610c3783612e33565b610c4a6001338660008787600088612f15565b50505050565b6000610c5b33611aac565b610c775760405162461bcd60e51b8152600401610c1390615380565b336000908152600b60205260409020546005548103610c968482612fe3565b336000818152600b6020526040902082850390819055919450610cbf908563ffffffff612ff916565b336001600160a01b03167f79dc947028ead97dc90a91709ac7d54ce368511fc330841f227929937593388985604051610cf8919061506b565b60405180910390a2505050919050565b610d1133612d36565b15610d2e5760405162461bcd60e51b8152600401610c13906157d3565b336000908152600b602052604090205480610d5b5760405162461bcd60e51b8152600401610c1390615830565b336000818152600b6020526040812055610d7b908263ffffffff612ff916565b60405133907ffa9bbf66bded823e4fb9b6e3b204382872af75ef0fe0a330d82af5f84256b00e90600090a250565b60055481565b60085481565b60005b82811015610c4a57610dea848483818110610dcf57fe5b9050602002016020810190610de4919061427b565b83611d79565b600101610db8565b610dfa611d4a565b610e165760405162461bcd60e51b8152600401610c1390615574565b7f7ad23e704ae3ade0a94213eb580d92e6e1bce7243aab9eca2584936485d29e1c60055482604051610e49929190615bdc565b60405180910390a1600555565b336000908152600e6020908152604080832085845290915290205481811415610e915760405162461bcd60e51b8152600401610c1390615881565b336000818152600e6020908152604080832087845290915290819020849055517fc9fec98da4403e7d178ac928f2d08614c7121b0e1ae2fc4f607ebd48c623b48790610ee290869085908790615074565b60405180910390a2505050565b604080840151516001600160a01b039081166000908152600c6020529190912054606091610f1d9116611aac565b610f525750604080518082019091526014815273115e1958dd5d1bdc939bdd135a5b94dd185ad95960621b60208201526114a6565b604084015151610f639084846124e7565b610f97575060408051808201909152601381527250726f7669646572496c6c697175696469747960681b60208201526114a6565b6060610fb585602001518660400151610faf88613095565b86611c65565b9050610fc0816130c0565b610fcb5790506114a6565b6000610fd686612393565b865160009081526011602052604090205490915081146110285760405180604001604052806016815260200175092dcecc2d8d2c8a8c2e6d6a4cac6cad2e0e890c2e6d60531b815250925050506114a6565b60a08601511580159061103f5750428660a0015111155b15611078576040518060400160405280601281526020017115185cdad49958d95a5c1d115e1c1a5c995960721b815250925050506114a6565b61108186613095565b51511561120f5760005b61109487613095565b515181101561120d576110a687613095565b518051829081106110b357fe5b6020026020010151600001516001600160a01b031663a99891c588600001516110db8a613095565b518051859081106110e857fe5b6020026020010151602001518a60c001516040518463ffffffff1660e01b815260040161111793929190615bb3565b60006040518083038186803b15801561112f57600080fd5b505afa92505050801561116457506040513d6000823e601f3d908101601f191682016040526111619190810190614755565b60015b6111e657611170615c9c565b8061117b57506111a6565b8060405160200161118c9190614e65565b6040516020818303038152906040529450505050506114a6565b6040518060400160405280601b81526020017f436f6e646974696f6e52657665727465643a756e646566696e6564000000000081525093505050506114a6565b6111ef816130c0565b611204578060405160200161118c9190614ed8565b5060010161108b565b505b60005b61121b87613095565b60200151518110156113ff5761123087613095565b60200151818151811061123f57fe5b602002602001015160a00151611254576113f7565b61125d87613095565b60200151818151811061126c57fe5b6020026020010151600001516001600160a01b031663eb9e7126886000015189602001516112998b613095565b6020015185815181106112a857fe5b6020026020010151602001516112bd8c613095565b6020015186815181106112cc57fe5b6020026020010151606001516112e18d613095565b6020015187815181106112f057fe5b6020026020010151608001518d60c001516040518763ffffffff1660e01b815260040161132296959493929190615b61565b60006040518083038186803b15801561133a57600080fd5b505afa92505050801561136f57506040513d6000823e601f3d908101601f1916820160405261136c9190810190614755565b60015b6113d75761137b615c9c565b806113865750611397565b8060405160200161118c9190614e2e565b6040518060400160405280601781526020017f416374696f6e52657665727465644e6f4d65737361676500000000000000000081525093505050506114a6565b6113e0816130c0565b6113f5578060405160200161118c9190614e9f565b505b600101611212565b503330141561142c57604051806040016040528060028152602001614f4b60f01b815250925050506114a6565b604086810151516001600160a01b039081166000908152600c60205291909120541633141561147957604051806040016040528060028152602001614f4b60f01b815250925050506114a6565b6040518060400160405280600f81526020016e24b73b30b634b222bc32b1baba37b960891b815250925050505b9392505050565b6000806114c0848463ffffffff61313316565b905061150160646040518060600160405280602c8152602001615dda602c91396006546114f490859063ffffffff61313316565b919063ffffffff61316d16565b0190505b92915050565b60075481565b600034116115315760405162461bcd60e51b8152600401610c139061578b565b6001600160a01b0381166000908152600a602052604081205461155a903463ffffffff6131a416565b9050816001600160a01b03167f7eb3336aae9a3b461018823bcfbd81627ab3872ec4760568cb69599b3f572c873483604051611597929190615bdc565b60405180910390a26001600160a01b039091166000908152600a6020526040902055565b60005b81518110156115eb576115e38282815181106115d657fe5b60200260200101516120ee565b6001016115be565b5050565b60005b81518110156115eb5781818151811061160757fe5b6020026020010151604001516000141561163b5760001982828151811061162a57fe5b602002602001015160400181815250505b600061165983838151811061164c57fe5b6020026020010151611e8b565b905061167c8184848151811061166b57fe5b602002602001015160400151610e56565b604051819033907f57eba0f5699d16b2cdc399006d21f172c68772b9eb995702bb087eace7604fe890600090a3506001016115f2565b600060603330146116d55760405162461bcd60e51b8152600401610c139061542a565b60606116e2868686610eef565b90506116ed816130c0565b6116fc5760019250905061171a565b611705866131c9565b50506040805160208101909152600080825291505b935093915050565b6001600160a01b0382166000908152600f602052604081206114a6908363ffffffff6134a116565b60035481565b600e60209081526000928352604080842090915290825290205481565b600d6020526000908152604090205481565b611787611d4a565b6117a35760405162461bcd60e51b8152600401610c1390615574565b7fabed28d8267464321e12f0e7fb50f149327ccd924ca4f97169a81350c0000fcc600454826040516117d6929190615bdc565b60405180910390a1600455565b600b6020526000908152604090205481565b6117fd611d4a565b6118195760405162461bcd60e51b8152600401610c1390615574565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60005b81518110156115eb5761188c3383838151811061187f57fe5b6020026020010151611722565b6118a85760405162461bcd60e51b8152600401610c13906155f3565b6118df8282815181106118b757fe5b602090810291909101810151336000908152600f90925260409091209063ffffffff6134bf16565b508181815181106118ec57fe5b60200260200101516001600160a01b0316336001600160a01b03167f7a88170de70a4f05aedbab44658e05b07a34686b1c3044c0a130763e613c34de60405160405180910390a3600101611866565b60005b81518110156115eb576119573383838151811061187f57fe5b156119745760405162461bcd60e51b8152600401610c1390615684565b6119ab82828151811061198357fe5b602090810291909101810151336000908152600f90925260409091209063ffffffff6135d216565b508181815181106119b857fe5b60200260200101516001600160a01b0316336001600160a01b03167f0b25d15701a5ba475e30812c6fb077ee6ecaa9337afe94b54fa2d673a7e264b960405160405180910390a360010161193e565b60005b81518110156115eb576000611a2483838151811061164c57fe5b336000908152600e60209081526040808320848452909152902054909150611a5e5760405162461bcd60e51b8152600401610c13906153dd565b336000818152600e60209081526040808320858452909152808220829055518392917fb1bd71728ee07f94bcab41c157fcdce5fbdeef0932e50955da5b60dfcb5c02f691a350600101611a0a565b6005546001600160a01b0382166000908152600b602052604090205410155b919050565b600080611ae3848463ffffffff61313316565b9050611b1760646040518060600160405280602e8152602001615e95602e91396007546114f490859063ffffffff61313316565b949350505050565b336000908152600c60205260409020546001600160a01b03908116908216811415611b5c5760405162461bcd60e51b8152600401610c13906158f5565b6001600160a01b03821615611b9057611b7482611aac565b611b905760405162461bcd60e51b8152600401610c1390615a2b565b6001600160a01b03811615611bc0576001600160a01b0381166000908152600d6020526040902080546000190190555b336000908152600c6020526040902080546001600160a01b0319166001600160a01b03841690811790915515611c10576001600160a01b0382166000908152600d60205260409020805460010190555b6040516001600160a01b03808416919083169033907f1a8b0d27a5b7dcaa3d4823d6e62cb91475b6db3711f348acd68dfd245647046190600090a45050565b6000546001600160a01b03165b90565b60065481565b606083600001516001600160a01b0316856001600160a01b03161415611cd0578183606001511015611ccb575060408051808201909152601881527f53656c6650726f766964657247617350726963654365696c00000000000000006020820152611b17565b611d30565b6000611cde61086b8561362b565b85516001600160a01b03166000908152600e60209081526040808320848452909152902054909150831115611d2e57604051806060016040528060238152602001615e3660239139915050611b17565b505b611d3b858585612661565b95945050505050565b60045481565b6000546001600160a01b0316331490565b61d6d881565b60095481565b60116020526000908152604090205481565b6001600160a01b038083166000908152600c602052604090205416338114611db35760405162461bcd60e51b8152600401610c13906154c1565b816001600160a01b0316816001600160a01b03161415611de55760405162461bcd60e51b8152600401610c1390615a88565b611dee82611aac565b611e0a5760405162461bcd60e51b8152600401610c139061572e565b6001600160a01b038181166000818152600d602081815260408084208054600019019055888616808552600c835281852080546001600160a01b031916978a16978817905586855292909152808320805460010190555190917fd71c850483c235524c816dbe9b5c11d4c3097788bf44f3cea4c969d91432681a91a4505050565b600060608260200151516001600160401b0381118015611eaa57600080fd5b50604051908082528060200260200182016040528015611ee457816020015b611ed1613b57565b815260200190600190039081611ec95790505b50905060005b83602001515181101561200457611eff613b57565b6040518060a0016040528086602001518481518110611f1a57fe5b6020026020010151600001516001600160a01b0316815260200186602001518481518110611f4457fe5b6020026020010151604001516001811115611f5b57fe5b815260200186602001518481518110611f7057fe5b6020026020010151606001516003811115611f8757fe5b815260200186602001518481518110611f9c57fe5b602002602001015160800151600014611fb6576001611fb9565b60005b1515815260200186602001518481518110611fd057fe5b602002602001015160a001511515815250905080838381518110611ff057fe5b602090810291909101015250600101611eea565b50825160405161201991908390602001614f87565b60405160208183030381529060405280519060200120915050919050565b61203f611d4a565b61205b5760405162461bcd60e51b8152600401610c1390615574565b7f0e2413d9141d1b6412c7ba967d457bf348f597f0e5bf6d5f82991c38f8b2923060065482600754840160405161209493929190615074565b60405180910390a1600681905560075401600855565b34156120b9576120b933611511565b6001600160a01b038316156120d1576120d183611b1f565b6120da826115ef565b6120e38161193b565b505050565b60001981565b80602001516001600160a01b0316336001600160a01b0316148061211f57506040810151516001600160a01b031633145b61213b5760405162461bcd60e51b8152600401610c139061517e565b600061214682612393565b825160009081526011602052604090205490915081146121785760405162461bcd60e51b8152600401610c13906151fb565b81516000908152601160205260408082208290558351905133927f744b8104621eb036ccd898df8af9eca45fdef9a44758a759b9a02edfc3c2253d91a35050565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561223c5780601f106122115761010080835404028352916020019161223c565b820191906000526020600020905b81548152906001019060200180831161221f57829003601f168201915b505050505081565b6001546001600160a01b031681565b8215612264576122628361245a565b505b61226d82611a07565b6120e381611863565b336000908152600b6020526040902054600554348201908110156122ac5760405162461bcd60e51b8152600401610c1390615474565b336000818152600b602052604090819020839055517feb86fbd76202b1fb8ea477263ebbaa0ca039911aebfaa0d93aeaaf8f422d7772906122f09085908590615bdc565b60405180910390a25050565b83516001600160a01b03163314156123175761231783612e33565b610c4a600133866000878760008a518902612f15565b600a6020526000908152604090205481565b60105481565b606061234f613b87565b6123588361362b565b9050612368846000015182612514565b9150612373826130c0565b1561238b57612383858585612661565b9150506114a6565b509392505050565b6000816040516020016123a69190615ae5565b604051602081830303815290604052805190602001209050919050565b6001600160a01b0381166000908152600f6020526040902060609061150590613666565b6123ef611d4a565b61240b5760405162461bcd60e51b8152600401610c1390615574565b7f67e5ac0a08ca541e78d867cdf9766fb1e2e572cc4f1fe4a4f338ba5c585fd20c60075482836006540160405161244493929190615074565b60405180910390a1600781905560065401600855565b336000908152600a60205260408120546124748382612fe3565b336000818152600a602052604090208284039081905591935061249d908463ffffffff612ff916565b336001600160a01b03167fffd57c770591833d795262faf39af705c4e7f7428a2857f5a15b4c6d1c01e09f84836040516124d8929190615bdc565b60405180910390a25050919050565b6001600160a01b0383166000908152600a602052604081205461250a8484612645565b1115949350505050565b6001600160a01b0382166000908152600e6020526040812060609161253884611e8b565b8152602001908152602001600020546000141561257f575060408051808201909152601381527215185cdad4dc1958d39bdd141c9bdd9a591959606a1b6020820152611505565b506040805180820190915260028152614f4b60f01b602082015292915050565b6125a7611d4a565b6125c35760405162461bcd60e51b8152600401610c1390615574565b6001600160a01b0381166125e95760405162461bcd60e51b8152600401610c1390615998565b6001546040516001600160a01b038084169216907f3d30b06f36978acd3a6f74d861ea1b0e6d1ebe3d9d65a0e4c738d1b680a70f3a90600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b60085460009061d6d88401830290606490820204019392505050565b606061267583600001518460200151611722565b6126ab5750604080518082019091526015815274496e76616c696450726f76696465724d6f64756c6560581b60208201526114a6565b82516001600160a01b0385811691161461276f5760208301518351604051633f17c3df60e01b81526001600160a01b03831691633f17c3df916126f49189918890600401614f5b565b60006040518083038186803b15801561270c57600080fd5b505afa92505050801561274157506040513d6000823e601f3d908101601f1916820160405261273e9190810190614755565b60015b61276657604051806060016040528060248152602001615d92602491399150506114a6565b91506114a69050565b506040805180820190915260028152614f4b60f01b60208201526114a6565b600c602052600090815260409020546001600160a01b031681565b60005a905060006127b8613721565b604084810151516001600160a01b039081166000908152600c60205291909120549192501633146127fb5760405162461bcd60e51b8152600401610c1390615643565b6000612806846137f7565b61281257600354612820565b61281b84613095565b604001515b905060006060306001600160a01b03166348f3c009612862600454604051806060016040528060218152602001615d71602191395a919063ffffffff61381416565b8886886040518563ffffffff1660e01b815260040161288393929190615af8565b600060405180830381600088803b15801561289d57600080fd5b5087f1935050505080156128d357506040513d6000823e601f3d908101601f191682016040526128d091908101906146f6565b60015b61291a576128df615c9c565b806128ea57506128f5565b600292509050612915565b60029150604051806060016040528060258152602001615f1a6025913990505b612920565b90925090505b600082600281111561292e57fe5b14156129a05760008061294d886040015160000151600089888a613840565b915091508760000151336001600160a01b03167f24676369d56b822255a2ba8afa7c68231dbbb5d324cd311d023fd37554da594e8484604051612991929190615bdc565b60405180910390a35050612aa7565b60018260028111156129ae57fe5b14156129f557855160405133907f5d326d4f0aa3ba9e690e44880c6750bdb3b93089be85717401ac419ae2c942a2906129e890859061508a565b60405180910390a3612aa7565b82851015612a3457855160405133907f582386e898e6a2854d5cc88154e27da9816ef33b0a260f010f2c17f3b385f9e6906129e8906000908690615165565b855160009081526011602052604080822082905587015151612a5a906001888789613840565b5090508660000151336001600160a01b03167f582386e898e6a2854d5cc88154e27da9816ef33b0a260f010f2c17f3b385f9e68385604051612a9d929190615165565b60405180910390a3505b505050505050565b82516001600160a01b039081166000908152600c6020526040902054606091612ad89116611aac565b612afc57604051806060016040528060308152602001615e06603091399050611b17565b8115612b2a5742821015612b2a57604051806060016040528060248152602001615db6602491399050611b17565b606084600001516001600160a01b0316866001600160a01b03161415612b9c57600454612b5e90600263ffffffff61313316565b84604001511015612b8a57604051806060016040528060358152602001615ee560359139915050611b17565b612b95868686612661565b9050612baa565b612ba7868686612345565b90505b612bb3816130c0565b612bdf5780604051602001612bc89190614d8d565b604051602081830303815290604052915050611b17565b50506040805180820190915260028152614f4b60f01b6020820152949350505050565b6000612c0c611d4a565b612c285760405162461bcd60e51b8152600401610c1390615574565b600954612c358482612fe3565b8082036009819055909250612c596001600160a01b0385168463ffffffff612ff916565b7f555f142d04d5fd169d7709fec5eda01b4d671371a74cda4734159a9863a13cd18282604051612c8a929190615bdc565b60405180910390a1505092915050565b612ca2611d4a565b612cbe5760405162461bcd60e51b8152600401610c1390615574565b7f980ecf343395980880528aff1988eab2b3c7284da56044b30cc0af8cb72bac3560028383604051612cf29392919061509d565b60405180910390a16120e360028383613ba8565b612d0e611d4a565b612d2a5760405162461bcd60e51b8152600401610c1390615574565b612d33816139ac565b50565b6001600160a01b03166000908152600d6020526040902054151590565b612d5b611d4a565b612d775760405162461bcd60e51b8152600401610c1390615574565b7fc6e11d62bd8aab57eb4e534cf62d7f0c9670522681d2559de9ac3ff7ef8325d360035482604051612daa929190615bdc565b60405180910390a1600355565b604080516001808252818301909252606091816020015b612dd6613c26565b815260200190600190039081612dce5790505090508281600081518110612df957fe5b602090810291909101015283516001600160a01b0316331415612e1f57612e1f81612e33565b610c4a600033866000858760006001612f15565b60005b81518110156115eb57818181518110612e4b57fe5b60200260200101516040015160001415612e8357600354828281518110612e6e57fe5b60200260200101516040018181525050612ecd565b600454612e9790600263ffffffff61313316565b828281518110612ea357fe5b6020026020010151604001511015612ecd5760405162461bcd60e51b8152600401610c1390615314565b818181518110612ed957fe5b60200260200101516060015160001415612f0d57600019828281518110612efc57fe5b602002602001015160600181815250505b600101612e36565b6010805460010190819055612f28613c4e565b6040518061010001604052808381526020018a6001600160a01b031681526020018981526020018881526020018781526020018681526020018b612f6c5785612f6e565b835b815260200184905290506000612f8382612393565b8251600090815260116020526040908190208290558351905191925082917f77be3ee486c6101ef6d894d85101234637da624e1bc54f11bd8e97174564b08e90612fce908690615ae5565b60405180910390a35050505050505050505050565b6000818310612ff257816114a6565b5090919050565b804710156130195760405162461bcd60e51b8152600401610c13906152dd565b6000826001600160a01b03168260405161303290611c5c565b60006040518083038185875af1925050503d806000811461306f576040519150601f19603f3d011682016040523d82523d6000602084013e613074565b606091505b50509050806120e35760405162461bcd60e51b8152600401610c1390615280565b61309d613c26565b81608001518260600151815181106130b157fe5b60200260200101519050919050565b600060028251101580156130f35750816000815181106130dc57fe5b6020910101516001600160f81b031916604f60f81b145b801561311e57508160018151811061310757fe5b6020910101516001600160f81b031916604b60f81b145b1561312b57506001611acb565b506000919050565b60008261314257506000611505565b8282028284828161314f57fe5b04146114a65760405162461bcd60e51b8152600401610c1390615533565b6000818361318e5760405162461bcd60e51b8152600401610c13919061508a565b50600083858161319a57fe5b0495945050505050565b6000828201838110156114a65760405162461bcd60e51b8152600401610c1390615249565b606060008260400151602001516001600160a01b03166306fca7288460000151856020015186604001516000015161320088613095565b8860c001516040518663ffffffff1660e01b8152600401613225959493929190615b1d565b60006040518083038186803b15801561323d57600080fd5b505afa92505050801561327257506040513d6000823e601f3d908101601f1916820160405261326f91908101906146b2565b60015b6132d85761327e615c9c565b8061328957506132c0565b8060405160200161329a9190614f02565b60408051601f198184030181529082905262461bcd60e51b8252610c139160040161508a565b60405162461bcd60e51b8152600401610c1390615952565b9092509050825160009081526011602090815260408083208390559085015190516060916001600160a01b031690613311908690614c68565b6000604051808303816000865af19150503d806000811461334e576040519150601f19603f3d011682016040523d82523d6000602084013e613353565b606091505b50915091508180156133625750825b15613404578460400151602001516001600160a01b0316633e88ecf4826040518263ffffffff1660e01b815260040161339b919061508a565b60006040518083038186803b1580156133b357600080fd5b505afa9250505080156133c4575060015b613404576133d0615c9c565b806133db57506133ec565b8060405160200161329a9190614ddf565b60405162461bcd60e51b8152600401610c13906159e1565b8115613461578460e0015160011461345c5761345c60008660200151876040015161342e89613a2d565b60808a015160a08b015160c08c015160e08d0151156134545760018d60e0015103613457565b60005b612f15565b61349a565b60408051808201909152601181527023b2b630ba37a1b7b932972fb2bc32b19d60791b602082015261349a90829063ffffffff613a4f16565b5050505050565b6001600160a01b031660009081526020919091526040902054151590565b60006134cb83836134a1565b156135ca576001600160a01b0382166000908152602084905260409020546001840154600019918201910180821461357657600085600101828154811061350e57fe5b6000918252602090912001546001870180546001600160a01b03909216925082918590811061353957fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815290869052604090206001830190555b6001600160a01b0384166000908152602086905260408120556001850180548061359c57fe5b600082815260209020810160001990810180546001600160a01b031916905501905550600191506115059050565b506000611505565b60006135de83836134a1565b6135ca57506001828101805480830182556000828152602080822090920180546001600160a01b0319166001600160a01b0387169081179091559254928152908590526040902055611505565b613633613b87565b604051806060016040528061364b8460000151613abb565b81526020018360200151815260200160008152509050919050565b600181015460609081906001600160401b038111801561368557600080fd5b506040519080825280602002602001820160405280156136af578160200160208202803683370190505b50905060005b600184015481101561371a578360010181815481106136d057fe5b9060005260206000200160009054906101000a90046001600160a01b03168282815181106136fa57fe5b6001600160a01b03909216602092830291909101909101526001016136b5565b5092915050565b60015460405160009182916060916001600160a01b03169061374590600290614c84565b600060405180830381855afa9150503d8060008114613780576040519150601f19603f3d011682016040523d82523d6000602084013e613785565b606091505b5091509150816137b8576137b8604051806060016040528060228152602001615ec360229139829063ffffffff613a4f16565b6000818060200190518101906137ce919061473d565b9050600081136137f05760405162461bcd60e51b8152600401610c13906155a9565b9250505090565b6020810151604090910151516001600160a01b0391821691161490565b600081848411156138385760405162461bcd60e51b8152600401610c13919061508a565b505050900390565b60008060005a86039050600085821061385d5761d6d88601613863565b61d6d882015b9050600088600181111561387357fe5b141561391d5761388381866114ad565b935061388f8186611ad0565b92506138e36138a4858563ffffffff6131a416565b6040518060600160405280603c8152602001615e59603c91396001600160a01b038c166000908152600a6020526040902054919063ffffffff61381416565b6001600160a01b038a166000908152600a6020908152604080832093909355338252600b90522080548501905560098054840190556139a0565b61392d818663ffffffff61313316565b9350613972846040518060600160405280603c8152602001615e59603c91396001600160a01b038c166000908152600a6020526040902054919063ffffffff61381416565b6001600160a01b038a166000908152600a6020908152604080832093909355338252600b9052208054850190555b50509550959350505050565b6001600160a01b0381166139d25760405162461bcd60e51b8152600401610c13906151b5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060018260800151510382606001511461312b578160600151600101611505565b6020825181613a5a57fe5b0660041415613aaa57602082015162461bcd60e51b6001600160e01b031982161415613a9957604483019250818360405160200161329a929190614cf4565b8160405160200161329a9190614d22565b8060405160200161329a9190614d55565b606081516001600160401b0381118015613ad457600080fd5b50604051908082528060200260200182016040528015613afe578160200160208202803683370190505b50905060005b8251811015613b5157828181518110613b1957fe5b602002602001015160000151828281518110613b3157fe5b6001600160a01b0390921660209283029190910190910152600101613b04565b50919050565b6040805160a081019091526000808252602082019081526020016000815260006020820181905260409091015290565b60405180606001604052806060815260200160608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613be95782800160ff19823516178555613c16565b82800160010185558215613c16579182015b82811115613c16578235825591602001919060010190613bfb565b50613c22929150613c97565b5090565b6040518060800160405280606081526020016060815260200160008152602001600081525090565b604080516101008101825260008082526020820152908101613c6e613cb1565b815260200160008152602001606081526020016000815260200160008152602001600081525090565b611c5c91905b80821115613c225760008155600101613c9d565b604080518082019091526000808252602082015290565b803561150581615d4d565b600082601f830112613ce3578081fd5b8135613cf6613cf182615c10565b615bea565b818152915060208083019084810181840286018201871015613d1757600080fd5b60005b84811015613d3f578135613d2d81615d4d565b84529282019290820190600101613d1a565b505050505092915050565b600082601f830112613d5a578081fd5b8135613d68613cf182615c10565b818152915060208083019084810160005b84811015613d3f578135870160c080601f19838c03011215613d9a57600080fd5b613da381615bea565b85830135613db081615d4d565b81526040838101356001600160401b03811115613dcc57600080fd5b613dda8d8983880101613ef6565b888401525060608085013560028110613df257600080fd5b80838501525060809150613e088d838701613f8a565b9083015260a08481013582840152613e228d858701613eeb565b9083015250865250509282019290820190600101613d79565b600082601f830112613e4b578081fd5b8135613e59613cf182615c10565b818152915060208083019084810160005b84811015613d3f57613e81888484358a010161407d565b84529282019290820190600101613e6a565b600082601f830112613ea3578081fd5b8135613eb1613cf182615c10565b818152915060208083019084810160005b84811015613d3f57613ed9888484358a010161415d565b84529282019290820190600101613ec2565b803561150581615d62565b600082601f830112613f06578081fd5b8135613f14613cf182615c2f565b9150808252836020828501011115613f2b57600080fd5b8060208401602084013760009082016020015292915050565b600082601f830112613f54578081fd5b8151613f62613cf182615c2f565b9150808252836020828501011115613f7957600080fd5b61371a816020840160208601615c6a565b80356004811061150557600080fd5b600060408284031215613faa578081fd5b613fb46040615bea565b90508135613fc181615d4d565b81526020820135613fd181615d4d565b602082015292915050565b60006101208284031215613fee578081fd5b610100613ffa81615bea565b91508235825261400d8460208501613cc8565b602083015261401f8460408501613f99565b60408301526080830135606083015260a08301356001600160401b0381111561404757600080fd5b61405385828601613e93565b60808401525060c083013560a083015260e083013560c08301528083013560e08301525092915050565b60006060828403121561408e578081fd5b6140986060615bea565b905081356001600160401b03808211156140b157600080fd5b81840185601f8201126140c357600080fd5b803592506140d3613cf184615c10565b8084825260208083019250808401898283890287010111156140f457600080fd5b600094505b8685101561412057803561410c81615d4d565b8452600194909401939281019281016140f9565b508187528088013595508486111561413757600080fd5b61414389878a01613d4a565b818801525050505050506040820135604082015292915050565b60006080828403121561416e578081fd5b6141786080615bea565b905081356001600160401b038082111561419157600080fd5b81840185601f8201126141a357600080fd5b803592506141b3613cf184615c10565b8381526020808201919083810160005b878110156142335781358601604080601f19838f030112156141e457600080fd5b6141ed81615bea565b6141f98e878501613cc8565b8152818301358a81111561420c57600080fd5b61421a8f8883870101613ef6565b82880152508752505093820193908201906001016141c3565b50508187528088013595508486111561424b57600080fd5b61425789878a01613d4a565b81880152505050505050604082013560408201526060820135606082015292915050565b60006020828403121561428c578081fd5b81356114a681615d4d565b600080604083850312156142a9578081fd5b82356142b481615d4d565b915060208301356142c481615d4d565b809150509250929050565b6000806000606084860312156142e3578081fd5b83356142ee81615d4d565b925060208401356001600160401b0380821115614309578283fd5b61431587838801613e3b565b9350604086013591508082111561432a578283fd5b5061433786828701613cd3565b9150509250925092565b60008060408385031215614353578182fd5b823561435e81615d4d565b946020939093013593505050565b600080604083850312156142a9578182fd5b600080600060808486031215614392578081fd5b833561439d81615d4d565b92506143ac8560208601613f99565b915060608401356001600160401b038111156143c6578182fd5b6143378682870161415d565b60008060008060a085870312156143e7578182fd5b84356143f281615d4d565b93506144018660208701613f99565b925060608501356001600160401b0381111561441b578283fd5b6144278782880161415d565b949793965093946080013593505050565b6000806040838503121561444a578182fd5b823561445581615d4d565b915060208301356001600160401b0381111561446f578182fd5b61447b8582860161407d565b9150509250929050565b600080600060608486031215614499578081fd5b83356144a481615d4d565b95602085013595506040909401359392505050565b6000806000604084860312156144cd578081fd5b83356001600160401b03808211156144e3578283fd5b81860187601f8201126144f4578384fd5b8035925081831115614504578384fd5b8760208085028301011115614517578384fd5b602090810195509193505084013561452e81615d4d565b809150509250925092565b60006020828403121561454a578081fd5b81356001600160401b0381111561455f578182fd5b611b1784828501613cd3565b6000602080838503121561457d578182fd5b82356001600160401b03811115614592578283fd5b80840185601f8201126145a3578384fd5b803591506145b3613cf183615c10565b82815283810190828501865b858110156145e8576145d68a888435880101613fdc565b845292860192908601906001016145bf565b509098975050505050505050565b600060208284031215614607578081fd5b81356001600160401b0381111561461c578182fd5b611b1784828501613e3b565b6000806040838503121561463a578182fd5b50508035926020909101359150565b6000806020838503121561465b578182fd5b82356001600160401b0380821115614671578384fd5b81850186601f820112614682578485fd5b8035925081831115614692578485fd5b8660208483010111156146a3578485fd5b60200196919550909350505050565b600080604083850312156146c4578182fd5b82516001600160401b038111156146d9578283fd5b6146e585828601613f44565b92505060208301516142c481615d62565b60008060408385031215614708578182fd5b825160038110614716578283fd5b60208401519092506001600160401b03811115614731578182fd5b61447b85828601613f44565b60006020828403121561474e578081fd5b5051919050565b600060208284031215614766578081fd5b81516001600160401b0381111561477b578182fd5b611b1784828501613f44565b60008060008060a0858703121561479c578182fd5b6147a68686613f99565b935060408501356001600160401b038111156147c0578283fd5b6147cc87828801613e93565b949794965050505060608301359260800135919050565b6000806000608084860312156147f7578081fd5b6148018585613f99565b925060408401356001600160401b0381111561481b578182fd5b6148278682870161415d565b925050606084013590509250925092565b600060208284031215614849578081fd5b81356001600160401b0381111561485e578182fd5b611b1784828501613fdc565b60008060006060848603121561487e578081fd5b83356001600160401b03811115614893578182fd5b61489f86828701613fdc565b9660208601359650604090950135949350505050565b6000602082840312156148c6578081fd5b81356001600160401b038111156148db578182fd5b611b178482850161407d565b6000602082840312156148f8578081fd5b5035919050565b60008060408385031215614911578182fd5b8235915060208301356142c481615d4d565b600080600060608486031215614937578081fd5b8335925060208401356001600160401b0380821115614309578283fd5b6001600160a01b03169052565b6000815180845260208085018081965082840281019150828601855b85811015614a10578284038952815160c0614999868351614954565b8682015181888801526149ae82880182614a93565b604092508284015191506149c483890183614acc565b606092508284015191506149da83890183614abf565b6080848101519089015260a08085015190935091506149fb83890183614a63565b9b88019b96505050918501915060010161497d565b5091979650505050505050565b6000815180845260208085018081965082840281019150828601855b85811015614a10578284038952614a51848351614bd1565b98850198935090840190600101614a39565b15159052565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452614aab816020860160208601615c6a565b601f01601f19169290920160200192915050565b614ac881615d43565b9052565b60028110614ac857fe5b600060018060a01b038251168352602082015160406020850152611b176040850182614a93565b80516001600160a01b0316825260208082015190614b1d90840182614acc565b506040810151614b2c81615d43565b60408301526060818101511515908301526080908101511515910152565b600061012082518452602083015160018060a01b0380821660208701526040850151915080825116604087015280602083015116606087015250506060830151608085015260808301518160a0860152614ba682860182614a1d565b60a085015160c087015260c085015160e087015260e085015161010087015280935050505092915050565b60006080830182516080855281815180845260a0870191506020935060a08482028801018484018694505b82851015614c2c57609f19898303018452614c18828251614ad6565b600195909501949386019391508501614bfc565b5084870151935087810385890152614c448185614961565b94505050505060408301516040850152606083015160608501528091505092915050565b60008251614c7a818460208701615c6a565b9190910192915050565b6000808354600180821660008114614ca35760018114614cba57614ce9565b60ff198316865260028304607f1686019350614ce9565b600283048786526020808720875b83811015614ce15781548a820152908501908201614cc8565b505050860193505b509195945050505050565b60008351614d06818460208801615c6a565b8351908301614d19828260208801615c6a565b01949350505050565b60008251614d34818460208701615c6a565b6e2737a2b93937b929b2b632b1ba37b960891b920191825250600f01919050565b60008251614d67818460208701615c6a565b73556e657870656374656452657475726e6461746160601b920191825250601401919050565b60007f47656c61746f436f72652e63616e5375626d69745461736b2e697350726f76698252633232b21d60e11b60208301528251614dd2816024850160208701615c6a565b9190910160240192915050565b60007f47656c61746f436f72652e5f657865632e65786563526576657274436865636b8252601d60f91b60208301528251614e21816021850160208701615c6a565b9190910160210192915050565b60006e20b1ba34b7b72932bb32b93a32b21d60891b82528251614e5881600f850160208701615c6a565b91909101600f0192915050565b60007121b7b73234ba34b7b72932bb32b93a32b21d60711b82528251614e92816012850160208701615c6a565b9190910160120192915050565b60007020b1ba34b7b72a32b936b9a737ba27b59d60791b82528251614ecb816011850160208701615c6a565b9190910160110192915050565b60006e21b7b73234ba34b7b72737ba27b59d60891b82528251614e5881600f850160208701615c6a565b60007f47656c61746f436f72652e5f657865632e657865635061796c6f61643a00000082528251614f3a81601d850160208701615c6a565b91909101601d0192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03848116825283166020820152606060408201819052600090611d3b90830184614bd1565b604080825283519082018190526000906020906060840190828701845b82811015614fc857614fb68251615c5e565b84529284019290840190600101614fa4565b50505083810382850152845180825285830191830190845b8181101561500657614ff3838551614afd565b9284019260a09290920191600101614fe0565b5090979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156150545783516001600160a01b03168352928401929184019160010161502f565b50909695505050505050565b901515815260200190565b90815260200190565b9283526020830191909152604082015260600190565b6000602082526114a66020830184614a93565b600060408201604083528186546001808216600081146150c457600181146150e557615121565b6150d4607f60028504168661506b565b60ff19841681526020019350615121565b600283046150f3818761506b565b6150fc8c615c52565b885b8381101561511857815483820152908501906020016150fe565b91909101955050505b5050508381036020850152615137818688614a69565b979650505050505050565b60006003841061514e57fe5b83825260406020830152611b176040830184614a93565b600083825260406020830152611b176040830184614a93565b6020808252601d908201527f47656c61746f436f72652e63616e63656c5461736b3a2073656e646572000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252602e908201527f47656c61746f436f72652e63616e63656c5461736b3a20696e76616c6964207460408201526d0c2e6d6a4cac6cad2e0e890c2e6d60931b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252603a908201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260408201527f6563697069656e74206d61792068617665207265766572746564000000000000606082015260800190565b6020808252601d908201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604082015260600190565b60208082526046908201527f47656c61746f436f72652e5f68616e646c6553656c6650726f7669646572476160408201527f7344656661756c74733a73656c6650726f76696465724761734c696d697420746060820152656f6f206c6f7760d01b608082015260a00190565b6020808252603a908201527f47656c61746f4578656375746f72732e7769746864726177457863657373457860408201527f656375746f725374616b653a206e6f74206d696e5374616b6564000000000000606082015260800190565b6020808252602d908201527f47656c61746f50726f7669646572732e756e70726f766964655461736b53706560408201526c18dcce881c99591d5b99185b9d609a1b606082015260800190565b6020808252602a908201527f47656c61746f436f72652e657865637574696f6e577261707065723a6f6e6c7960408201526947656c61746f436f726560b01b606082015260800190565b6020808252602d908201527f47656c61746f4578656375746f72732e7374616b654578656375746f723a206260408201526c656c6f77206d696e5374616b6560981b606082015260800190565b6020808252604c908201527f47656c61746f50726f7669646572732e6578656375746f7241737369676e734560408201527f78656375746f723a206d73672e73656e646572206973206e6f7420617373696760608201526b3732b21032bc32b1baba37b960a11b608082015260a00190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602a908201527f47656c61746f53797341646d696e2e5f67657447656c61746f47617350726963604082015269653a306f7242656c6f7760b01b606082015260800190565b60208082526030908201527f47656c61746f50726f7669646572732e72656d6f766550726f76696465724d6f60408201526f191d5b195cce881c99591d5b99185b9d60821b606082015260800190565b60208082526021908201527f47656c61746f436f72652e657865633a20496e76616c6964204578656375746f6040820152603960f91b606082015260800190565b6020808252602d908201527f47656c61746f50726f7669646572732e61646450726f76696465724d6f64756c60408201526c195cce881c99591d5b99185b9d609a1b606082015260800190565b6020808252603d908201527f47656c61746f436f72652e7375626d69745461736b436861696e3a206c65737360408201527f20726571756573746564207375626d697473207468616e207461736b73000000606082015260800190565b6020808252603e908201527f47656c61746f50726f7669646572732e6578656375746f7241737369676e734560408201527f78656375746f723a2069734578656375746f724d696e5374616b656428290000606082015260800190565b60208082526028908201527f47656c61746f50726f7669646572732e70726f7669646546756e64733a207a65604082015267726f2076616c756560c01b606082015260800190565b6020808252603a908201527f47656c61746f4578656375746f72732e756e7374616b654578656375746f723a60408201527f206d73672e73656e646572207374696c6c2061737369676e6564000000000000606082015260800190565b60208082526031908201527f47656c61746f4578656375746f72732e756e7374616b654578656375746f723a60408201527008185b1c9958591e481d5b9cdd185ad959607a1b606082015260800190565b6020808252604e908201527f47656c61746f50726f7669646572732e7365745461736b53706563476173507260408201527f6963654365696c3a20416c72656164792077686974656c69737465642077697460608201526d1a0819d85cd41c9a58d950d95a5b60921b608082015260a00190565b6020808252603a908201527f47656c61746f50726f7669646572732e70726f766964657241737369676e734560408201527f78656375746f723a20616c72656164792061737369676e65642e000000000000606082015260800190565b60208082526026908201527f47656c61746f436f72652e5f657865632e657865635061796c6f61643a756e6460408201526519599a5b995960d21b606082015260800190565b60208082526029908201527f47656c61746f53797341646d696e2e73657447656c61746f476173507269636560408201526804f7261636c653a20360bc1b606082015260800190565b6020808252602a908201527f47656c61746f436f72652e5f657865632e65786563526576657274436865636b6040820152690e9d5b9919599a5b995960b21b606082015260800190565b6020808252603e908201527f47656c61746f50726f7669646572732e70726f766964657241737369676e734560408201527f78656375746f723a2069734578656375746f724d696e5374616b656428290000606082015260800190565b6020808252603a908201527f47656c61746f50726f7669646572732e6578656375746f7241737369676e734560408201527f78656375746f723a20616c72656164792061737369676e65642e000000000000606082015260800190565b6000602082526114a66020830184614b4a565b600060608252615b0b6060830186614b4a565b60208301949094525060400152919050565b8581526001600160a01b0385811660208301528416604082015260a060608201819052600090615b4f90830185614bd1565b90508260808301529695505050505050565b8681526001600160a01b038616602082015260c060408201819052600090615b8b90830187614a93565b9050615b9685615d43565b8460608301528360808301528260a0830152979650505050505050565b600084825260606020830152615bcc6060830185614a93565b9050826040830152949350505050565b918252602082015260400190565b6040518181016001600160401b0381118282101715615c0857600080fd5b604052919050565b60006001600160401b03821115615c25578081fd5b5060209081020190565b60006001600160401b03821115615c44578081fd5b50601f01601f191660200190565b60009081526020902090565b6001600160a01b031690565b60005b83811015615c85578181015183820152602001615c6d565b83811115610c4a5750506000910152565b60e01c90565b600060443d1015615cac57611c5c565b600481823e6308c379a0615cc08251615c96565b14615cca57611c5c565b6040513d600319016004823e80513d6001600160401b038160248401118184111715615cf95750505050611c5c565b82840191508151925080831115615d135750505050611c5c565b503d83016020838301011115615d2b57505050611c5c565b601f91909101601f1916810160200160405291505090565b60048110612d3357fe5b6001600160a01b0381168114612d3357600080fd5b8015158114612d3357600080fdfe47656c61746f436f72652e657865633a20496e73756666696369656e742067617347656c61746f50726f7669646572732e70726f76696465724d6f64756c65436865636b7347656c61746f436f72652e63616e5375626d69745461736b3a206578706972794461746547656c61746f53797341646d696e2e6578656375746f72537563636573734665653a20646976206572726f7247656c61746f436f72652e63616e5375626d69745461736b3a206578656375746f72206e6f74206d696e5374616b65647461736b5370656347617350726963654365696c2d4f522d6e6f7450726f766964656447656c61746f436f72652e5f70726f6365737350726f766964657250617961626c65733a2070726f766964657246756e647320756e646572666c6f7747656c61746f53797341646d696e2e73797341646d696e5375636365737353686172653a20646976206572726f7247656c61746f53797341646d696e2e5f67657447656c61746f47617350726963653a47656c61746f436f72652e63616e5375626d69745461736b3a73656c6650726f76696465724761734c696d697420746f6f206c6f7747656c61746f436f72652e657865637574696f6e577261707065723a756e646566696e6564a2646970667358221220270c1fc00c3b8119649fce05842ce508354ccf557dab8ac78c1f084a9926c0a964736f6c634300060a0033",
+ "deployedBytecode": "0x6080604052600436106103ef5760003560e01c80639075180f11610208578063bf2a458a11610118578063d58b172c116100ab578063e9d1a8a91161007a578063e9d1a8a914610b4c578063f2fde38b14610b6c578063f323609914610b8c578063f8559c0814610bac578063ff92b1a814610bcc576103ef565b8063d58b172c14610acc578063d922de9914610aec578063e138d05014610b0c578063e61235b714610b2c576103ef565b8063ca1efcdb116100e7578063ca1efcdb14610a4c578063cf37b49514610a6c578063d378597414610a8c578063d3ab1f7a14610aac576103ef565b8063bf2a458a146109bf578063c234feb6146109ec578063c6638a8b14610a0c578063ca05abe114610a2c576103ef565b8063a4ceb6a31161019b578063b348e2681161016a578063b348e2681461092a578063bac3bf131461094a578063bb07c5031461096a578063bedf04a71461097f578063beecd4931461099f576103ef565b8063a4ceb6a3146108d8578063a4fffd2c146108ed578063b300f75214610902578063b30f457214610922576103ef565b80639a53cb79116101d75780639a53cb79146108705780639aad3798146108905780639d703cdf146108a3578063a4c12256146108b8576103ef565b80639075180f146107fb578063949d87901461081057806394caca6f1461083057806399b2261714610850576103ef565b8063613f2b7d1161030357806385f75f70116102965780638e2e925f116102655780638e2e925f146107875780638e68595d1461079c5780638f01bf77146107bc5780638f32d59b146107d1578063905bc3e3146107e6576103ef565b806385f75f7014610705578063888a4a7a1461072557806388a5e330146107455780638da5cb5b14610765576103ef565b8063715018a6116102d2578063715018a61461069057806372d55083146106a55780637c3ceda4146106c55780637f9fe1a2146106e5576103ef565b8063613f2b7d146106105780636264f6981461063057806363905be8146106505780636d00e9a014610670576103ef565b80631f3bb9bc116103865780633e75a9a8116103555780633e75a9a814610560578063413a0ed31461058057806348f3c009146105a05780634a088019146105ce57806352ee5bc7146105fb576103ef565b80631f3bb9bc146104eb5780632325b1801461051857806323eaa5df1461053857806328d0cad71461054d576103ef565b8063172e7bc9116103c2578063172e7bc9146104765780631746a2b41461048b578063193d4922146104ab5780631a69e173146104cb576103ef565b806302526490146103f45780630b379b1814610416578063114c3bcd1461044c57806311c7662414610461575b600080fd5b34801561040057600080fd5b5061041461040f366004614787565b610bec565b005b34801561042257600080fd5b506104366104313660046148e7565b610c50565b604051610443919061506b565b60405180910390f35b34801561045857600080fd5b50610414610d08565b34801561046d57600080fd5b50610436610da9565b34801561048257600080fd5b50610436610daf565b34801561049757600080fd5b506104146104a63660046144b9565b610db5565b3480156104b757600080fd5b506104146104c63660046148e7565b610df2565b3480156104d757600080fd5b506104146104e6366004614628565b610e56565b3480156104f757600080fd5b5061050b61050636600461486a565b610eef565b604051610443919061508a565b34801561052457600080fd5b50610436610533366004614628565b6114ad565b34801561054457600080fd5b5061043661150b565b61041461055b36600461427b565b611511565b34801561056c57600080fd5b5061041461057b36600461456b565b6115bb565b34801561058c57600080fd5b5061041461059b3660046145f6565b6115ef565b3480156105ac57600080fd5b506105c06105bb36600461486a565b6116b2565b604051610443929190615142565b3480156105da57600080fd5b506105ee6105e936600461436c565b611722565b6040516104439190615060565b34801561060757600080fd5b5061043661174a565b34801561061c57600080fd5b5061043661062b366004614341565b611750565b34801561063c57600080fd5b5061043661064b36600461427b565b61176d565b34801561065c57600080fd5b5061041461066b3660046148e7565b61177f565b34801561067c57600080fd5b5061043661068b36600461427b565b6117e3565b34801561069c57600080fd5b506104146117f5565b3480156106b157600080fd5b506104146106c0366004614539565b611863565b3480156106d157600080fd5b506104146106e0366004614539565b61193b565b3480156106f157600080fd5b506104146107003660046145f6565b611a07565b34801561071157600080fd5b506105ee61072036600461427b565b611aac565b34801561073157600080fd5b50610436610740366004614628565b611ad0565b34801561075157600080fd5b5061041461076036600461427b565b611b1f565b34801561077157600080fd5b5061077a611c4f565b6040516104439190614f47565b34801561079357600080fd5b50610436611c5f565b3480156107a857600080fd5b5061050b6107b73660046143d2565b611c65565b3480156107c857600080fd5b50610436611d44565b3480156107dd57600080fd5b506105ee611d4a565b3480156107f257600080fd5b50610436611d5b565b34801561080757600080fd5b50610436611d61565b34801561081c57600080fd5b5061043661082b3660046148e7565b611d67565b34801561083c57600080fd5b5061041461084b366004614297565b611d79565b34801561085c57600080fd5b5061043661086b3660046148b5565b611e8b565b34801561087c57600080fd5b5061041461088b3660046148e7565b612037565b61041461089e3660046142cf565b6120aa565b3480156108af57600080fd5b506104366120e8565b3480156108c457600080fd5b506104146108d3366004614838565b6120ee565b3480156108e457600080fd5b5061050b6121b9565b3480156108f957600080fd5b5061077a612244565b34801561090e57600080fd5b5061041461091d366004614923565b612253565b610414612276565b34801561093657600080fd5b50610414610945366004614787565b6122fc565b34801561095657600080fd5b5061043661096536600461427b565b61232d565b34801561097657600080fd5b5061043661233f565b34801561098b57600080fd5b5061050b61099a36600461437e565b612345565b3480156109ab57600080fd5b506104366109ba366004614838565b612393565b3480156109cb57600080fd5b506109df6109da36600461427b565b6123c3565b6040516104439190615013565b3480156109f857600080fd5b50610414610a073660046148e7565b6123e7565b348015610a1857600080fd5b50610436610a273660046148e7565b61245a565b348015610a3857600080fd5b506105ee610a47366004614485565b6124e7565b348015610a5857600080fd5b5061050b610a67366004614438565b612514565b348015610a7857600080fd5b50610414610a8736600461427b565b61259f565b348015610a9857600080fd5b50610436610aa7366004614628565b612645565b348015610ab857600080fd5b5061050b610ac736600461437e565b612661565b348015610ad857600080fd5b5061077a610ae736600461427b565b61278e565b348015610af857600080fd5b50610414610b07366004614838565b6127a9565b348015610b1857600080fd5b5061050b610b273660046143d2565b612aaf565b348015610b3857600080fd5b50610436610b473660046148ff565b612c02565b348015610b5857600080fd5b50610414610b67366004614649565b612c9a565b348015610b7857600080fd5b50610414610b8736600461427b565b612d06565b348015610b9857600080fd5b506105ee610ba736600461427b565b612d36565b348015610bb857600080fd5b50610414610bc73660046148e7565b612d53565b348015610bd857600080fd5b50610414610be73660046147e3565b612db7565b8015610c1c578251811015610c1c5760405162461bcd60e51b8152600401610c13906156d1565b60405180910390fd5b83516001600160a01b0316331415610c3757610c3783612e33565b610c4a6001338660008787600088612f15565b50505050565b6000610c5b33611aac565b610c775760405162461bcd60e51b8152600401610c1390615380565b336000908152600b60205260409020546005548103610c968482612fe3565b336000818152600b6020526040902082850390819055919450610cbf908563ffffffff612ff916565b336001600160a01b03167f79dc947028ead97dc90a91709ac7d54ce368511fc330841f227929937593388985604051610cf8919061506b565b60405180910390a2505050919050565b610d1133612d36565b15610d2e5760405162461bcd60e51b8152600401610c13906157d3565b336000908152600b602052604090205480610d5b5760405162461bcd60e51b8152600401610c1390615830565b336000818152600b6020526040812055610d7b908263ffffffff612ff916565b60405133907ffa9bbf66bded823e4fb9b6e3b204382872af75ef0fe0a330d82af5f84256b00e90600090a250565b60055481565b60085481565b60005b82811015610c4a57610dea848483818110610dcf57fe5b9050602002016020810190610de4919061427b565b83611d79565b600101610db8565b610dfa611d4a565b610e165760405162461bcd60e51b8152600401610c1390615574565b7f7ad23e704ae3ade0a94213eb580d92e6e1bce7243aab9eca2584936485d29e1c60055482604051610e49929190615bdc565b60405180910390a1600555565b336000908152600e6020908152604080832085845290915290205481811415610e915760405162461bcd60e51b8152600401610c1390615881565b336000818152600e6020908152604080832087845290915290819020849055517fc9fec98da4403e7d178ac928f2d08614c7121b0e1ae2fc4f607ebd48c623b48790610ee290869085908790615074565b60405180910390a2505050565b604080840151516001600160a01b039081166000908152600c6020529190912054606091610f1d9116611aac565b610f525750604080518082019091526014815273115e1958dd5d1bdc939bdd135a5b94dd185ad95960621b60208201526114a6565b604084015151610f639084846124e7565b610f97575060408051808201909152601381527250726f7669646572496c6c697175696469747960681b60208201526114a6565b6060610fb585602001518660400151610faf88613095565b86611c65565b9050610fc0816130c0565b610fcb5790506114a6565b6000610fd686612393565b865160009081526011602052604090205490915081146110285760405180604001604052806016815260200175092dcecc2d8d2c8a8c2e6d6a4cac6cad2e0e890c2e6d60531b815250925050506114a6565b60a08601511580159061103f5750428660a0015111155b15611078576040518060400160405280601281526020017115185cdad49958d95a5c1d115e1c1a5c995960721b815250925050506114a6565b61108186613095565b51511561120f5760005b61109487613095565b515181101561120d576110a687613095565b518051829081106110b357fe5b6020026020010151600001516001600160a01b031663a99891c588600001516110db8a613095565b518051859081106110e857fe5b6020026020010151602001518a60c001516040518463ffffffff1660e01b815260040161111793929190615bb3565b60006040518083038186803b15801561112f57600080fd5b505afa92505050801561116457506040513d6000823e601f3d908101601f191682016040526111619190810190614755565b60015b6111e657611170615c9c565b8061117b57506111a6565b8060405160200161118c9190614e65565b6040516020818303038152906040529450505050506114a6565b6040518060400160405280601b81526020017f436f6e646974696f6e52657665727465643a756e646566696e6564000000000081525093505050506114a6565b6111ef816130c0565b611204578060405160200161118c9190614ed8565b5060010161108b565b505b60005b61121b87613095565b60200151518110156113ff5761123087613095565b60200151818151811061123f57fe5b602002602001015160a00151611254576113f7565b61125d87613095565b60200151818151811061126c57fe5b6020026020010151600001516001600160a01b031663eb9e7126886000015189602001516112998b613095565b6020015185815181106112a857fe5b6020026020010151602001516112bd8c613095565b6020015186815181106112cc57fe5b6020026020010151606001516112e18d613095565b6020015187815181106112f057fe5b6020026020010151608001518d60c001516040518763ffffffff1660e01b815260040161132296959493929190615b61565b60006040518083038186803b15801561133a57600080fd5b505afa92505050801561136f57506040513d6000823e601f3d908101601f1916820160405261136c9190810190614755565b60015b6113d75761137b615c9c565b806113865750611397565b8060405160200161118c9190614e2e565b6040518060400160405280601781526020017f416374696f6e52657665727465644e6f4d65737361676500000000000000000081525093505050506114a6565b6113e0816130c0565b6113f5578060405160200161118c9190614e9f565b505b600101611212565b503330141561142c57604051806040016040528060028152602001614f4b60f01b815250925050506114a6565b604086810151516001600160a01b039081166000908152600c60205291909120541633141561147957604051806040016040528060028152602001614f4b60f01b815250925050506114a6565b6040518060400160405280600f81526020016e24b73b30b634b222bc32b1baba37b960891b815250925050505b9392505050565b6000806114c0848463ffffffff61313316565b905061150160646040518060600160405280602c8152602001615dda602c91396006546114f490859063ffffffff61313316565b919063ffffffff61316d16565b0190505b92915050565b60075481565b600034116115315760405162461bcd60e51b8152600401610c139061578b565b6001600160a01b0381166000908152600a602052604081205461155a903463ffffffff6131a416565b9050816001600160a01b03167f7eb3336aae9a3b461018823bcfbd81627ab3872ec4760568cb69599b3f572c873483604051611597929190615bdc565b60405180910390a26001600160a01b039091166000908152600a6020526040902055565b60005b81518110156115eb576115e38282815181106115d657fe5b60200260200101516120ee565b6001016115be565b5050565b60005b81518110156115eb5781818151811061160757fe5b6020026020010151604001516000141561163b5760001982828151811061162a57fe5b602002602001015160400181815250505b600061165983838151811061164c57fe5b6020026020010151611e8b565b905061167c8184848151811061166b57fe5b602002602001015160400151610e56565b604051819033907f57eba0f5699d16b2cdc399006d21f172c68772b9eb995702bb087eace7604fe890600090a3506001016115f2565b600060603330146116d55760405162461bcd60e51b8152600401610c139061542a565b60606116e2868686610eef565b90506116ed816130c0565b6116fc5760019250905061171a565b611705866131c9565b50506040805160208101909152600080825291505b935093915050565b6001600160a01b0382166000908152600f602052604081206114a6908363ffffffff6134a116565b60035481565b600e60209081526000928352604080842090915290825290205481565b600d6020526000908152604090205481565b611787611d4a565b6117a35760405162461bcd60e51b8152600401610c1390615574565b7fabed28d8267464321e12f0e7fb50f149327ccd924ca4f97169a81350c0000fcc600454826040516117d6929190615bdc565b60405180910390a1600455565b600b6020526000908152604090205481565b6117fd611d4a565b6118195760405162461bcd60e51b8152600401610c1390615574565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60005b81518110156115eb5761188c3383838151811061187f57fe5b6020026020010151611722565b6118a85760405162461bcd60e51b8152600401610c13906155f3565b6118df8282815181106118b757fe5b602090810291909101810151336000908152600f90925260409091209063ffffffff6134bf16565b508181815181106118ec57fe5b60200260200101516001600160a01b0316336001600160a01b03167f7a88170de70a4f05aedbab44658e05b07a34686b1c3044c0a130763e613c34de60405160405180910390a3600101611866565b60005b81518110156115eb576119573383838151811061187f57fe5b156119745760405162461bcd60e51b8152600401610c1390615684565b6119ab82828151811061198357fe5b602090810291909101810151336000908152600f90925260409091209063ffffffff6135d216565b508181815181106119b857fe5b60200260200101516001600160a01b0316336001600160a01b03167f0b25d15701a5ba475e30812c6fb077ee6ecaa9337afe94b54fa2d673a7e264b960405160405180910390a360010161193e565b60005b81518110156115eb576000611a2483838151811061164c57fe5b336000908152600e60209081526040808320848452909152902054909150611a5e5760405162461bcd60e51b8152600401610c13906153dd565b336000818152600e60209081526040808320858452909152808220829055518392917fb1bd71728ee07f94bcab41c157fcdce5fbdeef0932e50955da5b60dfcb5c02f691a350600101611a0a565b6005546001600160a01b0382166000908152600b602052604090205410155b919050565b600080611ae3848463ffffffff61313316565b9050611b1760646040518060600160405280602e8152602001615e95602e91396007546114f490859063ffffffff61313316565b949350505050565b336000908152600c60205260409020546001600160a01b03908116908216811415611b5c5760405162461bcd60e51b8152600401610c13906158f5565b6001600160a01b03821615611b9057611b7482611aac565b611b905760405162461bcd60e51b8152600401610c1390615a2b565b6001600160a01b03811615611bc0576001600160a01b0381166000908152600d6020526040902080546000190190555b336000908152600c6020526040902080546001600160a01b0319166001600160a01b03841690811790915515611c10576001600160a01b0382166000908152600d60205260409020805460010190555b6040516001600160a01b03808416919083169033907f1a8b0d27a5b7dcaa3d4823d6e62cb91475b6db3711f348acd68dfd245647046190600090a45050565b6000546001600160a01b03165b90565b60065481565b606083600001516001600160a01b0316856001600160a01b03161415611cd0578183606001511015611ccb575060408051808201909152601881527f53656c6650726f766964657247617350726963654365696c00000000000000006020820152611b17565b611d30565b6000611cde61086b8561362b565b85516001600160a01b03166000908152600e60209081526040808320848452909152902054909150831115611d2e57604051806060016040528060238152602001615e3660239139915050611b17565b505b611d3b858585612661565b95945050505050565b60045481565b6000546001600160a01b0316331490565b61d6d881565b60095481565b60116020526000908152604090205481565b6001600160a01b038083166000908152600c602052604090205416338114611db35760405162461bcd60e51b8152600401610c13906154c1565b816001600160a01b0316816001600160a01b03161415611de55760405162461bcd60e51b8152600401610c1390615a88565b611dee82611aac565b611e0a5760405162461bcd60e51b8152600401610c139061572e565b6001600160a01b038181166000818152600d602081815260408084208054600019019055888616808552600c835281852080546001600160a01b031916978a16978817905586855292909152808320805460010190555190917fd71c850483c235524c816dbe9b5c11d4c3097788bf44f3cea4c969d91432681a91a4505050565b600060608260200151516001600160401b0381118015611eaa57600080fd5b50604051908082528060200260200182016040528015611ee457816020015b611ed1613b57565b815260200190600190039081611ec95790505b50905060005b83602001515181101561200457611eff613b57565b6040518060a0016040528086602001518481518110611f1a57fe5b6020026020010151600001516001600160a01b0316815260200186602001518481518110611f4457fe5b6020026020010151604001516001811115611f5b57fe5b815260200186602001518481518110611f7057fe5b6020026020010151606001516003811115611f8757fe5b815260200186602001518481518110611f9c57fe5b602002602001015160800151600014611fb6576001611fb9565b60005b1515815260200186602001518481518110611fd057fe5b602002602001015160a001511515815250905080838381518110611ff057fe5b602090810291909101015250600101611eea565b50825160405161201991908390602001614f87565b60405160208183030381529060405280519060200120915050919050565b61203f611d4a565b61205b5760405162461bcd60e51b8152600401610c1390615574565b7f0e2413d9141d1b6412c7ba967d457bf348f597f0e5bf6d5f82991c38f8b2923060065482600754840160405161209493929190615074565b60405180910390a1600681905560075401600855565b34156120b9576120b933611511565b6001600160a01b038316156120d1576120d183611b1f565b6120da826115ef565b6120e38161193b565b505050565b60001981565b80602001516001600160a01b0316336001600160a01b0316148061211f57506040810151516001600160a01b031633145b61213b5760405162461bcd60e51b8152600401610c139061517e565b600061214682612393565b825160009081526011602052604090205490915081146121785760405162461bcd60e51b8152600401610c13906151fb565b81516000908152601160205260408082208290558351905133927f744b8104621eb036ccd898df8af9eca45fdef9a44758a759b9a02edfc3c2253d91a35050565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561223c5780601f106122115761010080835404028352916020019161223c565b820191906000526020600020905b81548152906001019060200180831161221f57829003601f168201915b505050505081565b6001546001600160a01b031681565b8215612264576122628361245a565b505b61226d82611a07565b6120e381611863565b336000908152600b6020526040902054600554348201908110156122ac5760405162461bcd60e51b8152600401610c1390615474565b336000818152600b602052604090819020839055517feb86fbd76202b1fb8ea477263ebbaa0ca039911aebfaa0d93aeaaf8f422d7772906122f09085908590615bdc565b60405180910390a25050565b83516001600160a01b03163314156123175761231783612e33565b610c4a600133866000878760008a518902612f15565b600a6020526000908152604090205481565b60105481565b606061234f613b87565b6123588361362b565b9050612368846000015182612514565b9150612373826130c0565b1561238b57612383858585612661565b9150506114a6565b509392505050565b6000816040516020016123a69190615ae5565b604051602081830303815290604052805190602001209050919050565b6001600160a01b0381166000908152600f6020526040902060609061150590613666565b6123ef611d4a565b61240b5760405162461bcd60e51b8152600401610c1390615574565b7f67e5ac0a08ca541e78d867cdf9766fb1e2e572cc4f1fe4a4f338ba5c585fd20c60075482836006540160405161244493929190615074565b60405180910390a1600781905560065401600855565b336000908152600a60205260408120546124748382612fe3565b336000818152600a602052604090208284039081905591935061249d908463ffffffff612ff916565b336001600160a01b03167fffd57c770591833d795262faf39af705c4e7f7428a2857f5a15b4c6d1c01e09f84836040516124d8929190615bdc565b60405180910390a25050919050565b6001600160a01b0383166000908152600a602052604081205461250a8484612645565b1115949350505050565b6001600160a01b0382166000908152600e6020526040812060609161253884611e8b565b8152602001908152602001600020546000141561257f575060408051808201909152601381527215185cdad4dc1958d39bdd141c9bdd9a591959606a1b6020820152611505565b506040805180820190915260028152614f4b60f01b602082015292915050565b6125a7611d4a565b6125c35760405162461bcd60e51b8152600401610c1390615574565b6001600160a01b0381166125e95760405162461bcd60e51b8152600401610c1390615998565b6001546040516001600160a01b038084169216907f3d30b06f36978acd3a6f74d861ea1b0e6d1ebe3d9d65a0e4c738d1b680a70f3a90600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b60085460009061d6d88401830290606490820204019392505050565b606061267583600001518460200151611722565b6126ab5750604080518082019091526015815274496e76616c696450726f76696465724d6f64756c6560581b60208201526114a6565b82516001600160a01b0385811691161461276f5760208301518351604051633f17c3df60e01b81526001600160a01b03831691633f17c3df916126f49189918890600401614f5b565b60006040518083038186803b15801561270c57600080fd5b505afa92505050801561274157506040513d6000823e601f3d908101601f1916820160405261273e9190810190614755565b60015b61276657604051806060016040528060248152602001615d92602491399150506114a6565b91506114a69050565b506040805180820190915260028152614f4b60f01b60208201526114a6565b600c602052600090815260409020546001600160a01b031681565b60005a905060006127b8613721565b604084810151516001600160a01b039081166000908152600c60205291909120549192501633146127fb5760405162461bcd60e51b8152600401610c1390615643565b6000612806846137f7565b61281257600354612820565b61281b84613095565b604001515b905060006060306001600160a01b03166348f3c009612862600454604051806060016040528060218152602001615d71602191395a919063ffffffff61381416565b8886886040518563ffffffff1660e01b815260040161288393929190615af8565b600060405180830381600088803b15801561289d57600080fd5b5087f1935050505080156128d357506040513d6000823e601f3d908101601f191682016040526128d091908101906146f6565b60015b61291a576128df615c9c565b806128ea57506128f5565b600292509050612915565b60029150604051806060016040528060258152602001615f1a6025913990505b612920565b90925090505b600082600281111561292e57fe5b14156129a05760008061294d886040015160000151600089888a613840565b915091508760000151336001600160a01b03167f24676369d56b822255a2ba8afa7c68231dbbb5d324cd311d023fd37554da594e8484604051612991929190615bdc565b60405180910390a35050612aa7565b60018260028111156129ae57fe5b14156129f557855160405133907f5d326d4f0aa3ba9e690e44880c6750bdb3b93089be85717401ac419ae2c942a2906129e890859061508a565b60405180910390a3612aa7565b82851015612a3457855160405133907f582386e898e6a2854d5cc88154e27da9816ef33b0a260f010f2c17f3b385f9e6906129e8906000908690615165565b855160009081526011602052604080822082905587015151612a5a906001888789613840565b5090508660000151336001600160a01b03167f582386e898e6a2854d5cc88154e27da9816ef33b0a260f010f2c17f3b385f9e68385604051612a9d929190615165565b60405180910390a3505b505050505050565b82516001600160a01b039081166000908152600c6020526040902054606091612ad89116611aac565b612afc57604051806060016040528060308152602001615e06603091399050611b17565b8115612b2a5742821015612b2a57604051806060016040528060248152602001615db6602491399050611b17565b606084600001516001600160a01b0316866001600160a01b03161415612b9c57600454612b5e90600263ffffffff61313316565b84604001511015612b8a57604051806060016040528060358152602001615ee560359139915050611b17565b612b95868686612661565b9050612baa565b612ba7868686612345565b90505b612bb3816130c0565b612bdf5780604051602001612bc89190614d8d565b604051602081830303815290604052915050611b17565b50506040805180820190915260028152614f4b60f01b6020820152949350505050565b6000612c0c611d4a565b612c285760405162461bcd60e51b8152600401610c1390615574565b600954612c358482612fe3565b8082036009819055909250612c596001600160a01b0385168463ffffffff612ff916565b7f555f142d04d5fd169d7709fec5eda01b4d671371a74cda4734159a9863a13cd18282604051612c8a929190615bdc565b60405180910390a1505092915050565b612ca2611d4a565b612cbe5760405162461bcd60e51b8152600401610c1390615574565b7f980ecf343395980880528aff1988eab2b3c7284da56044b30cc0af8cb72bac3560028383604051612cf29392919061509d565b60405180910390a16120e360028383613ba8565b612d0e611d4a565b612d2a5760405162461bcd60e51b8152600401610c1390615574565b612d33816139ac565b50565b6001600160a01b03166000908152600d6020526040902054151590565b612d5b611d4a565b612d775760405162461bcd60e51b8152600401610c1390615574565b7fc6e11d62bd8aab57eb4e534cf62d7f0c9670522681d2559de9ac3ff7ef8325d360035482604051612daa929190615bdc565b60405180910390a1600355565b604080516001808252818301909252606091816020015b612dd6613c26565b815260200190600190039081612dce5790505090508281600081518110612df957fe5b602090810291909101015283516001600160a01b0316331415612e1f57612e1f81612e33565b610c4a600033866000858760006001612f15565b60005b81518110156115eb57818181518110612e4b57fe5b60200260200101516040015160001415612e8357600354828281518110612e6e57fe5b60200260200101516040018181525050612ecd565b600454612e9790600263ffffffff61313316565b828281518110612ea357fe5b6020026020010151604001511015612ecd5760405162461bcd60e51b8152600401610c1390615314565b818181518110612ed957fe5b60200260200101516060015160001415612f0d57600019828281518110612efc57fe5b602002602001015160600181815250505b600101612e36565b6010805460010190819055612f28613c4e565b6040518061010001604052808381526020018a6001600160a01b031681526020018981526020018881526020018781526020018681526020018b612f6c5785612f6e565b835b815260200184905290506000612f8382612393565b8251600090815260116020526040908190208290558351905191925082917f77be3ee486c6101ef6d894d85101234637da624e1bc54f11bd8e97174564b08e90612fce908690615ae5565b60405180910390a35050505050505050505050565b6000818310612ff257816114a6565b5090919050565b804710156130195760405162461bcd60e51b8152600401610c13906152dd565b6000826001600160a01b03168260405161303290611c5c565b60006040518083038185875af1925050503d806000811461306f576040519150601f19603f3d011682016040523d82523d6000602084013e613074565b606091505b50509050806120e35760405162461bcd60e51b8152600401610c1390615280565b61309d613c26565b81608001518260600151815181106130b157fe5b60200260200101519050919050565b600060028251101580156130f35750816000815181106130dc57fe5b6020910101516001600160f81b031916604f60f81b145b801561311e57508160018151811061310757fe5b6020910101516001600160f81b031916604b60f81b145b1561312b57506001611acb565b506000919050565b60008261314257506000611505565b8282028284828161314f57fe5b04146114a65760405162461bcd60e51b8152600401610c1390615533565b6000818361318e5760405162461bcd60e51b8152600401610c13919061508a565b50600083858161319a57fe5b0495945050505050565b6000828201838110156114a65760405162461bcd60e51b8152600401610c1390615249565b606060008260400151602001516001600160a01b03166306fca7288460000151856020015186604001516000015161320088613095565b8860c001516040518663ffffffff1660e01b8152600401613225959493929190615b1d565b60006040518083038186803b15801561323d57600080fd5b505afa92505050801561327257506040513d6000823e601f3d908101601f1916820160405261326f91908101906146b2565b60015b6132d85761327e615c9c565b8061328957506132c0565b8060405160200161329a9190614f02565b60408051601f198184030181529082905262461bcd60e51b8252610c139160040161508a565b60405162461bcd60e51b8152600401610c1390615952565b9092509050825160009081526011602090815260408083208390559085015190516060916001600160a01b031690613311908690614c68565b6000604051808303816000865af19150503d806000811461334e576040519150601f19603f3d011682016040523d82523d6000602084013e613353565b606091505b50915091508180156133625750825b15613404578460400151602001516001600160a01b0316633e88ecf4826040518263ffffffff1660e01b815260040161339b919061508a565b60006040518083038186803b1580156133b357600080fd5b505afa9250505080156133c4575060015b613404576133d0615c9c565b806133db57506133ec565b8060405160200161329a9190614ddf565b60405162461bcd60e51b8152600401610c13906159e1565b8115613461578460e0015160011461345c5761345c60008660200151876040015161342e89613a2d565b60808a015160a08b015160c08c015160e08d0151156134545760018d60e0015103613457565b60005b612f15565b61349a565b60408051808201909152601181527023b2b630ba37a1b7b932972fb2bc32b19d60791b602082015261349a90829063ffffffff613a4f16565b5050505050565b6001600160a01b031660009081526020919091526040902054151590565b60006134cb83836134a1565b156135ca576001600160a01b0382166000908152602084905260409020546001840154600019918201910180821461357657600085600101828154811061350e57fe5b6000918252602090912001546001870180546001600160a01b03909216925082918590811061353957fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815290869052604090206001830190555b6001600160a01b0384166000908152602086905260408120556001850180548061359c57fe5b600082815260209020810160001990810180546001600160a01b031916905501905550600191506115059050565b506000611505565b60006135de83836134a1565b6135ca57506001828101805480830182556000828152602080822090920180546001600160a01b0319166001600160a01b0387169081179091559254928152908590526040902055611505565b613633613b87565b604051806060016040528061364b8460000151613abb565b81526020018360200151815260200160008152509050919050565b600181015460609081906001600160401b038111801561368557600080fd5b506040519080825280602002602001820160405280156136af578160200160208202803683370190505b50905060005b600184015481101561371a578360010181815481106136d057fe5b9060005260206000200160009054906101000a90046001600160a01b03168282815181106136fa57fe5b6001600160a01b03909216602092830291909101909101526001016136b5565b5092915050565b60015460405160009182916060916001600160a01b03169061374590600290614c84565b600060405180830381855afa9150503d8060008114613780576040519150601f19603f3d011682016040523d82523d6000602084013e613785565b606091505b5091509150816137b8576137b8604051806060016040528060228152602001615ec360229139829063ffffffff613a4f16565b6000818060200190518101906137ce919061473d565b9050600081136137f05760405162461bcd60e51b8152600401610c13906155a9565b9250505090565b6020810151604090910151516001600160a01b0391821691161490565b600081848411156138385760405162461bcd60e51b8152600401610c13919061508a565b505050900390565b60008060005a86039050600085821061385d5761d6d88601613863565b61d6d882015b9050600088600181111561387357fe5b141561391d5761388381866114ad565b935061388f8186611ad0565b92506138e36138a4858563ffffffff6131a416565b6040518060600160405280603c8152602001615e59603c91396001600160a01b038c166000908152600a6020526040902054919063ffffffff61381416565b6001600160a01b038a166000908152600a6020908152604080832093909355338252600b90522080548501905560098054840190556139a0565b61392d818663ffffffff61313316565b9350613972846040518060600160405280603c8152602001615e59603c91396001600160a01b038c166000908152600a6020526040902054919063ffffffff61381416565b6001600160a01b038a166000908152600a6020908152604080832093909355338252600b9052208054850190555b50509550959350505050565b6001600160a01b0381166139d25760405162461bcd60e51b8152600401610c13906151b5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060018260800151510382606001511461312b578160600151600101611505565b6020825181613a5a57fe5b0660041415613aaa57602082015162461bcd60e51b6001600160e01b031982161415613a9957604483019250818360405160200161329a929190614cf4565b8160405160200161329a9190614d22565b8060405160200161329a9190614d55565b606081516001600160401b0381118015613ad457600080fd5b50604051908082528060200260200182016040528015613afe578160200160208202803683370190505b50905060005b8251811015613b5157828181518110613b1957fe5b602002602001015160000151828281518110613b3157fe5b6001600160a01b0390921660209283029190910190910152600101613b04565b50919050565b6040805160a081019091526000808252602082019081526020016000815260006020820181905260409091015290565b60405180606001604052806060815260200160608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613be95782800160ff19823516178555613c16565b82800160010185558215613c16579182015b82811115613c16578235825591602001919060010190613bfb565b50613c22929150613c97565b5090565b6040518060800160405280606081526020016060815260200160008152602001600081525090565b604080516101008101825260008082526020820152908101613c6e613cb1565b815260200160008152602001606081526020016000815260200160008152602001600081525090565b611c5c91905b80821115613c225760008155600101613c9d565b604080518082019091526000808252602082015290565b803561150581615d4d565b600082601f830112613ce3578081fd5b8135613cf6613cf182615c10565b615bea565b818152915060208083019084810181840286018201871015613d1757600080fd5b60005b84811015613d3f578135613d2d81615d4d565b84529282019290820190600101613d1a565b505050505092915050565b600082601f830112613d5a578081fd5b8135613d68613cf182615c10565b818152915060208083019084810160005b84811015613d3f578135870160c080601f19838c03011215613d9a57600080fd5b613da381615bea565b85830135613db081615d4d565b81526040838101356001600160401b03811115613dcc57600080fd5b613dda8d8983880101613ef6565b888401525060608085013560028110613df257600080fd5b80838501525060809150613e088d838701613f8a565b9083015260a08481013582840152613e228d858701613eeb565b9083015250865250509282019290820190600101613d79565b600082601f830112613e4b578081fd5b8135613e59613cf182615c10565b818152915060208083019084810160005b84811015613d3f57613e81888484358a010161407d565b84529282019290820190600101613e6a565b600082601f830112613ea3578081fd5b8135613eb1613cf182615c10565b818152915060208083019084810160005b84811015613d3f57613ed9888484358a010161415d565b84529282019290820190600101613ec2565b803561150581615d62565b600082601f830112613f06578081fd5b8135613f14613cf182615c2f565b9150808252836020828501011115613f2b57600080fd5b8060208401602084013760009082016020015292915050565b600082601f830112613f54578081fd5b8151613f62613cf182615c2f565b9150808252836020828501011115613f7957600080fd5b61371a816020840160208601615c6a565b80356004811061150557600080fd5b600060408284031215613faa578081fd5b613fb46040615bea565b90508135613fc181615d4d565b81526020820135613fd181615d4d565b602082015292915050565b60006101208284031215613fee578081fd5b610100613ffa81615bea565b91508235825261400d8460208501613cc8565b602083015261401f8460408501613f99565b60408301526080830135606083015260a08301356001600160401b0381111561404757600080fd5b61405385828601613e93565b60808401525060c083013560a083015260e083013560c08301528083013560e08301525092915050565b60006060828403121561408e578081fd5b6140986060615bea565b905081356001600160401b03808211156140b157600080fd5b81840185601f8201126140c357600080fd5b803592506140d3613cf184615c10565b8084825260208083019250808401898283890287010111156140f457600080fd5b600094505b8685101561412057803561410c81615d4d565b8452600194909401939281019281016140f9565b508187528088013595508486111561413757600080fd5b61414389878a01613d4a565b818801525050505050506040820135604082015292915050565b60006080828403121561416e578081fd5b6141786080615bea565b905081356001600160401b038082111561419157600080fd5b81840185601f8201126141a357600080fd5b803592506141b3613cf184615c10565b8381526020808201919083810160005b878110156142335781358601604080601f19838f030112156141e457600080fd5b6141ed81615bea565b6141f98e878501613cc8565b8152818301358a81111561420c57600080fd5b61421a8f8883870101613ef6565b82880152508752505093820193908201906001016141c3565b50508187528088013595508486111561424b57600080fd5b61425789878a01613d4a565b81880152505050505050604082013560408201526060820135606082015292915050565b60006020828403121561428c578081fd5b81356114a681615d4d565b600080604083850312156142a9578081fd5b82356142b481615d4d565b915060208301356142c481615d4d565b809150509250929050565b6000806000606084860312156142e3578081fd5b83356142ee81615d4d565b925060208401356001600160401b0380821115614309578283fd5b61431587838801613e3b565b9350604086013591508082111561432a578283fd5b5061433786828701613cd3565b9150509250925092565b60008060408385031215614353578182fd5b823561435e81615d4d565b946020939093013593505050565b600080604083850312156142a9578182fd5b600080600060808486031215614392578081fd5b833561439d81615d4d565b92506143ac8560208601613f99565b915060608401356001600160401b038111156143c6578182fd5b6143378682870161415d565b60008060008060a085870312156143e7578182fd5b84356143f281615d4d565b93506144018660208701613f99565b925060608501356001600160401b0381111561441b578283fd5b6144278782880161415d565b949793965093946080013593505050565b6000806040838503121561444a578182fd5b823561445581615d4d565b915060208301356001600160401b0381111561446f578182fd5b61447b8582860161407d565b9150509250929050565b600080600060608486031215614499578081fd5b83356144a481615d4d565b95602085013595506040909401359392505050565b6000806000604084860312156144cd578081fd5b83356001600160401b03808211156144e3578283fd5b81860187601f8201126144f4578384fd5b8035925081831115614504578384fd5b8760208085028301011115614517578384fd5b602090810195509193505084013561452e81615d4d565b809150509250925092565b60006020828403121561454a578081fd5b81356001600160401b0381111561455f578182fd5b611b1784828501613cd3565b6000602080838503121561457d578182fd5b82356001600160401b03811115614592578283fd5b80840185601f8201126145a3578384fd5b803591506145b3613cf183615c10565b82815283810190828501865b858110156145e8576145d68a888435880101613fdc565b845292860192908601906001016145bf565b509098975050505050505050565b600060208284031215614607578081fd5b81356001600160401b0381111561461c578182fd5b611b1784828501613e3b565b6000806040838503121561463a578182fd5b50508035926020909101359150565b6000806020838503121561465b578182fd5b82356001600160401b0380821115614671578384fd5b81850186601f820112614682578485fd5b8035925081831115614692578485fd5b8660208483010111156146a3578485fd5b60200196919550909350505050565b600080604083850312156146c4578182fd5b82516001600160401b038111156146d9578283fd5b6146e585828601613f44565b92505060208301516142c481615d62565b60008060408385031215614708578182fd5b825160038110614716578283fd5b60208401519092506001600160401b03811115614731578182fd5b61447b85828601613f44565b60006020828403121561474e578081fd5b5051919050565b600060208284031215614766578081fd5b81516001600160401b0381111561477b578182fd5b611b1784828501613f44565b60008060008060a0858703121561479c578182fd5b6147a68686613f99565b935060408501356001600160401b038111156147c0578283fd5b6147cc87828801613e93565b949794965050505060608301359260800135919050565b6000806000608084860312156147f7578081fd5b6148018585613f99565b925060408401356001600160401b0381111561481b578182fd5b6148278682870161415d565b925050606084013590509250925092565b600060208284031215614849578081fd5b81356001600160401b0381111561485e578182fd5b611b1784828501613fdc565b60008060006060848603121561487e578081fd5b83356001600160401b03811115614893578182fd5b61489f86828701613fdc565b9660208601359650604090950135949350505050565b6000602082840312156148c6578081fd5b81356001600160401b038111156148db578182fd5b611b178482850161407d565b6000602082840312156148f8578081fd5b5035919050565b60008060408385031215614911578182fd5b8235915060208301356142c481615d4d565b600080600060608486031215614937578081fd5b8335925060208401356001600160401b0380821115614309578283fd5b6001600160a01b03169052565b6000815180845260208085018081965082840281019150828601855b85811015614a10578284038952815160c0614999868351614954565b8682015181888801526149ae82880182614a93565b604092508284015191506149c483890183614acc565b606092508284015191506149da83890183614abf565b6080848101519089015260a08085015190935091506149fb83890183614a63565b9b88019b96505050918501915060010161497d565b5091979650505050505050565b6000815180845260208085018081965082840281019150828601855b85811015614a10578284038952614a51848351614bd1565b98850198935090840190600101614a39565b15159052565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452614aab816020860160208601615c6a565b601f01601f19169290920160200192915050565b614ac881615d43565b9052565b60028110614ac857fe5b600060018060a01b038251168352602082015160406020850152611b176040850182614a93565b80516001600160a01b0316825260208082015190614b1d90840182614acc565b506040810151614b2c81615d43565b60408301526060818101511515908301526080908101511515910152565b600061012082518452602083015160018060a01b0380821660208701526040850151915080825116604087015280602083015116606087015250506060830151608085015260808301518160a0860152614ba682860182614a1d565b60a085015160c087015260c085015160e087015260e085015161010087015280935050505092915050565b60006080830182516080855281815180845260a0870191506020935060a08482028801018484018694505b82851015614c2c57609f19898303018452614c18828251614ad6565b600195909501949386019391508501614bfc565b5084870151935087810385890152614c448185614961565b94505050505060408301516040850152606083015160608501528091505092915050565b60008251614c7a818460208701615c6a565b9190910192915050565b6000808354600180821660008114614ca35760018114614cba57614ce9565b60ff198316865260028304607f1686019350614ce9565b600283048786526020808720875b83811015614ce15781548a820152908501908201614cc8565b505050860193505b509195945050505050565b60008351614d06818460208801615c6a565b8351908301614d19828260208801615c6a565b01949350505050565b60008251614d34818460208701615c6a565b6e2737a2b93937b929b2b632b1ba37b960891b920191825250600f01919050565b60008251614d67818460208701615c6a565b73556e657870656374656452657475726e6461746160601b920191825250601401919050565b60007f47656c61746f436f72652e63616e5375626d69745461736b2e697350726f76698252633232b21d60e11b60208301528251614dd2816024850160208701615c6a565b9190910160240192915050565b60007f47656c61746f436f72652e5f657865632e65786563526576657274436865636b8252601d60f91b60208301528251614e21816021850160208701615c6a565b9190910160210192915050565b60006e20b1ba34b7b72932bb32b93a32b21d60891b82528251614e5881600f850160208701615c6a565b91909101600f0192915050565b60007121b7b73234ba34b7b72932bb32b93a32b21d60711b82528251614e92816012850160208701615c6a565b9190910160120192915050565b60007020b1ba34b7b72a32b936b9a737ba27b59d60791b82528251614ecb816011850160208701615c6a565b9190910160110192915050565b60006e21b7b73234ba34b7b72737ba27b59d60891b82528251614e5881600f850160208701615c6a565b60007f47656c61746f436f72652e5f657865632e657865635061796c6f61643a00000082528251614f3a81601d850160208701615c6a565b91909101601d0192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03848116825283166020820152606060408201819052600090611d3b90830184614bd1565b604080825283519082018190526000906020906060840190828701845b82811015614fc857614fb68251615c5e565b84529284019290840190600101614fa4565b50505083810382850152845180825285830191830190845b8181101561500657614ff3838551614afd565b9284019260a09290920191600101614fe0565b5090979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156150545783516001600160a01b03168352928401929184019160010161502f565b50909695505050505050565b901515815260200190565b90815260200190565b9283526020830191909152604082015260600190565b6000602082526114a66020830184614a93565b600060408201604083528186546001808216600081146150c457600181146150e557615121565b6150d4607f60028504168661506b565b60ff19841681526020019350615121565b600283046150f3818761506b565b6150fc8c615c52565b885b8381101561511857815483820152908501906020016150fe565b91909101955050505b5050508381036020850152615137818688614a69565b979650505050505050565b60006003841061514e57fe5b83825260406020830152611b176040830184614a93565b600083825260406020830152611b176040830184614a93565b6020808252601d908201527f47656c61746f436f72652e63616e63656c5461736b3a2073656e646572000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252602e908201527f47656c61746f436f72652e63616e63656c5461736b3a20696e76616c6964207460408201526d0c2e6d6a4cac6cad2e0e890c2e6d60931b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252603a908201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260408201527f6563697069656e74206d61792068617665207265766572746564000000000000606082015260800190565b6020808252601d908201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604082015260600190565b60208082526046908201527f47656c61746f436f72652e5f68616e646c6553656c6650726f7669646572476160408201527f7344656661756c74733a73656c6650726f76696465724761734c696d697420746060820152656f6f206c6f7760d01b608082015260a00190565b6020808252603a908201527f47656c61746f4578656375746f72732e7769746864726177457863657373457860408201527f656375746f725374616b653a206e6f74206d696e5374616b6564000000000000606082015260800190565b6020808252602d908201527f47656c61746f50726f7669646572732e756e70726f766964655461736b53706560408201526c18dcce881c99591d5b99185b9d609a1b606082015260800190565b6020808252602a908201527f47656c61746f436f72652e657865637574696f6e577261707065723a6f6e6c7960408201526947656c61746f436f726560b01b606082015260800190565b6020808252602d908201527f47656c61746f4578656375746f72732e7374616b654578656375746f723a206260408201526c656c6f77206d696e5374616b6560981b606082015260800190565b6020808252604c908201527f47656c61746f50726f7669646572732e6578656375746f7241737369676e734560408201527f78656375746f723a206d73672e73656e646572206973206e6f7420617373696760608201526b3732b21032bc32b1baba37b960a11b608082015260a00190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602a908201527f47656c61746f53797341646d696e2e5f67657447656c61746f47617350726963604082015269653a306f7242656c6f7760b01b606082015260800190565b60208082526030908201527f47656c61746f50726f7669646572732e72656d6f766550726f76696465724d6f60408201526f191d5b195cce881c99591d5b99185b9d60821b606082015260800190565b60208082526021908201527f47656c61746f436f72652e657865633a20496e76616c6964204578656375746f6040820152603960f91b606082015260800190565b6020808252602d908201527f47656c61746f50726f7669646572732e61646450726f76696465724d6f64756c60408201526c195cce881c99591d5b99185b9d609a1b606082015260800190565b6020808252603d908201527f47656c61746f436f72652e7375626d69745461736b436861696e3a206c65737360408201527f20726571756573746564207375626d697473207468616e207461736b73000000606082015260800190565b6020808252603e908201527f47656c61746f50726f7669646572732e6578656375746f7241737369676e734560408201527f78656375746f723a2069734578656375746f724d696e5374616b656428290000606082015260800190565b60208082526028908201527f47656c61746f50726f7669646572732e70726f7669646546756e64733a207a65604082015267726f2076616c756560c01b606082015260800190565b6020808252603a908201527f47656c61746f4578656375746f72732e756e7374616b654578656375746f723a60408201527f206d73672e73656e646572207374696c6c2061737369676e6564000000000000606082015260800190565b60208082526031908201527f47656c61746f4578656375746f72732e756e7374616b654578656375746f723a60408201527008185b1c9958591e481d5b9cdd185ad959607a1b606082015260800190565b6020808252604e908201527f47656c61746f50726f7669646572732e7365745461736b53706563476173507260408201527f6963654365696c3a20416c72656164792077686974656c69737465642077697460608201526d1a0819d85cd41c9a58d950d95a5b60921b608082015260a00190565b6020808252603a908201527f47656c61746f50726f7669646572732e70726f766964657241737369676e734560408201527f78656375746f723a20616c72656164792061737369676e65642e000000000000606082015260800190565b60208082526026908201527f47656c61746f436f72652e5f657865632e657865635061796c6f61643a756e6460408201526519599a5b995960d21b606082015260800190565b60208082526029908201527f47656c61746f53797341646d696e2e73657447656c61746f476173507269636560408201526804f7261636c653a20360bc1b606082015260800190565b6020808252602a908201527f47656c61746f436f72652e5f657865632e65786563526576657274436865636b6040820152690e9d5b9919599a5b995960b21b606082015260800190565b6020808252603e908201527f47656c61746f50726f7669646572732e70726f766964657241737369676e734560408201527f78656375746f723a2069734578656375746f724d696e5374616b656428290000606082015260800190565b6020808252603a908201527f47656c61746f50726f7669646572732e6578656375746f7241737369676e734560408201527f78656375746f723a20616c72656164792061737369676e65642e000000000000606082015260800190565b6000602082526114a66020830184614b4a565b600060608252615b0b6060830186614b4a565b60208301949094525060400152919050565b8581526001600160a01b0385811660208301528416604082015260a060608201819052600090615b4f90830185614bd1565b90508260808301529695505050505050565b8681526001600160a01b038616602082015260c060408201819052600090615b8b90830187614a93565b9050615b9685615d43565b8460608301528360808301528260a0830152979650505050505050565b600084825260606020830152615bcc6060830185614a93565b9050826040830152949350505050565b918252602082015260400190565b6040518181016001600160401b0381118282101715615c0857600080fd5b604052919050565b60006001600160401b03821115615c25578081fd5b5060209081020190565b60006001600160401b03821115615c44578081fd5b50601f01601f191660200190565b60009081526020902090565b6001600160a01b031690565b60005b83811015615c85578181015183820152602001615c6d565b83811115610c4a5750506000910152565b60e01c90565b600060443d1015615cac57611c5c565b600481823e6308c379a0615cc08251615c96565b14615cca57611c5c565b6040513d600319016004823e80513d6001600160401b038160248401118184111715615cf95750505050611c5c565b82840191508151925080831115615d135750505050611c5c565b503d83016020838301011115615d2b57505050611c5c565b601f91909101601f1916810160200160405291505090565b60048110612d3357fe5b6001600160a01b0381168114612d3357600080fd5b8015158114612d3357600080fdfe47656c61746f436f72652e657865633a20496e73756666696369656e742067617347656c61746f50726f7669646572732e70726f76696465724d6f64756c65436865636b7347656c61746f436f72652e63616e5375626d69745461736b3a206578706972794461746547656c61746f53797341646d696e2e6578656375746f72537563636573734665653a20646976206572726f7247656c61746f436f72652e63616e5375626d69745461736b3a206578656375746f72206e6f74206d696e5374616b65647461736b5370656347617350726963654365696c2d4f522d6e6f7450726f766964656447656c61746f436f72652e5f70726f6365737350726f766964657250617961626c65733a2070726f766964657246756e647320756e646572666c6f7747656c61746f53797341646d696e2e73797341646d696e5375636365737353686172653a20646976206572726f7247656c61746f53797341646d696e2e5f67657447656c61746f47617350726963653a47656c61746f436f72652e63616e5375626d69745461736b3a73656c6650726f76696465724761734c696d697420746f6f206c6f7747656c61746f436f72652e657865637574696f6e577261707065723a756e646566696e6564a2646970667358221220270c1fc00c3b8119649fce05842ce508354ccf557dab8ac78c1f084a9926c0a964736f6c634300060a0033",
+ "devdoc": {
+ "author": "Luis Schliesske & Hilmar Orth",
+ "details": "Find all NatSpecs inside IGelatoCore",
+ "methods": {
+ "isOwner()": {
+ "details": "Returns true if the caller is the current owner."
+ },
+ "owner()": {
+ "details": "Returns the address of the current owner."
+ },
+ "renounceOwnership()": {
+ "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner."
+ },
+ "transferOwnership(address)": {
+ "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."
+ }
+ },
+ "title": "GelatoCore"
+ },
+ "userdoc": {
+ "methods": {},
+ "notice": "Task: submission, validation, execution, and cancellation"
+ },
+ "storageLayout": {
+ "storage": [
+ {
+ "astId": 510,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "_owner",
+ "offset": 0,
+ "slot": "0",
+ "type": "t_address"
+ },
+ {
+ "astId": 10223,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "gelatoGasPriceOracle",
+ "offset": 0,
+ "slot": "1",
+ "type": "t_address"
+ },
+ {
+ "astId": 10226,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "oracleRequestData",
+ "offset": 0,
+ "slot": "2",
+ "type": "t_bytes_storage"
+ },
+ {
+ "astId": 10229,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "gelatoMaxGas",
+ "offset": 0,
+ "slot": "3",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 10232,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "internalGasRequirement",
+ "offset": 0,
+ "slot": "4",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 10235,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "minExecutorStake",
+ "offset": 0,
+ "slot": "5",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 10238,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "executorSuccessShare",
+ "offset": 0,
+ "slot": "6",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 10241,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "sysAdminSuccessShare",
+ "offset": 0,
+ "slot": "7",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 10244,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "totalSuccessShare",
+ "offset": 0,
+ "slot": "8",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 10247,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "sysAdminFunds",
+ "offset": 0,
+ "slot": "9",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 9182,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "providerFunds",
+ "offset": 0,
+ "slot": "10",
+ "type": "t_mapping(t_address,t_uint256)"
+ },
+ {
+ "astId": 9187,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "executorStake",
+ "offset": 0,
+ "slot": "11",
+ "type": "t_mapping(t_address,t_uint256)"
+ },
+ {
+ "astId": 9192,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "executorByProvider",
+ "offset": 0,
+ "slot": "12",
+ "type": "t_mapping(t_address,t_address)"
+ },
+ {
+ "astId": 9197,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "executorProvidersCount",
+ "offset": 0,
+ "slot": "13",
+ "type": "t_mapping(t_address,t_uint256)"
+ },
+ {
+ "astId": 9204,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "taskSpecGasPriceCeil",
+ "offset": 0,
+ "slot": "14",
+ "type": "t_mapping(t_address,t_mapping(t_bytes32,t_uint256))"
+ },
+ {
+ "astId": 9208,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "_providerModules",
+ "offset": 0,
+ "slot": "15",
+ "type": "t_mapping(t_address,t_struct(Set)12992_storage)"
+ },
+ {
+ "astId": 7554,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "currentTaskReceiptId",
+ "offset": 0,
+ "slot": "16",
+ "type": "t_uint256"
+ },
+ {
+ "astId": 7559,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "taskReceiptHash",
+ "offset": 0,
+ "slot": "17",
+ "type": "t_mapping(t_uint256,t_bytes32)"
+ }
+ ],
+ "types": {
+ "t_address": {
+ "encoding": "inplace",
+ "label": "address",
+ "numberOfBytes": "20"
+ },
+ "t_array(t_contract(IGelatoProviderModule)11609)dyn_storage": {
+ "base": "t_contract(IGelatoProviderModule)11609",
+ "encoding": "dynamic_array",
+ "label": "contract IGelatoProviderModule[]",
+ "numberOfBytes": "32"
+ },
+ "t_bytes32": {
+ "encoding": "inplace",
+ "label": "bytes32",
+ "numberOfBytes": "32"
+ },
+ "t_bytes_storage": {
+ "encoding": "bytes",
+ "label": "bytes",
+ "numberOfBytes": "32"
+ },
+ "t_contract(IGelatoProviderModule)11609": {
+ "encoding": "inplace",
+ "label": "contract IGelatoProviderModule",
+ "numberOfBytes": "20"
+ },
+ "t_mapping(t_address,t_address)": {
+ "encoding": "mapping",
+ "key": "t_address",
+ "label": "mapping(address => address)",
+ "numberOfBytes": "32",
+ "value": "t_address"
+ },
+ "t_mapping(t_address,t_mapping(t_bytes32,t_uint256))": {
+ "encoding": "mapping",
+ "key": "t_address",
+ "label": "mapping(address => mapping(bytes32 => uint256))",
+ "numberOfBytes": "32",
+ "value": "t_mapping(t_bytes32,t_uint256)"
+ },
+ "t_mapping(t_address,t_struct(Set)12992_storage)": {
+ "encoding": "mapping",
+ "key": "t_address",
+ "label": "mapping(address => struct ProviderModuleSet.Set)",
+ "numberOfBytes": "32",
+ "value": "t_struct(Set)12992_storage"
+ },
+ "t_mapping(t_address,t_uint256)": {
+ "encoding": "mapping",
+ "key": "t_address",
+ "label": "mapping(address => uint256)",
+ "numberOfBytes": "32",
+ "value": "t_uint256"
+ },
+ "t_mapping(t_bytes32,t_uint256)": {
+ "encoding": "mapping",
+ "key": "t_bytes32",
+ "label": "mapping(bytes32 => uint256)",
+ "numberOfBytes": "32",
+ "value": "t_uint256"
+ },
+ "t_mapping(t_contract(IGelatoProviderModule)11609,t_uint256)": {
+ "encoding": "mapping",
+ "key": "t_contract(IGelatoProviderModule)11609",
+ "label": "mapping(contract IGelatoProviderModule => uint256)",
+ "numberOfBytes": "32",
+ "value": "t_uint256"
+ },
+ "t_mapping(t_uint256,t_bytes32)": {
+ "encoding": "mapping",
+ "key": "t_uint256",
+ "label": "mapping(uint256 => bytes32)",
+ "numberOfBytes": "32",
+ "value": "t_bytes32"
+ },
+ "t_struct(Set)12992_storage": {
+ "encoding": "inplace",
+ "label": "struct ProviderModuleSet.Set",
+ "members": [
+ {
+ "astId": 12988,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "index",
+ "offset": 0,
+ "slot": "0",
+ "type": "t_mapping(t_contract(IGelatoProviderModule)11609,t_uint256)"
+ },
+ {
+ "astId": 12991,
+ "contract": "contracts/gelato_core/GelatoCore.sol:GelatoCore",
+ "label": "modules",
+ "offset": 0,
+ "slot": "1",
+ "type": "t_array(t_contract(IGelatoProviderModule)11609)dyn_storage"
+ }
+ ],
+ "numberOfBytes": "64"
+ },
+ "t_uint256": {
+ "encoding": "inplace",
+ "label": "uint256",
+ "numberOfBytes": "32"
+ }
+ }
+ }
+}
diff --git a/deployments/mainnet/solcInputs/d9397bda7e9d5c90e2ef9a83ef888759.json b/deployments/mainnet/solcInputs/d9397bda7e9d5c90e2ef9a83ef888759.json
new file mode 100644
index 0000000..766e13d
--- /dev/null
+++ b/deployments/mainnet/solcInputs/d9397bda7e9d5c90e2ef9a83ef888759.json
@@ -0,0 +1,279 @@
+{
+ "language": "Solidity",
+ "sources": {
+ "contracts/dapp_interfaces/gnosis/IBatchExchange.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nstruct Order {\n uint16 buyToken;\n uint16 sellToken;\n uint32 validFrom; // order is valid from auction collection period: validFrom inclusive\n uint32 validUntil; // order is valid till auction collection period: validUntil inclusive\n uint128 priceNumerator;\n uint128 priceDenominator;\n uint128 usedAmount; // remainingAmount = priceDenominator - usedAmount\n}\n\ninterface IBatchExchange {\n\n function withdraw(address user, address token)\n external;\n\n function deposit(address token, uint256 amount)\n external;\n\n function getPendingWithdraw(address user, address token)\n external\n view\n returns (uint256, uint32);\n\n function getCurrentBatchId()\n external\n view\n returns (uint32);\n\n function hasValidWithdrawRequest(address user, address token)\n external\n view\n returns (bool);\n\n function tokenAddressToIdMap(address addr)\n external\n view\n returns (uint16);\n\n function orders(address userAddress)\n external\n view\n returns (Order[] memory);\n\n\n // Returns orderId\n function placeOrder(uint16 buyToken, uint16 sellToken, uint32 validUntil, uint128 buyAmount, uint128 sellAmount)\n external\n returns (uint256);\n\n function requestFutureWithdraw(address token, uint256 amount, uint32 batchId)\n external;\n\n function requestWithdraw(address token, uint256 amount)\n external;\n\n}\n"
+ },
+ "contracts/gelato_conditions/gnosis/ConditionBatchExchangeWithdrawStateful.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"../GelatoStatefulConditionsStandard.sol\";\nimport \"../../dapp_interfaces/gnosis/IBatchExchange.sol\";\nimport {IGelatoCore} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract ConditionBatchExchangeWithdrawStateful is GelatoStatefulConditionsStandard {\n\n\n constructor(IGelatoCore _gelatoCore) GelatoStatefulConditionsStandard(_gelatoCore)\n public\n {}\n\n // userProxy => taskReceiptId => refBatchId\n mapping(address => mapping(uint256 => uint256)) public refBatchId;\n\n uint32 public constant BATCH_TIME = 300;\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(address _userProxy)\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(this.checkRefBatchId.selector, uint256(0), _userProxy);\n }\n\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n address userProxy = abi.decode(_conditionData[36:], (address));\n return checkRefBatchId(_taskReceiptId, userProxy);\n }\n\n // Specific Implementation\n /// @dev Abi encode these parameter inputs. Use a placeholder for _taskReceiptId.\n /// @param _taskReceiptId Will be stripped from encoded data and replaced by\n /// the value passed in from GelatoCore.\n function checkRefBatchId(uint256 _taskReceiptId, address _userProxy)\n public\n view\n virtual\n returns(string memory)\n {\n uint256 _refBatchId = refBatchId[_userProxy][_taskReceiptId];\n uint256 currentBatchId = uint32(block.timestamp / BATCH_TIME);\n if (_refBatchId < currentBatchId) return OK;\n return \"NotOkBatchIdDidNotPass\";\n }\n\n /// @dev This function should be called via the userProxy of a Gelato Task as part\n /// of the Task.actions, if the Condition state should be updated after the task.\n /// This is for Task Cycles/Chains and we fetch the TaskReceipt.id of the\n // next Task that will be auto-submitted by GelatoCore in the same exec Task transaction.\n function setRefBatchId(uint256 _delta, uint256 _idDelta) external {\n uint256 currentBatchId = uint32(block.timestamp / BATCH_TIME);\n uint256 newRefBatchId = currentBatchId + _delta;\n refBatchId[msg.sender][_getIdOfNextTaskInCycle() + _idDelta] = newRefBatchId;\n }\n}"
+ },
+ "contracts/gelato_conditions/GelatoStatefulConditionsStandard.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"./GelatoConditionsStandard.sol\";\nimport {IGelatoCore} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\nabstract contract GelatoStatefulConditionsStandard is GelatoConditionsStandard {\n IGelatoCore public immutable gelatoCore;\n\n constructor(IGelatoCore _gelatoCore) public { gelatoCore = _gelatoCore; }\n\n function _getIdOfNextTaskInCycle() internal view returns(uint256 nextTaskReceiptId) {\n try gelatoCore.currentTaskReceiptId() returns(uint256 currentId) {\n nextTaskReceiptId = currentId + 1;\n } catch Error(string memory _err) {\n revert(\n string(abi.encodePacked(\n \"GelatoStatefulConditionsStandard._getIdOfNextTaskInCycle\", _err\n ))\n );\n } catch {\n revert(\"GelatoStatefulConditionsStandard._getIdOfNextTaskInCycle:undefined\");\n }\n }\n}\n"
+ },
+ "contracts/gelato_core/interfaces/IGelatoCore.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoProviderModule} from \"../../gelato_provider_modules/IGelatoProviderModule.sol\";\nimport {IGelatoCondition} from \"../../gelato_conditions/IGelatoCondition.sol\";\n\nstruct Provider {\n address addr; // if msg.sender == provider => self-Provider\n IGelatoProviderModule module; // can be IGelatoProviderModule(0) for self-Providers\n}\n\nstruct Condition {\n IGelatoCondition inst; // can be AddressZero for self-conditional Actions\n bytes data; // can be bytes32(0) for self-conditional Actions\n}\n\nenum Operation { Call, Delegatecall }\n\nenum DataFlow { None, In, Out, InAndOut }\n\nstruct Action {\n address addr;\n bytes data;\n Operation operation;\n DataFlow dataFlow;\n uint256 value;\n bool termsOkCheck;\n}\n\nstruct Task {\n Condition[] conditions; // optional\n Action[] actions;\n uint256 selfProviderGasLimit; // optional: 0 defaults to gelatoMaxGas\n uint256 selfProviderGasPriceCeil; // optional: 0 defaults to NO_CEIL\n}\n\nstruct TaskReceipt {\n uint256 id;\n address userProxy;\n Provider provider;\n uint256 index;\n Task[] tasks;\n uint256 expiryDate;\n uint256 cycleId; // auto-filled by GelatoCore. 0 for non-cyclic/chained tasks\n uint256 submissionsLeft;\n}\n\ninterface IGelatoCore {\n event LogTaskSubmitted(\n uint256 indexed taskReceiptId,\n bytes32 indexed taskReceiptHash,\n TaskReceipt taskReceipt\n );\n\n event LogExecSuccess(\n address indexed executor,\n uint256 indexed taskReceiptId,\n uint256 executorSuccessFee,\n uint256 sysAdminSuccessFee\n );\n event LogCanExecFailed(\n address indexed executor,\n uint256 indexed taskReceiptId,\n string reason\n );\n event LogExecReverted(\n address indexed executor,\n uint256 indexed taskReceiptId,\n uint256 executorRefund,\n string reason\n );\n\n event LogTaskCancelled(uint256 indexed taskReceiptId, address indexed cancellor);\n\n /// @notice API to query whether Task can be submitted successfully.\n /// @dev In submitTask the msg.sender must be the same as _userProxy here.\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _userProxy The userProxy from which the task will be submitted.\n /// @param _task Selected provider, conditions, actions, expiry date of the task\n function canSubmitTask(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task,\n uint256 _expiryDate\n )\n external\n view\n returns(string memory);\n\n /// @notice API to submit a single Task.\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task A Gelato Task object: provider, conditions, actions.\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\n function submitTask(\n Provider calldata _provider,\n Task calldata _task,\n uint256 _expiryDate\n )\n external;\n\n\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed.\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _cycles How many full cycles will be submitted\n function submitTaskCycle(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external;\n\n\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed.\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\n /// @dev If _sumOfRequestedTaskSubmits = 1 && _tasks.length = 2, only the first task\n /// would be submitted, but not the second\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\n /// that should have occured once the cycle is complete:\n /// _sumOfRequestedTaskSubmits = 0 => One Task will resubmit the next Task infinitly\n /// _sumOfRequestedTaskSubmits = 1 => One Task will resubmit no other task\n /// _sumOfRequestedTaskSubmits = 2 => One Task will resubmit 1 other task\n /// ...\n function submitTaskChain(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n external;\n\n // ================ Exec Suite =========================\n /// @notice Off-chain API for executors to check, if a TaskReceipt is executable\n /// @dev GelatoCore checks this during execution, in order to safeguard the Conditions\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\n /// @param _gasLimit Task.selfProviderGasLimit is used for SelfProviders. All other\n /// Providers must use gelatoMaxGas. If the _gasLimit is used by an Executor and the\n /// tx reverts, a refund is paid by the Provider and the TaskReceipt is annulated.\n /// @param _execTxGasPrice Must be used by Executors. Gas Price fed by gelatoCore's\n /// Gas Price Oracle. Executors can query the current gelatoGasPrice from events.\n function canExec(TaskReceipt calldata _TR, uint256 _gasLimit, uint256 _execTxGasPrice)\n external\n view\n returns(string memory);\n\n /// @notice Executors call this when Conditions allow it to execute submitted Tasks.\n /// @dev Executors get rewarded for successful Execution. The Task remains open until\n /// successfully executed, or when the execution failed, despite of gelatoMaxGas usage.\n /// In the latter case Executors are refunded by the Task Provider.\n /// @param _TR TaskReceipt: id, userProxy, Task.\n function exec(TaskReceipt calldata _TR) external;\n\n /// @notice Cancel task\n /// @dev Callable only by userProxy or selected provider\n /// @param _TR TaskReceipt: id, userProxy, Task.\n function cancelTask(TaskReceipt calldata _TR) external;\n\n /// @notice Cancel multiple tasks at once\n /// @dev Callable only by userProxy or selected provider\n /// @param _taskReceipts TaskReceipts: id, userProxy, Task.\n function multiCancelTasks(TaskReceipt[] calldata _taskReceipts) external;\n\n /// @notice Compute hash of task receipt\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\n /// @return hash of taskReceipt\n function hashTaskReceipt(TaskReceipt calldata _TR) external pure returns(bytes32);\n\n // ================ Getters =========================\n /// @notice Returns the taskReceiptId of the last TaskReceipt submitted\n /// @return currentId currentId, last TaskReceiptId submitted\n function currentTaskReceiptId() external view returns(uint256);\n\n /// @notice Returns computed taskReceipt hash, used to check for taskReceipt validity\n /// @param _taskReceiptId Id of taskReceipt emitted in submission event\n /// @return hash of taskReceipt\n function taskReceiptHash(uint256 _taskReceiptId) external view returns(bytes32);\n}\n"
+ },
+ "contracts/gelato_conditions/GelatoConditionsStandard.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"./IGelatoCondition.sol\";\n\nabstract contract GelatoConditionsStandard is IGelatoCondition {\n string internal constant OK = \"OK\";\n}\n"
+ },
+ "contracts/gelato_conditions/IGelatoCondition.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\n/// @notice all the APIs of GelatoConditionsStandard\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\ninterface IGelatoCondition {\n\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\n /// \"ok\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\n /// source of Task identification.\n /// @param _conditionData This is the Condition.data field developers must encode their\n /// Condition's specific parameters in.\n /// @param _cycleId For Tasks that are executed as part of a cycle.\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\n external\n view\n returns(string memory);\n}"
+ },
+ "contracts/gelato_provider_modules/IGelatoProviderModule.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {Action, Task} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\ninterface IGelatoProviderModule {\n\n /// @notice Check if provider agrees to pay for inputted task receipt\n /// @dev Enables arbitrary checks by provider\n /// @param _userProxy The smart contract account of the user who submitted the Task.\n /// @param _provider The account of the Provider who uses the ProviderModule.\n /// @param _task Gelato Task to be executed.\n /// @return \"OK\" if provider agrees\n function isProvided(address _userProxy, address _provider, Task calldata _task)\n external\n view\n returns(string memory);\n\n /// @notice Convert action specific payload into proxy specific payload\n /// @dev Encoded multiple actions into a multisend\n /// @param _taskReceiptId Unique ID of Gelato Task to be executed.\n /// @param _userProxy The smart contract account of the user who submitted the Task.\n /// @param _provider The account of the Provider who uses the ProviderModule.\n /// @param _task Gelato Task to be executed.\n /// @param _cycleId For Tasks that form part of a cycle/chain.\n /// @return Encoded payload that will be used for low-level .call on user proxy\n /// @return checkReturndata if true, fwd returndata from userProxy.call to ProviderModule\n function execPayload(\n uint256 _taskReceiptId,\n address _userProxy,\n address _provider,\n Task calldata _task,\n uint256 _cycleId\n )\n external\n view\n returns(bytes memory, bool checkReturndata);\n\n /// @notice Called by GelatoCore.exec to verifiy that no revert happend on userProxy\n /// @dev If a caught revert is detected, this fn should revert with the detected error\n /// @param _proxyReturndata Data from GelatoCore._exec.userProxy.call(execPayload)\n function execRevertCheck(bytes calldata _proxyReturndata) external pure;\n}\n"
+ },
+ "contracts/user_proxies/gelato_user_proxy/GelatoUserProxyFactory.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoUserProxyFactory} from \"./interfaces/IGelatoUserProxyFactory.sol\";\nimport {Address} from \"../../external/Address.sol\";\nimport {GelatoUserProxy} from \"./GelatoUserProxy.sol\";\nimport {GelatoUserProxySet} from \"../../libraries/GelatoUserProxySet.sol\";\nimport {Action, Provider, Task} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract GelatoUserProxyFactory is IGelatoUserProxyFactory {\n\n using Address for address payable; /// for oz's sendValue method\n using GelatoUserProxySet for GelatoUserProxySet.Set;\n\n address public immutable override gelatoCore;\n\n mapping(GelatoUserProxy => address) public override userByGelatoProxy;\n mapping(address => GelatoUserProxySet.Set) private _gelatoProxiesByUser;\n\n constructor(address _gelatoCore) public { gelatoCore = _gelatoCore; }\n\n // ==================== CREATE =======================================\n function create() public payable override returns (GelatoUserProxy userProxy) {\n userProxy = new GelatoUserProxy{value: msg.value}(msg.sender, gelatoCore);\n _storeGelatoUserProxy(userProxy);\n }\n\n function createExecActions(Action[] calldata _actions)\n external\n payable\n override\n returns (GelatoUserProxy userProxy)\n {\n userProxy = create();\n if (_actions.length != 0) _execActions(userProxy, _actions);\n }\n\n function createSubmitTasks(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n override\n returns (GelatoUserProxy userProxy)\n {\n userProxy = create();\n if (_tasks.length != 0) _submitTasks(userProxy, _provider, _tasks, _expiryDates);\n }\n\n function createExecActionsSubmitTasks(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n override\n returns(GelatoUserProxy userProxy)\n {\n userProxy = create();\n if (_actions.length != 0) _execActions(userProxy, _actions);\n if (_tasks.length != 0) _submitTasks(userProxy, _provider, _tasks, _expiryDates);\n }\n\n function createExecActionsSubmitTaskCycle(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external\n payable\n override\n returns(GelatoUserProxy userProxy)\n {\n userProxy = create();\n if (_actions.length != 0) _execActions(userProxy, _actions);\n if (_tasks.length == 0)\n revert(\"GelatoUserProxyFactory.createExecActionsSubmitTaskCycle: 0 _tasks\");\n _submitTaskCycle(userProxy, _provider, _tasks, _expiryDate, _cycles);\n }\n\n function createExecActionsSubmitTaskChain(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n external\n payable\n override\n returns(GelatoUserProxy userProxy)\n {\n userProxy = create();\n if (_actions.length != 0) _execActions(userProxy, _actions);\n if (_tasks.length == 0)\n revert(\"GelatoUserProxyFactory.createExecActionsSubmitTaskChain: 0 _tasks\");\n _submitTaskChain(userProxy, _provider, _tasks, _expiryDate, _sumOfRequestedTaskSubmits);\n }\n\n // ==================== CREATE 2 =======================================\n function createTwo(uint256 _saltNonce)\n public\n payable\n override\n returns (GelatoUserProxy userProxy)\n {\n bytes32 salt = keccak256(abi.encode(msg.sender, _saltNonce));\n userProxy = new GelatoUserProxy{salt: salt, value: msg.value}(msg.sender, gelatoCore);\n require(\n address(userProxy) == predictProxyAddress(msg.sender, _saltNonce),\n \"GelatoUserProxyFactory.createTwo: wrong address prediction\"\n );\n _storeGelatoUserProxy(userProxy);\n }\n\n function createTwoExecActions(uint256 _saltNonce, Action[] calldata _actions)\n external\n payable\n override\n returns (GelatoUserProxy userProxy)\n {\n userProxy = createTwo(_saltNonce);\n if (_actions.length != 0) _execActions(userProxy, _actions);\n }\n\n function createTwoSubmitTasks(\n uint256 _saltNonce,\n // Submit Tasks Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n override\n returns (GelatoUserProxy userProxy)\n {\n userProxy = createTwo(_saltNonce);\n if (_tasks.length != 0) _submitTasks(userProxy, _provider, _tasks, _expiryDates);\n }\n\n // A standard _saltNonce can be used for deterministic shared address derivation\n function createTwoExecActionsSubmitTasks(\n uint256 _saltNonce,\n Action[] calldata _actions,\n // Submit Tasks Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n override\n returns(GelatoUserProxy userProxy)\n {\n userProxy = createTwo(_saltNonce);\n if (_actions.length != 0) _execActions(userProxy, _actions);\n if (_tasks.length != 0) _submitTasks(userProxy, _provider, _tasks, _expiryDates);\n }\n\n function createTwoExecActionsSubmitTaskCycle(\n uint256 _saltNonce,\n Action[] calldata _actions,\n // Submit TaskCycle Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external\n payable\n override\n returns(GelatoUserProxy userProxy)\n {\n userProxy = createTwo(_saltNonce);\n if (_actions.length != 0) _execActions(userProxy, _actions);\n if (_tasks.length == 0)\n revert(\"GelatoUserProxyFactory.createTwoExecActionsSubmitTaskCycle: 0 _tasks\");\n _submitTaskCycle(userProxy, _provider, _tasks, _expiryDate, _cycles);\n }\n\n function createTwoExecActionsSubmitTaskChain(\n uint256 _saltNonce,\n Action[] calldata _actions,\n // Submit TaskChain Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n external\n payable\n override\n returns(GelatoUserProxy userProxy)\n {\n userProxy = createTwo(_saltNonce);\n if (_actions.length != 0) _execActions(userProxy, _actions);\n if (_tasks.length == 0)\n revert(\"GelatoUserProxyFactory.createTwoExecActionsSubmitTaskChain: 0 _tasks\");\n _submitTaskChain(userProxy, _provider, _tasks, _expiryDate, _sumOfRequestedTaskSubmits);\n }\n\n // ==================== GETTERS =======================================\n function predictProxyAddress(address _user, uint256 _saltNonce)\n public\n view\n override\n returns(address)\n {\n // Standard Way of deriving salt\n bytes32 salt = keccak256(abi.encode(_user, _saltNonce));\n\n // Derive undeployed userProxy address\n return address(uint(keccak256(abi.encodePacked(\n byte(0xff),\n address(this),\n salt,\n keccak256(abi.encodePacked(proxyCreationCode(), abi.encode(_user, gelatoCore)))\n ))));\n }\n\n function isGelatoUserProxy(address _proxy) external view override returns(bool) {\n return userByGelatoProxy[GelatoUserProxy(payable(_proxy))] != address(0);\n }\n\n function isGelatoProxyUser(address _user, GelatoUserProxy _userProxy)\n external\n view\n override\n returns(bool)\n {\n return _gelatoProxiesByUser[_user].contains(_userProxy);\n }\n\n function gelatoProxiesByUser(address _user)\n external\n view\n override\n returns(GelatoUserProxy[] memory)\n {\n return _gelatoProxiesByUser[_user].enumerate();\n }\n\n function getGelatoUserProxyByIndex(address _user, uint256 _index)\n external\n view\n override\n returns(GelatoUserProxy)\n {\n return _gelatoProxiesByUser[_user].get(_index);\n }\n\n function proxyCreationCode() public pure override returns(bytes memory) {\n return type(GelatoUserProxy).creationCode;\n }\n\n // ==================== HELPERS =======================================\n // store and emit LogCreation\n function _storeGelatoUserProxy(GelatoUserProxy _userProxy) private {\n _gelatoProxiesByUser[msg.sender].add(_userProxy);\n userByGelatoProxy[_userProxy] = msg.sender;\n emit LogCreation(msg.sender, _userProxy, msg.value);\n }\n\n function _execActions(GelatoUserProxy _userProxy, Action[] calldata _actions) private {\n try _userProxy.multiExecActions(_actions) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxyFactory._execActions:\", err)));\n } catch {\n revert(\"GelatoUserProxyFactory._execActions:undefined\");\n }\n }\n\n function _submitTasks(\n GelatoUserProxy _userProxy,\n // Submit Tasks Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n private\n {\n try _userProxy.multiSubmitTasks(_provider, _tasks, _expiryDates) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxyFactory._submitTasks:\", err)));\n } catch {\n revert(\"GelatoUserProxyFactory._submitTasks:undefined\");\n }\n }\n\n function _submitTaskCycle(\n GelatoUserProxy _userProxy,\n // Submit TaskCyle Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n private\n {\n try _userProxy.submitTaskCycle(_provider, _tasks, _expiryDate, _cycles) {\n } catch Error(string memory err) {\n revert(\n string(abi.encodePacked(\"GelatoUserProxyFactory._submitTaskCycle:\", err))\n );\n } catch {\n revert(\"GelatoUserProxyFactory._submitTaskCycle:undefined\");\n }\n }\n\n function _submitTaskChain(\n GelatoUserProxy _userProxy,\n // Submit TaskChain Data\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n private\n {\n try _userProxy.submitTaskChain(\n _provider,\n _tasks,\n _expiryDate,\n _sumOfRequestedTaskSubmits\n ) {\n } catch Error(string memory err) {\n revert(\n string(abi.encodePacked(\"GelatoUserProxyFactory._submitTaskChain:\", err))\n );\n } catch {\n revert(\"GelatoUserProxyFactory._submitTaskChain:undefined\");\n }\n }\n}\n"
+ },
+ "contracts/user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxyFactory.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoUserProxy} from \"../GelatoUserProxy.sol\";\nimport {Action, Provider, Task} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ninterface IGelatoUserProxyFactory {\n event LogCreation(\n address indexed user,\n GelatoUserProxy indexed userProxy,\n uint256 funding\n );\n\n // ==================== CREATE =======================================\n /// @notice Create a GelatoUserProxy.\n /// @return userProxy address of deployed proxy contract.\n function create()\n external\n payable\n returns (GelatoUserProxy userProxy);\n\n /// @notice Create a GelatoUserProxy and exec actions\n /// @param _actions Optional actions to execute.\n /// @return userProxy address of deployed proxy contract.\n function createExecActions(Action[] calldata _actions)\n external\n payable\n returns (GelatoUserProxy userProxy);\n\n /// @notice Create a GelatoUserProxy and submit Tasks to Gelato in the same tx.\n /// @param _provider Provider for each of the _tasks.\n /// @param _tasks Tasks to submit to Gelato. Must each have their own Provider.\n /// @param _expiryDates expiryDate for each of the _tasks.\n /// CAUTION: The ordering of _tasks<=>_expiryDates must be coordinated.\n /// @return userProxy address of deployed proxy contract.\n function createSubmitTasks(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n returns (GelatoUserProxy userProxy);\n\n /// @notice Create a GelatoUserProxy.\n /// @param _actions Optional actions to execute.\n /// @param _provider Provider for each of the _tasks.\n /// @param _tasks Tasks to submit to Gelato. Must each have their own Provider.\n /// @param _expiryDates expiryDate for each of the _tasks.\n /// CAUTION: The ordering of _tasks<=>_expiryDates must be coordinated.\n /// @return userProxy address of deployed proxy contract.\n function createExecActionsSubmitTasks(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n returns(GelatoUserProxy userProxy);\n\n /// @notice Like create but for submitting a Task Cycle to Gelato. A\n // Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed.\n /// @param _actions Optional actions to execute.\n /// @param _provider Gelato Provider object for _tasks: provider address and module.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _cycles How many full cycles will be submitted\n function createExecActionsSubmitTaskCycle(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external\n payable\n returns(GelatoUserProxy userProxy);\n\n /// @notice Like create but for submitting a Task Cycle to Gelato. A\n // Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\n /// @param _actions Optional actions to execute.\n /// @param _provider Gelato Provider object for _tasks: provider address and module.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\n // that should have occured once the cycle is complete:\n /// 1) _sumOfRequestedTaskSubmits=X: number of times to run the same task or the sum\n /// of total cyclic task executions in the case of a sequence of different tasks.\n /// 2) _submissionsLeft=0: infinity - run the same task or sequence of tasks infinitely.\n function createExecActionsSubmitTaskChain(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n external\n payable\n returns(GelatoUserProxy userProxy);\n\n // ==================== CREATE 2 =======================================\n\n /// @notice Create a GelatoUserProxy using the create2 opcode.\n /// @param _saltNonce salt is generated thusly: keccak256(abi.encode(_user, _saltNonce))\n /// @return userProxy address of deployed proxy contract.\n function createTwo(uint256 _saltNonce)\n external\n payable\n returns (GelatoUserProxy userProxy);\n\n /// @notice Create a GelatoUserProxy using the create2 opcode and exec actions\n /// @param _saltNonce salt is generated thusly: keccak256(abi.encode(_user, _saltNonce))\n /// @param _actions Optional actions to execute.\n /// @return userProxy address of deployed proxy contract.\n function createTwoExecActions(uint256 _saltNonce, Action[] calldata _actions)\n external\n payable\n returns (GelatoUserProxy userProxy);\n\n /// @notice Create a salted GelatoUserProxy and submit Tasks to Gelato in the same tx.\n /// @param _provider Provider for each of the _tasks.\n /// @param _tasks Tasks to submit to Gelato. Must each have their own Provider.\n /// @param _expiryDates expiryDate for each of the _tasks.\n /// CAUTION: The ordering of _tasks<=>_expiryDates must be coordinated.\n /// @return userProxy address of deployed proxy contract.\n function createTwoSubmitTasks(\n uint256 _saltNonce,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n returns (GelatoUserProxy userProxy);\n\n /// @notice Create a GelatoUserProxy using the create2 opcode.\n /// @dev This allows for creating a GelatoUserProxy instance at a specific address.\n /// which can be predicted and e.g. prefunded.\n /// @param _saltNonce salt is generated thusly: keccak256(abi.encode(_user, _saltNonce))\n /// @param _actions Optional actions to execute.\n /// @param _provider Provider for each of the _tasks.\n /// @param _tasks Tasks to submit to Gelato. Must each have their own Provider.\n /// @param _expiryDates expiryDate for each of the _tasks.\n /// CAUTION: The ordering of _tasks<=>_expiryDates must be coordinated.\n function createTwoExecActionsSubmitTasks(\n uint256 _saltNonce,\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n payable\n returns(GelatoUserProxy userProxy);\n\n /// @notice Just like createAndSubmitTaskCycle just using create2, thus allowing for\n /// knowing the address the GelatoUserProxy will be assigned to in advance.\n /// @param _saltNonce salt is generated thusly: keccak256(abi.encode(_user, _saltNonce))\n function createTwoExecActionsSubmitTaskCycle(\n uint256 _saltNonce,\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external\n payable\n returns(GelatoUserProxy userProxy);\n\n /// @notice Just like createAndSubmitTaskChain just using create2, thus allowing for\n /// knowing the address the GelatoUserProxy will be assigned to in advance.\n /// @param _saltNonce salt is generated thusly: keccak256(abi.encode(_user, _saltNonce))\n function createTwoExecActionsSubmitTaskChain(\n uint256 _saltNonce,\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n external\n payable\n returns(GelatoUserProxy userProxy);\n\n // ==================== GETTERS =======================================\n function predictProxyAddress(address _user, uint256 _saltNonce)\n external\n view\n returns(address);\n\n /// @notice Get address of user (EOA) from proxy contract address\n /// @param _userProxy Address of proxy contract\n /// @return User (EOA) address\n function userByGelatoProxy(GelatoUserProxy _userProxy) external view returns(address);\n\n /// @notice Get a list of userProxies that belong to one user.\n /// @param _user Address of user\n /// @return array of deployed GelatoUserProxies that belong to the _user.\n function gelatoProxiesByUser(address _user) external view returns(GelatoUserProxy[] memory);\n\n function getGelatoUserProxyByIndex(address _user, uint256 _index)\n external\n view\n returns(GelatoUserProxy);\n\n /// @notice Check if proxy was deployed from gelato proxy factory\n /// @param _userProxy Address of proxy contract\n /// @return true if it was deployed from gelato user proxy factory\n function isGelatoUserProxy(address _userProxy) external view returns(bool);\n\n /// @notice Check if user has deployed a proxy from gelato proxy factory\n /// @param _user Address of user\n /// @param _userProxy Address of supposed userProxy\n /// @return true if user deployed a proxy from gelato user proxy factory\n function isGelatoProxyUser(address _user, GelatoUserProxy _userProxy)\n external\n view\n returns(bool);\n\n /// @notice Returns address of gelato\n /// @return Gelato core address\n function gelatoCore() external pure returns(address);\n\n /// @notice Returns the CreationCode used by the Factory to create GelatoUserProxies.\n /// @dev This is internally used by the factory to predict the address during create2.\n function proxyCreationCode() external pure returns(bytes memory);\n}"
+ },
+ "contracts/external/Address.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * This test is non-exhaustive, and there may be false-negatives: during the\n * execution of a contract's constructor, its address will be reported as\n * not containing a contract.\n *\n * IMPORTANT: It is unsafe to assume that an address for which this\n * function returns false is an externally-owned account (EOA) and not a\n * contract.\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies in extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n // for accounts without code, i.e. `keccak256('')`\n bytes32 codehash;\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n // solhint-disable-next-line no-inline-assembly\n assembly { codehash := extcodehash(account) }\n return (codehash != 0x0 && codehash != accountHash);\n }\n\n /**\n * @dev Converts an `address` into `address payable`. Note that this is\n * simply a type cast: the actual underlying value is not changed.\n *\n * _Available since v2.4.0._\n */\n function toPayable(address account) internal pure returns (address payable) {\n return address(uint160(account));\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n *\n * _Available since v2.4.0._\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-call-value\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n}\n"
+ },
+ "contracts/user_proxies/gelato_user_proxy/GelatoUserProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoUserProxy} from \"./interfaces/IGelatoUserProxy.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {\n Action, Operation, Provider, Task, TaskReceipt, IGelatoCore\n} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract GelatoUserProxy is IGelatoUserProxy {\n\n using GelatoBytes for bytes;\n\n address public immutable override factory;\n address public immutable override user;\n address public immutable override gelatoCore;\n\n constructor(address _user, address _gelatoCore)\n public\n payable\n noZeroAddress(_user)\n noZeroAddress(_gelatoCore)\n {\n factory = msg.sender;\n user = _user;\n gelatoCore = _gelatoCore;\n }\n\n receive() external payable {}\n\n modifier noZeroAddress(address _) {\n require(_ != address(0), \"GelatoUserProxy.noZeroAddress\");\n _;\n }\n\n modifier onlyUser() {\n require(msg.sender == user, \"GelatoUserProxy.onlyUser: failed\");\n _;\n }\n\n modifier userOrFactory() {\n require(\n msg.sender == user || msg.sender == factory,\n \"GelatoUserProxy.userOrFactory: failed\");\n _;\n }\n\n modifier auth() {\n require(\n msg.sender == gelatoCore || msg.sender == user || msg.sender == factory,\n \"GelatoUserProxy.auth: failed\"\n );\n _;\n }\n\n function submitTask(Provider calldata _provider, Task calldata _task, uint256 _expiryDate)\n public\n override\n userOrFactory\n {\n\n try IGelatoCore(gelatoCore).submitTask(_provider, _task, _expiryDate) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxy.submitTask:\", err)));\n } catch {\n revert(\"GelatoUserProxy.submitTask:undefinded\");\n }\n }\n\n function multiSubmitTasks(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external\n override\n {\n require(\n _tasks.length == _expiryDates.length,\n \"GelatoUserProxy.multiSubmitTasks: each task needs own expiryDate\"\n );\n for (uint i; i < _tasks.length; i++)\n submitTask(_provider, _tasks[i], _expiryDates[i]);\n }\n\n function submitTaskCycle(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles // num of full cycles\n )\n public\n override\n userOrFactory\n {\n try IGelatoCore(gelatoCore).submitTaskCycle(\n _provider,\n _tasks,\n _expiryDate,\n _cycles\n ) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxy.submitTaskCycle:\", err)));\n } catch {\n revert(\"GelatoUserProxy.submitTaskCycle:undefinded\");\n }\n }\n\n function submitTaskChain(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits // num of all prospective task submissions\n )\n public\n override\n userOrFactory\n {\n try IGelatoCore(gelatoCore).submitTaskChain(\n _provider,\n _tasks,\n _expiryDate,\n _sumOfRequestedTaskSubmits\n ) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxy.submitTaskChain:\", err)));\n } catch {\n revert(\"GelatoUserProxy.submitTaskChain:undefinded\");\n }\n }\n\n function cancelTask(TaskReceipt calldata _TR) external override onlyUser {\n try IGelatoCore(gelatoCore).cancelTask(_TR) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxy.cancelTask:\", err)));\n } catch {\n revert(\"GelatoUserProxy.cancelTask:undefinded\");\n }\n }\n\n function multiCancelTasks(TaskReceipt[] calldata _TRs) external override onlyUser {\n try IGelatoCore(gelatoCore).multiCancelTasks(_TRs) {\n } catch Error(string memory err) {\n revert(string(abi.encodePacked(\"GelatoUserProxy.multiCancelTasks:\", err)));\n } catch {\n revert(\"GelatoUserProxy.multiCancelTasks:undefinded\");\n }\n }\n\n // @dev we have to write duplicate code due to calldata _action FeatureNotImplemented\n function execAction(Action calldata _action) external payable override auth {\n if (_action.operation == Operation.Call)\n _callAction(_action.addr, _action.data, _action.value);\n else if (_action.operation == Operation.Delegatecall)\n _delegatecallAction(_action.addr, _action.data);\n else\n revert(\"GelatoUserProxy.execAction: invalid operation\");\n }\n\n // @dev we have to write duplicate code due to calldata _action FeatureNotImplemented\n function multiExecActions(Action[] calldata _actions) public payable override auth {\n for (uint i = 0; i < _actions.length; i++) {\n if (_actions[i].operation == Operation.Call)\n _callAction(_actions[i].addr, _actions[i].data, _actions[i].value);\n else if (_actions[i].operation == Operation.Delegatecall)\n _delegatecallAction(address(_actions[i].addr), _actions[i].data);\n else\n revert(\"GelatoUserProxy.multiExecActions: invalid operation\");\n }\n }\n\n // @dev we have to write duplicate code due to calldata _action FeatureNotImplemented\n function execActionsAndSubmitTaskCycle(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external\n payable\n override\n auth\n {\n if (_actions.length != 0) multiExecActions(_actions);\n if(_tasks.length != 0) submitTaskCycle(_provider, _tasks, _expiryDate, _cycles);\n }\n\n function _callAction(address _action, bytes calldata _data, uint256 _value)\n internal\n noZeroAddress(_action)\n {\n (bool success, bytes memory returndata) = _action.call{value: _value}(_data);\n if (!success) returndata.revertWithErrorString(\"GelatoUserProxy._callAction:\");\n }\n\n function _delegatecallAction(address _action, bytes calldata _data)\n internal\n noZeroAddress(_action)\n {\n (bool success, bytes memory returndata) = _action.delegatecall(_data);\n if (!success) returndata.revertWithErrorString(\"GelatoUserProxy._delegatecallAction:\");\n }\n}"
+ },
+ "contracts/libraries/GelatoUserProxySet.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoUserProxy} from \"../user_proxies/gelato_user_proxy/GelatoUserProxy.sol\";\n\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * As of v2.5.0, only `GelatoUserProxy` sets are supported.\n *\n * Include with `using EnumerableSet for EnumerableSet.Set;`.\n *\n * _Available since v2.5.0._\n *\n * @author Alberto Cuesta Cañada\n * @author Luis Schliessske (modified to GelatoUserProxySet)\n */\nlibrary GelatoUserProxySet {\n\n struct Set {\n // Position of the proxy in the `gelatoUserProxies` array, plus 1 because index 0\n // means a proxy is not in the set.\n mapping (GelatoUserProxy => uint256) index;\n GelatoUserProxy[] gelatoUserProxies;\n }\n\n /**\n * @dev Add a proxy to a set. O(1).\n * Returns false if the proxy was already in the set.\n */\n function add(Set storage set, GelatoUserProxy proxy)\n internal\n returns (bool)\n {\n if (!contains(set, proxy)) {\n set.gelatoUserProxies.push(proxy);\n // The element is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel proxy\n set.index[proxy] = set.gelatoUserProxies.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a proxy from a set. O(1).\n * Returns false if the proxy was not present in the set.\n */\n function remove(Set storage set, GelatoUserProxy proxy)\n internal\n returns (bool)\n {\n if (contains(set, proxy)){\n uint256 toDeleteIndex = set.index[proxy] - 1;\n uint256 lastIndex = set.gelatoUserProxies.length - 1;\n\n // If the element we're deleting is the last one, we can just remove it without doing a swap\n if (lastIndex != toDeleteIndex) {\n GelatoUserProxy lastValue = set.gelatoUserProxies[lastIndex];\n\n // Move the last proxy to the index where the deleted proxy is\n set.gelatoUserProxies[toDeleteIndex] = lastValue;\n // Update the index for the moved proxy\n set.index[lastValue] = toDeleteIndex + 1; // All indexes are 1-based\n }\n\n // Delete the index entry for the deleted proxy\n delete set.index[proxy];\n\n // Delete the old entry for the moved proxy\n set.gelatoUserProxies.pop();\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the proxy is in the set. O(1).\n */\n function contains(Set storage set, GelatoUserProxy proxy)\n internal\n view\n returns (bool)\n {\n return set.index[proxy] != 0;\n }\n\n /**\n * @dev Returns an array with all gelatoUserProxies in the set. O(N).\n * Note that there are no guarantees on the ordering of gelatoUserProxies inside the\n * array, and it may change when more gelatoUserProxies are added or removed.\n\n * WARNING: This function may run out of gas on large sets: use {length} and\n * {get} instead in these cases.\n */\n function enumerate(Set storage set)\n internal\n view\n returns (GelatoUserProxy[] memory)\n {\n GelatoUserProxy[] memory output = new GelatoUserProxy[](set.gelatoUserProxies.length);\n for (uint256 i; i < set.gelatoUserProxies.length; i++) output[i] = set.gelatoUserProxies[i];\n return output;\n }\n\n /**\n * @dev Returns the number of elements on the set. O(1).\n */\n function length(Set storage set)\n internal\n view\n returns (uint256)\n {\n return set.gelatoUserProxies.length;\n }\n\n /** @dev Returns the element stored at position `index` in the set. O(1).\n * Note that there are no guarantees on the ordering of gelatoUserProxies inside the\n * array, and it may change when more gelatoUserProxies are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function get(Set storage set, uint256 index)\n internal\n view\n returns (GelatoUserProxy)\n {\n return set.gelatoUserProxies[index];\n }\n}"
+ },
+ "contracts/user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {\n Action, Provider, Task, TaskReceipt\n} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ninterface IGelatoUserProxy {\n\n /// @notice API to submit a single Task.\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task A Gelato Task object: provider, conditions, actions.\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\n function submitTask(Provider calldata _provider, Task calldata _task, uint256 _expiryDate)\n external;\n\n /// @notice API to submit multiple \"single\" Tasks.\n /// @dev CAUTION: The ordering of _tasks<=>_expiryDates must be coordinated.\n /// @param _providers Gelato Provider object: provider address and module.\n /// @param _tasks An array of Gelato Task objects: provider, conditions, actions.\n /// @param _expiryDates From then on the task cannot be executed. 0 for infinity.\n function multiSubmitTasks(\n Provider calldata _providers,\n Task[] calldata _tasks,\n uint256[] calldata _expiryDates\n )\n external;\n\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _cycles How many full cycles will be submitted\n function submitTaskCycle(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external;\n\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\n /// the next one, after they have been executed.\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\n // that should have occured once the cycle is complete:\n /// 1) _sumOfRequestedTaskSubmits=X: number of times to run the same task or the sum\n /// of total cyclic task executions in the case of a sequence of different tasks.\n /// 2) _submissionsLeft=0: infinity - run the same task or sequence of tasks infinitely.\n function submitTaskChain(\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n ) external;\n\n\n /// @notice Execs actions and submits task cycle in one tx\n /// @param _actions Actions to execute\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _tasks This can be a single task or a sequence of tasks.\n /// @param _expiryDate After this no task of the sequence can be executed any more.\n /// @param _cycles How many full cycles will be submitted\n function execActionsAndSubmitTaskCycle(\n Action[] calldata _actions,\n Provider calldata _provider,\n Task[] calldata _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n external\n payable;\n\n /// @notice Cancel a task receipt on gelato\n /// @dev Proxy users or the Task providers can cancel.\n /// @param _TR Task Receipt to cancel\n function cancelTask(TaskReceipt calldata _TR) external;\n\n /// @notice Cancel Tasks with their receipts on gelato\n /// @dev Proxy users or the Task providers can cancel.\n /// @param _TRs Task Receipts of Tasks to cancel\n function multiCancelTasks(TaskReceipt[] calldata _TRs) external;\n\n /// @notice Execute an action\n /// @param _action Action to execute\n function execAction(Action calldata _action) external payable;\n\n /// @notice Execute multiple actions\n /// @param _actions Actions to execute\n function multiExecActions(Action[] calldata _actions) external payable;\n\n /// @notice Get the factory address whence the proxy was created.\n /// @return Address of proxy's factory\n function factory() external pure returns(address);\n\n /// @notice Get the owner (EOA) address of the proxy\n /// @return Address of proxy owner\n function user() external pure returns(address);\n\n /// @notice Get the address of gelato\n /// @return Address of gelato\n function gelatoCore() external pure returns(address);\n}\n"
+ },
+ "contracts/libraries/GelatoBytes.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nlibrary GelatoBytes {\n function calldataSliceSelector(bytes calldata _bytes)\n internal\n pure\n returns (bytes4 selector)\n {\n selector =\n _bytes[0] |\n (bytes4(_bytes[1]) >> 8) |\n (bytes4(_bytes[2]) >> 16) |\n (bytes4(_bytes[3]) >> 24);\n }\n\n function memorySliceSelector(bytes memory _bytes)\n internal\n pure\n returns (bytes4 selector)\n {\n selector =\n _bytes[0] |\n (bytes4(_bytes[1]) >> 8) |\n (bytes4(_bytes[2]) >> 16) |\n (bytes4(_bytes[3]) >> 24);\n }\n\n function revertWithErrorString(bytes memory _bytes, string memory _tracingInfo)\n internal\n pure\n {\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\n if (_bytes.length % 32 == 4) {\n bytes4 selector;\n assembly { selector := mload(add(0x20, _bytes)) }\n if (selector == 0x08c379a0) { // Function selector for Error(string)\n assembly { _bytes := add(_bytes, 68) }\n revert(string(abi.encodePacked(_tracingInfo, string(_bytes))));\n } else {\n revert(string(abi.encodePacked(_tracingInfo, \"NoErrorSelector\")));\n }\n } else {\n revert(string(abi.encodePacked(_tracingInfo, \"UnexpectedReturndata\")));\n }\n }\n}"
+ },
+ "contracts/gelato_provider_modules/gnosis_safe_proxy_provider/ProviderModuleGnosisSafeProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoProviderModuleStandard} from \"../GelatoProviderModuleStandard.sol\";\nimport {IProviderModuleGnosisSafeProxy} from \"./IProviderModuleGnosisSafeProxy.sol\";\nimport {Ownable} from \"../../external/Ownable.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {GelatoActionPipeline} from \"../../gelato_actions/GelatoActionPipeline.sol\";\nimport {\n IGnosisSafe\n} from \"../../user_proxies/gnosis_safe_proxy/interfaces/IGnosisSafe.sol\";\nimport {\n IGnosisSafeProxy\n} from \"../../user_proxies/gnosis_safe_proxy/interfaces/IGnosisSafeProxy.sol\";\nimport {Task} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract ProviderModuleGnosisSafeProxy is\n GelatoProviderModuleStandard,\n IProviderModuleGnosisSafeProxy,\n Ownable\n{\n using GelatoBytes for bytes;\n\n mapping(bytes32 => bool) public override isProxyExtcodehashProvided;\n mapping(address => bool) public override isMastercopyProvided;\n address public override immutable gelatoCore;\n address public override immutable gelatoActionPipeline;\n\n constructor(\n bytes32[] memory hashes,\n address[] memory masterCopies,\n address _gelatoCore,\n address _gelatoActionPipeline\n )\n public\n {\n multiProvide(hashes, masterCopies);\n gelatoCore = _gelatoCore;\n gelatoActionPipeline = _gelatoActionPipeline;\n }\n\n // ================= GELATO PROVIDER MODULE STANDARD ================\n // @dev since we check extcodehash prior to execution, we forego the execution option\n // where the userProxy is deployed at execution time.\n function isProvided(address _userProxy, address, Task calldata)\n external\n view\n override\n returns(string memory)\n {\n bytes32 codehash;\n assembly { codehash := extcodehash(_userProxy) }\n if (!isProxyExtcodehashProvided[codehash])\n return \"ProviderModuleGnosisSafeProxy.isProvided:InvalidGSPCodehash\";\n address mastercopy = IGnosisSafeProxy(_userProxy).masterCopy();\n if (!isMastercopyProvided[mastercopy])\n return \"ProviderModuleGnosisSafeProxy.isProvided:InvalidGSPMastercopy\";\n if (!isGelatoCoreWhitelisted(_userProxy))\n return \"ProviderModuleGnosisSafeProxy.isProvided:GelatoCoreNotWhitelisted\";\n return OK;\n }\n\n function execPayload(uint256, address, address, Task calldata _task, uint256)\n external\n view\n override\n returns(bytes memory payload, bool proxyReturndataCheck)\n {\n // execTransactionFromModuleReturnData catches reverts so must check for reverts\n proxyReturndataCheck = true;\n\n if (_task.actions.length == 1) {\n payload = abi.encodeWithSelector(\n IGnosisSafe.execTransactionFromModuleReturnData.selector,\n _task.actions[0].addr, // to\n _task.actions[0].value,\n _task.actions[0].data,\n _task.actions[0].operation\n );\n } else if (_task.actions.length > 1) {\n // Action.Operation encoded into multiSendPayload and handled by Multisend\n bytes memory gelatoActionPipelinePayload = abi.encodeWithSelector(\n GelatoActionPipeline.execActionsAndPipeData.selector,\n _task.actions\n );\n\n payload = abi.encodeWithSelector(\n IGnosisSafe.execTransactionFromModuleReturnData.selector,\n gelatoActionPipeline, // to\n 0, // value\n gelatoActionPipelinePayload, // data\n IGnosisSafe.Operation.DelegateCall\n );\n\n } else {\n revert(\"ProviderModuleGnosisSafeProxy.execPayload: 0 _task.actions length\");\n }\n }\n\n function execRevertCheck(bytes calldata _proxyReturndata)\n external\n pure\n virtual\n override\n {\n (bool success, bytes memory returndata) = abi.decode(_proxyReturndata, (bool,bytes));\n if (!success) returndata.revertWithErrorString(\":ProviderModuleGnosisSafeProxy:\");\n }\n\n // GnosisSafeProxy\n function provideProxyExtcodehashes(bytes32[] memory _hashes) public override onlyOwner {\n for (uint i; i < _hashes.length; i++) {\n require(\n !isProxyExtcodehashProvided[_hashes[i]],\n \"ProviderModuleGnosisSafeProxy.provideProxyExtcodehashes: redundant\"\n );\n isProxyExtcodehashProvided[_hashes[i]] = true;\n emit LogProvideProxyExtcodehash(_hashes[i]);\n }\n }\n\n function unprovideProxyExtcodehashes(bytes32[] memory _hashes) public override onlyOwner {\n for (uint i; i < _hashes.length; i++) {\n require(\n isProxyExtcodehashProvided[_hashes[i]],\n \"ProviderModuleGnosisSafeProxy.unprovideProxyExtcodehashes: redundant\"\n );\n delete isProxyExtcodehashProvided[_hashes[i]];\n emit LogUnprovideProxyExtcodehash(_hashes[i]);\n }\n }\n\n function provideMastercopies(address[] memory _mastercopies) public override onlyOwner {\n for (uint i; i < _mastercopies.length; i++) {\n require(\n !isMastercopyProvided[_mastercopies[i]],\n \"ProviderModuleGnosisSafeProxy.provideMastercopy: redundant\"\n );\n isMastercopyProvided[_mastercopies[i]] = true;\n emit LogProvideMastercopy(_mastercopies[i]);\n }\n }\n\n function unprovideMastercopies(address[] memory _mastercopies) public override onlyOwner {\n for (uint i; i < _mastercopies.length; i++) {\n require(\n isMastercopyProvided[_mastercopies[i]],\n \"ProviderModuleGnosisSafeProxy.unprovideMastercopies: redundant\"\n );\n delete isMastercopyProvided[_mastercopies[i]];\n emit LogUnprovideMastercopy(_mastercopies[i]);\n }\n }\n\n // Batch (un-)provide\n function multiProvide(bytes32[] memory _hashes, address[] memory _mastercopies)\n public\n override\n onlyOwner\n {\n provideProxyExtcodehashes(_hashes);\n provideMastercopies(_mastercopies);\n }\n\n function multiUnprovide(bytes32[] calldata _hashes, address[] calldata _mastercopies)\n external\n override\n onlyOwner\n {\n unprovideProxyExtcodehashes(_hashes);\n unprovideMastercopies(_mastercopies);\n }\n\n function isGelatoCoreWhitelisted(address _userProxy)\n view\n internal\n returns(bool)\n {\n address[] memory whitelistedModules = IGnosisSafe(_userProxy).getModules();\n for (uint i = 0; i < whitelistedModules.length; i++)\n if (whitelistedModules[i] == gelatoCore) return true;\n return false;\n }\n\n}"
+ },
+ "contracts/gelato_provider_modules/GelatoProviderModuleStandard.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoProviderModule} from \"./IGelatoProviderModule.sol\";\nimport {Task} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\nabstract contract GelatoProviderModuleStandard is IGelatoProviderModule {\n\n string internal constant OK = \"OK\";\n\n function isProvided(address, address, Task calldata)\n external\n view\n virtual\n override\n returns(string memory)\n {\n return OK;\n }\n\n /// @dev Overriding fns should revert with the revertMsg they detected on the userProxy\n function execRevertCheck(bytes calldata) external pure override virtual {\n // By default no reverts detected => do nothing\n }\n}\n"
+ },
+ "contracts/gelato_provider_modules/gnosis_safe_proxy_provider/IProviderModuleGnosisSafeProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\ninterface IProviderModuleGnosisSafeProxy{\n event LogProvideProxyExtcodehash(bytes32 indexed extcodehash);\n event LogUnprovideProxyExtcodehash(bytes32 indexed extcodehash);\n\n event LogProvideMastercopy(address indexed mastercopy);\n event LogUnprovideMastercopy(address indexed mastercopy);\n\n // GnosisSafeProxy\n function provideProxyExtcodehashes(bytes32[] calldata _hashes) external;\n function unprovideProxyExtcodehashes(bytes32[] calldata _hashes) external;\n\n function provideMastercopies(address[] calldata _mastercopies) external;\n function unprovideMastercopies(address[] calldata _mastercopies) external;\n\n // Batch (un-)provide\n function multiProvide(bytes32[] calldata _hashes, address[] calldata _mastercopies)\n external;\n\n function multiUnprovide(bytes32[] calldata _hashes, address[] calldata _mastercopies)\n external;\n\n function isProxyExtcodehashProvided(bytes32 _hash)\n external\n view\n returns(bool);\n function isMastercopyProvided(address _mastercopy)\n external\n view\n returns(bool);\n\n\n function gelatoCore() external pure returns(address);\n function gelatoActionPipeline() external pure returns(address);\n}\n"
+ },
+ "contracts/external/Ownable.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\ncontract Ownable {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() internal {\n _owner = msg.sender;\n emit OwnershipTransferred(address(0), _owner);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(isOwner(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Returns true if the caller is the current owner.\n */\n function isOwner() public view returns (bool) {\n return msg.sender == _owner;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n */\n function _transferOwnership(address newOwner) internal virtual {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n"
+ },
+ "contracts/gelato_actions/GelatoActionPipeline.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {Action, Operation, DataFlow} from \"../gelato_core/interfaces/IGelatoCore.sol\";\nimport {GelatoBytes} from \"../libraries/GelatoBytes.sol\";\nimport {IGelatoInFlowAction} from \"./action_pipeline_interfaces/IGelatoInFlowAction.sol\";\nimport {IGelatoOutFlowAction} from \"./action_pipeline_interfaces/IGelatoOutFlowAction.sol\";\nimport {\n IGelatoInAndOutFlowAction\n} from \"./action_pipeline_interfaces/IGelatoInAndOutFlowAction.sol\";\n\n/// @title GelatoActionPipeline\n/// @notice Runtime Environment for executing multiple Actions that can share data\ncontract GelatoActionPipeline {\n\n using GelatoBytes for bytes;\n\n address public immutable thisActionAddress;\n constructor() public { thisActionAddress = address(this); }\n\n /// @notice This code can be delegatecalled by User Proxies during the execution\n /// of multiple Actions, in order to let data flow between them, in\n /// accordance with their Action.DataFlow specifications.\n /// @dev ProviderModules should encode their execPayload with this function selector.\n /// @param _actions List of _actions to be executed sequentially in pipeline\n function execActionsAndPipeData(Action[] calldata _actions) external {\n require(thisActionAddress != address(this), \"GelatoActionPipeline.delegatecallOnly\");\n\n // Store for reusable data from Actions that DataFlow.Out or DataFlow.InAndOut\n bytes memory dataFromLastOutFlowAction;\n\n // We execute Actions sequentially and store reusable outflowing Data\n for (uint i = 0; i < _actions.length; i++) {\n require(_actions[i].addr != address(0), \"GelatoActionPipeline.noZeroAddress\");\n\n bytes memory actionPayload;\n\n if (_actions[i].dataFlow == DataFlow.In) {\n actionPayload = abi.encodeWithSelector(\n IGelatoInFlowAction.execWithDataFlowIn.selector,\n _actions[i].data,\n dataFromLastOutFlowAction\n );\n } else if (_actions[i].dataFlow == DataFlow.Out) {\n actionPayload = abi.encodeWithSelector(\n IGelatoOutFlowAction.execWithDataFlowOut.selector,\n _actions[i].data\n );\n } else if (_actions[i].dataFlow == DataFlow.InAndOut) {\n actionPayload = abi.encodeWithSelector(\n IGelatoInAndOutFlowAction.execWithDataFlowInAndOut.selector,\n _actions[i].data,\n dataFromLastOutFlowAction\n );\n } else {\n actionPayload = _actions[i].data;\n }\n\n bool success;\n bytes memory returndata;\n if (_actions[i].operation == Operation.Call){\n (success, returndata) = _actions[i].addr.call{value: _actions[i].value}(\n actionPayload\n );\n } else {\n (success, returndata) = _actions[i].addr.delegatecall(actionPayload);\n }\n\n if (!success)\n returndata.revertWithErrorString(\"GelatoActionPipeline.execActionsAndPipeData:\");\n\n if (\n _actions[i].dataFlow == DataFlow.Out ||\n _actions[i].dataFlow == DataFlow.InAndOut\n ) {\n // All OutFlow actions return (bytes memory). But the low-level\n // delegatecall encoded those bytes into returndata.\n // So we have to decode them again to obtain the original bytes value.\n dataFromLastOutFlowAction = abi.decode(returndata, (bytes));\n }\n }\n }\n\n function isValid(Action[] calldata _actions)\n external\n pure\n returns (\n bool ok,\n uint256 outActionIndex,\n uint256 inActionIndex,\n bytes32 currentOutflowType,\n bytes32 nextInflowType\n )\n {\n ok = true;\n for (uint256 i = 0; i < _actions.length; i++) {\n if (_actions[i].dataFlow == DataFlow.In || _actions[i].dataFlow == DataFlow.InAndOut) {\n // Make sure currentOutflowType matches what the inFlowAction expects\n try IGelatoInFlowAction(_actions[i].addr).DATA_FLOW_IN_TYPE()\n returns (bytes32 inFlowType)\n {\n if (inFlowType != currentOutflowType) {\n nextInflowType = inFlowType;\n inActionIndex = i;\n ok = false;\n break;\n } else {\n ok = true;\n }\n } catch {\n revert(\"GelatoActionPipeline.isValid: error DATA_FLOW_IN_TYPE\");\n }\n }\n if (_actions[i].dataFlow == DataFlow.Out || _actions[i].dataFlow == DataFlow.InAndOut) {\n if (ok == false) break;\n // Store this Actions outFlowType to be used by the next inFlowAction\n try IGelatoOutFlowAction(_actions[i].addr).DATA_FLOW_OUT_TYPE()\n returns (bytes32 outFlowType)\n {\n currentOutflowType = outFlowType;\n outActionIndex = i;\n ok = false;\n } catch {\n revert(\"GelatoActionPipeline.isValid: error DATA_FLOW_OUT_TYPE\");\n }\n }\n }\n }\n}"
+ },
+ "contracts/user_proxies/gnosis_safe_proxy/interfaces/IGnosisSafe.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\ninterface IGnosisSafe {\n enum Operation {Call, DelegateCall}\n\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external;\n\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes calldata signatures\n ) external returns (bool success);\n\n function enableModule(address module) external;\n function disableModule(address prevModule, address module) external;\n\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes calldata data,\n Operation operation\n ) external returns (bool success, bytes memory returndata);\n\n function isOwner(address owner) external view returns (bool);\n function getOwners() external view returns (address[] memory);\n\n function getModules() external view returns (address[] memory);\n}\n"
+ },
+ "contracts/user_proxies/gnosis_safe_proxy/interfaces/IGnosisSafeProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\ninterface IGnosisSafeProxy {\n function masterCopy() external view returns (address);\n}"
+ },
+ "contracts/gelato_actions/action_pipeline_interfaces/IGelatoInFlowAction.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/// @title IGelatoInFlowAction\n/// @notice Solidity interface for Actions that make use of DataFlow.In\n/// @dev Inherit this, if you want your Action to use DataFlow.In in a standard way.\ninterface IGelatoInFlowAction {\n /// @notice Executes the action implementation with data flowing in from a previous\n /// Action in the sequence.\n /// @dev The _inFlowData format should be defined by DATA_FLOW_IN_TYPE\n /// @param _actionData Known prior to execution and probably encoded off-chain.\n /// @param _inFlowData Not known prior to execution. Passed in via GelatoActionPipeline.\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable;\n\n /// @notice Returns the expected format of the execWithDataFlowIn _inFlowData.\n /// @dev Strict adherence to these formats is crucial for GelatoActionPipelines.\n function DATA_FLOW_IN_TYPE() external pure returns (bytes32);\n}\n"
+ },
+ "contracts/gelato_actions/action_pipeline_interfaces/IGelatoOutFlowAction.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/// @title IGelatoOutFlowAction\n/// @notice Solidity interface for Actions that make use of DataFlow.Out\n/// @dev Inherit this, if you want implement your Action.DataFlow.Out in a standard way.\ninterface IGelatoOutFlowAction {\n /// @notice Executes the Action implementation with data flowing out to consecutive\n /// Actions in a GelatoActionPipeline.\n /// @dev The outFlowData format should be defined by DATA_FLOW_OUT_TYPE\n /// @param _actionData Known prior to execution and probably encoded off-chain.\n /// @return outFlowData The bytes encoded data this action implementation emits.\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n returns (bytes memory outFlowData);\n\n /// @notice Returns the expected format of the execWithDataFlowOut outFlowData.\n /// @dev Strict adherence to these formats is crucial for GelatoActionPipelines.\n function DATA_FLOW_OUT_TYPE() external pure returns (bytes32);\n}\n"
+ },
+ "contracts/gelato_actions/action_pipeline_interfaces/IGelatoInAndOutFlowAction.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {Action} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\n/// @title IGelatoInAndOutFlowAction\n/// @notice Solidity interface for Actions that make use of DataFlow.InAndOut\ninterface IGelatoInAndOutFlowAction {\n\n /// @notice Executes the Action implementation with data flowing in from a previous\n /// Action in the GelatoActionPipeline and with data flowing out to consecutive\n /// Actions in the pipeline.\n /// @dev The _inFlowData format should be defined by DATA_FLOW_IN_TYPE and\n /// the outFlowData format should be defined by DATA_FLOW_OUT_TYPE.\n /// @param _actionData Known prior to execution and probably encoded off-chain.\n /// @param _inFlowData Not known prior to execution. Passed in via GelatoActionPipeline.\n /// @return outFlowData The bytes encoded data this action implementation emits.\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n returns (bytes memory outFlowData);\n\n /// @notice Returns the expected format of the execWithDataFlowIn _inFlowData.\n /// @dev Strict adherence to these formats is crucial for GelatoActionPipelines.\n function DATA_FLOW_IN_TYPE() external pure returns (bytes32);\n\n /// @notice Returns the expected format of the execWithDataFlowOut outFlowData.\n /// @dev Strict adherence to these formats is crucial for GelatoActionPipelines.\n function DATA_FLOW_OUT_TYPE() external pure returns (bytes32);\n}"
+ },
+ "contracts/user_proxies/gnosis_safe_proxy/interfaces/IGnosisSafeProxyFactory.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"./IGnosisSafe.sol\";\n\ninterface IGnosisSafeProxyFactory {\n\n event ProxyCreation(address proxy);\n\n /// @dev Allows to create new proxy contact and exec a message call to the\n /// new proxy within one transaction. Emits ProxyCreation.\n /// @param masterCopy Address of master copy.\n /// @param data Payload for message call sent to new proxy contract.\n /// @return proxy address\n function createProxy(address masterCopy, bytes calldata data)\n external\n returns (IGnosisSafe proxy);\n\n /// @dev Allows to create new proxy contact and exec a message call to the\n /// new proxy within one transaction. Emits ProxyCreation.\n /// @param _mastercopy Address of master copy.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the\n /// address of the new proxy contract.\n /// @return proxy address\n function createProxyWithNonce(\n address _mastercopy,\n bytes calldata initializer,\n uint256 saltNonce\n )\n external\n returns (IGnosisSafe proxy);\n\n /// @dev Allows to create new proxy contact, exec a message call to the\n // new proxy and call a specified callback within one transaction\n /// @param _mastercopy Address of master copy.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate\n /// the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract\n /// has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _mastercopy,\n bytes calldata initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n )\n external\n returns (IGnosisSafe proxy);\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an\n /// initializer that would revert, therefore the response is returned with a revert.\n /// When calling this method set `from` to the address of the proxy factory.\n /// @param _mastercopy Address of master copy.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the\n /// address of the new proxy contract.\n /// @return proxy address from a revert() reason string message\n function calculateCreateProxyWithNonceAddress(\n address _mastercopy,\n bytes calldata initializer,\n uint256 saltNonce\n )\n external\n returns (address proxy);\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy.\n /// This can be used to check that the expected Proxy was deployed.\n /// @return proxysRuntimeBytecode bytes\n function proxyRuntimeCode() external pure returns (bytes memory);\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment.\n /// With this it is easily possible to calculate predicted address.\n /// @return proxysCreationCode bytes\n function proxyCreationCode() external pure returns (bytes memory);\n\n}\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n address proxy,\n address _mastercopy,\n bytes calldata initializer,\n uint256 saltNonce\n )\n external;\n}"
+ },
+ "contracts/gelato_provider_modules/gelato_user_proxy_provider/ProviderModuleGelatoUserProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoProviderModuleStandard} from \"../GelatoProviderModuleStandard.sol\";\nimport {\n Action, Operation, DataFlow, Task\n} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n IGelatoUserProxyFactory\n} from \"../../user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxyFactory.sol\";\nimport {\n IGelatoUserProxy\n} from \"../../user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxy.sol\";\nimport {GelatoActionPipeline} from \"../../gelato_actions/GelatoActionPipeline.sol\";\n\ncontract ProviderModuleGelatoUserProxy is GelatoProviderModuleStandard {\n\n IGelatoUserProxyFactory public immutable gelatoUserProxyFactory;\n address public immutable gelatoActionPipeline;\n\n constructor(\n IGelatoUserProxyFactory _gelatoUserProxyFactory,\n address _gelatoActionPipeline\n )\n public\n {\n gelatoUserProxyFactory = _gelatoUserProxyFactory;\n gelatoActionPipeline = _gelatoActionPipeline;\n }\n\n // ================= GELATO PROVIDER MODULE STANDARD ================\n function isProvided(address _userProxy, address, Task calldata)\n external\n view\n override\n returns(string memory)\n {\n bool proxyOk = gelatoUserProxyFactory.isGelatoUserProxy(_userProxy);\n if (!proxyOk) return \"ProviderModuleGelatoUserProxy.isProvided:InvalidUserProxy\";\n return OK;\n }\n\n function execPayload(uint256, address, address, Task calldata _task, uint256)\n external\n view\n override\n returns(bytes memory payload, bool) // bool==false: no execRevertCheck\n {\n if (_task.actions.length > 1) {\n bytes memory gelatoActionPipelinePayload = abi.encodeWithSelector(\n GelatoActionPipeline.execActionsAndPipeData.selector,\n _task.actions\n );\n Action memory pipelinedActions = Action({\n addr: gelatoActionPipeline,\n data: gelatoActionPipelinePayload,\n operation: Operation.Delegatecall,\n dataFlow: DataFlow.None,\n value: 0,\n termsOkCheck: false\n });\n payload = abi.encodeWithSelector(\n IGelatoUserProxy.execAction.selector,\n pipelinedActions\n );\n } else if (_task.actions.length == 1) {\n payload = abi.encodeWithSelector(\n IGelatoUserProxy.execAction.selector,\n _task.actions[0]\n );\n } else {\n revert(\"ProviderModuleGelatoUserProxy.execPayload: 0 _task.actions length\");\n }\n }\n}"
+ },
+ "contracts/mocks/provider_modules/gelato_user_proxy_provider/MockProviderModuleGelatoUserProxyExecRevertCheckRevert.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {\n GelatoProviderModuleStandard\n} from \"../../../gelato_provider_modules/GelatoProviderModuleStandard.sol\";\nimport {Task} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n IGelatoUserProxy\n} from \"../../../user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxy.sol\";\n\ncontract MockProviderModuleGelatoUserProxyExecRevertCheckRevert is\n GelatoProviderModuleStandard\n{\n // Incorrect execPayload func on purpose\n function execPayload(uint256, address, address, Task calldata _task, uint256)\n external\n view\n virtual\n override\n returns(bytes memory payload, bool execRevertCheck)\n {\n if (_task.actions.length > 1) {\n payload = abi.encodeWithSelector(\n IGelatoUserProxy.multiExecActions.selector,\n _task.actions\n );\n } else if (_task.actions.length == 1) {\n payload = abi.encodeWithSelector(\n IGelatoUserProxy.execAction.selector,\n _task.actions[0]\n );\n } else {\n revert(\"ProviderModuleGelatoUserProxy.execPayload: 0 _actions length\");\n }\n execRevertCheck = true;\n }\n\n function execRevertCheck(bytes memory)\n public\n pure\n virtual\n override\n {\n revert(\"MockProviderModuleGelatoUserProxyExecRevertCheck.execRevertCheck\");\n }\n}"
+ },
+ "contracts/mocks/provider_modules/gelato_user_proxy_provider/MockProviderModuleGelatoUserProxyExecRevertCheckError.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {\n GelatoProviderModuleStandard\n} from \"../../../gelato_provider_modules/GelatoProviderModuleStandard.sol\";\nimport {Task} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n IGelatoUserProxy\n} from \"../../../user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxy.sol\";\n\ncontract MockProviderModuleGelatoUserProxyExecRevertCheckError is\n GelatoProviderModuleStandard\n{\n\n // Incorrect execPayload func on purpose\n function execPayload(uint256, address, address, Task calldata _task, uint256)\n external\n view\n virtual\n override\n returns(bytes memory payload, bool execRevertCheck)\n {\n if (_task.actions.length > 1) {\n payload = abi.encodeWithSelector(\n IGelatoUserProxy.multiExecActions.selector,\n _task.actions\n );\n } else if (_task.actions.length == 1) {\n payload = abi.encodeWithSelector(\n IGelatoUserProxy.execAction.selector,\n _task.actions[0]\n );\n } else {\n revert(\"ProviderModuleGelatoUserProxy.execPayload: 0 _actions length\");\n }\n execRevertCheck = true;\n }\n\n function execRevertCheck(bytes memory)\n public\n pure\n virtual\n override\n {\n assert(false);\n }\n}"
+ },
+ "contracts/mocks/provider_modules/gelato_user_proxy_provider/MockProviderModuleExecPayloadWrong.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {\n GelatoProviderModuleStandard\n} from \"../../../gelato_provider_modules/GelatoProviderModuleStandard.sol\";\nimport {Task} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract MockProviderModuleExecPayloadWrong is GelatoProviderModuleStandard {\n // Incorrect execPayload func on purpose\n function execPayload(uint256, address, address, Task calldata, uint256)\n external\n view\n override\n returns(bytes memory, bool)\n {\n return (abi.encodeWithSelector(this.bogus.selector), false);\n }\n\n function bogus() external {}\n}"
+ },
+ "contracts/mocks/provider_modules/gelato_user_proxy_provider/MockProviderModuleExecPayloadRevert.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {\n GelatoProviderModuleStandard\n} from \"../../../gelato_provider_modules/GelatoProviderModuleStandard.sol\";\nimport {Task} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract MockProviderModuleExecPayloadRevert is GelatoProviderModuleStandard {\n // Incorrect execPayload func on purpose\n function execPayload(uint256, address, address, Task calldata, uint256)\n external\n view\n override\n returns(bytes memory, bool)\n {\n revert(\"MockProviderModuleExecPayloadRevert.execPayload: test revert\");\n }\n}"
+ },
+ "contracts/mocks/gelato_actions/one-off/MockActionMaliciousProvider.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoActionsStandard} from \"../../../gelato_actions/GelatoActionsStandard.sol\";\nimport {IGelatoAction} from \"../../../gelato_actions/IGelatoAction.sol\";\nimport {\n IGelatoProviders,\n TaskSpec\n} from \"../../../gelato_core/interfaces/IGelatoProviders.sol\";\nimport {IGelatoProviderModule} from \"../../../gelato_provider_modules/IGelatoProviderModule.sol\";\n\n// This Action is the Provider and must be called from any UserProxy with .call a\ncontract MockActionMaliciousProvider {\n IGelatoProviders immutable gelato;\n\n constructor(IGelatoProviders _gelato) public { gelato = _gelato; }\n\n receive() external payable {}\n\n function action() public payable virtual {\n uint256 providerFunds = gelato.providerFunds(address(this));\n try gelato.unprovideFunds(providerFunds) {\n } catch Error(string memory err) {\n revert(\n string(\n abi.encodePacked(\"MockActionMaliciousProvider.action.unprovideFunds:\", err)\n )\n );\n } catch {\n revert(\"MockActionMaliciousProvider.action.unprovideFunds:undefinded\");\n }\n }\n\n function multiProvide(\n address _executor,\n TaskSpec[] calldata _taskSpecs,\n IGelatoProviderModule[] calldata _modules\n )\n external\n payable\n {\n try gelato.multiProvide{value: msg.value}(_executor, _taskSpecs, _modules) {\n } catch Error(string memory err) {\n revert(\n string(abi.encodePacked(\"MockActionMaliciousProvider.multiProvide:\", err))\n );\n } catch {\n revert(\"MockActionMaliciousProvider.multiProvide:undefinded\");\n }\n }\n}\n"
+ },
+ "contracts/gelato_actions/GelatoActionsStandard.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {IGelatoAction} from \"./IGelatoAction.sol\";\nimport {DataFlow} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\n/// @title GelatoActionsStandard\n/// @dev find all the NatSpecs inside IGelatoAction\nabstract contract GelatoActionsStandard is IGelatoAction {\n\n string internal constant OK = \"OK\";\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n address public immutable thisActionAddress;\n\n constructor() public { thisActionAddress = address(this); }\n\n modifier delegatecallOnly(string memory _tracingInfo) {\n require(\n thisActionAddress != address(this),\n string(abi.encodePacked(_tracingInfo, \":delegatecallOnly\"))\n );\n _;\n }\n\n function termsOk(\n uint256, // _taskReceiptId\n address, // _userProxy\n bytes calldata, // _actionData\n DataFlow,\n uint256, // _value: for actions that send ETH around\n uint256 // cycleId\n )\n external\n view\n virtual\n override\n returns(string memory) // actionTermsOk\n {\n // Standard return value for actionConditions fulfilled and no erros:\n return OK;\n }\n}\n"
+ },
+ "contracts/gelato_actions/IGelatoAction.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {DataFlow} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\n/// @title IGelatoAction - solidity interface of GelatoActionsStandard\n/// @notice all the APIs and events of GelatoActionsStandard\n/// @dev all the APIs are implemented inside GelatoActionsStandard\ninterface IGelatoAction {\n event LogOneWay(\n address origin,\n address sendToken,\n uint256 sendAmount,\n address destination\n );\n\n event LogTwoWay(\n address origin,\n address sendToken,\n uint256 sendAmount,\n address destination,\n address receiveToken,\n uint256 receiveAmount,\n address receiver\n );\n\n /// @notice Providers can use this for pre-execution sanity checks, to prevent reverts.\n /// @dev GelatoCore checks this in canExec and passes the parameters.\n /// @param _taskReceiptId The id of the task from which all arguments are passed.\n /// @param _userProxy The userProxy of the task. Often address(this) for delegatecalls.\n /// @param _actionData The encoded payload to be used in the Action.\n /// @param _dataFlow The dataFlow of the Action.\n /// @param _value A special param for ETH sending Actions. If the Action sends ETH\n /// in its Action function implementation, one should expect msg.value therein to be\n /// equal to _value. So Providers can check in termsOk that a valid ETH value will\n /// be used because they also have access to the same value when encoding the\n /// execPayload on their ProviderModule.\n /// @param _cycleId For tasks that are part of a Cycle.\n /// @return Returns OK, if Task can be executed safely according to the Provider's\n /// terms laid out in this function implementation.\n function termsOk(\n uint256 _taskReceiptId,\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256 _value,\n uint256 _cycleId\n )\n external\n view\n returns(string memory);\n}\n"
+ },
+ "contracts/gelato_core/interfaces/IGelatoProviders.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoProviderModule} from \"../../gelato_provider_modules/IGelatoProviderModule.sol\";\nimport {Action, Provider, Task, TaskReceipt} from \"../interfaces/IGelatoCore.sol\";\nimport {IGelatoCondition} from \"../../gelato_conditions/IGelatoCondition.sol\";\n\n// TaskSpec - Will be whitelised by providers and selected by users\nstruct TaskSpec {\n IGelatoCondition[] conditions; // Address: optional AddressZero for self-conditional actions\n Action[] actions;\n uint256 gasPriceCeil;\n}\n\ninterface IGelatoProviders {\n // Provider Funding\n event LogFundsProvided(\n address indexed provider,\n uint256 amount,\n uint256 newProviderFunds\n );\n event LogFundsUnprovided(\n address indexed provider,\n uint256 realWithdrawAmount,\n uint256 newProviderFunds\n );\n\n // Executor By Provider\n event LogProviderAssignedExecutor(\n address indexed provider,\n address indexed oldExecutor,\n address indexed newExecutor\n );\n event LogExecutorAssignedExecutor(\n address indexed provider,\n address indexed oldExecutor,\n address indexed newExecutor\n );\n\n // Actions\n event LogTaskSpecProvided(address indexed provider, bytes32 indexed taskSpecHash);\n event LogTaskSpecUnprovided(address indexed provider, bytes32 indexed taskSpecHash);\n event LogTaskSpecGasPriceCeilSet(\n address indexed provider,\n bytes32 taskSpecHash,\n uint256 oldTaskSpecGasPriceCeil,\n uint256 newTaskSpecGasPriceCeil\n );\n\n // Provider Module\n event LogProviderModuleAdded(\n address indexed provider,\n IGelatoProviderModule indexed module\n );\n event LogProviderModuleRemoved(\n address indexed provider,\n IGelatoProviderModule indexed module\n );\n\n // =========== GELATO PROVIDER APIs ==============\n\n /// @notice Validation that checks whether Task Spec is being offered by the selected provider\n /// @dev Checked in submitTask(), unless provider == userProxy\n /// @param _provider Address of selected provider\n /// @param _taskSpec Task Spec\n /// @return Expected to return \"OK\"\n function isTaskSpecProvided(address _provider, TaskSpec calldata _taskSpec)\n external\n view\n returns(string memory);\n\n /// @notice Validates that provider has provider module whitelisted + conducts isProvided check in ProviderModule\n /// @dev Checked in submitTask() if provider == userProxy\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task Task defined in IGelatoCore\n /// @return Expected to return \"OK\"\n function providerModuleChecks(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task\n )\n external\n view\n returns(string memory);\n\n\n /// @notice Validate if provider module and seleced TaskSpec is whitelisted by provider\n /// @dev Combines \"isTaskSpecProvided\" and providerModuleChecks\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task Task defined in IGelatoCore\n /// @return res Expected to return \"OK\"\n function isTaskProvided(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task\n )\n external\n view\n returns(string memory res);\n\n\n /// @notice Validate if selected TaskSpec is whitelisted by provider and that current gelatoGasPrice is below GasPriceCeil\n /// @dev If gasPriceCeil is != 0, Task Spec is whitelisted\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task Task defined in IGelatoCore\n /// @param _gelatoGasPrice Task Receipt defined in IGelatoCore\n /// @return res Expected to return \"OK\"\n function providerCanExec(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task,\n uint256 _gelatoGasPrice\n )\n external\n view\n returns(string memory res);\n\n // =========== PROVIDER STATE WRITE APIs ==============\n // Provider Funding\n /// @notice Deposit ETH as provider on Gelato\n /// @param _provider Address of provider who receives ETH deposit\n function provideFunds(address _provider) external payable;\n\n /// @notice Withdraw provider funds from gelato\n /// @param _withdrawAmount Amount\n /// @return amount that will be withdrawn\n function unprovideFunds(uint256 _withdrawAmount) external returns(uint256);\n\n /// @notice Assign executor as provider\n /// @param _executor Address of new executor\n function providerAssignsExecutor(address _executor) external;\n\n /// @notice Assign executor as previous selected executor\n /// @param _provider Address of provider whose executor to change\n /// @param _newExecutor Address of new executor\n function executorAssignsExecutor(address _provider, address _newExecutor) external;\n\n // (Un-)provide Task Spec\n\n /// @notice Whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from\n /// @dev If gasPriceCeil is == 0, Task Spec will be executed at any gas price (no ceil)\n /// @param _taskSpecs Task Receipt List defined in IGelatoCore\n function provideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;\n\n /// @notice De-whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from\n /// @dev If gasPriceCeil was set to NO_CEIL, Input NO_CEIL constant as GasPriceCeil\n /// @param _taskSpecs Task Receipt List defined in IGelatoCore\n function unprovideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;\n\n /// @notice Update gasPriceCeil of selected Task Spec\n /// @param _taskSpecHash Result of hashTaskSpec()\n /// @param _gasPriceCeil New gas price ceil for Task Spec\n function setTaskSpecGasPriceCeil(bytes32 _taskSpecHash, uint256 _gasPriceCeil) external;\n\n // Provider Module\n /// @notice Whitelist new provider Module(s)\n /// @param _modules Addresses of the modules which will be called during providerModuleChecks()\n function addProviderModules(IGelatoProviderModule[] calldata _modules) external;\n\n /// @notice De-Whitelist new provider Module(s)\n /// @param _modules Addresses of the modules which will be removed\n function removeProviderModules(IGelatoProviderModule[] calldata _modules) external;\n\n // Batch (un-)provide\n\n /// @notice Whitelist new executor, TaskSpec(s) and Module(s) in one tx\n /// @param _executor Address of new executor of provider\n /// @param _taskSpecs List of Task Spec which will be whitelisted by provider\n /// @param _modules List of module addresses which will be whitelisted by provider\n function multiProvide(\n address _executor,\n TaskSpec[] calldata _taskSpecs,\n IGelatoProviderModule[] calldata _modules\n )\n external\n payable;\n\n\n /// @notice De-Whitelist TaskSpec(s), Module(s) and withdraw funds from gelato in one tx\n /// @param _withdrawAmount Amount to withdraw from ProviderFunds\n /// @param _taskSpecs List of Task Spec which will be de-whitelisted by provider\n /// @param _modules List of module addresses which will be de-whitelisted by provider\n function multiUnprovide(\n uint256 _withdrawAmount,\n TaskSpec[] calldata _taskSpecs,\n IGelatoProviderModule[] calldata _modules\n )\n external;\n\n // =========== PROVIDER STATE READ APIs ==============\n // Provider Funding\n\n /// @notice Get balance of provider\n /// @param _provider Address of provider\n /// @return Provider Balance\n function providerFunds(address _provider) external view returns(uint256);\n\n /// @notice Get min stake required by all providers for executors to call exec\n /// @param _gelatoMaxGas Current gelatoMaxGas\n /// @param _gelatoGasPrice Current gelatoGasPrice\n /// @return How much provider balance is required for executor to submit exec tx\n function minExecProviderFunds(uint256 _gelatoMaxGas, uint256 _gelatoGasPrice)\n external\n view\n returns(uint256);\n\n /// @notice Check if provider has sufficient funds for executor to call exec\n /// @param _provider Address of provider\n /// @param _gelatoMaxGas Currentt gelatoMaxGas\n /// @param _gelatoGasPrice Current gelatoGasPrice\n /// @return Whether provider is liquid (true) or not (false)\n function isProviderLiquid(\n address _provider,\n uint256 _gelatoMaxGas,\n uint256 _gelatoGasPrice\n )\n external\n view\n returns(bool);\n\n // Executor Stake\n\n /// @notice Get balance of executor\n /// @param _executor Address of executor\n /// @return Executor Balance\n function executorStake(address _executor) external view returns(uint256);\n\n /// @notice Check if executor has sufficient stake on gelato\n /// @param _executor Address of provider\n /// @return Whether executor has sufficient stake (true) or not (false)\n function isExecutorMinStaked(address _executor) external view returns(bool);\n\n /// @notice Get executor of provider\n /// @param _provider Address of provider\n /// @return Provider's executor\n function executorByProvider(address _provider)\n external\n view\n returns(address);\n\n /// @notice Get num. of providers which haved assigned an executor\n /// @param _executor Address of executor\n /// @return Count of how many providers assigned the executor\n function executorProvidersCount(address _executor) external view returns(uint256);\n\n /// @notice Check if executor has one or more providers assigned\n /// @param _executor Address of provider\n /// @return Where 1 or more providers have assigned the executor\n function isExecutorAssigned(address _executor) external view returns(bool);\n\n // Task Spec and Gas Price Ceil\n /// @notice The maximum gas price the transaction will be executed with\n /// @param _provider Address of provider\n /// @param _taskSpecHash Hash of provider TaskSpec\n /// @return Max gas price an executor will execute the transaction with in wei\n function taskSpecGasPriceCeil(address _provider, bytes32 _taskSpecHash)\n external\n view\n returns(uint256);\n\n /// @notice Returns the hash of the formatted TaskSpec.\n /// @dev The action.data field of each Action is stripped before hashing.\n /// @param _taskSpec TaskSpec\n /// @return keccak256 hash of encoded condition address and Action List\n function hashTaskSpec(TaskSpec calldata _taskSpec) external view returns(bytes32);\n\n /// @notice Constant used to specify the highest gas price available in the gelato system\n /// @dev Input 0 as gasPriceCeil and it will be assigned to NO_CEIL\n /// @return MAX_UINT\n function NO_CEIL() external pure returns(uint256);\n\n // Providers' Module Getters\n\n /// @notice Check if inputted module is whitelisted by provider\n /// @param _provider Address of provider\n /// @param _module Address of module\n /// @return true if it is whitelisted\n function isModuleProvided(address _provider, IGelatoProviderModule _module)\n external\n view\n returns(bool);\n\n /// @notice Get all whitelisted provider modules from a given provider\n /// @param _provider Address of provider\n /// @return List of whitelisted provider modules\n function providerModules(address _provider)\n external\n view\n returns(IGelatoProviderModule[] memory);\n}\n"
+ },
+ "contracts/gelato_core/GelatoProviders.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoProviders, TaskSpec} from \"./interfaces/IGelatoProviders.sol\";\nimport {GelatoSysAdmin} from \"./GelatoSysAdmin.sol\";\nimport {Address} from \"../external/Address.sol\";\nimport {GelatoString} from \"../libraries/GelatoString.sol\";\nimport {Math} from \"../external/Math.sol\";\nimport {SafeMath} from \"../external/SafeMath.sol\";\nimport {IGelatoProviderModule} from \"../gelato_provider_modules/IGelatoProviderModule.sol\";\nimport {ProviderModuleSet} from \"../libraries/ProviderModuleSet.sol\";\nimport {\n Condition, Action, Operation, DataFlow, Provider, Task, TaskReceipt\n} from \"./interfaces/IGelatoCore.sol\";\nimport {IGelatoCondition} from \"../gelato_conditions/IGelatoCondition.sol\";\n\n/// @title GelatoProviders\n/// @notice Provider Management API - Whitelist TaskSpecs\n/// @dev Find all NatSpecs inside IGelatoProviders\nabstract contract GelatoProviders is IGelatoProviders, GelatoSysAdmin {\n\n using Address for address payable; /// for sendValue method\n using GelatoString for string;\n using ProviderModuleSet for ProviderModuleSet.Set;\n using SafeMath for uint256;\n\n // This is only for internal use by hashTaskSpec()\n struct NoDataAction {\n address addr;\n Operation operation;\n DataFlow dataFlow;\n bool value;\n bool termsOkCheck;\n }\n\n uint256 public constant override NO_CEIL = type(uint256).max;\n\n mapping(address => uint256) public override providerFunds;\n mapping(address => uint256) public override executorStake;\n mapping(address => address) public override executorByProvider;\n mapping(address => uint256) public override executorProvidersCount;\n // The Task-Spec Gas-Price-Ceil => taskSpecGasPriceCeil\n mapping(address => mapping(bytes32 => uint256)) public override taskSpecGasPriceCeil;\n mapping(address => ProviderModuleSet.Set) internal _providerModules;\n\n // GelatoCore: canSubmit\n function isTaskSpecProvided(address _provider, TaskSpec memory _taskSpec)\n public\n view\n override\n returns(string memory)\n {\n if (taskSpecGasPriceCeil[_provider][hashTaskSpec(_taskSpec)] == 0)\n return \"TaskSpecNotProvided\";\n return OK;\n }\n\n // IGelatoProviderModule: GelatoCore canSubmit & canExec\n function providerModuleChecks(\n address _userProxy,\n Provider memory _provider,\n Task memory _task\n )\n public\n view\n override\n returns(string memory)\n {\n if (!isModuleProvided(_provider.addr, _provider.module))\n return \"InvalidProviderModule\";\n\n if (_userProxy != _provider.addr) {\n IGelatoProviderModule providerModule = IGelatoProviderModule(\n _provider.module\n );\n\n try providerModule.isProvided(_userProxy, _provider.addr, _task)\n returns(string memory res)\n {\n return res;\n } catch {\n return \"GelatoProviders.providerModuleChecks\";\n }\n } else return OK;\n }\n\n // GelatoCore: canSubmit\n function isTaskProvided(\n address _userProxy,\n Provider memory _provider,\n Task memory _task\n )\n public\n view\n override\n returns(string memory res)\n {\n TaskSpec memory _taskSpec = _castTaskToSpec(_task);\n res = isTaskSpecProvided(_provider.addr, _taskSpec);\n if (res.startsWithOK())\n return providerModuleChecks(_userProxy, _provider, _task);\n }\n\n // GelatoCore canExec Gate\n function providerCanExec(\n address _userProxy,\n Provider memory _provider,\n Task memory _task,\n uint256 _gelatoGasPrice\n )\n public\n view\n override\n returns(string memory)\n {\n if (_userProxy == _provider.addr) {\n if (_task.selfProviderGasPriceCeil < _gelatoGasPrice)\n return \"SelfProviderGasPriceCeil\";\n } else {\n bytes32 taskSpecHash = hashTaskSpec(_castTaskToSpec(_task));\n if (taskSpecGasPriceCeil[_provider.addr][taskSpecHash] < _gelatoGasPrice)\n return \"taskSpecGasPriceCeil-OR-notProvided\";\n }\n return providerModuleChecks(_userProxy, _provider, _task);\n }\n\n // Provider Funding\n function provideFunds(address _provider) public payable override {\n require(msg.value > 0, \"GelatoProviders.provideFunds: zero value\");\n uint256 newProviderFunds = providerFunds[_provider].add(msg.value);\n emit LogFundsProvided(_provider, msg.value, newProviderFunds);\n providerFunds[_provider] = newProviderFunds;\n }\n\n // Unprovide funds\n function unprovideFunds(uint256 _withdrawAmount)\n public\n override\n returns(uint256 realWithdrawAmount)\n {\n uint256 previousProviderFunds = providerFunds[msg.sender];\n realWithdrawAmount = Math.min(_withdrawAmount, previousProviderFunds);\n\n uint256 newProviderFunds = previousProviderFunds - realWithdrawAmount;\n\n // Effects\n providerFunds[msg.sender] = newProviderFunds;\n\n // Interaction\n msg.sender.sendValue(realWithdrawAmount);\n\n emit LogFundsUnprovided(msg.sender, realWithdrawAmount, newProviderFunds);\n }\n\n // Called by Providers\n function providerAssignsExecutor(address _newExecutor) public override {\n address currentExecutor = executorByProvider[msg.sender];\n\n // CHECKS\n require(\n currentExecutor != _newExecutor,\n \"GelatoProviders.providerAssignsExecutor: already assigned.\"\n );\n if (_newExecutor != address(0)) {\n require(\n isExecutorMinStaked(_newExecutor),\n \"GelatoProviders.providerAssignsExecutor: isExecutorMinStaked()\"\n );\n }\n\n // EFFECTS: Provider reassigns from currentExecutor to newExecutor (or no executor)\n if (currentExecutor != address(0)) executorProvidersCount[currentExecutor]--;\n executorByProvider[msg.sender] = _newExecutor;\n if (_newExecutor != address(0)) executorProvidersCount[_newExecutor]++;\n\n emit LogProviderAssignedExecutor(msg.sender, currentExecutor, _newExecutor);\n }\n\n // Called by Executors\n function executorAssignsExecutor(address _provider, address _newExecutor) public override {\n address currentExecutor = executorByProvider[_provider];\n\n // CHECKS\n require(\n currentExecutor == msg.sender,\n \"GelatoProviders.executorAssignsExecutor: msg.sender is not assigned executor\"\n );\n require(\n currentExecutor != _newExecutor,\n \"GelatoProviders.executorAssignsExecutor: already assigned.\"\n );\n // Checks at the same time if _nexExecutor != address(0)\n require(\n isExecutorMinStaked(_newExecutor),\n \"GelatoProviders.executorAssignsExecutor: isExecutorMinStaked()\"\n );\n\n // EFFECTS: currentExecutor reassigns to newExecutor\n executorProvidersCount[currentExecutor]--;\n executorByProvider[_provider] = _newExecutor;\n executorProvidersCount[_newExecutor]++;\n\n emit LogExecutorAssignedExecutor(_provider, currentExecutor, _newExecutor);\n }\n\n // (Un-)provide Condition Action Combos at different Gas Price Ceils\n function provideTaskSpecs(TaskSpec[] memory _taskSpecs) public override {\n for (uint i; i < _taskSpecs.length; i++) {\n if (_taskSpecs[i].gasPriceCeil == 0) _taskSpecs[i].gasPriceCeil = NO_CEIL;\n bytes32 taskSpecHash = hashTaskSpec(_taskSpecs[i]);\n setTaskSpecGasPriceCeil(taskSpecHash, _taskSpecs[i].gasPriceCeil);\n emit LogTaskSpecProvided(msg.sender, taskSpecHash);\n }\n }\n\n function unprovideTaskSpecs(TaskSpec[] memory _taskSpecs) public override {\n for (uint i; i < _taskSpecs.length; i++) {\n bytes32 taskSpecHash = hashTaskSpec(_taskSpecs[i]);\n require(\n taskSpecGasPriceCeil[msg.sender][taskSpecHash] != 0,\n \"GelatoProviders.unprovideTaskSpecs: redundant\"\n );\n delete taskSpecGasPriceCeil[msg.sender][taskSpecHash];\n emit LogTaskSpecUnprovided(msg.sender, taskSpecHash);\n }\n }\n\n function setTaskSpecGasPriceCeil(bytes32 _taskSpecHash, uint256 _gasPriceCeil)\n public\n override\n {\n uint256 currentTaskSpecGasPriceCeil = taskSpecGasPriceCeil[msg.sender][_taskSpecHash];\n require(\n currentTaskSpecGasPriceCeil != _gasPriceCeil,\n \"GelatoProviders.setTaskSpecGasPriceCeil: Already whitelisted with gasPriceCeil\"\n );\n taskSpecGasPriceCeil[msg.sender][_taskSpecHash] = _gasPriceCeil;\n emit LogTaskSpecGasPriceCeilSet(\n msg.sender,\n _taskSpecHash,\n currentTaskSpecGasPriceCeil,\n _gasPriceCeil\n );\n }\n\n // Provider Module\n function addProviderModules(IGelatoProviderModule[] memory _modules) public override {\n for (uint i; i < _modules.length; i++) {\n require(\n !isModuleProvided(msg.sender, _modules[i]),\n \"GelatoProviders.addProviderModules: redundant\"\n );\n _providerModules[msg.sender].add(_modules[i]);\n emit LogProviderModuleAdded(msg.sender, _modules[i]);\n }\n }\n\n function removeProviderModules(IGelatoProviderModule[] memory _modules) public override {\n for (uint i; i < _modules.length; i++) {\n require(\n isModuleProvided(msg.sender, _modules[i]),\n \"GelatoProviders.removeProviderModules: redundant\"\n );\n _providerModules[msg.sender].remove(_modules[i]);\n emit LogProviderModuleRemoved(msg.sender, _modules[i]);\n }\n }\n\n // Batch (un-)provide\n function multiProvide(\n address _executor,\n TaskSpec[] memory _taskSpecs,\n IGelatoProviderModule[] memory _modules\n )\n public\n payable\n override\n {\n if (msg.value != 0) provideFunds(msg.sender);\n if (_executor != address(0)) providerAssignsExecutor(_executor);\n provideTaskSpecs(_taskSpecs);\n addProviderModules(_modules);\n }\n\n function multiUnprovide(\n uint256 _withdrawAmount,\n TaskSpec[] memory _taskSpecs,\n IGelatoProviderModule[] memory _modules\n )\n public\n override\n {\n if (_withdrawAmount != 0) unprovideFunds(_withdrawAmount);\n unprovideTaskSpecs(_taskSpecs);\n removeProviderModules(_modules);\n }\n\n // Provider Liquidity\n function minExecProviderFunds(uint256 _gelatoMaxGas, uint256 _gelatoGasPrice)\n public\n view\n override\n returns(uint256)\n {\n uint256 maxExecTxCost = (EXEC_TX_OVERHEAD + _gelatoMaxGas) * _gelatoGasPrice;\n return maxExecTxCost + (maxExecTxCost * totalSuccessShare) / 100;\n }\n\n function isProviderLiquid(\n address _provider,\n uint256 _gelatoMaxGas,\n uint256 _gelatoGasPrice\n )\n public\n view\n override\n returns(bool)\n {\n return minExecProviderFunds(_gelatoMaxGas, _gelatoGasPrice) <= providerFunds[_provider];\n }\n\n // An Executor qualifies and remains registered for as long as he has minExecutorStake\n function isExecutorMinStaked(address _executor) public view override returns(bool) {\n return executorStake[_executor] >= minExecutorStake;\n }\n\n // Providers' Executor Assignment\n function isExecutorAssigned(address _executor) public view override returns(bool) {\n return executorProvidersCount[_executor] != 0;\n }\n\n // Helper fn that can also be called to query taskSpecHash off-chain\n function hashTaskSpec(TaskSpec memory _taskSpec) public view override returns(bytes32) {\n NoDataAction[] memory noDataActions = new NoDataAction[](_taskSpec.actions.length);\n for (uint i = 0; i < _taskSpec.actions.length; i++) {\n NoDataAction memory noDataAction = NoDataAction({\n addr: _taskSpec.actions[i].addr,\n operation: _taskSpec.actions[i].operation,\n dataFlow: _taskSpec.actions[i].dataFlow,\n value: _taskSpec.actions[i].value == 0 ? false : true,\n termsOkCheck: _taskSpec.actions[i].termsOkCheck\n });\n noDataActions[i] = noDataAction;\n }\n return keccak256(abi.encode(_taskSpec.conditions, noDataActions));\n }\n\n // Providers' Module Getters\n function isModuleProvided(address _provider, IGelatoProviderModule _module)\n public\n view\n override\n returns(bool)\n {\n return _providerModules[_provider].contains(_module);\n }\n\n function providerModules(address _provider)\n external\n view\n override\n returns(IGelatoProviderModule[] memory)\n {\n return _providerModules[_provider].enumerate();\n }\n\n // Internal helper for is isTaskProvided() and providerCanExec\n function _castTaskToSpec(Task memory _task)\n private\n pure\n returns(TaskSpec memory taskSpec)\n {\n taskSpec = TaskSpec({\n conditions: _stripConditionData(_task.conditions),\n actions: _task.actions,\n gasPriceCeil: 0 // default: provider can set gasPriceCeil dynamically.\n });\n }\n\n function _stripConditionData(Condition[] memory _conditionsWithData)\n private\n pure\n returns(IGelatoCondition[] memory conditionInstances)\n {\n conditionInstances = new IGelatoCondition[](_conditionsWithData.length);\n for (uint i; i < _conditionsWithData.length; i++)\n conditionInstances[i] = _conditionsWithData[i].inst;\n }\n\n}\n"
+ },
+ "contracts/gelato_core/GelatoSysAdmin.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {IGelatoSysAdmin} from \"./interfaces/IGelatoSysAdmin.sol\";\nimport {Ownable} from \"../external/Ownable.sol\";\nimport {Address} from \"../external/Address.sol\";\nimport {GelatoBytes} from \"../libraries/GelatoBytes.sol\";\nimport {SafeMath} from \"../external/SafeMath.sol\";\nimport {Math} from \"../external/Math.sol\";\n\nabstract contract GelatoSysAdmin is IGelatoSysAdmin, Ownable {\n\n using Address for address payable;\n using GelatoBytes for bytes;\n using SafeMath for uint256;\n\n // Executor compensation for estimated tx costs not accounted for by startGas\n uint256 public constant override EXEC_TX_OVERHEAD = 55000;\n string internal constant OK = \"OK\";\n\n address public override gelatoGasPriceOracle;\n bytes public override oracleRequestData;\n uint256 public override gelatoMaxGas;\n uint256 public override internalGasRequirement;\n uint256 public override minExecutorStake;\n uint256 public override executorSuccessShare;\n uint256 public override sysAdminSuccessShare;\n uint256 public override totalSuccessShare;\n uint256 public override sysAdminFunds;\n\n // == The main functions of the Sys Admin (DAO) ==\n // The oracle defines the system-critical gelatoGasPrice\n function setGelatoGasPriceOracle(address _newOracle) external override onlyOwner {\n require(_newOracle != address(0), \"GelatoSysAdmin.setGelatoGasPriceOracle: 0\");\n emit LogGelatoGasPriceOracleSet(gelatoGasPriceOracle, _newOracle);\n gelatoGasPriceOracle = _newOracle;\n }\n\n function setOracleRequestData(bytes calldata _requestData) external override onlyOwner {\n emit LogOracleRequestDataSet(oracleRequestData, _requestData);\n oracleRequestData = _requestData;\n }\n\n // exec-tx gasprice: pulled in from the Oracle by the Executor during exec()\n function _getGelatoGasPrice() internal view returns(uint256) {\n (bool success, bytes memory returndata) = gelatoGasPriceOracle.staticcall(\n oracleRequestData\n );\n if (!success)\n returndata.revertWithErrorString(\"GelatoSysAdmin._getGelatoGasPrice:\");\n int oracleGasPrice = abi.decode(returndata, (int256));\n if (oracleGasPrice <= 0) revert(\"GelatoSysAdmin._getGelatoGasPrice:0orBelow\");\n return uint256(oracleGasPrice);\n }\n\n // exec-tx gas\n function setGelatoMaxGas(uint256 _newMaxGas) external override onlyOwner {\n emit LogGelatoMaxGasSet(gelatoMaxGas, _newMaxGas);\n gelatoMaxGas = _newMaxGas;\n }\n\n // exec-tx GelatoCore internal gas requirement\n function setInternalGasRequirement(uint256 _newRequirement) external override onlyOwner {\n emit LogInternalGasRequirementSet(internalGasRequirement, _newRequirement);\n internalGasRequirement = _newRequirement;\n }\n\n // Minimum Executor Stake Per Provider\n function setMinExecutorStake(uint256 _newMin) external override onlyOwner {\n emit LogMinExecutorStakeSet(minExecutorStake, _newMin);\n minExecutorStake = _newMin;\n }\n\n // Executors' profit share on exec costs\n function setExecutorSuccessShare(uint256 _percentage) external override onlyOwner {\n emit LogExecutorSuccessShareSet(\n executorSuccessShare,\n _percentage,\n _percentage + sysAdminSuccessShare\n );\n executorSuccessShare = _percentage;\n totalSuccessShare = _percentage + sysAdminSuccessShare;\n }\n\n // Sys Admin (DAO) Business Model\n function setSysAdminSuccessShare(uint256 _percentage) external override onlyOwner {\n emit LogSysAdminSuccessShareSet(\n sysAdminSuccessShare,\n _percentage,\n executorSuccessShare + _percentage\n );\n sysAdminSuccessShare = _percentage;\n totalSuccessShare = executorSuccessShare + _percentage;\n }\n\n function withdrawSysAdminFunds(uint256 _amount, address payable _to)\n external\n override\n onlyOwner\n returns(uint256 realWithdrawAmount)\n {\n uint256 currentBalance = sysAdminFunds;\n\n realWithdrawAmount = Math.min(_amount, currentBalance);\n\n uint256 newSysAdminFunds = currentBalance - realWithdrawAmount;\n\n // Effects\n sysAdminFunds = newSysAdminFunds;\n\n _to.sendValue(realWithdrawAmount);\n emit LogSysAdminFundsWithdrawn(currentBalance, newSysAdminFunds);\n }\n\n // Executors' total fee for a successful exec\n function executorSuccessFee(uint256 _gas, uint256 _gasPrice)\n public\n view\n override\n returns(uint256)\n {\n uint256 estExecCost = _gas.mul(_gasPrice);\n return estExecCost + estExecCost.mul(executorSuccessShare).div(\n 100,\n \"GelatoSysAdmin.executorSuccessFee: div error\"\n );\n }\n\n function sysAdminSuccessFee(uint256 _gas, uint256 _gasPrice)\n public\n view\n override\n returns(uint256)\n {\n uint256 estExecCost = _gas.mul(_gasPrice);\n return\n estExecCost.mul(sysAdminSuccessShare).div(\n 100,\n \"GelatoSysAdmin.sysAdminSuccessShare: div error\"\n );\n }\n}\n"
+ },
+ "contracts/libraries/GelatoString.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nlibrary GelatoString {\n function startsWithOK(string memory _str) internal pure returns(bool) {\n if (bytes(_str).length >= 2 && bytes(_str)[0] == \"O\" && bytes(_str)[1] == \"K\")\n return true;\n return false;\n }\n}"
+ },
+ "contracts/external/Math.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow, so we distribute\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\n }\n}"
+ },
+ "contracts/external/SafeMath.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n *\n * _Available since v2.4.0._\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n *\n * _Available since v2.4.0._\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n *\n * _Available since v2.4.0._\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}"
+ },
+ "contracts/libraries/ProviderModuleSet.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {IGelatoProviderModule} from \"../gelato_provider_modules/IGelatoProviderModule.sol\";\n\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * As of v2.5.0, only `IGelatoProviderModule` sets are supported.\n *\n * Include with `using EnumerableSet for EnumerableSet.Set;`.\n *\n * _Available since v2.5.0._\n *\n * @author Alberto Cuesta Cañada\n * @author Luis Schliessske (modified to ProviderModuleSet)\n */\nlibrary ProviderModuleSet {\n\n struct Set {\n // Position of the module in the `modules` array, plus 1 because index 0\n // means a module is not in the set.\n mapping (IGelatoProviderModule => uint256) index;\n IGelatoProviderModule[] modules;\n }\n\n /**\n * @dev Add a module to a set. O(1).\n * Returns false if the module was already in the set.\n */\n function add(Set storage set, IGelatoProviderModule module)\n internal\n returns (bool)\n {\n if (!contains(set, module)) {\n set.modules.push(module);\n // The element is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel module\n set.index[module] = set.modules.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a module from a set. O(1).\n * Returns false if the module was not present in the set.\n */\n function remove(Set storage set, IGelatoProviderModule module)\n internal\n returns (bool)\n {\n if (contains(set, module)){\n uint256 toDeleteIndex = set.index[module] - 1;\n uint256 lastIndex = set.modules.length - 1;\n\n // If the element we're deleting is the last one, we can just remove it without doing a swap\n if (lastIndex != toDeleteIndex) {\n IGelatoProviderModule lastValue = set.modules[lastIndex];\n\n // Move the last module to the index where the deleted module is\n set.modules[toDeleteIndex] = lastValue;\n // Update the index for the moved module\n set.index[lastValue] = toDeleteIndex + 1; // All indexes are 1-based\n }\n\n // Delete the index entry for the deleted module\n delete set.index[module];\n\n // Delete the old entry for the moved module\n set.modules.pop();\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the module is in the set. O(1).\n */\n function contains(Set storage set, IGelatoProviderModule module)\n internal\n view\n returns (bool)\n {\n return set.index[module] != 0;\n }\n\n /**\n * @dev Returns an array with all modules in the set. O(N).\n * Note that there are no guarantees on the ordering of modules inside the\n * array, and it may change when more modules are added or removed.\n\n * WARNING: This function may run out of gas on large sets: use {length} and\n * {get} instead in these cases.\n */\n function enumerate(Set storage set)\n internal\n view\n returns (IGelatoProviderModule[] memory)\n {\n IGelatoProviderModule[] memory output = new IGelatoProviderModule[](set.modules.length);\n for (uint256 i; i < set.modules.length; i++) output[i] = set.modules[i];\n return output;\n }\n\n /**\n * @dev Returns the number of elements on the set. O(1).\n */\n function length(Set storage set)\n internal\n view\n returns (uint256)\n {\n return set.modules.length;\n }\n\n /** @dev Returns the element stored at position `index` in the set. O(1).\n * Note that there are no guarantees on the ordering of modules inside the\n * array, and it may change when more modules are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function get(Set storage set, uint256 index)\n internal\n view\n returns (IGelatoProviderModule)\n {\n return set.modules[index];\n }\n}"
+ },
+ "contracts/gelato_core/interfaces/IGelatoSysAdmin.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\ninterface IGelatoSysAdmin {\n struct GelatoSysAdminInitialState {\n address gelatoGasPriceOracle;\n bytes oracleRequestData;\n uint256 gelatoMaxGas;\n uint256 internalGasRequirement;\n uint256 minExecutorStake;\n uint256 executorSuccessShare;\n uint256 sysAdminSuccessShare;\n uint256 totalSuccessShare;\n }\n\n // Events\n event LogGelatoGasPriceOracleSet(address indexed oldOracle, address indexed newOracle);\n event LogOracleRequestDataSet(bytes oldData, bytes newData);\n\n event LogGelatoMaxGasSet(uint256 oldMaxGas, uint256 newMaxGas);\n event LogInternalGasRequirementSet(uint256 oldRequirment, uint256 newRequirment);\n\n event LogMinExecutorStakeSet(uint256 oldMin, uint256 newMin);\n\n event LogExecutorSuccessShareSet(uint256 oldShare, uint256 newShare, uint256 total);\n event LogSysAdminSuccessShareSet(uint256 oldShare, uint256 newShare, uint256 total);\n\n event LogSysAdminFundsWithdrawn(uint256 oldBalance, uint256 newBalance);\n\n // State Writing\n\n /// @notice Assign new gas price oracle\n /// @dev Only callable by sysAdmin\n /// @param _newOracle Address of new oracle\n function setGelatoGasPriceOracle(address _newOracle) external;\n\n /// @notice Assign new gas price oracle\n /// @dev Only callable by sysAdmin\n /// @param _requestData The encoded payload for the staticcall to the oracle.\n function setOracleRequestData(bytes calldata _requestData) external;\n\n /// @notice Assign new maximum gas limit providers can consume in executionWrapper()\n /// @dev Only callable by sysAdmin\n /// @param _newMaxGas New maximum gas limit\n function setGelatoMaxGas(uint256 _newMaxGas) external;\n\n /// @notice Assign new interal gas limit requirement for exec()\n /// @dev Only callable by sysAdmin\n /// @param _newRequirement New internal gas requirement\n function setInternalGasRequirement(uint256 _newRequirement) external;\n\n /// @notice Assign new minimum executor stake\n /// @dev Only callable by sysAdmin\n /// @param _newMin New minimum executor stake\n function setMinExecutorStake(uint256 _newMin) external;\n\n /// @notice Assign new success share for executors to receive after successful execution\n /// @dev Only callable by sysAdmin\n /// @param _percentage New % success share of total gas consumed\n function setExecutorSuccessShare(uint256 _percentage) external;\n\n /// @notice Assign new success share for sysAdmin to receive after successful execution\n /// @dev Only callable by sysAdmin\n /// @param _percentage New % success share of total gas consumed\n function setSysAdminSuccessShare(uint256 _percentage) external;\n\n /// @notice Withdraw sysAdmin funds\n /// @dev Only callable by sysAdmin\n /// @param _amount Amount to withdraw\n /// @param _to Address to receive the funds\n function withdrawSysAdminFunds(uint256 _amount, address payable _to) external returns(uint256);\n\n // State Reading\n /// @notice Unaccounted tx overhead that will be refunded to executors\n function EXEC_TX_OVERHEAD() external pure returns(uint256);\n\n /// @notice Addess of current Gelato Gas Price Oracle\n function gelatoGasPriceOracle() external view returns(address);\n\n /// @notice Getter for oracleRequestData state variable\n function oracleRequestData() external view returns(bytes memory);\n\n /// @notice Gas limit an executor has to submit to get refunded even if actions revert\n function gelatoMaxGas() external view returns(uint256);\n\n /// @notice Internal gas limit requirements ti ensure executor payout\n function internalGasRequirement() external view returns(uint256);\n\n /// @notice Minimum stake required from executors\n function minExecutorStake() external view returns(uint256);\n\n /// @notice % Fee executors get as a reward for a successful execution\n function executorSuccessShare() external view returns(uint256);\n\n /// @notice Total % Fee executors and sysAdmin collectively get as a reward for a successful execution\n /// @dev Saves a state read\n function totalSuccessShare() external view returns(uint256);\n\n /// @notice Get total fee providers pay executors for a successful execution\n /// @param _gas Gas consumed by transaction\n /// @param _gasPrice Current gelato gas price\n function executorSuccessFee(uint256 _gas, uint256 _gasPrice)\n external\n view\n returns(uint256);\n\n /// @notice % Fee sysAdmin gets as a reward for a successful execution\n function sysAdminSuccessShare() external view returns(uint256);\n\n /// @notice Get total fee providers pay sysAdmin for a successful execution\n /// @param _gas Gas consumed by transaction\n /// @param _gasPrice Current gelato gas price\n function sysAdminSuccessFee(uint256 _gas, uint256 _gasPrice)\n external\n view\n returns(uint256);\n\n /// @notice Get sysAdminds funds\n function sysAdminFunds() external view returns(uint256);\n}\n"
+ },
+ "contracts/gelato_core/GelatoExecutors.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoExecutors} from \"./interfaces/IGelatoExecutors.sol\";\nimport {GelatoProviders} from \"./GelatoProviders.sol\";\nimport {Address} from \"../external/Address.sol\";\nimport {SafeMath} from \"../external/SafeMath.sol\";\nimport {Math} from \"../external/Math.sol\";\n\n/// @title GelatoExecutors\n/// @author Luis Schliesske & Hilmar Orth\n/// @notice Stake Management of executors & batch Unproving providers\n/// @dev Find all NatSpecs inside IGelatoExecutors\nabstract contract GelatoExecutors is IGelatoExecutors, GelatoProviders {\n\n using Address for address payable; /// for sendValue method\n using SafeMath for uint256;\n\n // Executor De/Registrations and Staking\n function stakeExecutor() external payable override {\n uint256 currentStake = executorStake[msg.sender];\n uint256 newStake = currentStake + msg.value;\n require(\n newStake >= minExecutorStake,\n \"GelatoExecutors.stakeExecutor: below minStake\"\n );\n executorStake[msg.sender] = newStake;\n emit LogExecutorStaked(msg.sender, currentStake, newStake);\n }\n\n function unstakeExecutor() external override {\n require(\n !isExecutorAssigned(msg.sender),\n \"GelatoExecutors.unstakeExecutor: msg.sender still assigned\"\n );\n uint256 unbondedStake = executorStake[msg.sender];\n require(\n unbondedStake != 0,\n \"GelatoExecutors.unstakeExecutor: already unstaked\"\n );\n delete executorStake[msg.sender];\n msg.sender.sendValue(unbondedStake);\n emit LogExecutorUnstaked(msg.sender);\n }\n\n function withdrawExcessExecutorStake(uint256 _withdrawAmount)\n external\n override\n returns(uint256 realWithdrawAmount)\n {\n require(\n isExecutorMinStaked(msg.sender),\n \"GelatoExecutors.withdrawExcessExecutorStake: not minStaked\"\n );\n\n uint256 currentExecutorStake = executorStake[msg.sender];\n uint256 excessExecutorStake = currentExecutorStake - minExecutorStake;\n\n realWithdrawAmount = Math.min(_withdrawAmount, excessExecutorStake);\n\n uint256 newExecutorStake = currentExecutorStake - realWithdrawAmount;\n\n // Effects\n executorStake[msg.sender] = newExecutorStake;\n\n // Interaction\n msg.sender.sendValue(realWithdrawAmount);\n emit LogExecutorBalanceWithdrawn(msg.sender, realWithdrawAmount);\n }\n\n // To unstake, Executors must reassign ALL their Providers to another staked Executor\n function multiReassignProviders(address[] calldata _providers, address _newExecutor)\n external\n override\n {\n for (uint i; i < _providers.length; i++)\n executorAssignsExecutor(_providers[i], _newExecutor);\n }\n}"
+ },
+ "contracts/gelato_core/interfaces/IGelatoExecutors.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\ninterface IGelatoExecutors {\n event LogExecutorStaked(address indexed executor, uint256 oldStake, uint256 newStake);\n event LogExecutorUnstaked(address indexed executor);\n\n event LogExecutorBalanceWithdrawn(\n address indexed executor,\n uint256 withdrawAmount\n );\n\n /// @notice Stake on Gelato to become a whitelisted executor\n /// @dev Msg.value has to be >= minExecutorStake\n function stakeExecutor() external payable;\n\n /// @notice Unstake on Gelato to become de-whitelisted and withdraw minExecutorStake\n function unstakeExecutor() external;\n\n /// @notice Re-assigns multiple providers to other executors\n /// @dev Executors must re-assign all providers before being able to unstake\n /// @param _providers List of providers to re-assign\n /// @param _newExecutor Address of new executor to assign providers to\n function multiReassignProviders(address[] calldata _providers, address _newExecutor)\n external;\n\n\n /// @notice Withdraw excess Execur Stake\n /// @dev Can only be called if executor is isExecutorMinStaked\n /// @param _withdrawAmount Amount to withdraw\n /// @return Amount that was actually withdrawn\n function withdrawExcessExecutorStake(uint256 _withdrawAmount) external returns(uint256);\n\n}\n"
+ },
+ "contracts/gelato_actions/transfer/ActionTransfer.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoActionsStandardFull} from \"../GelatoActionsStandardFull.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {Address} from \"../../external/Address.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\n/// @dev This action is for user proxies that store funds.\ncontract ActionTransfer is GelatoActionsStandardFull {\n // using SafeERC20 for IERC20; <- internal library methods vs. try/catch\n using Address for address payable;\n using SafeERC20 for IERC20;\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n function getActionData(address _sendToken, uint256 _sendAmount, address _destination)\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.action.selector,\n _sendToken,\n _sendAmount,\n _destination\n );\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_IN_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n // ======= ACTION IMPLEMENTATION DETAILS =========\n /// @dev Always use this function for encoding _actionData off-chain\n /// Will be called by GelatoActionPipeline if Action.dataFlow.None\n function action(address sendToken, uint256 sendAmount, address destination)\n public\n virtual\n delegatecallOnly(\"ActionTransfer.action\")\n {\n if (sendToken != ETH_ADDRESS) {\n IERC20 sendERC20 = IERC20(sendToken);\n sendERC20.safeTransfer(destination, sendAmount, \"ActionTransfer.action:\");\n emit LogOneWay(address(this), sendToken, sendAmount, destination);\n } else {\n payable(destination).sendValue(sendAmount);\n }\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n address destination = abi.decode(_actionData[68:100], (address));\n action(sendToken, sendAmount, destination);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address sendToken, uint256 sendAmount, address destination) = abi.decode(\n _actionData[4:],\n (address,uint256,address)\n );\n action(sendToken, sendAmount, destination);\n return abi.encode(sendToken, sendAmount);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n address destination = abi.decode(_actionData[68:100], (address));\n action(sendToken, sendAmount, destination);\n return abi.encode(sendToken, sendAmount);\n }\n\n // ===== ACTION TERMS CHECK ========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory)\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionTransfer: invalid action selector\";\n\n if (_dataFlow == DataFlow.In || _dataFlow == DataFlow.InAndOut)\n return \"ActionTransfer: termsOk check invalidated by inbound DataFlow\";\n\n (address sendToken, uint256 sendAmount) = abi.decode(\n _actionData[4:68],\n (address,uint256)\n );\n\n if (sendToken == ETH_ADDRESS) {\n if (_userProxy.balance < sendAmount)\n return \"ActionTransfer: NotOkUserProxyETHBalance\";\n } else {\n try IERC20(sendToken).balanceOf(_userProxy) returns(uint256 sendTokenBalance) {\n if (sendTokenBalance < sendAmount)\n return \"ActionTransfer: NotOkUserProxyERC20Balance\";\n } catch {\n return \"ActionTransfer: ErrorBalanceOf\";\n }\n }\n\n // STANDARD return string to signal actionConditions Ok\n return OK;\n }\n}\n"
+ },
+ "contracts/gelato_actions/GelatoActionsStandardFull.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandard} from \"./GelatoActionsStandard.sol\";\nimport {IGelatoInFlowAction} from \"./action_pipeline_interfaces/IGelatoInFlowAction.sol\";\nimport {IGelatoOutFlowAction} from \"./action_pipeline_interfaces/IGelatoOutFlowAction.sol\";\nimport {\n IGelatoInAndOutFlowAction\n} from \"./action_pipeline_interfaces/IGelatoInAndOutFlowAction.sol\";\n\n/// @title GelatoActionsStandardFull\n/// @notice ActionStandard that inherits from all the PipeAction interfaces.\n/// @dev Inherit this to enforce implementation of all PipeAction functions.\nabstract contract GelatoActionsStandardFull is\n GelatoActionsStandard,\n IGelatoInFlowAction,\n IGelatoOutFlowAction,\n IGelatoInAndOutFlowAction\n{\n function DATA_FLOW_IN_TYPE()\n external\n pure\n virtual\n override(IGelatoInFlowAction, IGelatoInAndOutFlowAction)\n returns (bytes32);\n\n function DATA_FLOW_OUT_TYPE()\n external\n pure\n virtual\n override(IGelatoOutFlowAction, IGelatoInAndOutFlowAction)\n returns (bytes32);\n}"
+ },
+ "contracts/external/IERC20.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP. Does not include\n * the optional functions; to access them see {ERC20Detailed}.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
+ },
+ "contracts/external/SafeERC20.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"./IERC20.sol\";\nimport \"./SafeMath.sol\";\nimport \"./Address.sol\";\n\n/**\n * @title SafeERC20\n * @notice Adapted by @gitpusha from Gelato to include error strings.\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value, string memory context)\n internal\n {\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value),\n context\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value,\n string memory context\n )\n internal\n {\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value),\n context\n );\n }\n\n function safeApprove(IERC20 token, address spender, uint256 value, string memory context)\n internal\n {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n string(\n abi.encodePacked(\n context, \"SafeERC20: approve from non-zero to non-zero allowance\"\n )\n )\n );\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value),\n context\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value,\n string memory context\n )\n internal\n {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, newAllowance),\n context\n );\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value,\n string memory context\n )\n internal\n {\n uint256 newAllowance = token.allowance(\n address(this),\n spender\n ).sub(\n value,\n string(abi.encodePacked(context, \"SafeERC20: decreased allowance below zero\")\n ));\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, newAllowance),\n context\n );\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param context Debugging Info for the revert message (addition to original library)\n */\n function callOptionalReturn(IERC20 token, bytes memory data, string memory context)\n private\n {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves.\n\n // A Solidity high level call has three parts:\n // 1. The target address is checked to verify it contains contract code\n // 2. The call itself is made, and success asserted\n // 3. The return value is decoded, which in turn checks the size of the returned data.\n // solhint-disable-next-line max-line-length\n require(\n address(token).isContract(),\n string(abi.encodePacked(context, \"SafeERC20: call to non-contract\"))\n );\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = address(token).call(data);\n require(\n success, string(abi.encodePacked(context, \"SafeERC20: low-level call failed\"))\n );\n\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(\n abi.decode(returndata, (bool)),\n string(\n abi.encodePacked(context, \"SafeERC20: ERC20 operation did not succeed\")\n )\n );\n }\n }\n}\n"
+ },
+ "contracts/mocks/gelato_actions/one-off/Gnosis/MockBatchExchange.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandard} from \"../../../../gelato_actions/GelatoActionsStandard.sol\";\nimport {SafeERC20} from \"../../../../external/SafeERC20.sol\";\nimport {IERC20} from \"../../../../external/IERC20.sol\";\n\ncontract MockBatchExchange {\n\n using SafeERC20 for IERC20;\n\n event LogWithdrawRequest();\n event LogCounter();\n\n mapping(address => uint256) public withdrawAmounts;\n mapping(address => bool) public validWithdrawRequests;\n\n uint256 public counter;\n\n function withdraw(address _proxyAddress, address _token)\n public\n {\n IERC20 token = IERC20(_token);\n uint256 withdrawAmount = withdrawAmounts[_token];\n token.safeTransfer(_proxyAddress, withdrawAmount, \"MockBatchExchange.withdraw\");\n }\n\n function setWithdrawAmount(address _token, uint256 _withdrawAmount)\n public\n {\n IERC20 token = IERC20(_token);\n require(\n token.balanceOf(address(this)) >= _withdrawAmount,\n \"MockBatchExchange: Insufficient Token balance\"\n );\n withdrawAmounts[_token] = _withdrawAmount;\n }\n\n function hasValidWithdrawRequest(address _proxyAddress, address)\n view\n public\n returns(bool)\n {\n if (validWithdrawRequests[_proxyAddress]) return true;\n }\n\n function setValidWithdrawRequest(address _proxyAddress)\n public\n {\n validWithdrawRequests[_proxyAddress] = true;\n emit LogWithdrawRequest();\n counter++;\n if(counter == 1 ) emit LogCounter();\n }\n\n // buyTokenId, sellTokenId, withdrawBatchId, _buyAmount, sellAmount\n function placeOrder(uint16 buyToken, uint16 sellToken, uint32 validUntil, uint128 buyAmount, uint128 sellAmount)\n public\n returns (uint256)\n {\n\n }\n\n function deposit(address _sellToken, uint128 _sellAmount)\n public\n {\n IERC20 sellToken = IERC20(_sellToken);\n sellToken.safeTransferFrom(\n msg.sender, address(this), _sellAmount, \"MockBatchExchange.deposit:\"\n );\n }\n\n function requestFutureWithdraw(address token, uint256 amount, uint32 batchId)\n public\n {\n }\n\n function tokenAddressToIdMap(address _token)\n public\n view\n returns(uint16 test)\n {\n\n }\n\n\n}\n"
+ },
+ "contracts/gelato_conditions/price/kyber/ConditionKyberRateStateful.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoStatefulConditionsStandard} from \"../../GelatoStatefulConditionsStandard.sol\";\nimport {IKyberNetworkProxy} from \"../../../dapp_interfaces/kyber/IKyberNetworkProxy.sol\";\nimport {SafeMath} from \"../../../external/SafeMath.sol\";\nimport {IERC20} from \"../../../external/IERC20.sol\";\nimport {IGelatoCore} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract ConditionKyberRateStateful is GelatoStatefulConditionsStandard {\n using SafeMath for uint256;\n\n IKyberNetworkProxy public immutable KYBER;\n\n // userProxy => taskReceipt.id => refPrice\n mapping(address => mapping(uint256 => uint256)) public refRate;\n\n constructor(IKyberNetworkProxy _kyberNetworkProxy, IGelatoCore _gelatoCore)\n public\n GelatoStatefulConditionsStandard(_gelatoCore)\n {\n KYBER = _kyberNetworkProxy;\n }\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(\n address _userProxy,\n address _sendToken,\n uint256 _sendAmount,\n address _receiveToken,\n bool _greaterElseSmaller\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.checkRefKyberRate.selector,\n uint256(0), // taskReceiptId placeholder\n _userProxy,\n _sendToken,\n _sendAmount,\n _receiveToken,\n _greaterElseSmaller\n );\n }\n\n // STANDARD Interface\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n (address userProxy,\n address sendToken,\n uint256 sendAmount,\n address receiveToken,\n bool greaterElseSmaller\n ) = abi.decode(\n _conditionData[36:], // slice out selector & taskReceiptId\n (address,address,uint256,address,bool)\n );\n return checkRefKyberRate(\n _taskReceiptId, userProxy, sendToken, sendAmount, receiveToken, greaterElseSmaller\n );\n }\n\n // Specific Implementation\n function checkRefKyberRate(\n uint256 _taskReceiptId,\n address _userProxy,\n address _sendToken,\n uint256 _sendAmount,\n address _receiveToken,\n bool _greaterElseSmaller\n )\n public\n view\n virtual\n returns(string memory)\n {\n uint256 currentRefRate = refRate[_userProxy][_taskReceiptId];\n try KYBER.getExpectedRate(_sendToken, _receiveToken, _sendAmount)\n returns(uint256 expectedRate, uint256)\n {\n if (_greaterElseSmaller) { // greaterThan\n if (expectedRate >= currentRefRate) return OK;\n return \"NotOkKyberExpectedRateIsNotGreaterThanRefRate\";\n } else { // smallerThan\n if (expectedRate <= currentRefRate) return OK;\n return \"NotOkKyberExpectedRateIsNotSmallerThanRefRate\";\n }\n } catch {\n return \"KyberGetExpectedRateError\";\n }\n }\n\n /// @dev This function should be called via the userProxy of a Gelato Task as part\n /// of the Task.actions, if the Condition state should be updated after the task.\n /// @param _rateDelta The change in price after which this condition should return for a given taskId\n /// @param _idDelta Default to 0. If you submit multiple tasks in one action, this can help\n // customize which taskId the state should be allocated to\n function setRefRate(\n address _sendToken,\n uint256 _sendAmount,\n address _receiveToken,\n bool _greaterElseSmaller,\n uint256 _rateDelta,\n uint256 _idDelta\n )\n external\n {\n uint256 taskReceiptId = _getIdOfNextTaskInCycle() + _idDelta;\n try KYBER.getExpectedRate(_sendToken, _receiveToken, _sendAmount)\n returns(uint256 expectedRate, uint256)\n {\n if (_greaterElseSmaller) {\n refRate[msg.sender][taskReceiptId] = expectedRate.add(_rateDelta);\n } else {\n refRate[msg.sender][taskReceiptId] = expectedRate.sub(\n _rateDelta,\n \"ConditionKyberRateStateful.setRefRate: Underflow\"\n );\n }\n } catch {\n revert(\"ConditionKyberRateStateful.setRefRate: KyberGetExpectedRateError\");\n }\n }\n\n function getKyberRate(address _sendToken, uint256 _sendAmount, address _receiveToken)\n external\n view\n returns(uint256)\n {\n try KYBER.getExpectedRate(_sendToken, _receiveToken, _sendAmount)\n returns(uint256 expectedRate, uint256)\n {\n return expectedRate;\n } catch {\n revert(\"ConditionKyberRateStateful.setRefRate: KyberGetExpectedRateError\");\n }\n }\n}"
+ },
+ "contracts/dapp_interfaces/kyber/IKyberNetworkProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\n/// @title IKyberNetworkProxy\n/// @notice Interface to the KyberNetworkProxy contract.\n/// The KyberNetworkProxy contract's role is to facilitate two main functionalities:\n/// 1) return the expected exchange rate, and 2) to execute a trade.\n/// @dev https://developer.kyber.network/docs/API_ABI-KyberNetworkProxy/\ninterface IKyberNetworkProxy {\n /**\n * @dev Makes a trade between src and dest token and send dest tokens to destAddress\n * @param src source ERC20 token contract address\n * @param srcAmount source ERC20 token amount in its token decimals\n * @param dest destination ERC20 token contract address\n * @param destAddress recipient address for destination ERC20 token\n * @param maxDestAmount limit on the amount of destination tokens\n * @param minConversionRate minimum conversion rate; trade is canceled if actual rate is lower\n * @param walletId wallet address to send part of the fees to\n * @return Amount of actual destination tokens\n * @notice srcAmount | maxDestAmount These amounts should be in the source and\n destination token decimals respectively. For example, if the user wants to swap\n from / to 10 POWR,which has 6 decimals, it would be 10 * (10 ** 6) = 10000000\n * @notice maxDestAmount should not be 0. Set it to an arbitarily large amount\n if you want all source tokens to be converted.\n * @notice minConversionRate: This rate is independent of the source and\n destination token decimals. To calculate this rate, take yourRate * 10**18.\n For example, even though ZIL has 12 token decimals, if we want the minimum\n conversion rate to be 1 ZIL = 0.00017 ETH, then\n minConversionRate = 0.00017 * (10 ** 18).\n * @notice walletId: If you are part of our fee sharing program, this will be\n your registered wallet address. Set it as 0 if you are not a participant.\n * @notice Since ETH is not an ERC20 token, we use\n 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee as a proxy address to represent it.\n * @notice If src is ETH, then you also need to send ether along with your call.\n * @notice There is a minimum trading value of 1000 wei tokens.\n Anything fewer is considered as 0.\n */\n function trade(\n address src,\n uint256 srcAmount,\n address dest,\n address destAddress,\n uint256 maxDestAmount,\n uint256 minConversionRate,\n address walletId\n )\n external\n payable\n returns (uint256);\n\n /**\n * @dev Get the expected exchange rate.\n * @param src source ERC20 token contract address\n * @param dest destination ERC20 token contract address\n * @param srcQty wei amount of source ERC20 token\n * @return The expected exchange rate and slippage rate.\n * @notice Returned values are in precision values (10**18)\n To understand what this rate means, divide the obtained value by 10**18\n (tA, tB,)\n */\n function getExpectedRate(address src, address dest, uint256 srcQty)\n external\n view\n returns (uint256, uint256);\n}\n"
+ },
+ "contracts/gelato_conditions/price/kyber/ConditionKyberRate.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoConditionsStandard} from \"../../GelatoConditionsStandard.sol\";\nimport {IKyberNetworkProxy} from \"../../../dapp_interfaces/kyber/IKyberNetworkProxy.sol\";\nimport {SafeMath} from \"../../../external/SafeMath.sol\";\n\ncontract ConditionKyberRate is GelatoConditionsStandard {\n using SafeMath for uint256;\n\n IKyberNetworkProxy public immutable KYBER;\n constructor(IKyberNetworkProxy _kyberProxy) public { KYBER = _kyberProxy; }\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(\n address _src,\n uint256 _srcAmt,\n address _dest,\n uint256 _refRate,\n bool _greaterElseSmaller\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.checkRate.selector,\n _src,\n _srcAmt,\n _dest,\n _refRate,\n _greaterElseSmaller\n );\n }\n\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n (address src,\n uint256 srcAmt,\n address dest,\n uint256 refRate,\n bool greaterElseSmaller) = abi.decode(\n _conditionData[4:],\n (address,uint256,address,uint256,bool)\n );\n return checkRate(src, srcAmt, dest, refRate, greaterElseSmaller);\n }\n\n // Specific Implementation\n function checkRate(\n address _src,\n uint256 _srcAmt,\n address _dest,\n uint256 _refRate,\n bool _greaterElseSmaller\n )\n public\n view\n virtual\n returns(string memory)\n {\n try KYBER.getExpectedRate(_src, _dest, _srcAmt)\n returns(uint256 expectedRate, uint256)\n {\n if (_greaterElseSmaller) { // greaterThan\n if (expectedRate >= _refRate) return OK;\n return \"NotOkKyberExpectedRateIsNotGreaterThanRefRate\";\n } else { // smallerThan\n if (expectedRate <= _refRate) return OK;\n return \"NotOkKyberExpectedRateIsNotSmallerThanRefRate\";\n }\n } catch {\n return \"KyberGetExpectedRateError\";\n }\n }\n}"
+ },
+ "contracts/mocks/gelato_conditions/MockConditionDummyRevert.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoConditionsStandard} from \"../../gelato_conditions/GelatoConditionsStandard.sol\";\n\ncontract MockConditionDummyRevert is GelatoConditionsStandard {\n // STANDARD interface\n function ok(uint256, bytes calldata _revertCheckData, uint256)\n external\n view\n virtual\n override\n returns(string memory)\n {\n bool returnOk = abi.decode(_revertCheckData, (bool));\n return revertCheck(returnOk);\n }\n\n function revertCheck(bool _returnOk) public pure virtual returns(string memory) {\n if (_returnOk) return OK;\n revert(\"MockConditionDummyRevert.ok: test revert\");\n }\n}"
+ },
+ "contracts/mocks/gelato_conditions/MockConditionDummy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoConditionsStandard} from \"../../gelato_conditions/GelatoConditionsStandard.sol\";\n\ncontract MockConditionDummy is GelatoConditionsStandard {\n // STANDARD interface\n function ok(uint256, bytes calldata _dummyCheckData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n bool returnOk = abi.decode(_dummyCheckData, (bool));\n return dummyCheck(returnOk);\n }\n\n function dummyCheck(bool _returnOk) public pure virtual returns(string memory returnString) {\n _returnOk ? returnString = OK : returnString = \"NotOk\";\n }\n}"
+ },
+ "contracts/gelato_conditions/gnosis/ConditionBatchExchangeFundsWithdrawable.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"../GelatoConditionsStandard.sol\";\nimport \"../../dapp_interfaces/gnosis/IBatchExchange.sol\";\n\ncontract ConditionBatchExchangeFundsWithdrawable is GelatoConditionsStandard {\n\n address public immutable batchExchangeAddress;\n constructor(address _batchExchange) public { batchExchangeAddress = _batchExchange; }\n\n function ok(uint256, bytes calldata _withdrawableCheckData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n (address proxy, address sellToken, address buyToken) = abi.decode(\n _withdrawableCheckData,\n (address,address,address)\n );\n return withdrawableCheck(proxy, sellToken, buyToken);\n }\n\n function withdrawableCheck(address _proxy, address _sellToken, address _buyToken)\n public\n view\n virtual\n returns(string memory) // executable?\n {\n (bool sellTokenWithdrawable, bool buyTokenWithdrawable) = getConditionValue(\n _proxy,\n _sellToken,\n _buyToken\n );\n if (!sellTokenWithdrawable) return \"SellTokenNotWithdrawable\";\n if (!buyTokenWithdrawable) return \"BuyTokenNotWithdrawable\";\n return OK;\n }\n\n function getConditionValue(\n address _proxy,\n address _sellToken,\n address _buyToken\n )\n public\n view\n returns(bool sellTokenWithdrawable, bool buyTokenWithdrawable)\n {\n IBatchExchange batchExchange = IBatchExchange(batchExchangeAddress);\n sellTokenWithdrawable = batchExchange.hasValidWithdrawRequest(_proxy, _sellToken);\n buyTokenWithdrawable = batchExchange.hasValidWithdrawRequest(_proxy, _buyToken);\n }\n}"
+ },
+ "contracts/gelato_conditions/eth_utils/eth_time/ConditionTime.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoConditionsStandard} from \"../../GelatoConditionsStandard.sol\";\n\ncontract ConditionTime is GelatoConditionsStandard {\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(uint256 _timestamp)\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encode(_timestamp);\n }\n\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n uint256 timestamp = abi.decode(_conditionData, (uint256));\n return timeCheck(timestamp);\n }\n\n // Specific implementation\n function timeCheck(uint256 _timestamp) public view virtual returns(string memory) {\n if (_timestamp <= block.timestamp) return OK;\n return \"NotOkTimestampDidNotPass\";\n }\n}"
+ },
+ "contracts/gelato_conditions/eth_utils/eth_time/ConditionTimeStateful.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoStatefulConditionsStandard} from \"../../GelatoStatefulConditionsStandard.sol\";\nimport {SafeMath} from \"../../../external/SafeMath.sol\";\nimport {IGelatoCore} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IERC20} from \"../../../external/IERC20.sol\";\n\ncontract ConditionTimeStateful is GelatoStatefulConditionsStandard {\n\n using SafeMath for uint256;\n\n // userProxy => taskReceiptId => refTime\n mapping(address => mapping(uint256 => uint256)) public refTime;\n\n constructor(IGelatoCore _gelatoCore)\n GelatoStatefulConditionsStandard(_gelatoCore)\n public\n {}\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(address _userProxy)\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(this.checkRefTime.selector, uint256(0), _userProxy);\n }\n\n // STANDARD interface\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n address userProxy = abi.decode(_conditionData[36:], (address));\n return checkRefTime(_taskReceiptId, userProxy);\n }\n\n // Specific Implementation\n /// @dev Abi encode these parameter inputs. Use a placeholder for _taskReceiptId.\n /// @param _taskReceiptId Will be stripped from encoded data and replaced by\n /// the value passed in from GelatoCore.\n function checkRefTime(uint256 _taskReceiptId, address _userProxy)\n public\n view\n virtual\n returns(string memory)\n {\n uint256 _refTime = refTime[_userProxy][_taskReceiptId];\n if (_refTime <= block.timestamp) return OK;\n return \"NotOkTimestampDidNotPass\";\n }\n\n /// @dev This function should be called via the userProxy of a Gelato Task as part\n /// of the Task.actions, if the Condition state should be updated after the task.\n /// This is for Task Cycles/Chains and we fetch the TaskReceipt.id of the\n // next Task that will be auto-submitted by GelatoCore in the same exec Task transaction.\n /// @param _timeDelta The time after which this condition should return for a given taskId\n /// @param _idDelta Default to 0. If you submit multiple tasks in one action, this can help\n // customize which taskId the state should be allocated to\n function setRefTime(uint256 _timeDelta, uint256 _idDelta) external {\n uint256 currentTime = block.timestamp;\n uint256 newRefTime = currentTime + _timeDelta;\n refTime[msg.sender][_getIdOfNextTaskInCycle() + _idDelta] = newRefTime;\n }\n}\n"
+ },
+ "contracts/gelato_conditions/balances/ConditionBalanceStateful.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoStatefulConditionsStandard} from \"../GelatoStatefulConditionsStandard.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\nimport {IGelatoCore} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\n\n\ncontract ConditionBalanceStateful is GelatoStatefulConditionsStandard {\n\n using SafeMath for uint256;\n\n // userProxy => taskReceiptId => refBalance\n mapping(address => mapping(uint256 => uint256)) public refBalance;\n\n constructor(IGelatoCore _gelatoCore)\n GelatoStatefulConditionsStandard(_gelatoCore)\n public\n {}\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(\n address _userProxy,\n address _account,\n address _token,\n bool _greaterElseSmaller\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.checkRefBalance.selector,\n uint256(0), // taskReceiptId placeholder\n _userProxy,\n _account,\n _token,\n _greaterElseSmaller\n );\n }\n\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n (address _userProxy,\n address _account,\n address _token,\n bool _greaterElseSmaller) = abi.decode(\n _conditionData[36:], // slice out selector and _taskReceiptId\n (address,address,address,bool)\n );\n return checkRefBalance(\n _taskReceiptId, _userProxy, _account, _token, _greaterElseSmaller\n );\n }\n\n // Specific Implementation\n /// @dev Abi encode these parameter inputs. Use a placeholder for _taskReceiptId.\n /// @param _taskReceiptId Will be stripped from encoded data and replaced by\n /// the value passed in from GelatoCore.\n function checkRefBalance(\n uint256 _taskReceiptId,\n address _userProxy,\n address _account,\n address _token,\n bool _greaterElseSmaller\n )\n public\n view\n virtual\n returns(string memory)\n {\n uint256 _refBalance = refBalance[_userProxy][_taskReceiptId];\n // ETH balances\n if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n if (_greaterElseSmaller) { // greaterThan\n if (_account.balance >= _refBalance) return OK;\n return \"NotOkETHBalanceIsNotGreaterThanRefBalance\";\n } else { // smallerThan\n if (_account.balance <= _refBalance) return OK;\n return \"NotOkETHBalanceIsNotSmallerThanRefBalance\";\n }\n } else {\n // ERC20 balances\n IERC20 erc20 = IERC20(_token);\n try erc20.balanceOf(_account) returns (uint256 erc20Balance) {\n if (_greaterElseSmaller) { // greaterThan\n if (erc20Balance >= _refBalance) return OK;\n return \"NotOkERC20BalanceIsNotGreaterThanRefBalance\";\n } else { // smallerThan\n if (erc20Balance <= _refBalance) return OK;\n return \"NotOkERC20BalanceIsNotSmallerThanRefBalance\";\n }\n } catch {\n return \"ERC20Error\";\n }\n }\n }\n\n /// @dev This function should be called via the userProxy of a Gelato Task as part\n /// of the Task.actions, if the Condition state should be updated after the task.\n /// This is for Task Cycles/Chains and we fetch the TaskReceipt.id of the\n // next Task that will be auto-submitted by GelatoCore in the same exec Task transaction.\n /// @param _balanceDelta The change in balance after which this condition should return for a given taskId\n /// @param _idDelta Default to 0. If you submit multiple tasks in one action, this can help\n // customize which taskId the state should be allocated to\n function setRefBalance(\n address _account,\n address _token,\n int256 _balanceDelta,\n uint256 _idDelta\n )\n external\n {\n uint256 currentBalanceOfAccount;\n uint256 newRefBalance;\n if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) // ETH\n currentBalanceOfAccount = _account.balance;\n else currentBalanceOfAccount = IERC20(_token).balanceOf(_account);\n require(\n int256(currentBalanceOfAccount) + _balanceDelta >= 0,\n \"ConditionBalanceStateful.setRefBalanceDelta: underflow\"\n );\n newRefBalance = uint256(int256(currentBalanceOfAccount) + _balanceDelta);\n refBalance[msg.sender][_getIdOfNextTaskInCycle() + _idDelta] = newRefBalance;\n }\n}"
+ },
+ "contracts/gelato_conditions/balances/ConditionBalance.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoConditionsStandard} from \"../GelatoConditionsStandard.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\n\ncontract ConditionBalance is GelatoConditionsStandard {\n\n /// @dev use this function to encode the data off-chain for the condition data field\n function getConditionData(\n address _account,\n address _token,\n uint256 _refBalance,\n bool _greaterElseSmaller\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.balanceCheck.selector,\n _account,\n _token,\n _refBalance,\n _greaterElseSmaller\n );\n }\n\n /// @param _conditionData The encoded data from getConditionData()\n function ok(uint256, bytes calldata _conditionData, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n (address _account,\n address _token,\n uint256 _refBalance,\n bool _greaterElseSmaller) = abi.decode(\n _conditionData[4:],\n (address,address,uint256,bool)\n );\n return balanceCheck(_account, _token, _refBalance, _greaterElseSmaller);\n }\n\n // Specific Implementation\n function balanceCheck(\n address _account,\n address _token,\n uint256 _refBalance,\n bool _greaterElseSmaller\n )\n public\n view\n virtual\n returns(string memory)\n {\n // ETH balances\n if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n if (_greaterElseSmaller) { // greaterThan\n if (_account.balance >= _refBalance) return OK;\n return \"NotOkETHBalanceIsNotGreaterThanRefBalance\";\n } else { // smallerThan\n if (_account.balance <= _refBalance) return OK;\n return \"NotOkETHBalanceIsNotSmallerThanRefBalance\";\n }\n } else {\n // ERC20 balances\n IERC20 erc20 = IERC20(_token);\n try erc20.balanceOf(_account) returns (uint256 erc20Balance) {\n if (_greaterElseSmaller) { // greaterThan\n if (erc20Balance >= _refBalance) return OK;\n return \"NotOkERC20BalanceIsNotGreaterThanRefBalance\";\n } else { // smallerThan\n if (erc20Balance <= _refBalance) return OK;\n return \"NotOkERC20BalanceIsNotSmallerThanRefBalance\";\n }\n } catch {\n return \"ERC20Error\";\n }\n }\n }\n}"
+ },
+ "contracts/gelato_actions/kyber/ActionKyberTrade.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandardFull} from \"../GelatoActionsStandardFull.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {IKyberNetworkProxy} from \"../../dapp_interfaces/kyber/IKyberNetworkProxy.sol\";\n\ncontract ActionKyberTrade is GelatoActionsStandardFull {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IKyberNetworkProxy public immutable KYBER;\n\n constructor(IKyberNetworkProxy _kyberNetworkProxy) public {\n KYBER =_kyberNetworkProxy;\n }\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n function getActionData(\n address _origin,\n address _sendToken, // ERC20 or ETH (symbol)\n uint256 _sendAmount,\n address _receiveToken, // ERC20 or ETH (symbol)\n address _receiver\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.action.selector,\n _origin,\n _sendToken,\n _sendAmount,\n _receiveToken,\n _receiver\n );\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_IN_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n function action(\n address _origin,\n address _sendToken, // ERC20 or ETH (symbol)\n uint256 _sendAmount,\n address _receiveToken, // ERC20 or ETH (symbol)\n address _receiver\n )\n public\n virtual\n delegatecallOnly(\"ActionKyberTrade.action\")\n returns (uint256 receiveAmount)\n {\n address receiver = _receiver == address(0) ? address(this) : _receiver;\n\n if (_sendToken == ETH_ADDRESS) {\n try KYBER.trade{value: _sendAmount}(\n _sendToken,\n _sendAmount,\n _receiveToken,\n receiver,\n type(uint256).max, // maxDestAmount\n 0, // minConversionRate (if price condition, limit order still possible)\n 0xe1F076849B781b1395Fd332dC1758Dbc129be6EC // fee-sharing: gelato-node\n )\n returns(uint256 receiveAmt)\n {\n receiveAmount = receiveAmt;\n } catch {\n revert(\"ActionKyberTrade.action: trade with ETH Error\");\n }\n } else {\n IERC20 sendERC20 = IERC20(_sendToken);\n\n // origin funds lightweight UserProxy\n if (_origin != address(0) && _origin != address(this)) {\n sendERC20.safeTransferFrom(\n _origin, address(this), _sendAmount, \"ActionKyberTrade.action:\"\n );\n }\n\n // UserProxy approves KyberNetworkProxy\n sendERC20.safeIncreaseAllowance(\n address(KYBER), _sendAmount, \"ActionKyberTrade.action:\"\n );\n\n try KYBER.trade(\n _sendToken,\n _sendAmount,\n _receiveToken,\n receiver,\n type(uint256).max, // maxDestAmount\n 0, // minConversionRate (if price condition, limit order still possible)\n 0xe1F076849B781b1395Fd332dC1758Dbc129be6EC // fee-sharing: gelato-node\n )\n returns(uint256 receiveAmt)\n {\n receiveAmount = receiveAmt;\n } catch {\n revert(\"ActionKyberTrade.action: trade with ERC20 Error\");\n }\n }\n\n emit LogTwoWay(\n _origin, // origin\n _sendToken,\n _sendAmount,\n address(KYBER), // destination\n _receiveToken,\n receiveAmount,\n receiver\n );\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n address origin = abi.decode(_actionData[4:36], (address));\n (address receiveToken, address receiver) = abi.decode(\n _actionData[100:],\n (address,address)\n );\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n action(origin, sendToken, sendAmount, receiveToken, receiver);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address origin, // 4:36\n address sendToken, // 36:68\n uint256 sendAmount, // 68:100\n address receiveToken, // 100:132\n address receiver /* 132:164 */) = abi.decode(\n _actionData[4:], // 0:4 == selector\n (address,address,uint256,address,address)\n );\n uint256 receiveAmount = action(origin, sendToken, sendAmount, receiveToken, receiver);\n return abi.encode(receiveToken, receiveAmount);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n address origin = abi.decode(_actionData[4:36], (address));\n (address receiveToken, address receiver) = abi.decode(\n _actionData[100:],\n (address,address)\n );\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n uint256 receiveAmount = action(origin, sendToken, sendAmount, receiveToken, receiver);\n return abi.encode(receiveToken, receiveAmount);\n }\n\n // ====== ACTION TERMS CHECK ==========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory)\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionKyberTrade: invalid action selector\";\n\n if (_dataFlow == DataFlow.In || _dataFlow == DataFlow.InAndOut)\n return \"ActionKyberTrade: termsOk check invalidated by inbound DataFlow\";\n\n (address origin, // 4:36\n address sendToken, // 36:68\n uint256 sendAmount, // 68:100\n /*address receiveToken*/, // 100:132\n address receiver) = abi.decode(\n _actionData[4:], // 0:4 == selector\n (address,address,uint256,address,address)\n );\n\n // Safety for the next Action that consumes data from this Action\n if (_dataFlow == DataFlow.Out && _userProxy != receiver && address(0) != receiver)\n return \"ActionKyberTrade: UserProxy must be receiver if DataFlow.Out\";\n\n if (sendToken == ETH_ADDRESS) {\n if (origin != _userProxy && origin != address(0))\n return \"ActionKyberTrade: MustHaveUserProxyOrZeroAsOriginForETHTrade\";\n\n if (_userProxy.balance < sendAmount)\n return \"ActionKyberTrade: NotOkUserProxyETHBalance\";\n } else {\n IERC20 sendERC20 = IERC20(sendToken);\n\n // UserProxy is prefunded\n if (origin == _userProxy || origin == address(0)) {\n try sendERC20.balanceOf(_userProxy) returns(uint256 proxySendTokenBalance) {\n if (proxySendTokenBalance < sendAmount)\n return \"ActionKyberTrade: NotOkUserProxySendTokenBalance\";\n } catch {\n return \"ActionKyberTrade: ErrorBalanceOf-1\";\n }\n } else {\n // UserProxy is not prefunded\n try sendERC20.balanceOf(origin) returns(uint256 originSendTokenBalance) {\n if (originSendTokenBalance < sendAmount)\n return \"ActionKyberTrade: NotOkOriginSendTokenBalance\";\n } catch {\n return \"ActionKyberTrade: ErrorBalanceOf-2\";\n }\n\n try sendERC20.allowance(origin, _userProxy)\n returns(uint256 userProxySendTokenAllowance)\n {\n if (userProxySendTokenAllowance < sendAmount)\n return \"ActionKyberTrade: NotOkUserProxySendTokenAllowance\";\n } catch {\n return \"ActionKyberTrade: ErrorAllowance\";\n }\n }\n }\n\n // Make sure Trading Pair is valid\n // @DEV we don't do this as this check is very expensive\n // However, by chaining another action that inspects this data before this\n // one, the same check can likely be made in a cheaper way. E.g.\n // a Provider Action that inspects whether sendToken/receiveToken is\n // on a custom whitelist.\n // try KYBER.getExpectedRate(sendToken, receiveToken, sendAmount)\n // returns (uint256 expectedRate, uint256)\n // {\n // if (expectedRate == 0) return \"ActionKyberTrade:noReserve\";\n // } catch {\n // return \"ActionKyberTrade:getExpectedRate-Error\";\n // }\n\n // STANDARD return string to signal actionConditions Ok\n return OK;\n }\n}\n"
+ },
+ "contracts/gelato_actions/uniswap/ActionUniswapTrade.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandardFull} from \"../GelatoActionsStandardFull.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {IUniswapExchange} from \"../../dapp_interfaces/uniswap/IUniswapExchange.sol\";\nimport {IUniswapFactory} from \"../../dapp_interfaces/uniswap/IUniswapFactory.sol\";\n\ncontract ActionUniswapTrade is GelatoActionsStandardFull {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IUniswapFactory public immutable UNI_FACTORY;\n\n constructor(IUniswapFactory _uniswapFactory) public {\n UNI_FACTORY =_uniswapFactory;\n }\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n function getActionData(\n address _origin,\n address _sendToken, // exchange\n uint256 _sendAmount, // tokens_sold\n address _receiveToken, // token_addr\n address _receiver\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.action.selector,\n _origin,\n _sendToken,\n _sendAmount,\n _receiveToken,\n _receiver\n );\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_IN_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n // ======= ACTION IMPLEMENTATION DETAILS =========\n /// @dev Always use this function for encoding _actionData off-chain\n /// Will be called by GelatoActionPipeline if Action.dataFlow.None\n function action(\n address _origin,\n address _sendToken, // exchange\n uint256 _sendAmount, // tokens_sold\n address _receiveToken, // token_addr\n address _receiver\n )\n public\n virtual\n delegatecallOnly(\"ActionUniswapTrade.action\")\n returns (uint256 receiveAmount)\n {\n address receiver = _receiver == address(0) ? address(this) : _receiver;\n IUniswapExchange sendTokenExchange;\n\n if (_sendToken == ETH_ADDRESS) {\n IUniswapExchange receiveTokenExchange = UNI_FACTORY.getExchange(\n IERC20(_receiveToken)\n );\n if (receiveTokenExchange != IUniswapExchange(0)) {\n // Swap ETH => ERC20\n try receiveTokenExchange.ethToTokenTransferInput{value: _sendAmount}(\n 1,\n block.timestamp,\n receiver\n )\n returns (uint256 receivedTokens)\n {\n receiveAmount = receivedTokens;\n } catch {\n revert(\"ActionUniswapTrade.action: ethToTokenTransferInput\");\n }\n } else {\n revert(\"ActionUniswapTrade.action: Invalid ReceiveTokenExchange-1\");\n }\n } else {\n IERC20 sendERC20 = IERC20(_sendToken);\n sendTokenExchange = UNI_FACTORY.getExchange(IERC20(sendERC20));\n\n if (sendTokenExchange != IUniswapExchange(0)) {\n\n // origin funds lightweight UserProxy\n if (_origin != address(0) && _origin != address(this)) {\n sendERC20.safeTransferFrom(\n _origin, address(this), _sendAmount, \"ActionUniswapTrade.action:\"\n );\n }\n\n // UserProxy approves Uniswap\n sendERC20.safeIncreaseAllowance(\n address(sendTokenExchange), _sendAmount, \"ActionUniswapTrade.action:\"\n );\n\n if (_receiveToken == ETH_ADDRESS) {\n // swap ERC20 => ETH\n try sendTokenExchange.tokenToEthTransferInput(\n _sendAmount,\n 1,\n block.timestamp,\n receiver\n )\n returns (uint256 receivedETH)\n {\n receiveAmount = receivedETH;\n } catch {\n revert(\"ActionUniswapTrade.action: tokenToEthTransferInput\");\n }\n } else {\n IUniswapExchange receiveTokenExchange = UNI_FACTORY.getExchange(\n IERC20(_receiveToken)\n );\n if (receiveTokenExchange != IUniswapExchange(0)) {\n try sendTokenExchange.tokenToTokenTransferInput(\n _sendAmount,\n 1,\n 1,\n block.timestamp,\n receiver,\n address(_receiveToken)\n )\n returns (uint256 receivedTokens)\n {\n receiveAmount = receivedTokens;\n } catch {\n revert(\"ActionUniswapTrade.action: tokenToTokenTransferInput\");\n }\n } else {\n revert(\"ActionUniswapTrade.action: Invalid ReceiveTokenExchange-2\");\n }\n }\n } else {\n revert(\"ActionUniswapTrade: Invalid SendTokenExchange\");\n }\n }\n\n emit LogTwoWay(\n _origin, // origin\n _sendToken,\n _sendAmount,\n address(sendTokenExchange), // destination\n _receiveToken,\n receiveAmount,\n receiver\n );\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n address origin = abi.decode(_actionData[4:36], (address));\n (address receiveToken, address receiver) = abi.decode(\n _actionData[100:],\n (address,address)\n );\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n action(origin, sendToken, sendAmount, receiveToken, receiver);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address origin, // 4:36\n address sendToken, // 36:68\n uint256 sendAmount, // 68:100\n address receiveToken, // 100:132\n address receiver /* 132:164 */) = abi.decode(\n _actionData[4:], // 0:4 == selector\n (address,address,uint256,address,address)\n );\n uint256 receiveAmount = action(origin, sendToken, sendAmount, receiveToken, receiver);\n return abi.encode(receiveToken, receiveAmount);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n address origin = abi.decode(_actionData[4:36], (address));\n (address receiveToken, address receiver) = abi.decode(\n _actionData[100:],\n (address,address)\n );\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n uint256 receiveAmount = action(origin, sendToken, sendAmount, receiveToken, receiver);\n return abi.encode(receiveToken, receiveAmount);\n }\n\n // ======= ACTION TERMS CHECK =========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory)\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionUniswapTrade: invalid action selector\";\n\n if (_dataFlow == DataFlow.In || _dataFlow == DataFlow.InAndOut)\n return \"ActionUniswapTrade: termsOk check invalidated by inbound DataFlow\";\n\n (address origin, // 4:36\n address sendToken, // 36:68\n uint256 sendAmount, // 68:100\n address receiveToken, // 100:132\n /*address receiver*/) = abi.decode(\n _actionData[4:], // 0:4 == selector\n (address,address,uint256,address,address)\n );\n\n // Safety for the next Action that consumes data from this Action\n if (\n _dataFlow == DataFlow.Out &&\n _userProxy != abi.decode(_actionData[132:164], (address)) && // receiver\n address(0) != abi.decode(_actionData[132:164], (address)) // receiver\n )\n return \"ActionUniswapTrade: UserProxy must be receiver if DataFlow.Out\";\n\n if (sendToken == ETH_ADDRESS) {\n IERC20 receiveERC20 = IERC20(receiveToken);\n IUniswapExchange receiveTokenExchange = UNI_FACTORY.getExchange(receiveERC20);\n if (receiveTokenExchange == IUniswapExchange(0))\n return \"ActionUniswapTrade: receiveTokenExchangeDoesNotExist-1\";\n\n if (origin != _userProxy && origin != address(0))\n return \"ActionUniswapTrade: MustHaveUserProxyOrZeroAsOriginForETHTrade\";\n if (_userProxy.balance < sendAmount)\n return \"ActionUniswapTrade: NotOkUserProxyETHBalance\";\n } else {\n IERC20 sendERC20 = IERC20(sendToken);\n\n // Make sure sendToken-receiveToken Pair is valid\n IUniswapExchange sendTokenExchange = UNI_FACTORY.getExchange(sendERC20);\n if (sendTokenExchange == IUniswapExchange(0))\n return \"ActionUniswapTrade: sendTokenExchangeDoesNotExist\";\n if (receiveToken != ETH_ADDRESS) {\n IERC20 receiveERC20 = IERC20(receiveToken);\n IUniswapExchange receiveTokenExchange = UNI_FACTORY.getExchange(receiveERC20);\n if (receiveTokenExchange == IUniswapExchange(0))\n return \"ActionUniswapTrade: receiveTokenExchangeDoesNotExist-2\";\n }\n\n // UserProxy is prefunded\n if (origin == _userProxy || origin == address(0)) {\n try sendERC20.balanceOf(_userProxy) returns(uint256 proxySendTokenBalance) {\n if (proxySendTokenBalance < sendAmount)\n return \"ActionUniswapTrade: NotOkUserProxySendTokenBalance\";\n } catch {\n return \"ActionUniswapTrade: ErrorBalanceOf-1\";\n }\n } else {\n // UserProxy is not prefunded\n try sendERC20.balanceOf(origin) returns(uint256 originSendTokenBalance) {\n if (originSendTokenBalance < sendAmount)\n return \"ActionUniswapTrade: NotOkOriginSendTokenBalance\";\n } catch {\n return \"ActionUniswapTrade: ErrorBalanceOf-2\";\n }\n\n try sendERC20.allowance(origin, _userProxy)\n returns(uint256 userProxySendTokenAllowance)\n {\n if (userProxySendTokenAllowance < sendAmount)\n return \"ActionUniswapTrade: NotOkUserProxySendTokenAllowance\";\n } catch {\n return \"ActionUniswapTrade: ErrorAllowance\";\n }\n }\n }\n\n // STANDARD return string to signal actionConditions Ok\n return OK;\n }\n}\n"
+ },
+ "contracts/dapp_interfaces/uniswap/IUniswapExchange.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"../../external/IERC20.sol\";\n\ninterface IUniswapExchange {\n function getEthToTokenInputPrice(uint256 ethSold)\n external\n view\n returns (uint256 tokensBought);\n\n function getTokenToEthOutputPrice(uint256 ethbought)\n external\n view\n returns (uint256 tokensToBeSold);\n\n function getTokenToEthInputPrice(uint256 tokensSold)\n external\n view\n returns (uint256 ethBought);\n\n function ethToTokenSwapInput(uint256 MintTokens, uint256 deadline)\n external\n payable\n returns (uint256 tokensBought);\n\n function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline)\n external\n payable\n returns (uint256 tokensSold);\n\n function ethToTokenTransferInput(\n uint256 MintTokens,\n uint256 deadline,\n address recipient\n ) external payable returns (uint256 tokensBought);\n\n function tokenToEthSwapInput(\n uint256 tokens_sold,\n uint256 min_eth,\n uint256 deadline\n ) external returns (uint256);\n\n function tokenToEthSwapOutput(\n uint256 eth_bought,\n uint256 max_tokens,\n uint256 deadline\n ) external returns (uint256);\n\n function tokenToTokenSwapInput(\n uint256 tokensSold,\n uint256 MintTokensBought,\n uint256 minEthBought,\n uint256 deadline,\n address tokenAddr\n ) external returns (uint256 tokensBought);\n\n function tokenToEthTransferInput(\n uint256 tokens_sold,\n uint256 min_eth,\n uint256 deadline,\n address recipient\n ) external returns (uint256);\n\n function tokenToTokenTransferInput(\n uint256 tokens_sold,\n uint256 min_tokens_bought,\n uint256 min_eth_bought,\n uint256 deadline,\n address recipient,\n address token_addr\n ) external returns (uint256);\n\n}\n"
+ },
+ "contracts/dapp_interfaces/uniswap/IUniswapFactory.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"./IUniswapExchange.sol\";\n\ninterface IUniswapFactory {\n function getExchange(IERC20 token)\n external\n view\n returns (IUniswapExchange exchange);\n}\n"
+ },
+ "contracts/gelato_actions/transfer/ActionERC20TransferFrom.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoActionsStandardFull} from \"../GelatoActionsStandardFull.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {Address} from \"../../external/Address.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\n\ncontract ActionERC20TransferFrom is GelatoActionsStandardFull {\n // using SafeERC20 for IERC20; <- internal library methods vs. try/catch\n using Address for address;\n using SafeERC20 for IERC20;\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n /// Use \"address _sendToken\" for Human Readable ABI.\n function getActionData(\n address _user,\n IERC20 _sendToken,\n uint256 _sendAmount,\n address _destination\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.action.selector,\n _user,\n _sendToken,\n _sendAmount,\n _destination\n );\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_IN_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n // ======= ACTION IMPLEMENTATION DETAILS =========\n /// @dev Always use this function for encoding _actionData off-chain\n /// Will be called by GelatoActionPipeline if Action.dataFlow.None\n /// Use \"address _sendToken\" for Human Readable ABI.\n function action(\n address _user,\n IERC20 _sendToken,\n uint256 _sendAmount,\n address _destination\n )\n public\n virtual\n delegatecallOnly(\"ActionERC20TransferFrom.action\")\n {\n _sendToken.safeTransferFrom(\n _user, _destination, _sendAmount, \"ActionERC20TransferFrom.action:\"\n );\n emit LogOneWay(_user, address(_sendToken), _sendAmount, _destination);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n address user = abi.decode(_actionData[4:36], (address));\n address destination = abi.decode(_actionData[100:132], (address));\n (IERC20 sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (IERC20,uint256));\n action(user, sendToken, sendAmount, destination);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address user,\n IERC20 sendToken,\n uint256 sendAmount,\n address destination) = abi.decode(\n _actionData[4:],\n (address,IERC20,uint256,address)\n );\n action(user, sendToken, sendAmount, destination);\n return abi.encode(sendToken, sendAmount);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n address user = abi.decode(_actionData[4:36], (address));\n address destination = abi.decode(_actionData[100:132], (address));\n (IERC20 sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (IERC20,uint256));\n action(user, sendToken, sendAmount, destination);\n return abi.encode(sendToken, sendAmount);\n }\n\n // ======= ACTION TERMS CHECK =========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory)\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionERC20TransferFrom: invalid action selector\";\n\n if (_dataFlow == DataFlow.In || _dataFlow == DataFlow.InAndOut)\n return \"ActionERC20TransferFrom: termsOk check invalidated by inbound DataFlow\";\n\n (address user, IERC20 sendToken, uint256 sendAmount, ) = abi.decode(\n _actionData[4:],\n (address,IERC20,uint256,address)\n );\n\n try sendToken.balanceOf(user) returns(uint256 sendERC20Balance) {\n if (sendERC20Balance < sendAmount)\n return \"ActionERC20TransferFrom: NotOkUserSendTokenBalance\";\n } catch {\n return \"ActionERC20TransferFrom: ErrorBalanceOf\";\n }\n\n try sendToken.allowance(user, _userProxy) returns(uint256 allowance) {\n if (allowance < sendAmount)\n return \"ActionERC20TransferFrom: NotOkUserProxySendTokenAllowance\";\n } catch {\n return \"ActionERC20TransferFrom: ErrorAllowance\";\n }\n\n return OK;\n }\n}\n"
+ },
+ "contracts/gelato_actions/provider/ActionFeeHandler.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoActionsStandardFull} from \"../GelatoActionsStandardFull.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {Address} from \"../../external/Address.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\nimport {Ownable} from \"../../external/Ownable.sol\";\n\ncontract ActionFeeHandler is GelatoActionsStandardFull {\n // using SafeERC20 for IERC20; <- internal library methods vs. try/catch\n using Address for address payable;\n using SafeERC20 for IERC20;\n using SafeMath for uint256;\n\n address payable public immutable provider;\n FeeHandlerFactory public immutable feeHandlerFactory;\n uint256 public immutable feeNum;\n uint256 public immutable feeDen;\n\n constructor(\n address payable _provider,\n FeeHandlerFactory _feeHandlerFactory,\n uint256 _num,\n uint256 _den\n )\n public\n {\n require(_num <= _den, \"ActionFeeHandler.constructor: _num greater than _den\");\n provider = _provider;\n feeHandlerFactory = _feeHandlerFactory;\n feeNum = _num;\n feeDen = _den;\n }\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n function getActionData(address _sendToken, uint256 _sendAmount, address _feePayer)\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(this.action.selector, _sendToken, _sendAmount, _feePayer);\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_IN_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n function isTokenWhitelisted(address _token) public view returns(bool) {\n return feeHandlerFactory.isWhitelistedToken(provider, _token);\n }\n\n // ======= ACTION IMPLEMENTATION DETAILS =========\n /// @dev Use this function for encoding off-chain. DelegatecallOnly!\n function action(address _sendToken, uint256 _sendAmount, address _feePayer)\n public\n virtual\n delegatecallOnly(\"ActionFeeHandler.action\")\n returns (uint256 sendAmountAfterFee)\n {\n uint256 fee = _sendAmount.mul(feeNum).sub(1) / feeDen + 1;\n if (address(this) == _feePayer) {\n if (_sendToken == ETH_ADDRESS) provider.sendValue(fee);\n else IERC20(_sendToken).safeTransfer(provider, fee, \"ActionFeeHandler.action:\");\n } else {\n IERC20(_sendToken).safeTransferFrom(\n _feePayer, provider, fee, \"ActionFeeHandler.action:\"\n );\n }\n sendAmountAfterFee = _sendAmount.sub(fee);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n address feePayer = abi.decode(_actionData[68:], (address));\n action(sendToken, sendAmount, feePayer);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address sendToken, uint256 sendAmount, address feePayer) = abi.decode(\n _actionData[4:],\n (address,uint256,address)\n );\n uint256 sendAmountAfterFee = action(sendToken, sendAmount, feePayer);\n return abi.encode(sendToken, sendAmountAfterFee);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address sendToken, uint256 sendAmount) = abi.decode(_inFlowData, (address,uint256));\n address feePayer = abi.decode(_actionData[68:], (address));\n uint256 sendAmountAfterFee = action(sendToken, sendAmount, feePayer);\n return abi.encode(sendToken, sendAmountAfterFee);\n }\n\n // ======= ACTION TERMS CHECK =========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory)\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionFeeHandler: invalid action selector\";\n\n if (_dataFlow == DataFlow.In || _dataFlow == DataFlow.InAndOut)\n return \"ActionFeeHandler: termsOk check invalidated by inbound DataFlow\";\n\n (address sendToken, uint256 sendAmount, address feePayer) = abi.decode(\n _actionData[4:],\n (address,uint256,address)\n );\n\n if (sendAmount == 0)\n return \"ActionFeeHandler: Insufficient sendAmount\";\n\n if (!isTokenWhitelisted(sendToken))\n return \"ActionFeeHandler: Token not whitelisted for fee\";\n\n IERC20 sendERC20 = IERC20(sendToken);\n\n if (_userProxy == feePayer) {\n if (sendToken == ETH_ADDRESS) {\n if (_userProxy.balance < sendAmount)\n return \"ActionFeeHandler: NotOkUserProxyETHBalance\";\n } else {\n try sendERC20.balanceOf(_userProxy) returns (uint256 balance) {\n\n if (balance < sendAmount)\n return \"ActionFeeHandler: NotOkUserProxySendTokenBalance\";\n } catch {\n return \"ActionFeeHandler: ErrorBalanceOf\";\n }\n }\n } else {\n if (sendToken == ETH_ADDRESS)\n return \"ActionFeeHandler: CannotTransferFromETH\";\n try sendERC20.balanceOf(feePayer) returns (uint256 balance) {\n if (balance < sendAmount)\n return \"ActionFeeHandler: NotOkFeePayerSendTokenBalance\";\n } catch {\n return \"ActionFeeHandler: ErrorBalanceOf\";\n }\n try sendERC20.allowance(feePayer, _userProxy) returns (uint256 allowance) {\n if (allowance < sendAmount)\n return \"ActionFeeHandler: NotOkFeePayerSendTokenAllowance\";\n } catch {\n return \"ActionFeeHandler: ErrorAllowance\";\n }\n }\n\n return OK;\n }\n}\n\ncontract FeeHandlerFactory {\n\n event Created(\n address indexed provider,\n ActionFeeHandler indexed feeHandler,\n uint256 indexed num\n );\n\n // Denominator => For a fee of 1% => Input num = 100, as 100 / 10.000 = 0.01 == 1%\n uint256 public constant DEN = 10000;\n\n // provider => num => ActionFeeHandler\n mapping(address => mapping(uint256 => ActionFeeHandler)) public feeHandlerByProviderAndNum;\n mapping(address => ActionFeeHandler[]) public feeHandlersByProvider;\n mapping(address => mapping(address => bool)) public isWhitelistedToken;\n\n /// @notice Deploys a new feeHandler instance\n /// @dev Input _num = 100 for 1% fee, _num = 50 for 0.5% fee, etc\n function create(uint256 _num) public returns (ActionFeeHandler feeHandler) {\n require(\n feeHandlerByProviderAndNum[msg.sender][_num] == ActionFeeHandler(0),\n \"FeeHandlerFactory.create: already deployed\"\n );\n require(_num <= DEN, \"FeeHandlerFactory.create: num greater than DEN\");\n feeHandler = new ActionFeeHandler(msg.sender, this, _num, DEN);\n feeHandlerByProviderAndNum[msg.sender][_num] = feeHandler;\n feeHandlersByProvider[msg.sender].push(feeHandler);\n emit Created(msg.sender, feeHandler, _num);\n }\n\n // Provider Token whitelist\n function addTokensToWhitelist(address[] calldata _tokens) external {\n for (uint i; i < _tokens.length; i++) {\n isWhitelistedToken[msg.sender][_tokens[i]] = true;\n }\n }\n\n function removeTokensFromWhitelist(address[] calldata _tokens) external {\n for (uint i; i < _tokens.length; i++) {\n isWhitelistedToken[msg.sender][_tokens[i]] = false;\n }\n }\n}\n"
+ },
+ "contracts/gelato_core/GelatoGasPriceOracle.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport \"./interfaces/IGelatoGasPriceOracle.sol\";\nimport \"../external/Ownable.sol\";\n\ncontract GelatoGasPriceOracle is IGelatoGasPriceOracle, Ownable {\n\n address public override oracle;\n\n // This gasPrice is pulled into GelatoCore.exec() via GelatoSysAdmin._getGelatoGasPrice()\n uint256 private gasPrice;\n\n constructor(uint256 _gasPrice) public {\n setOracle(msg.sender);\n setGasPrice(_gasPrice);\n }\n\n modifier onlyOracle {\n require(msg.sender == oracle, \"GelatoGasPriceOracle.onlyOracle\");\n _;\n }\n\n function setOracle(address _newOracle) public override onlyOwner {\n emit LogOracleSet(oracle, _newOracle);\n oracle = _newOracle;\n }\n\n function setGasPrice(uint256 _newGasPrice) public override onlyOracle {\n emit LogGasPriceSet(gasPrice, _newGasPrice);\n gasPrice = _newGasPrice;\n }\n\n function latestAnswer() view external override returns(int256) {\n return int256(gasPrice);\n }\n}\n"
+ },
+ "contracts/gelato_core/interfaces/IGelatoGasPriceOracle.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\ninterface IGelatoGasPriceOracle {\n // Owner\n event LogOracleSet(address indexed oldOracle, address indexed newOracle);\n\n // Oracle\n event LogGasPriceSet(uint256 indexed oldGasPrice, uint256 indexed newGasPrice);\n\n // Owner\n\n /// @notice Set new address that can set the gas price\n /// @dev Only callable by owner\n /// @param _newOracle Address of new oracle admin\n function setOracle(address _newOracle) external;\n\n // Oracle\n\n /// @notice Set new gelato gas price\n /// @dev Only callable by oracle admin\n /// @param _newGasPrice New gas price in wei\n function setGasPrice(uint256 _newGasPrice) external;\n\n /// @notice Get address of oracle admin that can set gas prices\n /// @return Oracle Admin address\n function oracle() external view returns(address);\n\n /// @notice Get current gas price\n /// @return Gas price in wei\n function latestAnswer() external view returns(int256);\n}\n"
+ },
+ "contracts/gelato_actions/gnosis/ActionPlaceOrderBatchExchange.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoActionsStandardFull} from \"../GelatoActionsStandardFull.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\nimport {IBatchExchange} from \"../../dapp_interfaces/gnosis/IBatchExchange.sol\";\nimport {Task} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\n\n/// @title ActionPlaceOrderBatchExchange\n/// @author Luis Schliesske & Hilmar Orth\n/// @notice Gelato Action that\n/// 1) withdraws funds form user's EOA,\n/// 2) deposits on Batch Exchange,\n/// 3) Places order on batch exchange and\n// 4) requests future withdraw on batch exchange\ncontract ActionPlaceOrderBatchExchange is GelatoActionsStandardFull {\n\n using SafeERC20 for IERC20;\n using SafeMath for uint256;\n\n uint256 public constant MAX_UINT = type(uint256).max;\n uint32 public constant BATCH_TIME = 300;\n\n IBatchExchange public immutable batchExchange;\n\n constructor(IBatchExchange _batchExchange) public { batchExchange = _batchExchange; }\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n /// Use \"address _sellToken\" and \"address _buyToken\" for Human Readable ABI.\n function getActionData(\n address _origin,\n address _sellToken,\n uint128 _sellAmount,\n address _buyToken,\n uint128 _buyAmount,\n uint32 _batchDuration\n )\n public\n pure\n virtual\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.action.selector,\n _origin,\n _sellToken,\n _sellAmount,\n _buyToken,\n _buyAmount,\n _batchDuration\n );\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_IN_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n // ======= ACTION IMPLEMENTATION DETAILS =========\n /// @notice Place order on Batch Exchange and request future withdraw for buy/sell token\n /// @dev Use \"address _sellToken\" and \"address _buyToken\" for Human Readable ABI.\n /// @param _sellToken ERC20 Token to sell on Batch Exchange\n /// @param _sellAmount Amount to sell\n /// @param _buyToken ERC20 Token to buy on Batch Exchange\n /// @param _buyAmount Amount to receive (at least)\n /// @param _batchDuration After how many batches funds should be\n function action(\n address _origin,\n address _sellToken,\n uint128 _sellAmount,\n address _buyToken,\n uint128 _buyAmount,\n uint32 _batchDuration\n )\n public\n virtual\n delegatecallOnly(\"ActionPlaceOrderBatchExchange.action\")\n {\n IERC20 sellToken = IERC20(_sellToken);\n\n // 1. Get current batch id\n uint32 withdrawBatchId = uint32(block.timestamp / BATCH_TIME) + _batchDuration;\n\n // 2. Optional: If light proxy, transfer from funds to proxy\n if (_origin != address(0) && _origin != address(this)) {\n sellToken.safeTransferFrom(\n _origin,\n address(this),\n _sellAmount,\n \"ActionPlaceOrderBatchExchange.action:\"\n );\n }\n\n // 3. Fetch token Ids for sell & buy token on Batch Exchange\n uint16 sellTokenId = batchExchange.tokenAddressToIdMap(_sellToken);\n uint16 buyTokenId = batchExchange.tokenAddressToIdMap(_buyToken);\n\n // 4. Approve _sellToken to BatchExchange Contract\n sellToken.safeIncreaseAllowance(\n address(batchExchange),\n _sellAmount,\n \"ActionPlaceOrderBatchExchange.action:\"\n );\n\n // 5. Deposit _sellAmount on BatchExchange\n try batchExchange.deposit(address(_sellToken), _sellAmount) {\n } catch {\n revert(\"ActionPlaceOrderBatchExchange.deposit _sellToken failed\");\n }\n\n // 6. Place Order on Batch Exchange\n // uint16 buyToken, uint16 sellToken, uint32 validUntil, uint128 buyAmount, uint128 _sellAmount\n try batchExchange.placeOrder(\n buyTokenId,\n sellTokenId,\n withdrawBatchId,\n _buyAmount,\n _sellAmount\n ) {\n } catch {\n revert(\"ActionPlaceOrderBatchExchange.placeOrderfailed\");\n }\n\n // 7. First check if we have a valid future withdraw request for the selltoken\n uint256 sellTokenWithdrawAmount = uint256(_sellAmount);\n try batchExchange.getPendingWithdraw(address(this), _sellToken)\n returns(uint256 reqWithdrawAmount, uint32 requestedBatchId)\n {\n // Check if the withdraw request is not in the past\n if (requestedBatchId >= uint32(block.timestamp / BATCH_TIME)) {\n // If we requested a max_uint withdraw, the withdraw amount will not change\n if (reqWithdrawAmount == MAX_UINT)\n sellTokenWithdrawAmount = reqWithdrawAmount;\n // If not, we add the previous amount to the new one\n else\n sellTokenWithdrawAmount = sellTokenWithdrawAmount.add(reqWithdrawAmount);\n }\n } catch {\n revert(\"ActionPlaceOrderBatchExchange.getPendingWithdraw _sellToken failed\");\n }\n\n // 8. Request future withdraw on Batch Exchange for sellToken\n try batchExchange.requestFutureWithdraw(_sellToken, sellTokenWithdrawAmount, withdrawBatchId) {\n } catch {\n revert(\"ActionPlaceOrderBatchExchange.requestFutureWithdraw _sellToken failed\");\n }\n\n // 9. Request future withdraw on Batch Exchange for buyToken\n // @DEV using MAX_UINT as we don't know in advance how much buyToken we will get\n try batchExchange.requestFutureWithdraw(_buyToken, MAX_UINT, withdrawBatchId) {\n } catch {\n revert(\"ActionPlaceOrderBatchExchange.requestFutureWithdraw _buyToken failed\");\n }\n\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n (address sellToken, uint128 sellAmount) = _handleInFlowData(_inFlowData);\n (address origin,\n address buyToken,\n uint128 buyAmount,\n uint32 batchDuration) = _extractReusableActionData(_actionData);\n\n action(origin, sellToken, sellAmount, buyToken, buyAmount, batchDuration);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address origin,\n address sellToken,\n uint128 sellAmount,\n address buyToken,\n uint128 buyAmount,\n uint32 batchDuration) = abi.decode(\n _actionData[4:],\n (address,address,uint128,address,uint128,uint32)\n );\n action(origin, sellToken, sellAmount, buyToken, buyAmount, batchDuration);\n return abi.encode(sellToken, sellAmount);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address sellToken, uint128 sellAmount) = _handleInFlowData(_inFlowData);\n (address origin,\n address buyToken,\n uint128 buyAmount,\n uint32 batchDuration) = _extractReusableActionData(_actionData);\n\n action(origin, sellToken, sellAmount, buyToken, buyAmount, batchDuration);\n\n return abi.encode(sellToken, sellAmount);\n }\n\n // ======= ACTION TERMS CHECK =========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _userProxy,\n bytes calldata _actionData,\n DataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory) // actionCondition\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionPlaceOrderBatchExchange: invalid action selector\";\n\n (address origin, address _sellToken, uint128 sellAmount, address buyToken) = abi.decode(\n _actionData[4:132],\n (address,address,uint128,address)\n );\n\n IERC20 sellToken = IERC20(_sellToken);\n\n if (origin == address(0) || origin == _userProxy) {\n try sellToken.balanceOf(_userProxy) returns(uint256 proxySendTokenBalance) {\n if (proxySendTokenBalance < sellAmount)\n return \"ActionPlaceOrderBatchExchange: NotOkUserProxySendTokenBalance\";\n } catch {\n return \"ActionPlaceOrderBatchExchange: ErrorBalanceOf-1\";\n }\n } else {\n try sellToken.balanceOf(origin) returns(uint256 originSendTokenBalance) {\n if (originSendTokenBalance < sellAmount)\n return \"ActionPlaceOrderBatchExchange: NotOkOriginSendTokenBalance\";\n } catch {\n return \"ActionPlaceOrderBatchExchange: ErrorBalanceOf-2\";\n }\n\n try sellToken.allowance(origin, _userProxy)\n returns(uint256 userProxySendTokenAllowance)\n {\n if (userProxySendTokenAllowance < sellAmount)\n return \"ActionPlaceOrderBatchExchange: NotOkUserProxySendTokenAllowance\";\n } catch {\n return \"ActionPlaceOrderBatchExchange: ErrorAllowance\";\n }\n }\n\n uint32 currentBatchId = uint32(block.timestamp / BATCH_TIME);\n\n try batchExchange.getPendingWithdraw(_userProxy, _sellToken)\n returns(uint256, uint32 requestedBatchId)\n {\n // Check if the withdraw request is valid => we need the withdraw to exec first\n if (requestedBatchId != 0 && requestedBatchId < currentBatchId) {\n return \"ActionPlaceOrderBatchExchange WaitUntilPreviousBatchWasWithdrawn sellToken\";\n }\n } catch {\n return \"ActionPlaceOrderBatchExchange getPendingWithdraw failed sellToken\";\n }\n\n try batchExchange.getPendingWithdraw(_userProxy, buyToken)\n returns(uint256, uint32 requestedBatchId)\n {\n // Check if the withdraw request is valid => we need the withdraw to exec first\n if (requestedBatchId != 0 && requestedBatchId < currentBatchId) {\n return \"ActionPlaceOrderBatchExchange WaitUntilPreviousBatchWasWithdrawn buyToken\";\n }\n } catch {\n return \"ActionPlaceOrderBatchExchange getPendingWithdraw failed buyToken\";\n }\n\n // STANDARD return string to signal actionConditions Ok\n return OK;\n }\n\n // ======= ACTION HELPERS =========\n function _handleInFlowData(bytes calldata _inFlowData)\n internal\n pure\n virtual\n returns(address sellToken, uint128 sellAmount)\n {\n uint256 sellAmount256;\n (sellToken, sellAmount256) = abi.decode(_inFlowData, (address,uint256));\n sellAmount = uint128(sellAmount256);\n require(\n sellAmount == sellAmount256,\n \"ActionPlaceOrderBatchExchange._handleInFlowData: sellAmount conversion error\"\n );\n }\n\n function _extractReusableActionData(bytes calldata _actionData)\n internal\n pure\n virtual\n returns (address origin, address buyToken, uint128 buyAmount, uint32 batchDuration)\n {\n (origin,/*sellToken*/,/*sellAmount*/, buyToken, buyAmount, batchDuration) = abi.decode(\n _actionData[4:],\n (address,address,uint128,address,uint128,uint32)\n );\n }\n}"
+ },
+ "contracts/gelato_actions/gnosis/ActionPlaceOrderBatchExchangeWithSlippage.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {ActionPlaceOrderBatchExchange} from \"./ActionPlaceOrderBatchExchange.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\nimport {IBatchExchange} from \"../../dapp_interfaces/gnosis/IBatchExchange.sol\";\nimport {Task} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IKyberNetworkProxy} from \"../../dapp_interfaces/kyber/IKyberNetworkProxy.sol\";\n\n/// @title ActionPlaceOrderBatchExchangeWithSlippage\n/// @author Luis Schliesske & Hilmar Orth\n/// @notice Gelato Action that\n/// 1) Calculates buyAmout based on inputted slippage value,\n/// 2) withdraws funds form user's EOA,\n/// 3) deposits on Batch Exchange,\n/// 4) Places order on batch exchange and\n// 5) requests future withdraw on batch exchange\ncontract ActionPlaceOrderBatchExchangeWithSlippage is ActionPlaceOrderBatchExchange {\n\n using SafeMath for uint256;\n using SafeERC20 for address;\n\n IKyberNetworkProxy public immutable KYBER;\n\n constructor(\n IBatchExchange _batchExchange,\n IKyberNetworkProxy _kyberNetworkProxy\n )\n ActionPlaceOrderBatchExchange(_batchExchange)\n public\n {\n KYBER = _kyberNetworkProxy;\n }\n\n /// @dev use this function to encode the data off-chain for the action data field\n /// Use \"address _sellToken\" and \"address _buyToken\" for Human Readable ABI.\n function getActionData(\n address _origin,\n address _sellToken,\n uint128 _sellAmount,\n address _buyToken,\n uint128 _buySlippage,\n uint32 _batchDuration\n )\n public\n pure\n virtual\n override\n returns(bytes memory)\n {\n return abi.encodeWithSelector(\n this.action.selector,\n _origin,\n _sellToken,\n _sellAmount,\n _buyToken,\n _buySlippage,\n _batchDuration\n );\n }\n\n /// @notice Place order on Batch Exchange and request future withdraw for buy/sell token\n /// @dev Use \"address _sellToken\" and \"address _buyToken\" for Human Readable ABI.\n /// @param _sellToken Token to sell on Batch Exchange\n /// @param _sellAmount Amount to sell\n /// @param _buyToken Token to buy on Batch Exchange\n /// @param _buySlippage Slippage inlcuded for the buySlippage in order placement\n /// @param _batchDuration After how many batches funds should be\n function action(\n address _origin,\n address _sellToken,\n uint128 _sellAmount,\n address _buyToken,\n uint128 _buySlippage,\n uint32 _batchDuration\n )\n public\n virtual\n override\n delegatecallOnly(\"ActionPlaceOrderBatchExchangeWithSlippage.action\")\n {\n uint128 expectedBuyAmount = getKyberBuyAmountWithSlippage(\n _sellToken,\n _buyToken,\n _sellAmount,\n _buySlippage\n );\n super.action(\n _origin, _sellToken, _sellAmount, _buyToken, expectedBuyAmount, _batchDuration\n );\n }\n\n function getKyberBuyAmountWithSlippage(\n address _sellToken,\n address _buyToken,\n uint128 _sellAmount,\n uint256 _slippage\n )\n view\n public\n returns(uint128 expectedBuyAmount128)\n {\n uint256 sellTokenDecimals = getDecimals(_sellToken);\n uint256 buyTokenDecimals = getDecimals(_buyToken);\n\n try KYBER.getExpectedRate(address(_sellToken), address(_buyToken), _sellAmount)\n returns(uint256 expectedRate, uint256)\n {\n // Returned values in kyber are in 18 decimals\n // regardless of the destination token's decimals\n uint256 expectedBuyAmount256 = expectedRate\n // * sellAmount, as kyber returns the price for 1 unit\n .mul(_sellAmount)\n // * buy decimal tokens, to convert expectedRate * sellAmount to buyToken decimals\n .mul(10 ** buyTokenDecimals)\n // / sell token decimals to account for sell token decimals of _sellAmount\n .div(10 ** sellTokenDecimals)\n // / 10**18 to account for kyber always returning with 18 decimals\n .div(1e18);\n\n // return amount minus slippage. e.g. _slippage = 5 => 5% slippage\n if(_slippage != 0) {\n expectedBuyAmount256\n = expectedBuyAmount256 - expectedBuyAmount256.mul(_slippage).div(100);\n }\n expectedBuyAmount128 = uint128(expectedBuyAmount256);\n require(\n expectedBuyAmount128 == expectedBuyAmount256,\n \"ActionPlaceOrderBatchExchangeWithSlippage.getKyberRate: uint conversion\"\n );\n } catch {\n revert(\"ActionPlaceOrderBatchExchangeWithSlippage.getKyberRate:Error\");\n }\n }\n\n function getDecimals(address _token)\n internal\n view\n returns(uint256)\n {\n (bool success, bytes memory data) = _token.staticcall{gas: 30000}(\n abi.encodeWithSignature(\"decimals()\")\n );\n\n if (!success) {\n (success, data) = _token.staticcall{gas: 30000}(\n abi.encodeWithSignature(\"DECIMALS()\")\n );\n }\n if (success) return abi.decode(data, (uint256));\n else revert(\"ActionPlaceOrderBatchExchangeWithSlippage.getDecimals:revert\");\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.In\n // => do not use for _actionData encoding\n function execWithDataFlowIn(bytes calldata _actionData, bytes calldata _inFlowData)\n external\n payable\n virtual\n override\n {\n (address sellToken, uint128 sellAmount) = _handleInFlowData(_inFlowData);\n (address origin,\n address buyToken,\n uint128 buySlippage,\n uint32 batchDuration) = _extractReusableActionData(_actionData);\n\n action(origin, sellToken, sellAmount, buyToken, buySlippage, batchDuration);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address origin,\n address sellToken,\n uint128 sellAmount,\n address buyToken,\n uint128 buySlippage,\n uint32 batchDuration) = abi.decode(\n _actionData[4:],\n (address,address,uint128,address,uint128,uint32)\n );\n action(origin, sellToken, sellAmount, buyToken, buySlippage, batchDuration);\n return abi.encode(sellToken, sellAmount);\n }\n\n /// @dev Will be called by GelatoActionPipeline if Action.dataFlow.InAndOut\n // => do not use for _actionData encoding\n function execWithDataFlowInAndOut(\n bytes calldata _actionData,\n bytes calldata _inFlowData\n )\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n (address sellToken, uint128 sellAmount) = _handleInFlowData(_inFlowData);\n (address origin,\n address buyToken,\n uint128 buySlippage,\n uint32 batchDuration) = _extractReusableActionData(_actionData);\n\n action(origin, sellToken, sellAmount, buyToken, buySlippage, batchDuration);\n\n return abi.encode(sellToken, sellAmount);\n }\n\n // ======= ACTION HELPERS =========\n function _handleInFlowData(bytes calldata _inFlowData)\n internal\n pure\n virtual\n override\n returns(address sellToken, uint128 sellAmount)\n {\n uint256 sellAmount256;\n (sellToken, sellAmount256) = abi.decode(_inFlowData, (address,uint256));\n sellAmount = uint128(sellAmount256);\n require(\n sellAmount == sellAmount256,\n \"ActionPlaceOrderBatchExchange._handleInFlowData: sellAmount conversion error\"\n );\n }\n\n function _extractReusableActionData(bytes calldata _actionData)\n internal\n pure\n virtual\n override\n returns (address origin, address buyToken, uint128 buySlippage, uint32 batchDuration)\n {\n (origin,/*sellToken*/,/*sellAmount*/, buyToken, buySlippage, batchDuration) = abi.decode(\n _actionData[4:],\n (address,address,uint128,address,uint128,uint32)\n );\n }\n}"
+ },
+ "contracts/gelato_actions/gnosis/ActionWithdrawBatchExchange.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandard} from \"../GelatoActionsStandard.sol\";\nimport {\n IGelatoOutFlowAction\n} from \"../action_pipeline_interfaces/IGelatoOutFlowAction.sol\";\nimport {DataFlow} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {IERC20} from \"../../external/IERC20.sol\";\nimport {IBatchExchange} from \"../../dapp_interfaces/gnosis/IBatchExchange.sol\";\nimport {GelatoBytes} from \"../../libraries/GelatoBytes.sol\";\nimport {SafeERC20} from \"../../external/SafeERC20.sol\";\nimport {SafeMath} from \"../../external/SafeMath.sol\";\n\n/// @title ActionWithdrawBatchExchange\n/// @author Luis Schliesske & Hilmar Orth\n/// @notice Gelato Action that withdraws funds from BatchExchange and returns withdrawamount\n/// @dev Can be used in a GelatoActionPipeline as OutFlowAction.\ncontract ActionWithdrawBatchExchange is GelatoActionsStandard, IGelatoOutFlowAction {\n\n using SafeMath for uint256;\n using SafeERC20 for address;\n\n IBatchExchange public immutable batchExchange;\n\n constructor(IBatchExchange _batchExchange) public { batchExchange = _batchExchange; }\n\n // ======= DEV HELPERS =========\n /// @dev use this function to encode the data off-chain for the action data field\n /// Human Readable ABI: [\"function getActionData(address _token)\"]\n function getActionData(IERC20 _token)\n public\n pure\n returns(bytes memory)\n {\n return abi.encodeWithSelector(this.action.selector, _token);\n }\n\n /// @dev Used by GelatoActionPipeline.isValid()\n function DATA_FLOW_OUT_TYPE() public pure virtual override returns (bytes32) {\n return keccak256(\"TOKEN,UINT256\");\n }\n\n // ======= ACTION IMPLEMENTATION DETAILS =========\n /// @notice Withdraw token from Batch Exchange\n /// @dev delegatecallOnly\n /// Human Readable ABI: [\"function action(address _token)\"]\n /// @param _token Token to withdraw from Batch Exchange\n function action(address _token)\n public\n virtual\n delegatecallOnly(\"ActionWithdrawBatchExchange.action\")\n returns (uint256 withdrawAmount)\n {\n IERC20 token = IERC20(_token);\n uint256 preTokenBalance = token.balanceOf(address(this));\n\n try batchExchange.withdraw(address(this), _token) {\n uint256 postTokenBalance = token.balanceOf(address(this));\n if (postTokenBalance > preTokenBalance)\n withdrawAmount = postTokenBalance - preTokenBalance;\n } catch {\n revert(\"ActionWithdrawBatchExchange.withdraw _token failed\");\n }\n }\n\n ///@dev Will be called by GelatoActionPipeline if Action.dataFlow.Out\n // => do not use for _actionData encoding\n function execWithDataFlowOut(bytes calldata _actionData)\n external\n payable\n virtual\n override\n returns (bytes memory)\n {\n address token = abi.decode(_actionData[4:], (address));\n uint256 withdrawAmount = action(token);\n return abi.encode(token, withdrawAmount);\n }\n\n // ======= ACTION TERMS CHECK =========\n // Overriding and extending GelatoActionsStandard's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address, //_userProxy,\n bytes calldata _actionData,\n DataFlow,\n uint256, // value\n uint256 // cycleId\n )\n public\n view\n virtual\n override\n returns(string memory)\n {\n if (this.action.selector != GelatoBytes.calldataSliceSelector(_actionData))\n return \"ActionWithdrawBatchExchange: invalid action selector\";\n // address token = abi.decode(_actionData[4:], (address));\n // bool tokenWithdrawable = batchExchange.hasValidWithdrawRequest(_userProxy, token);\n // if (!tokenWithdrawable)\n // return \"ActionWithdrawBatchExchange: Token not withdrawable yet\";\n return OK;\n }\n}"
+ },
+ "contracts/mocks/gelato_actions/one-off/MockActionDummyRevert.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandard} from \"../../../gelato_actions/GelatoActionsStandard.sol\";\nimport {DataFlow} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract MockActionDummyRevert is GelatoActionsStandard {\n function action(bool) public payable virtual {\n revert(\"MockActionDummyRevert.action: test revert\");\n }\n\n function termsOk(uint256, address, bytes calldata _data, DataFlow, uint256, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n bool isOk = abi.decode(_data, (bool));\n if (isOk) return OK;\n revert(\"MockActionDummyOutOfGas.termsOk\");\n }\n}\n"
+ },
+ "contracts/mocks/gelato_actions/one-off/MockActionDummyOutOfGas.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandard} from \"../../../gelato_actions/GelatoActionsStandard.sol\";\nimport {DataFlow} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract MockActionDummyOutOfGas is GelatoActionsStandard {\n\n uint256 public overflowVar;\n\n function action(bool) public payable virtual {\n assert(false);\n }\n\n function placeholder() public pure {\n assert(false);\n }\n\n function termsOk(uint256, address, bytes calldata _data, DataFlow, uint256, uint256)\n public\n view\n virtual\n override\n returns(string memory)\n {\n (bool isOk) = abi.decode(_data, (bool));\n bool _;\n bytes memory __;\n (_, __) = address(this).staticcall(abi.encodePacked(this.placeholder.selector));\n if (isOk) return OK;\n revert(\"MockActionDummyOutOfGas.termsOk\");\n }\n}\n"
+ },
+ "contracts/mocks/gelato_actions/one-off/MockActionDummy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {GelatoActionsStandard} from \"../../../gelato_actions/GelatoActionsStandard.sol\";\nimport {DataFlow} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract MockActionDummy is GelatoActionsStandard {\n event LogAction(bool falseOrTrue);\n\n function action(bool _falseOrTrue) public payable virtual {\n emit LogAction(_falseOrTrue);\n }\n\n function termsOk(uint256, address, bytes calldata _data, DataFlow, uint256, uint256)\n external\n view\n virtual\n override\n returns(string memory)\n {\n bool isOk = abi.decode(_data[4:], (bool));\n if (isOk) return OK;\n return \"NotOk\";\n }\n}\n"
+ },
+ "contracts/gelato_core/GelatoCore.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoCore, Provider, Task, TaskReceipt} from \"./interfaces/IGelatoCore.sol\";\nimport {GelatoExecutors} from \"./GelatoExecutors.sol\";\nimport {GelatoBytes} from \"../libraries/GelatoBytes.sol\";\nimport {GelatoTaskReceipt} from \"../libraries/GelatoTaskReceipt.sol\";\nimport {SafeMath} from \"../external/SafeMath.sol\";\nimport {IGelatoCondition} from \"../gelato_conditions/IGelatoCondition.sol\";\nimport {IGelatoAction} from \"../gelato_actions/IGelatoAction.sol\";\nimport {IGelatoProviderModule} from \"../gelato_provider_modules/IGelatoProviderModule.sol\";\n\n/// @title GelatoCore\n/// @author Luis Schliesske & Hilmar Orth\n/// @notice Task: submission, validation, execution, and cancellation\n/// @dev Find all NatSpecs inside IGelatoCore\ncontract GelatoCore is IGelatoCore, GelatoExecutors {\n\n using GelatoBytes for bytes;\n using GelatoTaskReceipt for TaskReceipt;\n using SafeMath for uint256;\n\n // Setting State Vars for GelatoSysAdmin\n constructor(GelatoSysAdminInitialState memory _) public {\n gelatoGasPriceOracle = _.gelatoGasPriceOracle;\n oracleRequestData = _.oracleRequestData;\n gelatoMaxGas = _.gelatoMaxGas;\n internalGasRequirement = _.internalGasRequirement;\n minExecutorStake = _.minExecutorStake;\n executorSuccessShare = _.executorSuccessShare;\n sysAdminSuccessShare = _.sysAdminSuccessShare;\n totalSuccessShare = _.totalSuccessShare;\n }\n\n // ================ STATE VARIABLES ======================================\n // TaskReceiptIds\n uint256 public override currentTaskReceiptId;\n // taskReceipt.id => taskReceiptHash\n mapping(uint256 => bytes32) public override taskReceiptHash;\n\n // ================ SUBMIT ==============================================\n function canSubmitTask(\n address _userProxy,\n Provider memory _provider,\n Task memory _task,\n uint256 _expiryDate\n )\n external\n view\n override\n returns(string memory)\n {\n // EXECUTOR CHECKS\n if (!isExecutorMinStaked(executorByProvider[_provider.addr]))\n return \"GelatoCore.canSubmitTask: executor not minStaked\";\n\n // ExpiryDate\n if (_expiryDate != 0)\n if (_expiryDate < block.timestamp)\n return \"GelatoCore.canSubmitTask: expiryDate\";\n\n // Check Provider details\n string memory isProvided;\n if (_userProxy == _provider.addr) {\n if (_task.selfProviderGasLimit < internalGasRequirement.mul(2))\n return \"GelatoCore.canSubmitTask:selfProviderGasLimit too low\";\n isProvided = providerModuleChecks(_userProxy, _provider, _task);\n }\n else isProvided = isTaskProvided(_userProxy, _provider, _task);\n if (!isProvided.startsWithOK())\n return string(abi.encodePacked(\"GelatoCore.canSubmitTask.isProvided:\", isProvided));\n\n // Success\n return OK;\n }\n\n function submitTask(\n Provider memory _provider,\n Task memory _task,\n uint256 _expiryDate\n )\n external\n override\n {\n Task[] memory singleTask = new Task[](1);\n singleTask[0] = _task;\n if (msg.sender == _provider.addr) _handleSelfProviderGasDefaults(singleTask);\n _storeTaskReceipt(false, msg.sender, _provider, 0, singleTask, _expiryDate, 0, 1);\n }\n\n function submitTaskCycle(\n Provider memory _provider,\n Task[] memory _tasks,\n uint256 _expiryDate,\n uint256 _cycles // how many full cycles should be submitted\n )\n external\n override\n {\n if (msg.sender == _provider.addr) _handleSelfProviderGasDefaults(_tasks);\n _storeTaskReceipt(\n true, msg.sender, _provider, 0, _tasks, _expiryDate, 0, _cycles * _tasks.length\n );\n }\n\n function submitTaskChain(\n Provider memory _provider,\n Task[] memory _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits // see IGelatoCore for explanation\n )\n external\n override\n {\n if (_sumOfRequestedTaskSubmits != 0) {\n require(\n _sumOfRequestedTaskSubmits >= _tasks.length,\n \"GelatoCore.submitTaskChain: less requested submits than tasks\"\n );\n }\n if (msg.sender == _provider.addr) _handleSelfProviderGasDefaults(_tasks);\n _storeTaskReceipt(\n true, msg.sender, _provider, 0, _tasks, _expiryDate, 0, _sumOfRequestedTaskSubmits\n );\n }\n\n function _storeTaskReceipt(\n bool _newCycle,\n address _userProxy,\n Provider memory _provider,\n uint256 _index,\n Task[] memory _tasks,\n uint256 _expiryDate,\n uint256 _cycleId,\n uint256 _submissionsLeft\n )\n private\n {\n // Increment TaskReceipt ID storage\n uint256 nextTaskReceiptId = currentTaskReceiptId + 1;\n currentTaskReceiptId = nextTaskReceiptId;\n\n // Generate new Task Receipt\n TaskReceipt memory taskReceipt = TaskReceipt({\n id: nextTaskReceiptId,\n userProxy: _userProxy, // Smart Contract Accounts ONLY\n provider: _provider,\n index: _index,\n tasks: _tasks,\n expiryDate: _expiryDate,\n cycleId: _newCycle ? nextTaskReceiptId : _cycleId,\n submissionsLeft: _submissionsLeft // 0=infinity, 1=once, X=maxTotalExecutions\n });\n\n // Hash TaskReceipt\n bytes32 hashedTaskReceipt = hashTaskReceipt(taskReceipt);\n\n // Store TaskReceipt Hash\n taskReceiptHash[taskReceipt.id] = hashedTaskReceipt;\n\n emit LogTaskSubmitted(taskReceipt.id, hashedTaskReceipt, taskReceipt);\n }\n\n // ================ CAN EXECUTE EXECUTOR API ============================\n // _gasLimit must be gelatoMaxGas for all Providers except SelfProviders.\n function canExec(TaskReceipt memory _TR, uint256 _gasLimit, uint256 _gelatoGasPrice)\n public\n view\n override\n returns(string memory)\n {\n if (!isExecutorMinStaked(executorByProvider[_TR.provider.addr]))\n return \"ExecutorNotMinStaked\";\n\n if (!isProviderLiquid(_TR.provider.addr, _gasLimit, _gelatoGasPrice))\n return \"ProviderIlliquidity\";\n\n string memory res = providerCanExec(\n _TR.userProxy,\n _TR.provider,\n _TR.task(),\n _gelatoGasPrice\n );\n if (!res.startsWithOK()) return res;\n\n bytes32 hashedTaskReceipt = hashTaskReceipt(_TR);\n if (taskReceiptHash[_TR.id] != hashedTaskReceipt) return \"InvalidTaskReceiptHash\";\n\n if (_TR.expiryDate != 0 && _TR.expiryDate <= block.timestamp)\n return \"TaskReceiptExpired\";\n\n // Optional CHECK Condition for user proxies\n if (_TR.task().conditions.length != 0) {\n for (uint i; i < _TR.task().conditions.length; i++) {\n try _TR.task().conditions[i].inst.ok(\n _TR.id,\n _TR.task().conditions[i].data,\n _TR.cycleId\n )\n returns(string memory condition)\n {\n if (!condition.startsWithOK())\n return string(abi.encodePacked(\"ConditionNotOk:\", condition));\n } catch Error(string memory error) {\n return string(abi.encodePacked(\"ConditionReverted:\", error));\n } catch {\n return \"ConditionReverted:undefined\";\n }\n }\n }\n\n // Optional CHECK Action Terms\n for (uint i; i < _TR.task().actions.length; i++) {\n // Only check termsOk if specified, else continue\n if (!_TR.task().actions[i].termsOkCheck) continue;\n\n try IGelatoAction(_TR.task().actions[i].addr).termsOk(\n _TR.id,\n _TR.userProxy,\n _TR.task().actions[i].data,\n _TR.task().actions[i].dataFlow,\n _TR.task().actions[i].value,\n _TR.cycleId\n )\n returns(string memory actionTermsOk)\n {\n if (!actionTermsOk.startsWithOK())\n return string(abi.encodePacked(\"ActionTermsNotOk:\", actionTermsOk));\n } catch Error(string memory error) {\n return string(abi.encodePacked(\"ActionReverted:\", error));\n } catch {\n return \"ActionRevertedNoMessage\";\n }\n }\n\n // Executor Validation\n if (msg.sender == address(this)) return OK;\n else if (msg.sender == executorByProvider[_TR.provider.addr]) return OK;\n else return \"InvalidExecutor\";\n }\n\n // ================ EXECUTE EXECUTOR API ============================\n enum ExecutionResult { ExecSuccess, CanExecFailed, ExecRevert }\n enum ExecutorPay { Reward, Refund }\n\n // Execution Entry Point: tx.gasprice must be greater or equal to _getGelatoGasPrice()\n function exec(TaskReceipt memory _TR) external override {\n\n // Store startGas for gas-consumption based cost and payout calcs\n uint256 startGas = gasleft();\n\n // memcopy of gelatoGasPrice, to avoid multiple storage reads\n uint256 gelatoGasPrice = _getGelatoGasPrice();\n\n // Only assigned executor can execute this function\n require(\n msg.sender == executorByProvider[_TR.provider.addr],\n \"GelatoCore.exec: Invalid Executor\"\n );\n\n // The gas stipend the executor must provide. Special case for SelfProviders.\n uint256 gasLimit\n = _TR.selfProvider() ? _TR.task().selfProviderGasLimit : gelatoMaxGas;\n\n ExecutionResult executionResult;\n string memory reason;\n\n try this.executionWrapper{\n gas: gasleft().sub(internalGasRequirement, \"GelatoCore.exec: Insufficient gas\")\n }(_TR, gasLimit, gelatoGasPrice)\n returns (ExecutionResult _executionResult, string memory _reason)\n {\n executionResult = _executionResult;\n reason = _reason;\n } catch Error(string memory error) {\n executionResult = ExecutionResult.ExecRevert;\n reason = error;\n } catch {\n // If any of the external calls in executionWrapper resulted in e.g. out of gas,\n // Executor is eligible for a Refund, but only if Executor sent gelatoMaxGas.\n executionResult = ExecutionResult.ExecRevert;\n reason = \"GelatoCore.executionWrapper:undefined\";\n }\n\n if (executionResult == ExecutionResult.ExecSuccess) {\n // END-1: SUCCESS => TaskReceipt was deleted in _exec & Reward\n (uint256 executorSuccessFee, uint256 sysAdminSuccessFee) = _processProviderPayables(\n _TR.provider.addr,\n ExecutorPay.Reward,\n startGas,\n gasLimit,\n gelatoGasPrice\n );\n emit LogExecSuccess(msg.sender, _TR.id, executorSuccessFee, sysAdminSuccessFee);\n\n } else if (executionResult == ExecutionResult.CanExecFailed) {\n // END-2: CanExecFailed => No TaskReceipt Deletion & No Refund\n emit LogCanExecFailed(msg.sender, _TR.id, reason);\n\n } else {\n // executionResult == ExecutionResult.ExecRevert\n // END-3.1: ExecReverted NO gelatoMaxGas => No TaskReceipt Deletion & No Refund\n if (startGas < gasLimit)\n emit LogExecReverted(msg.sender, _TR.id, 0, reason);\n else {\n // END-3.2: ExecReverted BUT gelatoMaxGas was used\n // => TaskReceipt Deletion (delete in _exec was reverted) & Refund\n delete taskReceiptHash[_TR.id];\n (uint256 executorRefund,) = _processProviderPayables(\n _TR.provider.addr,\n ExecutorPay.Refund,\n startGas,\n gasLimit,\n gelatoGasPrice\n );\n emit LogExecReverted(msg.sender, _TR.id, executorRefund, reason);\n }\n }\n }\n\n // Used by GelatoCore.exec(), to handle Out-Of-Gas from execution gracefully\n function executionWrapper(\n TaskReceipt memory taskReceipt,\n uint256 _gasLimit, // gelatoMaxGas or task.selfProviderGasLimit\n uint256 _gelatoGasPrice\n )\n external\n returns(ExecutionResult, string memory)\n {\n require(msg.sender == address(this), \"GelatoCore.executionWrapper:onlyGelatoCore\");\n\n // canExec()\n string memory canExecRes = canExec(taskReceipt, _gasLimit, _gelatoGasPrice);\n if (!canExecRes.startsWithOK()) return (ExecutionResult.CanExecFailed, canExecRes);\n\n // Will revert if exec failed => will be caught in exec flow\n _exec(taskReceipt);\n\n // Execution Success: Executor REWARD\n return (ExecutionResult.ExecSuccess, \"\");\n }\n\n function _exec(TaskReceipt memory _TR) private {\n // INTERACTIONS\n // execPayload and proxyReturndataCheck values read from ProviderModule\n bytes memory execPayload;\n bool proxyReturndataCheck;\n\n try IGelatoProviderModule(_TR.provider.module).execPayload(\n _TR.id,\n _TR.userProxy,\n _TR.provider.addr,\n _TR.task(),\n _TR.cycleId\n )\n returns(bytes memory _execPayload, bool _proxyReturndataCheck)\n {\n execPayload = _execPayload;\n proxyReturndataCheck = _proxyReturndataCheck;\n } catch Error(string memory _error) {\n revert(string(abi.encodePacked(\"GelatoCore._exec.execPayload:\", _error)));\n } catch {\n revert(\"GelatoCore._exec.execPayload:undefined\");\n }\n\n // To prevent single task exec reentrancy we delete hash before external call\n delete taskReceiptHash[_TR.id];\n\n // Execution via UserProxy\n (bool success, bytes memory userProxyReturndata) = _TR.userProxy.call(execPayload);\n\n // Check if actions reverts were caught by userProxy\n if (success && proxyReturndataCheck) {\n try _TR.provider.module.execRevertCheck(userProxyReturndata) {\n // success: no revert from providerModule signifies no revert found\n } catch Error(string memory _error) {\n revert(string(abi.encodePacked(\"GelatoCore._exec.execRevertCheck:\", _error)));\n } catch {\n revert(\"GelatoCore._exec.execRevertCheck:undefined\");\n }\n }\n\n // SUCCESS\n if (success) {\n // Optional: Automated Cyclic Task Submissions\n if (_TR.submissionsLeft != 1) {\n _storeTaskReceipt(\n false, // newCycle?\n _TR.userProxy,\n _TR.provider,\n _TR.nextIndex(),\n _TR.tasks,\n _TR.expiryDate,\n _TR.cycleId,\n _TR.submissionsLeft == 0 ? 0 : _TR.submissionsLeft - 1\n );\n }\n } else {\n // FAILURE: reverts, caught or uncaught in userProxy.call, were detected\n // We revert all state from _exec/userProxy.call and catch revert in exec flow\n // Caution: we also revert the deletion of taskReceiptHash.\n userProxyReturndata.revertWithErrorString(\"GelatoCore._exec:\");\n }\n }\n\n function _processProviderPayables(\n address _provider,\n ExecutorPay _payType,\n uint256 _startGas,\n uint256 _gasLimit, // gelatoMaxGas or selfProviderGasLimit\n uint256 _gelatoGasPrice\n )\n private\n returns(uint256 executorCompensation, uint256 sysAdminCompensation)\n {\n uint256 estGasUsed = _startGas - gasleft();\n\n // Provider payable Gas Refund capped at gelatoMaxGas\n // (- consecutive state writes + gas refund from deletion)\n uint256 cappedGasUsed =\n estGasUsed < _gasLimit\n ? estGasUsed + EXEC_TX_OVERHEAD\n : _gasLimit + EXEC_TX_OVERHEAD;\n\n if (_payType == ExecutorPay.Reward) {\n executorCompensation = executorSuccessFee(cappedGasUsed, _gelatoGasPrice);\n sysAdminCompensation = sysAdminSuccessFee(cappedGasUsed, _gelatoGasPrice);\n // ExecSuccess: Provider pays ExecutorSuccessFee and SysAdminSuccessFee\n providerFunds[_provider] = providerFunds[_provider].sub(\n executorCompensation.add(sysAdminCompensation),\n \"GelatoCore._processProviderPayables: providerFunds underflow\"\n );\n executorStake[msg.sender] += executorCompensation;\n sysAdminFunds += sysAdminCompensation;\n } else {\n // ExecFailure: Provider REFUNDS estimated costs to executor\n executorCompensation = cappedGasUsed.mul(_gelatoGasPrice);\n providerFunds[_provider] = providerFunds[_provider].sub(\n executorCompensation,\n \"GelatoCore._processProviderPayables: providerFunds underflow\"\n );\n executorStake[msg.sender] += executorCompensation;\n }\n }\n\n // ================ CANCEL USER / EXECUTOR API ============================\n function cancelTask(TaskReceipt memory _TR) public override {\n // Checks\n require(\n msg.sender == _TR.userProxy || msg.sender == _TR.provider.addr,\n \"GelatoCore.cancelTask: sender\"\n );\n // Effects\n bytes32 hashedTaskReceipt = hashTaskReceipt(_TR);\n require(\n hashedTaskReceipt == taskReceiptHash[_TR.id],\n \"GelatoCore.cancelTask: invalid taskReceiptHash\"\n );\n delete taskReceiptHash[_TR.id];\n emit LogTaskCancelled(_TR.id, msg.sender);\n }\n\n function multiCancelTasks(TaskReceipt[] memory _taskReceipts) external override {\n for (uint i; i < _taskReceipts.length; i++) cancelTask(_taskReceipts[i]);\n }\n\n // Helpers\n function hashTaskReceipt(TaskReceipt memory _TR) public pure override returns(bytes32) {\n return keccak256(abi.encode(_TR));\n }\n\n function _handleSelfProviderGasDefaults(Task[] memory _tasks) private view {\n for (uint256 i; i < _tasks.length; i++) {\n if (_tasks[i].selfProviderGasLimit == 0) {\n _tasks[i].selfProviderGasLimit = gelatoMaxGas;\n } else {\n require(\n _tasks[i].selfProviderGasLimit >= internalGasRequirement.mul(2),\n \"GelatoCore._handleSelfProviderGasDefaults:selfProviderGasLimit too low\"\n );\n }\n if (_tasks[i].selfProviderGasPriceCeil == 0)\n _tasks[i].selfProviderGasPriceCeil = NO_CEIL;\n }\n }\n}\n"
+ },
+ "contracts/libraries/GelatoTaskReceipt.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\n\nimport {Task, TaskReceipt} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\nlibrary GelatoTaskReceipt {\n function task(TaskReceipt memory _TR) internal pure returns(Task memory) {\n return _TR.tasks[_TR.index];\n }\n\n function nextIndex(TaskReceipt memory _TR) internal pure returns(uint256) {\n return _TR.index == _TR.tasks.length - 1 ? 0 : _TR.index + 1;\n }\n\n function selfProvider(TaskReceipt memory _TR) internal pure returns(bool) {\n return _TR.provider.addr == _TR.userProxy;\n }\n}"
+ },
+ "contracts/gelato_helpers/GelatoMultiCall.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoCore, TaskReceipt} from \"../gelato_core/interfaces/IGelatoCore.sol\";\nimport {GelatoTaskReceipt} from \"../libraries/GelatoTaskReceipt.sol\";\n\n/// @title GelatoMultiCall - Aggregate results from multiple read-only function calls on GelatoCore\n/// @author Hilmar X (inspired by Maker's Multicall)\ncontract GelatoMultiCall {\n\n using GelatoTaskReceipt for TaskReceipt;\n\n IGelatoCore public immutable gelatoCore;\n\n constructor(IGelatoCore _gelatoCore) public { gelatoCore = _gelatoCore; }\n\n struct Reponse { uint256 taskReceiptId; string response; }\n\n function multiCanExec(\n TaskReceipt[] memory _TR,\n uint256 _gelatoMaxGas,\n uint256 _gelatoGasPrice\n )\n public\n view\n returns (uint256 blockNumber, Reponse[] memory responses)\n {\n blockNumber = block.number;\n responses = new Reponse[](_TR.length);\n for(uint256 i = 0; i < _TR.length; i++) {\n try gelatoCore.canExec(_TR[i], getGasLimit(_TR[i], _gelatoMaxGas), _gelatoGasPrice)\n returns(string memory response)\n {\n responses[i] = Reponse({taskReceiptId: _TR[i].id, response: response});\n } catch {\n responses[i] = Reponse({\n taskReceiptId: _TR[i].id,\n response: \"GelatoMultiCall.multiCanExec: failed\"\n });\n }\n }\n }\n\n function getGasLimit(TaskReceipt memory _TR, uint256 _gelatoMaxGas)\n private\n pure\n returns(uint256 gasLimit)\n {\n gasLimit = _TR.selfProvider() ? _TR.task().selfProviderGasLimit : _gelatoMaxGas;\n }\n\n}"
+ },
+ "contracts/gelato_provider_modules/ds_proxy_provider/ProviderModuleDSProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {GelatoProviderModuleStandard} from \"../GelatoProviderModuleStandard.sol\";\nimport {Task} from \"../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n DSProxyFactory\n} from \"../../user_proxies/ds_proxy/Proxy.sol\";\nimport {\n IDSProxy\n} from \"../../user_proxies/ds_proxy/interfaces/IProxy.sol\";\nimport {DSAuthority} from \"../../user_proxies/ds_proxy/Auth.sol\";\nimport {GelatoActionPipeline} from \"../../gelato_actions/GelatoActionPipeline.sol\";\n\ncontract ProviderModuleDSProxy is GelatoProviderModuleStandard {\n\n address public immutable dsProxyFactory;\n address public immutable gelatoCore;\n GelatoActionPipeline public immutable gelatoActionPipeline;\n\n constructor(\n address _dsProxyFactory,\n address _gelatoCore,\n GelatoActionPipeline _gelatActionPipeline\n )\n public\n {\n dsProxyFactory = _dsProxyFactory;\n gelatoCore = _gelatoCore;\n gelatoActionPipeline = _gelatActionPipeline;\n }\n\n // ================= GELATO PROVIDER MODULE STANDARD ================\n function isProvided(address _userProxy, address, Task calldata)\n external\n view\n override\n returns(string memory)\n {\n // Was proxy deployed from correct factory?\n bool proxyOk = DSProxyFactory(dsProxyFactory).isProxy(\n _userProxy\n );\n if (!proxyOk) return \"ProviderModuleGelatoUserProxy.isProvided:InvalidUserProxy\";\n\n // Is gelato core whitelisted?\n DSAuthority authority = IDSProxy(_userProxy).authority();\n bool isGelatoWhitelisted = authority.canCall(gelatoCore, _userProxy, IDSProxy(_userProxy).execute.selector);\n if (!isGelatoWhitelisted) return \"ProviderModuleGelatoUserProxy.isProvided:GelatoCoreNotWhitelisted\";\n\n return OK;\n }\n\n /// @dev DS PROXY ONLY ALLOWS DELEGATE CALL for single actions, that's why we also use multisend\n function execPayload(uint256, address, address, Task calldata _task, uint256)\n external\n view\n override\n returns(bytes memory payload, bool)\n {\n // Action.Operation encoded into gelatoActionPipelinePayload and handled by GelatoActionPipeline\n bytes memory gelatoActionPipelinePayload = abi.encodeWithSelector(\n GelatoActionPipeline.execActionsAndPipeData.selector,\n _task.actions\n );\n\n // Delegate call by default\n payload = abi.encodeWithSignature(\n \"execute(address,bytes)\",\n gelatoActionPipeline, // to\n gelatoActionPipelinePayload // data\n );\n\n }\n}"
+ },
+ "contracts/user_proxies/ds_proxy/Proxy.sol": {
+ "content": "// proxy.sol - execute actions atomically through the proxy's identity\n\n// Copyright (C) 2017 DappHub, LLC\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.5.0;\n\nimport {DSAuth} from \"./Auth.sol\";\nimport {DSNote} from \"./Note.sol\";\n\n// DSProxy\n// Allows code execution using a persistant identity This can be very\n// useful to execute a sequence of atomic actions. Since the owner of\n// the proxy can be changed, this allows for dynamic ownership models\n// i.e. a multisig\ncontract DSProxy is DSAuth, DSNote {\n DSProxyCache public cache; // global cache for contracts\n\n constructor(address _cacheAddr) public {\n setCache(_cacheAddr);\n }\n\n fallback() external {\n }\n\n receive() external payable {\n }\n\n // use the proxy to execute calldata _data on contract _code\n function execute(bytes memory _code, bytes memory _data)\n public\n payable\n returns (address target, bytes memory response)\n {\n target = cache.read(_code);\n if (target == address(0)) {\n // deploy contract & store its address in cache\n target = cache.write(_code);\n }\n\n response = execute(target, _data);\n }\n\n function execute(address _target, bytes memory _data)\n public\n auth\n note\n payable\n returns (bytes memory response)\n {\n require(_target != address(0), \"ds-proxy-target-address-required\");\n\n // call contract in current context\n assembly {\n let succeeded := delegatecall(sub(gas(), 5000), _target, add(_data, 0x20), mload(_data), 0, 0)\n let size := returndatasize()\n\n response := mload(0x40)\n mstore(0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f))))\n mstore(response, size)\n returndatacopy(add(response, 0x20), 0, size)\n\n switch iszero(succeeded)\n case 1 {\n // throw if delegatecall failed\n revert(add(response, 0x20), size)\n }\n }\n }\n\n //set new cache\n function setCache(address _cacheAddr)\n public\n auth\n note\n returns (bool)\n {\n require(_cacheAddr != address(0), \"ds-proxy-cache-address-required\");\n cache = DSProxyCache(_cacheAddr); // overwrite cache\n return true;\n }\n}\n\n// DSProxyFactory\n// This factory deploys new proxy instances through build()\n// Deployed proxy addresses are logged\ncontract DSProxyFactory {\n event Created(address indexed sender, address indexed owner, address proxy, address cache);\n mapping(address=>bool) public isProxy;\n DSProxyCache public cache;\n\n constructor() public {\n cache = new DSProxyCache();\n }\n\n // deploys a new proxy instance\n // sets owner of proxy to caller\n function build() public returns (address payable proxy) {\n proxy = build(msg.sender);\n }\n\n // deploys a new proxy instance\n // sets custom owner of proxy\n function build(address owner) public returns (address payable proxy) {\n proxy = address(new DSProxy(address(cache)));\n emit Created(msg.sender, owner, address(proxy), address(cache));\n DSProxy(proxy).setOwner(owner);\n isProxy[proxy] = true;\n }\n}\n\n// DSProxyCache\n// This global cache stores addresses of contracts previously deployed\n// by a proxy. This saves gas from repeat deployment of the same\n// contracts and eliminates blockchain bloat.\n\n// By default, all proxies deployed from the same factory store\n// contracts in the same cache. The cache a proxy instance uses can be\n// changed. The cache uses the sha3 hash of a contract's bytecode to\n// lookup the address\ncontract DSProxyCache {\n mapping(bytes32 => address) cache;\n\n function read(bytes memory _code) public view returns (address) {\n bytes32 hash = keccak256(_code);\n return cache[hash];\n }\n\n function write(bytes memory _code) public returns (address target) {\n assembly {\n target := create(0, add(_code, 0x20), mload(_code))\n switch iszero(extcodesize(target))\n case 1 {\n // throw if contract failed to deploy\n revert(0, 0)\n }\n }\n bytes32 hash = keccak256(_code);\n cache[hash] = target;\n }\n}"
+ },
+ "contracts/user_proxies/ds_proxy/interfaces/IProxy.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.5.0;\n\nimport {DSAuthority} from \"../Auth.sol\";\n\ninterface IDSProxy {\n\n function execute(address _target, bytes calldata _data)\n external\n returns (bytes memory response);\n\n function authority()\n external\n view\n returns (DSAuthority);\n}"
+ },
+ "contracts/user_proxies/ds_proxy/Auth.sol": {
+ "content": "// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.4.23;\n\n\nabstract contract DSAuthority {\n function canCall(\n address src, address dst, bytes4 sig\n ) public view virtual returns (bool);\n}\n\ncontract DSAuthEvents {\n event LogSetAuthority (address indexed authority);\n event LogSetOwner (address indexed owner);\n}\n\ncontract DSAuth is DSAuthEvents {\n DSAuthority public authority;\n address public owner;\n\n constructor() public {\n owner = msg.sender;\n emit LogSetOwner(msg.sender);\n }\n\n function setOwner(address owner_)\n public\n auth\n {\n owner = owner_;\n emit LogSetOwner(owner);\n }\n\n function setAuthority(DSAuthority authority_)\n public\n auth\n {\n authority = authority_;\n emit LogSetAuthority(address(authority));\n }\n\n modifier auth {\n require(isAuthorized(msg.sender, msg.sig), \"ds-auth-unauthorized\");\n _;\n }\n\n function isAuthorized(address src, bytes4 sig) internal view returns (bool) {\n if (src == address(this)) {\n return true;\n } else if (src == owner) {\n return true;\n } else if (authority == DSAuthority(0)) {\n return false;\n } else {\n return authority.canCall(src, address(this), sig);\n }\n }\n}"
+ },
+ "contracts/user_proxies/ds_proxy/Note.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\n\n/// note.sol -- the `note' modifier, for logging calls as events\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.4.23;\n\ncontract DSNote {\n event LogNote(\n bytes4 indexed sig,\n address indexed guy,\n bytes32 indexed foo,\n bytes32 indexed bar,\n uint256 wad,\n bytes fax\n ) anonymous;\n\n modifier note {\n bytes32 foo;\n bytes32 bar;\n uint256 wad;\n\n assembly {\n foo := calldataload(4)\n bar := calldataload(36)\n wad := callvalue()\n }\n\n emit LogNote(msg.sig, msg.sender, foo, bar, wad, msg.data);\n\n _;\n }\n}"
+ },
+ "contracts/user_proxies/ds_proxy/Guard.sol": {
+ "content": "// guard.sol -- simple whitelist implementation of DSAuthority\n\n// Copyright (C) 2017 DappHub, LLC\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.4.23;\n\nimport {DSAuth, DSAuthority} from \"./Auth.sol\";\n\ncontract DSGuardEvents {\n event LogPermit(\n bytes32 indexed src,\n bytes32 indexed dst,\n bytes32 indexed sig\n );\n\n event LogForbid(\n bytes32 indexed src,\n bytes32 indexed dst,\n bytes32 indexed sig\n );\n}\n\ncontract DSGuard is DSAuth, DSAuthority, DSGuardEvents {\n bytes32 constant public ANY = bytes32(uint(-1));\n\n mapping (bytes32 => mapping (bytes32 => mapping (bytes32 => bool))) acl;\n\n function canCall(\n address src_, address dst_, bytes4 sig\n ) public view override returns (bool) {\n bytes32 src = bytes32(bytes20(src_));\n bytes32 dst = bytes32(bytes20(dst_));\n\n return acl[src][dst][sig]\n || acl[src][dst][ANY]\n || acl[src][ANY][sig]\n || acl[src][ANY][ANY]\n || acl[ANY][dst][sig]\n || acl[ANY][dst][ANY]\n || acl[ANY][ANY][sig]\n || acl[ANY][ANY][ANY];\n }\n\n function permit(bytes32 src, bytes32 dst, bytes32 sig) public auth {\n acl[src][dst][sig] = true;\n emit LogPermit(src, dst, sig);\n }\n\n function forbid(bytes32 src, bytes32 dst, bytes32 sig) public auth {\n acl[src][dst][sig] = false;\n emit LogForbid(src, dst, sig);\n }\n\n function permit(address src, address dst, bytes32 sig) public {\n permit(bytes32(bytes20(src)), bytes32(bytes20(dst)), sig);\n }\n function forbid(address src, address dst, bytes32 sig) public {\n forbid(bytes32(bytes20(src)), bytes32(bytes20(dst)), sig);\n }\n\n}\n\ncontract DSGuardFactory {\n mapping (address => bool) public isGuard;\n\n function newGuard() public returns (DSGuard guard) {\n guard = new DSGuard();\n guard.setOwner(msg.sender);\n isGuard[address(guard)] = true;\n }\n}"
+ },
+ "contracts/mocks/provider_modules/gelato_user_proxy_provider/MockProviderModuleGelatoUserProxyExecRevertCheckOk.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {\n MockProviderModuleGelatoUserProxyExecRevertCheckRevert\n} from \"./MockProviderModuleGelatoUserProxyExecRevertCheckRevert.sol\";\nimport {Action} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n IGelatoUserProxy\n} from \"../../../user_proxies/gelato_user_proxy/interfaces/IGelatoUserProxy.sol\";\n\ncontract MockProviderModuleGelatoUserProxyExecRevertCheckOk is\n MockProviderModuleGelatoUserProxyExecRevertCheckRevert\n{\n function execRevertCheck(bytes memory)\n public\n pure\n virtual\n override\n {\n // do nothing\n }\n}"
+ },
+ "contracts/user_proxies/ds_proxy/scripts/SubmitTaskScript.sol": {
+ "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity ^0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoCore, Provider, Task} from \"../../../gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract SubmitTaskScript {\n\n IGelatoCore public immutable gelatoCore;\n\n constructor(address _gelatoCore) public {\n gelatoCore = IGelatoCore(_gelatoCore);\n }\n\n /// @dev will be delegate called by ds_proxy\n function submitTask(Provider memory _provider, Task memory _task, uint256 _expiryDate)\n public\n {\n gelatoCore.submitTask(_provider, _task, _expiryDate);\n }\n\n /// @dev will be delegate called by ds_proxy\n function submitTaskCycle(\n Provider memory _provider,\n Task[] memory _tasks,\n uint256 _expiryDate,\n uint256 _cycles\n )\n public\n {\n gelatoCore.submitTaskCycle(_provider, _tasks, _expiryDate, _cycles);\n }\n\n /// @dev will be delegate called by ds_proxy\n function submitTaskChain(\n Provider memory _provider,\n Task[] memory _tasks,\n uint256 _expiryDate,\n uint256 _sumOfRequestedTaskSubmits\n )\n public\n {\n gelatoCore.submitTaskCycle(_provider, _tasks, _expiryDate, _sumOfRequestedTaskSubmits);\n }\n}\n"
+ }
+ },
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 200
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode",
+ "evm.deployedBytecode",
+ "evm.methodIdentifiers",
+ "metadata",
+ "devdoc",
+ "userdoc",
+ "storageLayout",
+ "evm.gasEstimates"
+ ],
+ "": ["ast"]
+ }
+ },
+ "metadata": {
+ "useLiteralContent": true
+ }
+ }
+}