@mean-finance/dca-v2-core
Version:
Core smart contracts of DCA v2 by mean.finance
1,937 lines • 144 kB
JSON
{
"_format": "hh-sol-artifact-1",
"contractName": "DCAHub",
"sourceName": "contracts/DCAHub/DCAHub.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_immediateGovernor",
"type": "address"
},
{
"internalType": "address",
"name": "_timeLockedGovernor",
"type": "address"
},
{
"internalType": "contract ITokenPriceOracle",
"name": "_oracle",
"type": "address"
},
{
"internalType": "contract IDCAPermissionManager",
"name": "_permissionManager",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "AmountTooBig",
"type": "error"
},
{
"inputs": [],
"name": "HighFee",
"type": "error"
},
{
"inputs": [],
"name": "HighPlatformFeeRatio",
"type": "error"
},
{
"inputs": [],
"name": "IntervalNotAllowed",
"type": "error"
},
{
"inputs": [],
"name": "InvalidAllowedTokensInput",
"type": "error"
},
{
"inputs": [],
"name": "InvalidFee",
"type": "error"
},
{
"inputs": [],
"name": "InvalidInterval",
"type": "error"
},
{
"inputs": [],
"name": "InvalidMask",
"type": "error"
},
{
"inputs": [],
"name": "InvalidPairs",
"type": "error"
},
{
"inputs": [],
"name": "InvalidPosition",
"type": "error"
},
{
"inputs": [],
"name": "InvalidToken",
"type": "error"
},
{
"inputs": [],
"name": "InvalidTokens",
"type": "error"
},
{
"inputs": [],
"name": "LiquidityNotReturned",
"type": "error"
},
{
"inputs": [],
"name": "NoSwapsToExecute",
"type": "error"
},
{
"inputs": [],
"name": "PositionDoesNotMatchToken",
"type": "error"
},
{
"inputs": [],
"name": "UnallowedToken",
"type": "error"
},
{
"inputs": [],
"name": "UnauthorizedCaller",
"type": "error"
},
{
"inputs": [],
"name": "ZeroAddress",
"type": "error"
},
{
"inputs": [],
"name": "ZeroAmount",
"type": "error"
},
{
"inputs": [],
"name": "ZeroSwaps",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "depositor",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "positionId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint32",
"name": "swapInterval",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint120",
"name": "rate",
"type": "uint120"
},
{
"indexed": false,
"internalType": "uint32",
"name": "startingSwap",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint32",
"name": "lastSwap",
"type": "uint32"
},
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "enum IDCAPermissionManager.Permission[]",
"name": "permissions",
"type": "uint8[]"
}
],
"indexed": false,
"internalType": "struct IDCAPermissionManager.PermissionSet[]",
"name": "permissions",
"type": "tuple[]"
}
],
"name": "Deposited",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "positionId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "Miscellaneous",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "positionId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint120",
"name": "rate",
"type": "uint120"
},
{
"indexed": false,
"internalType": "uint32",
"name": "startingSwap",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint32",
"name": "lastSwap",
"type": "uint32"
}
],
"name": "Modified",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "contract ITokenPriceOracle",
"name": "oracle",
"type": "address"
}
],
"name": "OracleSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint16",
"name": "platformFeeRatio",
"type": "uint16"
}
],
"name": "PlatformFeeRatioSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint32",
"name": "feeSet",
"type": "uint32"
}
],
"name": "SwapFeeSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint32[]",
"name": "swapIntervals",
"type": "uint32[]"
}
],
"name": "SwapIntervalsAllowed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint32[]",
"name": "swapIntervals",
"type": "uint32[]"
}
],
"name": "SwapIntervalsForbidden",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "rewardRecipient",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "callbackHandler",
"type": "address"
},
{
"components": [
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "reward",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "toProvide",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "platformFee",
"type": "uint256"
}
],
"internalType": "struct IDCAHubSwapHandler.TokenInSwap[]",
"name": "tokens",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
},
{
"internalType": "uint256",
"name": "totalAmountToSwapTokenA",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "totalAmountToSwapTokenB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ratioAToB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ratioBToA",
"type": "uint256"
},
{
"internalType": "bytes1",
"name": "intervalsInSwap",
"type": "bytes1"
}
],
"internalType": "struct IDCAHubSwapHandler.PairInSwap[]",
"name": "pairs",
"type": "tuple[]"
}
],
"indexed": false,
"internalType": "struct IDCAHubSwapHandler.SwapInfo",
"name": "swapInformation",
"type": "tuple"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "borrowed",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "uint32",
"name": "fee",
"type": "uint32"
}
],
"name": "Swapped",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "recipientUnswapped",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "recipientSwapped",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "positionId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "returnedUnswapped",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "returnedSwapped",
"type": "uint256"
}
],
"name": "Terminated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address[]",
"name": "tokens",
"type": "address[]"
},
{
"indexed": false,
"internalType": "bool[]",
"name": "allowed",
"type": "bool[]"
}
],
"name": "TokensAllowedUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "withdrawer",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "positionId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Withdrew",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"indexed": false,
"internalType": "struct IDCAHub.AmountOfToken[]",
"name": "amounts",
"type": "tuple[]"
}
],
"name": "WithdrewFromPlatform",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "withdrawer",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "positionIds",
"type": "uint256[]"
}
],
"indexed": false,
"internalType": "struct IDCAHubPositionHandler.PositionSet[]",
"name": "positions",
"type": "tuple[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "withdrew",
"type": "uint256[]"
}
],
"name": "WithdrewMany",
"type": "event"
},
{
"inputs": [],
"name": "DEFAULT_ADMIN_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "IMMEDIATE_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_FEE",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_PLATFORM_FEE_RATIO",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "PLATFORM_WITHDRAW_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "PRIVILEGED_SWAPPER_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "TIME_LOCKED_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "bytes1",
"name": "",
"type": "bytes1"
},
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"name": "accumRatio",
"outputs": [
{
"internalType": "uint256",
"name": "accumRatioAToB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "accumRatioBToA",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "activeSwapIntervals",
"outputs": [
{
"internalType": "bytes1",
"name": "",
"type": "bytes1"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32[]",
"name": "_swapIntervals",
"type": "uint32[]"
}
],
"name": "addSwapIntervalsToAllowedList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "allowedSwapIntervals",
"outputs": [
{
"internalType": "bytes1",
"name": "",
"type": "bytes1"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "allowedTokens",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_from",
"type": "address"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "_amountOfSwaps",
"type": "uint32"
},
{
"internalType": "uint32",
"name": "_swapInterval",
"type": "uint32"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "enum IDCAPermissionManager.Permission[]",
"name": "permissions",
"type": "uint8[]"
}
],
"internalType": "struct IDCAPermissionManager.PermissionSet[]",
"name": "_permissions",
"type": "tuple[]"
}
],
"name": "deposit",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_from",
"type": "address"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "_amountOfSwaps",
"type": "uint32"
},
{
"internalType": "uint32",
"name": "_swapInterval",
"type": "uint32"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "enum IDCAPermissionManager.Permission[]",
"name": "permissions",
"type": "uint8[]"
}
],
"internalType": "struct IDCAPermissionManager.PermissionSet[]",
"name": "_permissions",
"type": "tuple[]"
},
{
"internalType": "bytes",
"name": "_miscellaneous",
"type": "bytes"
}
],
"name": "deposit",
"outputs": [
{
"internalType": "uint256",
"name": "_positionId",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "_tokens",
"type": "address[]"
},
{
"components": [
{
"internalType": "uint8",
"name": "indexTokenA",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "indexTokenB",
"type": "uint8"
}
],
"internalType": "struct IDCAHubSwapHandler.PairIndexes[]",
"name": "_pairs",
"type": "tuple[]"
},
{
"internalType": "bool",
"name": "_calculatePrivilegedAvailability",
"type": "bool"
},
{
"internalType": "bytes",
"name": "_oracleData",
"type": "bytes"
}
],
"name": "getNextSwapInfo",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "reward",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "toProvide",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "platformFee",
"type": "uint256"
}
],
"internalType": "struct IDCAHubSwapHandler.TokenInSwap[]",
"name": "tokens",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
},
{
"internalType": "uint256",
"name": "totalAmountToSwapTokenA",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "totalAmountToSwapTokenB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ratioAToB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ratioBToA",
"type": "uint256"
},
{
"internalType": "bytes1",
"name": "intervalsInSwap",
"type": "bytes1"
}
],
"internalType": "struct IDCAHubSwapHandler.PairInSwap[]",
"name": "pairs",
"type": "tuple[]"
}
],
"internalType": "struct IDCAHubSwapHandler.SwapInfo",
"name": "_swapInformation",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "getRoleAdmin",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "grantRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "hasRole",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_positionId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "_newAmountOfSwaps",
"type": "uint32"
}
],
"name": "increasePosition",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "oracle",
"outputs": [
{
"internalType": "contract ITokenPriceOracle",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "permissionManager",
"outputs": [
{
"internalType": "contract IDCAPermissionManager",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "platformBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "platformFeeRatio",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_positionId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "_newAmountOfSwaps",
"type": "uint32"
},
{
"internalType": "address",
"name": "_recipient",
"type": "address"
}
],
"name": "reducePosition",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32[]",
"name": "_swapIntervals",
"type": "uint32[]"
}
],
"name": "removeSwapIntervalsFromAllowedList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "renounceRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "revokeRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "_tokens",
"type": "address[]"
},
{
"internalType": "bool[]",
"name": "_allowed",
"type": "bool[]"
}
],
"name": "setAllowedTokens",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ITokenPriceOracle",
"name": "_oracle",
"type": "address"
}
],
"name": "setOracle",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "_platformFeeRatio",
"type": "uint16"
}
],
"name": "setPlatformFeeRatio",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_swapFee",
"type": "uint32"
}
],
"name": "setSwapFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "_tokens",
"type": "address[]"
},
{
"components": [
{
"internalType": "uint8",
"name": "indexTokenA",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "indexTokenB",
"type": "uint8"
}
],
"internalType": "struct IDCAHubSwapHandler.PairIndexes[]",
"name": "_pairsToSwap",
"type": "tuple[]"
},
{
"internalType": "address",
"name": "_rewardRecipient",
"type": "address"
},
{
"internalType": "address",
"name": "_callbackHandler",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "_borrow",
"type": "uint256[]"
},
{
"internalType": "bytes",
"name": "_callbackData",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "_oracleData",
"type": "bytes"
}
],
"name": "swap",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "reward",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "toProvide",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "platformFee",
"type": "uint256"
}
],
"internalType": "struct IDCAHubSwapHandler.TokenInSwap[]",
"name": "tokens",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
},
{
"internalType": "uint256",
"name": "totalAmountToSwapTokenA",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "totalAmountToSwapTokenB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ratioAToB",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ratioBToA",
"type": "uint256"
},
{
"internalType": "bytes1",
"name": "intervalsInSwap",
"type": "bytes1"
}
],
"internalType": "struct IDCAHubSwapHandler.PairInSwap[]",
"name": "pairs",
"type": "tuple[]"
}
],
"internalType": "struct IDCAHubSwapHandler.SwapInfo",
"name": "_swapInformation",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "bytes1",
"name": "",
"type": "bytes1"
},
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"name": "swapAmountDelta",
"outputs": [
{
"internalType": "uint128",
"name": "swapDeltaAToB",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "swapDeltaBToA",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "bytes1",
"name": "",
"type": "bytes1"
}
],
"name": "swapData",
"outputs": [
{
"internalType": "uint32",
"name": "performedSwaps",
"type": "uint32"
},
{
"internalType": "uint224",
"name": "nextAmountToSwapAToB",
"type": "uint224"
},
{
"internalType": "uint32",
"name": "lastSwappedAt",
"type": "uint32"
},
{
"internalType": "uint224",
"name": "nextAmountToSwapBToA",
"type": "uint224"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "swapFee",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_positionId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_recipientUnswapped",
"type": "address"
},
{
"internalType": "address",
"name": "_recipientSwapped",
"type": "address"
}
],
"name": "terminate",
"outputs": [
{
"internalType": "uint256",
"name": "_unswapped",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_swapped",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "tokenMagnitude",
"outputs": [
{
"internalType": "uint120",
"name": "",
"type": "uint120"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalCreatedPositions",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "unpause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_positionId",
"type": "uint256"
}
],
"name": "userPosition",
"outputs": [
{
"components": [
{
"internalType": "contract IERC20Metadata",
"name": "from",
"type": "address"
},
{
"internalType": "contract IERC20Metadata",
"name": "to",
"type": "address"
},
{
"internalType": "uint32",
"name": "swapInterval",
"type": "uint32"
},
{
"internalType": "uint32",
"name": "swapsExecuted",
"type": "uint32"
},
{
"internalType": "uint256",
"name": "swapped",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "swapsLeft",
"type": "uint32"
},
{
"internalType": "uint256",
"name": "remaining",
"type": "uint256"
},
{
"internalType": "uint120",
"name": "rate",
"type": "uint120"
}
],
"internalType": "struct IDCAHubPositionHandler.UserPosition",
"name": "_userPosition",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct IDCAHub.AmountOfToken[]",
"name": "_amounts",
"type": "tuple[]"
},
{
"internalType": "address",
"name": "_recipient",
"type": "address"
}
],
"name": "withdrawFromPlatformBalance",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_positionId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_recipient",
"type": "address"
}
],
"name": "withdrawSwapped",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "positionIds",
"type": "uint256[]"
}
],
"internalType": "struct IDCAHubPositionHandler.PositionSet[]",
"name": "_positions",
"type": "tuple[]"
},
{
"internalType": "address",
"name": "_recipient",
"type": "address"
}
],
"name": "withdrawSwappedMany",
"outputs": [
{
"internalType": "uint256[]",
"name": "_swapped",
"type": "uint256[]"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x60806040527f313f8c5ec4103e5607b5d8b3519ab06a512037396eaf72a07527d8b838012ed46008557ffb63867dc303889c4e19b6276d834e066500dd4210f4434d34089a246beec82a600955600a805466ffffffffffffff60a01b1916659c4f0000017760a41b1790553480156200007757600080fd5b50604051620062e7380380620062e78339810160408190526200009a916200033a565b60016000556007805460ff19169055808484846001600160a01b0383161580620000cb57506001600160a01b038216155b80620000de57506001600160a01b038116155b15620000fd5760405163d92e233d60e01b815260040160405180910390fd5b6008546200010c9084620001fa565b6009546200011b9083620001fa565b6200014f7f73c06b41830ea810d4e9dd3dfb0309555fbff1642391fb7644bc4a0b0f7a77fd6008546200020a60201b60201c565b620001837f052bd61fb293c90e13fa32c291e2dcb25630630baf169861d2a103dfe65025f46008546200020a60201b60201c565b6008546200019290806200020a565b600954620001a190806200020a565b600a80546001600160a01b0319166001600160a01b039290921691909117905550620001cf90508162000255565b600d80546001600160a01b0319166001600160a01b039290921691909117905550620003a292505050565b62000206828262000280565b5050565b600082815260066020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6001600160a01b0381166200027d5760405163d92e233d60e01b815260040160405180910390fd5b50565b60008281526006602090815260408083206001600160a01b038516845290915290205460ff16620002065760008281526006602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002e03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b03811681146200027d57600080fd5b600080600080608085870312156200035157600080fd5b84516200035e8162000324565b6020860151909450620003718162000324565b6040860151909350620003848162000324565b6060860151909250620003978162000324565b939692955090935050565b615f3580620003b26000396000f3fe608060405234801561001057600080fd5b50600436106102ea5760003560e01c80636b29e1bd1161018c578063a217fddf116100ee578063d547741f11610097578063e744092e11610071578063e744092e1461082f578063f1accf3914610852578063fc4481581461086557600080fd5b8063d547741f146107f6578063d6d788c314610809578063ded700a61461081c57600080fd5b8063bc063e1a116100c8578063bc063e1a146107b9578063c67e32e9146107c3578063cc7a2049146107e357600080fd5b8063a217fddf1461078b578063b2b513c114610793578063b39461e5146107a657600080fd5b80637d361dd311610150578063808ba8e01161012a578063808ba8e0146106b55780638456cb591461074a57806391d148541461075257600080fd5b80637d361dd31461066e5780637d8e8603146106775780637dc0d1d01461068a57600080fd5b80636b29e1bd1461060f5780636eefd1341461062257806372ada4c51461063557806374ae623b146106485780637adbf9731461065b57600080fd5b8063480b379611610250578063560c6499116101f95780635b6fd01d116101d35780635b6fd01d146105c05780635c975abb146105e057806364857370146105e857600080fd5b8063560c64991461056a57806357ae1cec1461057d578063582cf84b1461059257600080fd5b80634aa91aee1161022a5780634aa91aee146104c75780634eeeb3eb1461053557806354cf2aeb1461053e57600080fd5b8063480b37961461045a578063480e5da11461047a5780634997cdc3146104a757600080fd5b8063248a9ca3116102b2578063366395801161028c57806336639580146104365780633f4ba83a1461043f5780633feb14931461044757600080fd5b8063248a9ca3146103eb5780632f2ff15d1461040e57806336568abe1461042357600080fd5b806301ffc9a7146102ef5780630b1aa9841461031757806316cd7af81461036d57806317621890146103ae5780631b8b8c34146103cf575b600080fd5b6103026102fd366004614a51565b61088c565b60405190151581526020015b60405180910390f35b610358610325366004614acc565b60046020908152600094855260408086208252938552838520815291845282842090915282529020805460019091015482565b6040805192835260208301919091520161030e565b61039661037b366004614b24565b600c602052600090815260409020546001600160781b031681565b6040516001600160781b03909116815260200161030e565b6103c16103bc366004614b41565b6108c3565b60405190815260200161030e565b6103d861271081565b60405161ffff909116815260200161030e565b6103c16103f9366004614b71565b60009081526006602052604090206001015490565b61042161041c366004614b41565b610976565b005b610421610431366004614b41565b6109a0565b6103c160105481565b610421610a1e565b610421610455366004614bce565b610a35565b61046d610468366004614c0f565b610aea565b60405161030e9190614ca0565b600a5461048e90600160c01b900460f81b81565b6040516001600160f81b0319909116815260200161030e565b6104ba6104b5366004614d46565b610d2c565b60405161030e9190614f01565b6105156104d5366004614acc565b60036020908152600094855260408086208252938552838520815291845282842090915282529020546001600160801b0380821691600160801b90041682565b604080516001600160801b0393841681529290911660208301520161030e565b6103c160095481565b600a5461055590600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161030e565b610421610578366004614f14565b61144f565b600a546103d890600160c81b900461ffff1681565b61048e6105a0366004614f4b565b600160209081526000928352604080842090915290825290205460f81b81565b6105d36105ce366004614b71565b6115d6565b60405161030e9190614f79565b610302611794565b6103c17f052bd61fb293c90e13fa32c291e2dcb25630630baf169861d2a103dfe65025f481565b6103c161061d366004614ffe565b6117a3565b6104216106303660046150a3565b611b43565b6103586106433660046150c7565b611bce565b6104216106563660046150fe565b611e1b565b610421610669366004614b24565b611fe0565b6103c160085481565b610421610685366004614bce565b612050565b600a5461069d906001600160a01b031681565b6040516001600160a01b03909116815260200161030e565b6107136106c3366004615169565b6005602090815260009384526040808520825